dawn-cmake/test/tint/bug/tint/948.wgsl.expected.dxc.hlsl

219 lines
7.6 KiB
HLSL
Raw Normal View History

cbuffer cbuffer_x_20 : register(b9, space2) {
uint4 x_20[8];
};
Texture2D<float4> frameMapTexture : register(t3, space2);
SamplerState frameMapSampler : register(s2, space2);
static float2 tUV = float2(0.0f, 0.0f);
Texture2D<float4> tileMapsTexture0 : register(t5, space2);
SamplerState tileMapsSampler : register(s4, space2);
Texture2D<float4> tileMapsTexture1 : register(t6, space2);
Texture2D<float4> animationMapTexture : register(t8, space2);
SamplerState animationMapSampler : register(s7, space2);
static float mt = 0.0f;
Texture2D<float4> spriteSheetTexture : register(t1, space2);
SamplerState spriteSheetSampler : register(s0, space2);
static float4 glFragColor = float4(0.0f, 0.0f, 0.0f, 0.0f);
static float2 tileID_1 = float2(0.0f, 0.0f);
static float2 levelUnits = float2(0.0f, 0.0f);
static float2 stageUnits_1 = float2(0.0f, 0.0f);
static float3 vPosition = float3(0.0f, 0.0f, 0.0f);
static float2 vUV = float2(0.0f, 0.0f);
float4x4 getFrameData_f1_(inout float frameID) {
float fX = 0.0f;
const float x_15 = frameID;
const float x_25 = asfloat(x_20[6].w);
fX = (x_15 / x_25);
const float x_37 = fX;
const float4 x_40 = frameMapTexture.SampleBias(frameMapSampler, float2(x_37, 0.0f), 0.0f);
const float x_44 = fX;
const float4 x_47 = frameMapTexture.SampleBias(frameMapSampler, float2(x_44, 0.25f), 0.0f);
const float x_51 = fX;
const float4 x_54 = frameMapTexture.SampleBias(frameMapSampler, float2(x_51, 0.5f), 0.0f);
return float4x4(float4(x_40.x, x_40.y, x_40.z, x_40.w), float4(x_47.x, x_47.y, x_47.z, x_47.w), float4(x_54.x, x_54.y, x_54.z, x_54.w), (0.0f).xxxx);
}
void main_1() {
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
float2 tileUV = float2(0.0f, 0.0f);
float2 tileID = float2(0.0f, 0.0f);
float2 sheetUnits = float2(0.0f, 0.0f);
float spriteUnits = 0.0f;
float2 stageUnits = float2(0.0f, 0.0f);
int i = 0;
float frameID_1 = 0.0f;
float4 animationData = float4(0.0f, 0.0f, 0.0f, 0.0f);
float f = 0.0f;
float4x4 frameData = float4x4(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f);
float param = 0.0f;
float2 frameSize = float2(0.0f, 0.0f);
float2 offset_1 = float2(0.0f, 0.0f);
float2 ratio = float2(0.0f, 0.0f);
float4 nc = float4(0.0f, 0.0f, 0.0f, 0.0f);
float alpha = 0.0f;
float3 mixed = float3(0.0f, 0.0f, 0.0f);
color = (0.0f).xxxx;
const float2 x_86 = tUV;
tileUV = frac(x_86);
const float x_91 = tileUV.y;
tileUV.y = (1.0f - x_91);
const float2 x_95 = tUV;
tileID = floor(x_95);
const float2 x_101 = asfloat(x_20[6].xy);
sheetUnits = ((1.0f).xx / x_101);
const float x_106 = asfloat(x_20[6].w);
spriteUnits = (1.0f / x_106);
const float2 x_111 = asfloat(x_20[5].zw);
stageUnits = ((1.0f).xx / x_111);
i = 0;
tint/hlsl: remove [loop] attribute on all loops I added the forcing of the "loop" attribute to all loops to address FXC failing on uniformity errors related to gradients in loops. Since then, Tint now implements UA and it recently became an error, so we no longer need this hack. As a result, FXC is now better able to cope with loops that it determines executes 0 times. Most e2e tests are affected because so many use loops, but 27 tests that were previously failing are now passing with this change: tint/bug/tint/1538.wgsl.expected.fxc.hlsl tint/bug/tint/1604.wgsl.expected.fxc.hlsl tint/bug/tint/1605.wgsl.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.fxc.hlsl Bug: tint:1522 Bug: tint:1538 Bug: tint:1604 Bug: tint:1605 Change-Id: I530b846b6b8df122ab351ff7b85d3e1c9ac11526 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104121 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-29 16:53:58 +00:00
while (true) {
const int x_122 = i;
if ((x_122 < 2)) {
} else {
break;
}
const int x_126 = i;
switch(x_126) {
case 1: {
const float2 x_150 = tileID;
const float2 x_154 = asfloat(x_20[5].zw);
const float4 x_156 = tileMapsTexture1.SampleBias(tileMapsSampler, ((x_150 + (0.5f).xx) / x_154), 0.0f);
frameID_1 = x_156.x;
break;
}
case 0: {
const float2 x_136 = tileID;
const float2 x_140 = asfloat(x_20[5].zw);
const float4 x_142 = tileMapsTexture0.SampleBias(tileMapsSampler, ((x_136 + (0.5f).xx) / x_140), 0.0f);
frameID_1 = x_142.x;
break;
}
default: {
break;
}
}
const float x_166 = frameID_1;
const float x_169 = asfloat(x_20[6].w);
const float4 x_172 = animationMapTexture.SampleBias(animationMapSampler, float2(((x_166 + 0.5f) / x_169), 0.0f), 0.0f);
animationData = x_172;
const float x_174 = animationData.y;
if ((x_174 > 0.0f)) {
const float x_181 = asfloat(x_20[0].x);
const float x_184 = animationData.z;
mt = ((x_181 * x_184) % 1.0f);
f = 0.0f;
tint/hlsl: remove [loop] attribute on all loops I added the forcing of the "loop" attribute to all loops to address FXC failing on uniformity errors related to gradients in loops. Since then, Tint now implements UA and it recently became an error, so we no longer need this hack. As a result, FXC is now better able to cope with loops that it determines executes 0 times. Most e2e tests are affected because so many use loops, but 27 tests that were previously failing are now passing with this change: tint/bug/tint/1538.wgsl.expected.fxc.hlsl tint/bug/tint/1604.wgsl.expected.fxc.hlsl tint/bug/tint/1605.wgsl.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_ClassifyCFGEdges_LoopBreak_FromLoopHeader_SingleBlockLoop_TrueBranch.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_ComputeBlockOrder_Loop_HeaderHasBreakUnless.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_EmitBody_IfSelection_TrueBranch_LoopBreak.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserCFGTest_FindIfSelectionInternalHeaders_TrueBranch_LoopBreak_Ok.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_MultiBlockLoopIndex.spvasm.expected.fxc.hlsl tint/unittest/reader/spirv/SpvParserFunctionVarTest_EmitStatement_Phi_SingleBlockLoopIndex.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/cov-dead-code-unreachable-merge/0-opt.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/similar-nested-ifs/0-opt.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/spv-load-from-frag-color/1.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-false-if-discard-loop/0.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/0.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-fragcoord-less-than-zero/1.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/0-opt.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/stable-binarysearch-tree-with-loop-read-write-global/1.wgsl.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.spvasm.expected.fxc.hlsl tint/vk-gl-cts/graphicsfuzz/write-red-after-search/0-opt.wgsl.expected.fxc.hlsl Bug: tint:1522 Bug: tint:1538 Bug: tint:1604 Bug: tint:1605 Change-Id: I530b846b6b8df122ab351ff7b85d3e1c9ac11526 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/104121 Reviewed-by: Ben Clayton <bclayton@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Kokoro: Kokoro <noreply+kokoro@google.com>
2022-09-29 16:53:58 +00:00
while (true) {
const float x_193 = f;
if ((x_193 < 8.0f)) {
} else {
break;
}
const float x_197 = animationData.y;
const float x_198 = mt;
if ((x_197 > x_198)) {
const float x_203 = animationData.x;
frameID_1 = x_203;
break;
}
const float x_208 = frameID_1;
const float x_211 = asfloat(x_20[6].w);
const float x_214 = f;
const float4 x_217 = (0.0f).xxxx;
animationData = x_217;
{
const float x_218 = f;
f = (x_218 + 1.0f);
}
}
}
const float x_222 = frameID_1;
param = (x_222 + 0.5f);
const float4x4 x_225 = getFrameData_f1_(param);
frameData = x_225;
const float4 x_228 = frameData[0];
const float2 x_231 = asfloat(x_20[6].xy);
frameSize = (float2(x_228.w, x_228.z) / x_231);
const float4 x_235 = frameData[0];
const float2 x_237 = sheetUnits;
offset_1 = (float2(x_235.x, x_235.y) * x_237);
const float4 x_241 = frameData[2];
const float4 x_244 = frameData[0];
ratio = (float2(x_241.x, x_241.y) / float2(x_244.w, x_244.z));
const float x_248 = frameData[2].z;
if ((x_248 == 1.0f)) {
const float2 x_252 = tileUV;
tileUV = float2(x_252.y, x_252.x);
}
const int x_254 = i;
if ((x_254 == 0)) {
const float2 x_263 = tileUV;
const float2 x_264 = frameSize;
const float2 x_266 = offset_1;
const float4 x_268 = spriteSheetTexture.Sample(spriteSheetSampler, ((x_263 * x_264) + x_266));
color = x_268;
} else {
const float2 x_274 = tileUV;
const float2 x_275 = frameSize;
const float2 x_277 = offset_1;
const float4 x_279 = spriteSheetTexture.Sample(spriteSheetSampler, ((x_274 * x_275) + x_277));
nc = x_279;
const float x_283 = color.w;
const float x_285 = nc.w;
alpha = min((x_283 + x_285), 1.0f);
const float4 x_290 = color;
const float4 x_292 = nc;
const float x_295 = nc.w;
mixed = lerp(float3(x_290.x, x_290.y, x_290.z), float3(x_292.x, x_292.y, x_292.z), float3(x_295, x_295, x_295));
const float3 x_298 = mixed;
const float x_299 = alpha;
color = float4(x_298.x, x_298.y, x_298.z, x_299);
}
{
const int x_304 = i;
i = (x_304 + 1);
}
}
const float3 x_310 = asfloat(x_20[7].xyz);
const float4 x_311 = color;
const float3 x_313 = (float3(x_311.x, x_311.y, x_311.z) * x_310);
const float4 x_314 = color;
color = float4(x_313.x, x_313.y, x_313.z, x_314.w);
const float4 x_318 = color;
glFragColor = x_318;
return;
}
struct main_out {
float4 glFragColor_1;
};
struct tint_symbol_1 {
float3 vPosition_param : TEXCOORD0;
float2 vUV_param : TEXCOORD1;
float2 tUV_param : TEXCOORD2;
float2 stageUnits_1_param : TEXCOORD3;
float2 levelUnits_param : TEXCOORD4;
float2 tileID_1_param : TEXCOORD5;
};
struct tint_symbol_2 {
float4 glFragColor_1 : SV_Target0;
};
main_out main_inner(float2 tUV_param, float2 tileID_1_param, float2 levelUnits_param, float2 stageUnits_1_param, float3 vPosition_param, float2 vUV_param) {
tUV = tUV_param;
tileID_1 = tileID_1_param;
levelUnits = levelUnits_param;
stageUnits_1 = stageUnits_1_param;
vPosition = vPosition_param;
vUV = vUV_param;
main_1();
const main_out tint_symbol_6 = {glFragColor};
return tint_symbol_6;
}
tint_symbol_2 main(tint_symbol_1 tint_symbol) {
const main_out inner_result = main_inner(tint_symbol.tUV_param, tint_symbol.tileID_1_param, tint_symbol.levelUnits_param, tint_symbol.stageUnits_1_param, tint_symbol.vPosition_param, tint_symbol.vUV_param);
tint_symbol_2 wrapper_result = (tint_symbol_2)0;
wrapper_result.glFragColor_1 = inner_result.glFragColor_1;
return wrapper_result;
}