3 Replies Latest reply on Feb 28, 2009 3:28 AM by rahulgarg

    Computer Shader model limited to global buffer?

      global buffer, compute shader

      From what little I can find in the documentation about the global buffer, is it true there is only one available (i.e., g[])?


      Also, it appears that I can't use o0-o7 output registers in a computer shader. Instead, if I want to output from a kernel I need to scatter writes to the global buffer. I would like the flexibility of outputing to multiple o# registers. I know I can emulate this behavior with a scatter but it's a bit messy.


      What is the best practice for handling multiple output buffers in that case? Is seems I am limited to outputing to just the single global buffer in the kernel when using the compute shader model.

        • Computer Shader model limited to global buffer?

          There is only one g register.

          When writing to o#, you can only write to the current location in the domain of execution. You can't index into them arbitrarily (you can't index into them at all, actually). For example, if vWinCoord0.x = 20.5 and y = 70.5, this means I'm at row 70 column 20 in a 2d matrix. To write to that location, call "mov o0, r2" (or any other operation with o# as a destination register).

          If you're going to use the global buffer as your output, you map it to a resource by passing a flag when you call ResAllocLocal1D(). You can probably still additionally map o0-o7 to resources as well and use them for output.