-
By "runtime sized" I mean that the size isn't hardcoded in the shader and I'm not using a specialization constant to tell the shader how big it is. I'm trying to bounds check a StructuredBuffer in my shader. From the examples it seems like the way to do this is by using GetDimensions. My shader looks like this (specifically I'm trying to benchmark whether it's faster to do parallel reduction with a loop in the shader vs generating commands accordingly in the C++ program):
This at least doesn't crash, however, GetDimensions just writes 0 to count, and so the if condition always fails. I expected that GetDimensions would be able to find the size of the buffer at runtime, like Edit: Now I feel like I'm going crazy, because now this isn't working in GLSL either. I'm sure I was able to get the correct length of a buffer in this piece of code:
Now when I try to make a minimum reproducible example like this
it also reports the array as having size 0 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I think I've at least found out why the size was being reported as 0. At 512 * 1024 *1024 elements, the length function reports the array as having length 0 for some reason. When I lower the count to 256 * 1024 * 1024 I get a sensible length, although it seems there is still some problem with my algorithm because it doesn't find the correct minimum, but that's outside the scope of the initial question. |
Beta Was this translation helpful? Give feedback.
I think I've at least found out why the size was being reported as 0. At 512 * 1024 *1024 elements, the length function reports the array as having length 0 for some reason. When I lower the count to 256 * 1024 * 1024 I get a sensible length, although it seems there is still some problem with my algorithm because it doesn't find the correct minimum, but that's outside the scope of the initial question.