Hi,
I am trying to compile following shader code written for DX12_1 feature level with shader model cs_5_1.
Hitting following error -
X3664 vs_2_0 does not support synchronization operations
I tried to change shader model from VS_studio HLSL properties but didn't worked.
I have Intel GPU with DX 12_1 feature level support.
Shader code
// Input texture
Texture2D<float> inputTexture : register(t0);
// Intermediate buffer for storing maximum values from each thread group
RWBuffer<float> intermediateBuffer : register(u0);
// Define the number of threads per group
[numthreads(16, 16, 1)]
void CSMain(uint3 DTid : SV_DispatchThreadID, uint3 GTid : SV_GroupThreadID, uint3 GID : SV_GroupID)
{
// Calculate the index based on the thread ID
uint index = GTid.y * 16 + GTid.x;
// Read the value from the input texture
float value = inputTexture.Load(int3(DTid.xy, 0));
// Perform reduction to find the maximum value in the group
for (uint stride = 8; stride > 0; stride >>= 1)
{
if (GTid.x < stride)
{
value = max(value, inputTexture.Load(int3(DTid.xy + int2(stride, 0), 0)));
value = max(value, inputTexture.Load(int3(DTid.xy + int2(0, stride), 0)));
}
GroupMemoryBarrierWithGroupSync();
}
// Write the maximum value to the intermediate buffer
if (GTid.x == 0 && GTid.y == 0)
{
intermediateBuffer[GID.y * (16) + GID.x] = value;
}
}