Fix #103398: Fix Icon sampler initialization in Metal backend.
Resolves issue with nearest filtering on UI Icons. Note that as Metal does not support LOD bias as a parameter on a sampler object, the original code has been modified to perform LOD biasing at the shader level. As GPU_SAMPLER_ICON is not widely used, it is more efficient to apply directly to the affected shaders, rather than workaround passing in the sampler LOD bias as a separate value e.g. uniform or push constant. Original PR feedback addressed to also refactor ICON shaders to use consistent style for single and multi Icon rendering. Authored by Apple: Michael Parkin-White Ref #96261 Pull Request #105145
This commit is contained in:
@@ -8,6 +8,10 @@
|
||||
|
||||
void main()
|
||||
{
|
||||
/* Sample texture with LOD BIAS. Used instead of custom lod bias in GPU_SAMPLER_ICON. */
|
||||
fragColor = texture(image, texCoord_interp, -0.5) * finalColor;
|
||||
|
||||
#ifdef DO_CORNER_MASKING
|
||||
/* Top-left rounded corner parameters. */
|
||||
const float circle_radius_outer = 0.1;
|
||||
const float circle_radius_inner = 0.075;
|
||||
@@ -18,7 +22,6 @@ void main()
|
||||
const float mask_transparency = 0.25;
|
||||
|
||||
vec2 circle_center = vec2(circle_radius_outer - text_width, 0.5);
|
||||
fragColor = texture(image, texCoord_interp) * color;
|
||||
|
||||
/* radius in icon space (1 is the icon width). */
|
||||
float radius = length(mask_coord_interp - circle_center);
|
||||
@@ -39,4 +42,5 @@ void main()
|
||||
}
|
||||
|
||||
fragColor = mix(vec4(0.0), fragColor, max(mask_transparency, mask));
|
||||
#endif
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user