LunarG/LunarGLASS

Type-Casts on parameters declared 'out' results in erroneous code

Opened this issue · 1 comments

Calling any atomic function of the uint type seems to result in optimizations to pick the corresponding atomic function of the int type, subsequently forcing a cast on its parameters. However the first parameter is declared as out and does thus not allow to be cast there (since that results in a non-lvalue). As an example you can see

#version 450
layout (binding = 0) buffer uintBuffer {
	uint inUInt;
};
layout (location = 0) out uint outUInt;
void main() {
	outUInt = atomicOr(inUInt, 1);
}

which has the corresponding output from LunarGOO.exe

#version 450 core
// LunarGOO output
layout(binding=0) buffer uintBuffer {
        uint inUInt;
} ;
layout(location=0) out uint outUInt;
const int C_1 = 1;
void main()
{
        int outUInt1 = atomicOr(int(inUInt), C_1);
        outUInt = uint(outUInt1);
}

Can confirm that this still happens with the latest commit (012965a)