Antonio Maiorano 9943de6813 Fix FXC compile errors on modulo by zero
Just like for divide, FXC fails with the exact same error when
performing a modulo on a value that FXC determines to be zero. We
address it in the same way as we do for divide.

This also fixes a couple of the vk-gl-cts tests for which I manually
generated expectation files for.

Bug: tint:1083
Change-Id: Ia388bf002112afded542adb791d37e88e35a77ff
Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/74220
Reviewed-by: James Price <jrprice@google.com>
Kokoro: Kokoro <noreply+kokoro@google.com>
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
2021-12-22 15:02:09 +00:00

60 lines
1.5 KiB
HLSL

cbuffer cbuffer_x_6 : register(b0, space0) {
uint4 x_6[4];
};
static float4 x_GLF_color = float4(0.0f, 0.0f, 0.0f, 0.0f);
void main_1() {
int a = 0;
int i = 0;
const int x_27 = asint(x_6[3].x);
a = x_27;
i = 0;
{
[loop] for(; (i < 3); i = (i + 1)) {
const int x_35 = i;
const int x_37 = asint(x_6[1].x);
if ((x_35 == x_37)) {
a = (a + 1);
} else {
a = (a / (i == 0 ? 1 : i));
}
}
}
const int x_49 = a;
const int x_51 = asint(x_6[2].x);
if ((x_49 == x_51)) {
const uint scalar_offset = ((16u * uint(0))) / 4;
const int x_57 = asint(x_6[scalar_offset / 4][scalar_offset % 4]);
const int x_60 = asint(x_6[1].x);
const int x_63 = asint(x_6[1].x);
const uint scalar_offset_1 = ((16u * uint(0))) / 4;
const int x_66 = asint(x_6[scalar_offset_1 / 4][scalar_offset_1 % 4]);
x_GLF_color = float4(float(x_57), float(x_60), float(x_63), float(x_66));
} else {
const int x_70 = asint(x_6[1].x);
const float x_71 = float(x_70);
x_GLF_color = float4(x_71, x_71, x_71, x_71);
}
return;
}
struct main_out {
float4 x_GLF_color_1;
};
struct tint_symbol {
float4 x_GLF_color_1 : SV_Target0;
};
main_out main_inner() {
main_1();
const main_out tint_symbol_2 = {x_GLF_color};
return tint_symbol_2;
}
tint_symbol main() {
const main_out inner_result = main_inner();
tint_symbol wrapper_result = (tint_symbol)0;
wrapper_result.x_GLF_color_1 = inner_result.x_GLF_color_1;
return wrapper_result;
}