There is a compute shader that i want to test, but i can’t get desired value. The format of uav is DXGI_FORMAT_R8G8B8A8_UNORM. I am sure the pipelinestate and rootsignture et have no problems. According to ChatGPT’s suggestion, I set the compute shader to “disable optimization” and “enable debugging mode” with version number cs_5_0,but it didn’t work.
The expected output will be an orange color like image. However i got a gray one. By the use of Renderdoc, in debug mode, i found that the ‘hardcolor’ is (0.5,0.5,0.5,0.5) instead of (0.8,0.5,0.0,0.5). I can’t understand why the issue occurs.
hlsl:
RWTexture2D<unorm float4> g_Output : register(u0); // output
[numthreads(8, 8, 1)] // 8x8
void main(uint3 DTid : SV_DispatchThreadID) // ID
{
unorm float4 hardcolor = (unorm float4)(0.8f, 0.5f, 0.0f, 0.5f);
g_Output[DTid.xy] = hardcolor;
}
The debug result of Renderdoc:
Sun yang is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.