hlsl – Compute shader – are you able to append values to an appendbuffer after which instantly learn from that very same buffer?

hlsl – Compute shader – are you able to append values to an appendbuffer after which instantly learn from that very same buffer?

[ad_1]

hlsl – Compute shader – are you able to append values to an appendbuffer after which instantly learn from that very same buffer? – Recreation Improvement Stack Trade







Recreation Improvement Stack Trade is a query and reply web site for skilled and unbiased sport builders. It solely takes a minute to enroll.

Signal as much as be part of this neighborhood

Anyone can ask a query

Anyone can reply

The perfect solutions are voted up and rise to the highest

Requested

Considered
2 occasions

$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.

default

 

[ad_2]

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Scroll to Top