Nvidia miscompiles the buffer increment
AaronGhost opened this issue · 0 comments
AaronGhost commented
Description
The following code containing an array copy and a conversion from a boolean to an integer crashes.
#version 450
layout(local_size_x = 1, local_size_y = 1, local_size_z = 1) in;
layout(std430, binding = 0) buffer buffer_0 {
int ext_4[3]; // 1 1 1
};
void main()
{
bool var_0[6] = bool[6](true, true, true, true, false, true);
int var_1[3] = ext_4; // 1 1 1
++ ext_4[int(var_0[var_1[1]]) % 3];
}
NVIDIA output:
buffer_0 3 2 1
Expected output:
buffer_0 1 2 1
Thinking process
var_1[1] = 1
var_0[var_1[1]] = var_0[1] = true
int(var_0[var_1[1]]) = int(true) = 1
ext_4[int(var_0[var_1[1]]) % 3] = ext_4[1]
++ ext_4[1]
so ext_4[1] is set to 2
Code link
For the related code in the shadertrap test format, see: nvidia/miscompilation/shader17.shadertrap