Quantcast
Channel: Questions in topic: "hlsl"
Viewing all articles
Browse latest Browse all 206

How can I read in the actual elements from an Append Compute Buffer?

$
0
0
I have a Compute Shader in my game that runs every FixedUpdate() call. It has two passes/kernels: 1) clears out an Append buffer by "consuming" every element 2) appends several new elements into said Append buffer. After running it, I need to read the elements of that Append buffer onto the CPU. I know that the ```ComputeBuffer``` class has a ```GetData(Array data)``` method, but from what I understand it would grab the *entire* buffer, including data that isn't actually allocated yet. I'd like to only spend bandwidth on actual appended elements, instead of getting the full reserved buffer. Additionally, I don't even know how to find the number of existing elements in the buffer in the first place. So how can I get the number of elements currently in an Append buffer, and how can I read in just those values from the GPU?

Viewing all articles
Browse latest Browse all 206

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>