SPIRV-Cross/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag
Hans-Kristian Arntzen 938c7debed Handle control-dependent temporaries.
Derivatives, subgroup and implicit-lod instructions all need to happen
in the block they were created.
2018-03-12 17:34:54 +01:00

37 lines
772 B
GLSL

#version 450
layout(location = 0) out vec4 FragColor;
layout(binding = 0) uniform sampler2D uSampler;
layout(location = 0) in vec4 vInput;
void main()
{
FragColor = vInput;
vec4 t = texture(uSampler, vInput.xy);
vec4 d0 = dFdx(vInput);
vec4 d1 = dFdy(vInput);
vec4 d2 = fwidth(vInput);
vec4 d3 = dFdxCoarse(vInput);
vec4 d4 = dFdyCoarse(vInput);
vec4 d5 = fwidthCoarse(vInput);
vec4 d6 = dFdxFine(vInput);
vec4 d7 = dFdyFine(vInput);
vec4 d8 = fwidthFine(vInput);
vec2 lod = textureQueryLod(uSampler, vInput.zw);
if (vInput.y > 10.0)
{
FragColor += t;
FragColor += d0;
FragColor += d1;
FragColor += d2;
FragColor += d3;
FragColor += d4;
FragColor += d5;
FragColor += d6;
FragColor += d7;
FragColor += d8;
FragColor += lod.xyxy;
}
}