cbuffer array #256
-
What would be the procedure for uploading data to a constant/static array of data in a cbuffer? I set things up the way I expected it should work, and I get no errors or warnings, but the data does not get uploaded to the variable being used by the shaders. Is there a sample or example code that uploads data to a static cbuffer array? This is what my shader definition looks like:
I have this defined in a header that is only visible to the buffer uploader:
Then this is what my buffer creation/upload looks like:
Then finally this is what my pipeline resource signature entry looks like:
I first tried uploading the data as an array of 128 float4 elements, but kept getting errors about it being an array. So I switched to trying to upload as a single element. Are there any obvious problems with this approach? Note that most of the code above is executed through utility functions in a much more generic way, but I translated it to very specific setup code to make it more clear, so hopefully I didn't make any serious blunders while doing so. Really appreciate any help! Edit: For some reason, the data upload works if I change the pipeline resource variable type from |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 8 replies
-
Variable type is orthogonal to buffer usage. Immutable buffers are initialized when they are created and your code looks correct. |
Beta Was this translation helpful? Give feedback.
Variable type is orthogonal to buffer usage. Immutable buffers are initialized when they are created and your code looks correct.
Variable type defines how you are going to bind the resource to that variable.
Static variables are set directly through pipeline/signature.
Mutable and dynamic variables are set through SRB.