SPIRV-Cross/reference/opt/shaders-hlsl/frag/control-dependent-in-branch.desktop.frag
Hans-Kristian Arntzen 18bcc9b790 Do not disable temporary forwarding when we suppress usage tracking.
This subtle bug removed any expression validation for trivially swizzled
variables. Make usage suppression a more explicit concept rather than
just hacking off forwarded_temporaries.

There is some fallout here with loop generation since our expression
invalidation is currently a bit too naive to handle loops properly.
The forwarding bug masked this problem until now.

If part of the loop condition is also used in the body, we end up
reading an invalid expression, which in turn forces a temporary to be
generated in the condition block, not good. We'll need to be smarter
here ...
2019-07-23 19:18:44 +02:00

56 lines
1.3 KiB
GLSL

Texture2D<float4> uSampler : register(t0);
SamplerState _uSampler_sampler : register(s0);
static float4 FragColor;
static float4 vInput;
struct SPIRV_Cross_Input
{
float4 vInput : TEXCOORD0;
};
struct SPIRV_Cross_Output
{
float4 FragColor : SV_Target0;
};
void frag_main()
{
FragColor = vInput;
float4 _23 = uSampler.Sample(_uSampler_sampler, vInput.xy);
float4 _26 = ddx(vInput);
float4 _29 = ddy(vInput);
float4 _32 = fwidth(vInput);
float4 _35 = ddx_coarse(vInput);
float4 _38 = ddy_coarse(vInput);
float4 _41 = fwidth(vInput);
float4 _44 = ddx_fine(vInput);
float4 _47 = ddy_fine(vInput);
float4 _50 = fwidth(vInput);
float _56_tmp = uSampler.CalculateLevelOfDetail(_uSampler_sampler, vInput.zw);
float2 _56 = float2(_56_tmp, _56_tmp);
if (vInput.y > 10.0f)
{
FragColor += _23;
FragColor += _26;
FragColor += _29;
FragColor += _32;
FragColor += _35;
FragColor += _38;
FragColor += _41;
FragColor += _44;
FragColor += _47;
FragColor += _50;
FragColor += _56.xyxy;
}
}
SPIRV_Cross_Output main(SPIRV_Cross_Input stage_input)
{
vInput = stage_input.vInput;
frag_main();
SPIRV_Cross_Output stage_output;
stage_output.FragColor = FragColor;
return stage_output;
}