const FRAG_SRC: &str = "#ifdef GL_ES\n precision mediump float;\n#endif\n\nuniform sampler2D u_sampler;\n\n#if NEW_SHADER_INTERFACE\n in vec4 v_rgba_in_gamma;\n in vec2 v_tc;\n out vec4 f_color;\n // a dirty hack applied to support webGL2\n #define gl_FragColor f_color\n #define texture2D texture\n#else\n varying vec4 v_rgba_in_gamma;\n varying vec2 v_tc;\n#endif\n\n// -----------------------------------------------\n// Adapted from\n// https://www.shadertoy.com/view/llVGzG\n// Originally presented in:\n// Jimenez 2014, \"Next Generation Post-Processing in Call of Duty\"\n//\n// A good overview can be found in\n// https://blog.demofox.org/2022/01/01/interleaved-gradient-noise-a-different-kind-of-low-discrepancy-sequence/\n// via https://github.com/rerun-io/rerun/\nfloat interleaved_gradient_noise(vec2 n) {\n float f = 0.06711056 * n.x + 0.00583715 * n.y;\n return fract(52.9829189 * fract(f));\n}\n\nvec3 dither_interleaved(vec3 rgb, float levels) {\n float noise = interleaved_gradient_noise(gl_FragCoord.xy);\n // scale down the noise slightly to ensure flat colors aren\'t getting dithered\n noise = (noise - 0.5) * 0.95;\n return rgb + noise / (levels - 1.0);\n}\n\n// 0-1 sRGB gamma from 0-1 linear\nvec3 srgb_gamma_from_linear(vec3 rgb) {\n bvec3 cutoff = lessThan(rgb, vec3(0.0031308));\n vec3 lower = rgb * vec3(12.92);\n vec3 higher = vec3(1.055) * pow(rgb, vec3(1.0 / 2.4)) - vec3(0.055);\n return mix(higher, lower, vec3(cutoff));\n}\n\n// 0-1 sRGBA gamma from 0-1 linear\nvec4 srgba_gamma_from_linear(vec4 rgba) {\n return vec4(srgb_gamma_from_linear(rgba.rgb), rgba.a);\n}\n\nvoid main() {\n#if SRGB_TEXTURES\n vec4 texture_in_gamma = srgba_gamma_from_linear(texture2D(u_sampler, v_tc));\n#else\n vec4 texture_in_gamma = texture2D(u_sampler, v_tc);\n#endif\n\n // We multiply the colors in gamma space, because that\'s the only way to get text to look right.\n vec4 frag_color_gamma = v_rgba_in_gamma * texture_in_gamma;\n\n // Dither the float color down to eight bits to reduce banding.\n // This step is optional for egui backends.\n#if DITHERING\n frag_color_gamma.rgb = dither_interleaved(frag_color_gamma.rgb, 256.);\n#endif\n gl_FragColor = frag_color_gamma;\n}\n";