Jump to content
  • Advertisement
Sign in to follow this  
BloodyEpi

Writing to a buffer

This topic is 892 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

Hi,

 

I came across this idea for Surface Nets (http://www.merl.com/publications/docs/TR99-24.pdf) and I was wondering if it would be a good idea to implement it using D3D11.

 

The algorithm would need to iterate over a net multiple times, however since it needs to know the coordinates of every voxels (up to) 6 neighbors for a calculation, a simple vertex buffer probably wouldn't do it.

 

So, is there a way to let a shader write into some kind of hlsl buffer? I've been looking for an answer but couldn't find much, I have been doing some stuff with the stream output, but I don't think generating a new mesh for every iteration is a good idea.

 

Or would this be something better run on the CPU, since there is probably some branching going on depending on how many neighbors a voxel has.

 

Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement

Not sure I am following your question (I have not checked the article you refer to).

 

D3D11 allows you to write to unordered access buffer from pixel or compute shader using RWStructuredBuffer HLSL object.

https://msdn.microsoft.com/en-us/library/windows/desktop/ff476335(v=vs.85).aspx#Read_Write

 

To bind your structured buffer to the pixel shader for writing, you have to use ID3D11DeviceContext::OMSetRenderTargetsAndUnorderedAccessViews method.

To bind it to the compute shader, you will use ID3D11DeviceContext::CSSetUnorderedAccessViews routine.

Edited by _void_

Share this post


Link to post
Share on other sites

So, I guess putting my data into an RWStructuredBuffer and letting the CS do its work sounds good.

 

The internet says that, afterwards, I can use a UAV to directly stream a new mesh into a VertexBuffer using the CS and the previously created data. (Please correct me if Im wrong or this can be done somehow more effective.)

 

Thanks!

Edited by BloodyEpi

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!