Jump to content
  • Advertisement
Sign in to follow this  
michaelruecker

AppendStructuredBuffer / ConsumeStructuredBuffer element count

This topic is 2137 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Is there a way to to get the active element count of a AppendStructuredBuffer or ConsumeStructuredBuffer in HLSL?

 

I would like to access the element count on the shader side only.

 

(I guess I could use another buffer and fill it via CopyStructureCount. But was wondering if there is a direct method in HLSL)

 

All I found was a function called: GetDimensions (http://msdn.microsoft.com/en-us/library/windows/desktop/ff471449(v=vs.85).aspx).

 

But I think that function returns the maximal number of elements not the current element count.

Edited by me_12

Share this post


Link to post
Share on other sites
Advertisement

Unfortunately no, there isn't an intrinsic that you could use in this manner.  However, you can use the CopyStructureCount method to copy the value into a constant buffer which you could then use.

 

However, this will likely have little benefit to you during the execution of a compute shader in which you are actively appending or consuming against a buffer.  Since many threads are working on the buffer in parallel, the count will likely change in non-deterministic fashion depending on the underlying hardware and workload size.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!