Writing to a structured buffer with a compute shader (D3D11)
Posted
by
Vertexwahn
on Game Development
See other posts from Game Development
or by Vertexwahn
Published on 2013-06-28T09:09:47Z
Indexed on
2013/06/28
10:30 UTC
Read the original article
Hit count: 294
I have some problems writing to a structured buffer. First I create a structured buffer that is filled with float values beginning from 0 to 99. Afterwards a copy the structured buffer to a CPU accessible buffer is made to print the content of the structured buffer to the console. The output is as expected (Numbers 0 to 99 appear on the console). Afterwards I use a compute shader that should change the contents of the structured buffer:
RWStructuredBuffer<float> Result : register( u0 );
[numthreads(1, 1, 1)]
void CS_main( uint3 GroupId : SV_GroupID )
{
Result[GroupId.x] = GroupId.x * 10;
}
But the compute shader does not change the contents of the structured buffer.
The source code can be found here (main.cpp): https://bitbucket.org/Vertexwahn/cmakedemos/src/4abb067afd5781b87a553c4c720956668adca22a/D3D11ComputeShader/src/main.cpp?at=default
© Game Development or respective owner