const FRAG_SRC: &str = "#ifdef GL_ES\n // To avoid weird distortion issues when rendering text etc, we want highp if possible.\n // But apparently some devices don\'t support it, so we have to check first.\n #if defined(GL_FRAGMENT_PRECISION_HIGH) && GL_FRAGMENT_PRECISION_HIGH == 1\n precision highp float;\n #else\n precision mediump float;\n #endif\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\nvoid main() {\n vec4 texture_in_gamma = texture2D(u_sampler, v_tc);\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";