-
-
Notifications
You must be signed in to change notification settings - Fork 124
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AppendStructuredBuffer #321
Comments
I'm not sure I fully understand your issue, can you elaborate a bit more maybe show a small code sample..? If you're dispatching a shader on 3 axes and for each one you need to store an |
Hi Sergio, You are not far from it : for each (x, y, z) I have to store an array of int (from 0 to several tenth of values), representing the indexes of the matching objects for that tuple (actually triangles that are cutted by the cell at xyz). |
I see. Unfortunately I don't really see a way to implement this as a built-in buffer type. The buffer types ComputeSharp exposes are just mapping the real HLSL buffer types, but there's no type like this. In your scenario, you might need to allocate a 3D texture with a depth of the maximum possible number of matches for each item, and then have each tuple write to the right location. This might end up using too memory though, so you might need to find an alternative solution. |
Yes indeed, memory consumption would explose. |
Because there's no data type in HLSL that represents that. All resource types in ComputeSharp directly map to existing HLSL data types, it's not possible to just "create a new type". GPUs don't work like normal CPUs, and unfortunately this means you can't just easily create a data structure like that. You might be able to create something like this, but it'd be a custom-built thing with specific logic to support this, and it would need to be structured quite differently. And most importantly, you can't allocate new memory from a shader, which means you'd necessarily need to have an upper bound of maximum values to discover/set. |
Uuuh... I had completely missed those two new buffer types 👀 |
Any updates here? |
Hi Friends,
I have a shader that perfoms a calculation on 3 axis.
For each tuple (ThreadIds.X, ThreadIds.Y, ThreadIds.Z), the shader makes several tests to find matching indexed objects.
So, I have to store a list of int for each cell (X,Y,Z).
One way could have been to use a fixed sizes multi-dimensional ReadWriteBuffer, which doesn't seams to exists.
Another way could have been to use a HLSL AppendStructuredBuffer (with T = struct { ... }), but I don't know how to do it since CompSharp does not allow this type for now.
Any advice ?
Thanks ;-)
The text was updated successfully, but these errors were encountered: