skia/skia/5d666667465c65cf1ee7ce80fb1ad1797a62fff5
[gpu] Update linear inset epsilon for larger texture sizes
Ganesh used a value of 0.0001, which is lost when subtracting from the
texture size exceeding ~2000. Graphite used a value of 0.00001, which
was a typo since it's meant to be the same. This means the epsilon was
actually being lost for texture sizes exceeding ~250px.
This CL moves the constant to a shared value between Graphite and
Ganesh, and updates the shader constant in sksl_graphite_frag.sksl to
match. It also fixes Graphite's YUV linear UV inset calculation to use
the epsilon-adjusted values instead of just 1/2.
Unfortunately, these insets trigger a lot of gold image diffs and layout
test diffs in Chrome, so it has to be staged. In Ganesh and Graphite's
CPP code, this is trivial (SK_LEGACY_LINEAR_INSET either points to
GrTextureEffect/KeyHelper's original kLinearInset value or is assigned
to the new common skgpu::kLinearInset value).
Graphite's module SkSL also references its own version of the constant
for a number of shaders, and there isn't a good way to inject
build-defined values into SkSL. To stage it, two versions of the
constant and module functions are made. ShaderCodeDictionary selects the
appropriate one based on the build flag.
The legacy versions were made by first finding all references to
$kLinearInset. Functions which referenced $kLinearInset were copied and
renamed to `Foo_legacy_inset`, and their function bodies were changed to
reference $kLegacyLinearInset_DO_NOT_USE instead. This process was
repeated for these copied helper functions, e.g. any function
referencing $sample_image_subset or $cubic_image were also cloned to
reference the _legacy_inset version.
Bug: 540014634
Change-Id: Id30b9534cdffa3cf772308608a34ea9510b87384
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1334336
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Michael Ludwig <michaelludwig@google.com>
10 files changed