$begingroup$

I’m trying to obtain the next: I’ve a compute shader that receives a Texture2D as enter, the place a small share of the pixels within the texture are white. The situation of the white pixels are unpredictable for any given body. I wish to learn the depth worth at these white pixels and retailer them in reminiscence. I cant put them in a RWStructuredBuffer as a result of there isn’t any option to forestall every thread from overriding one other thread when storing values to the buffer. In fact I may assign every thread its personal place within the buffer, BUT THEN THIS WOULD INCLUDE ALL non-white pixels. I solely wish to retailer the values from white pixels, so the buffer could be a lot smaller in measurement than the feel. I can obtain this with an append buffer, just by having solely the white pixels append to the appendbuffer. However I do not know the way I can then subsequently READ from that appendbuffer in the identical compute shader. Is that doable?

Daniel Cardin is a brand new contributor to this web site. Take care in asking for clarification, commenting, and answering.
Try our Code of Conduct.

$endgroup$

You could log in to reply this query.