Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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):


share|improve this question
up vote 3 down vote accepted

Your dispatch call Dispatch( 100, 0, 0 ) is not actually creating any thread groups. You need (100, 1, 1). The total number of thread groups is the product of the three dimensions, so any zero dimension will nullify the whole thing.

Also, you're not re-copying the structured buffer to the staging buffer after running the compute shader.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.