graphicsdriver/opengl: Fix comments

This commit is contained in:
Hajime Hoshi 2020-06-25 01:06:30 +09:00
parent 2a63512c6e
commit d3613e13af

View File

@ -200,7 +200,7 @@ void main(void) {
color = vec4(0, 0, 0, 0); color = vec4(0, 0, 0, 0);
} }
# endif // defined(ADDRESS_UNSAFE) # endif // defined(ADDRESS_UNSAFE)
#endif #endif // defined(FILTER_NEAREST)
#if defined(FILTER_LINEAR) #if defined(FILTER_LINEAR)
vec4 color; vec4 color;
@ -241,7 +241,7 @@ void main(void) {
vec2 rate = fract(p0 * source_size); vec2 rate = fract(p0 * source_size);
color = mix(mix(c0, c1, rate.x), mix(c2, c3, rate.x), rate.y); color = mix(mix(c0, c1, rate.x), mix(c2, c3, rate.x), rate.y);
#endif #endif // defined(FILTER_LINEAR)
#if defined(FILTER_SCREEN) #if defined(FILTER_SCREEN)
highp vec2 texel_size = 1.0 / source_size; highp vec2 texel_size = 1.0 / source_size;
@ -259,11 +259,12 @@ void main(void) {
vec2 rate_center = vec2(1.0, 1.0) - half_scaled_texel_size; vec2 rate_center = vec2(1.0, 1.0) - half_scaled_texel_size;
vec2 rate = clamp(((fract(p0 * source_size) - rate_center) * scale) + rate_center, 0.0, 1.0); vec2 rate = clamp(((fract(p0 * source_size) - rate_center) * scale) + rate_center, 0.0, 1.0);
gl_FragColor = mix(mix(c0, c1, rate.x), mix(c2, c3, rate.x), rate.y); gl_FragColor = mix(mix(c0, c1, rate.x), mix(c2, c3, rate.x), rate.y);
// Assume that a color matrix and color vector values are not used with FILTER_SCREEN. // Assume that a color matrix and color vector values are not used with FILTER_SCREEN.
#else #else
#if defined(USE_COLOR_MATRIX) # if defined(USE_COLOR_MATRIX)
// Un-premultiply alpha. // Un-premultiply alpha.
// When the alpha is 0, 1.0 - sign(alpha) is 1.0, which means division does nothing. // When the alpha is 0, 1.0 - sign(alpha) is 1.0, which means division does nothing.
color.rgb /= color.a + (1.0 - sign(color.a)); color.rgb /= color.a + (1.0 - sign(color.a));
@ -272,16 +273,16 @@ void main(void) {
color *= varying_color_scale; color *= varying_color_scale;
// Premultiply alpha // Premultiply alpha
color.rgb *= color.a; color.rgb *= color.a;
#else # else
vec4 s = varying_color_scale; vec4 s = varying_color_scale;
color *= vec4(s.r, s.g, s.b, 1.0) * s.a; color *= vec4(s.r, s.g, s.b, 1.0) * s.a;
#endif # endif // defined(USE_COLOR_MATRIX)
color = min(color, color.a); color = min(color, color.a);
gl_FragColor = color; gl_FragColor = color;
#endif #endif // defined(FILTER_SCREEN)
} }
` `