My compute shader (written in HLSL) compiled and worked with the earlier SDK 1.0.65.0. I updated to 1.0.68.0 and recompiled it, now I get this error when calling vkCreateShaderModule
:
Vulkan error: [SC], code: 5: SPIR-V module not valid: AtomicSMax: expected Result Type to be int scalar type
I verified that the error comes from this function in my shader:
groupshared uint ldsZMax;
groupshared uint ldsZMin;
...
void CalculateMinMaxDepthInLds( uint3 globalThreadIdx, uint depthBufferSampleIdx )
{
float viewPosZ = depthTexture.Load( uint3( globalThreadIdx.x, globalThreadIdx.y, 0 ) ).x;
uint z = asuint( viewPosZ );
if (viewPosZ != 0.f)
{
InterlockedMax( ldsZMax, z );
InterlockedMin( ldsZMin, z );
}
}
I compile the shader with this command:
C:\VulkanSDK\1.0.68.0\Bin\glslangValidator -D -V -S comp -e CSMain LightCuller.hlsl -o LightCuller.spv
The error goes away if I don't use those Interlocked*
methods.
I also tried to use int
s instead of uint
s but the problem persists. What am I doing wrong or could this be a codegen bug?