How to create temp array in direct compute

Started by
4 comments, last by fido9dido 2 years, 5 months ago

I want to create a temporary array of type float4 and the size is no less than 35,937 without splitting.

basically what I am doing is I want to do some computation and output it in a temp buffer then do some computation using the temp maybe one or two times then return the result

so in short I am stuck on creating this temp array
I cant create RW buffer in the shader and i tried use dcl_indexableTemp but its not recognized

Advertisement

That amount of data is way too large to store in anything except for an actual buffer. Just create a buffer that your shader can write to and store your data in there.

Thank you for your answer, Yeah I will do that, I was just hoping there was some other way to do it do it internally

If the memory is only for internal use of a workgroup, you may want to use on chip LDS instead a buffer in VRAM. Iirc. DX calls this shared memory. Amount must be known at compile time because there is no dynamic allocation here either.
Your requested size is ofc. too large for this. But if you could reduce that, e.g. my dividing into smaller workloads, LDS could be a lot faster. Though, allocating too much LDS per workgroup can reduce occupancy, so profiling tools are good to find the best compromise.

Yeah but the LDS is 32kb if am not mistaken this is too small for my problem, I may do that in the future but for now I need a bigger size array until i get the hang of compute shader.

This topic is closed to new replies.

Advertisement