declare const _default: "\n varying uv0: vec2f;\n var smaaColorTexture: texture_2d;\n var smaaColorTextureSampler: sampler;\n var smaaBlendTexture: texture_2d;\n var smaaBlendTextureSampler: sampler;\n\n // 1 / width, 1 / height, width, height of the scene\n uniform smaaMetrics: vec4f;\n\n // the exposure the scene is displayed with\n uniform smaaExposure: f32;\n\n #include \"reversibleTonemapPS\"\n\n // below this alpha, the color of a blended pixel is not divided out of its alpha\n const SMAA_UNPREMULTIPLY_ALPHA: f32 = 1.0 / 255.0;\n\n // The scene is linear HDR, where blending a bright pixel with a dark one by half gives a\n // result still displayed as bright as the bright one - so the edge would stay aliased. The\n // colors are blended compressed by a reversible tone mapping of their exposed values instead,\n // and expanded back after. The compressed colors are blended premultiplied by their alpha, so\n // that the color of a transparent pixel, which is not displayed, does not tint the pixels\n // blended with it - and the alpha is divided out before the expansion, which is not linear.\n fn smaaCompress(color: vec4f, exposure: f32) -> vec4f {\n return vec4f(reversibleTonemap(color.rgb * exposure) * color.a, color.a);\n }\n\n // the blended color, with its alpha divided out - a pixel left transparent keeps its color\n fn smaaExpand(blended: vec4f, color: vec4f, exposure: f32) -> vec4f {\n let straight = blended.rgb / max(blended.a, SMAA_UNPREMULTIPLY_ALPHA);\n let rgb = select(color.rgb, reversibleTonemapInverse(straight) / exposure, blended.a > SMAA_UNPREMULTIPLY_ALPHA);\n return vec4f(rgb, blended.a);\n }\n\n fn sampleColor(uv: vec2f) -> vec4f {\n return textureSampleLevel(smaaColorTexture, smaaColorTextureSampler, uv, 0.0);\n }\n\n fn sampleBlend(uv: vec2f) -> vec4f {\n return textureSampleLevel(smaaBlendTexture, smaaBlendTextureSampler, uv, 0.0);\n }\n\n @fragment\n fn fragmentMain(input: FragmentInput) -> FragmentOutput {\n var output: FragmentOutput;\n let texel = uniform.smaaMetrics.xy;\n\n // the blending weights of the pixel, along with those its right and bottom neighbors\n // hold for it\n let own = sampleBlend(uv0);\n let a = vec4f(\n sampleBlend(uv0 + vec2f(texel.x, 0.0)).a,\n sampleBlend(uv0 + vec2f(0.0, texel.y)).g,\n own.z,\n own.x\n );\n\n var color = sampleColor(uv0);\n\n // a pixel on an edge blends with its neighbors on either side, along the direction of the\n // stronger edge\n if (dot(a, vec4f(1.0)) >= 1.0e-5) {\n let horizontal = max(a.x, a.z) > max(a.y, a.w);\n let dir = select(vec2f(0.0, texel.y), vec2f(texel.x, 0.0), horizontal);\n let fraction = select(a.yw, a.xz, horizontal);\n let weight = fraction / dot(fraction, vec2f(1.0));\n\n let e = max(uniform.smaaExposure, 1.0e-6);\n let center = smaaCompress(color, e);\n let positive = smaaCompress(sampleColor(uv0 + dir), e);\n let negative = smaaCompress(sampleColor(uv0 - dir), e);\n let blended = weight.x * mix(center, positive, fraction.x) + weight.y * mix(center, negative, fraction.y);\n color = smaaExpand(blended, color, e);\n }\n\n output.color = color;\n return output;\n }\n"; export default _default;