Jump to content
  • Advertisement
Sign in to follow this  
Martin Perry

RWTexture2D - read and write

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

I create my RWTexture2D with this flags:

textureDesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE;

In Compute Shader
RWTexture2D<float4> data;


Afterward I want to bind this texture for Read only (srv, some errors) or Write (uav) or Read/Write (uav)...

If I bind this texture as SRV or UAV and read from it, i got this error:

- typed UAV loads are only allowed for single-component 32-bit element types
- if my code contains for-loop with break: Loop termination conditions in varying flow control cannot depend on data read from a UAV


First one is limitation of DX SDK as i found... co i can do only RWTexture2D<int> if I want to use it as read only (srv).
Second error is mystery :) Even if I change float4 to int


Thanks

Share this post


Link to post
Share on other sites
Advertisement
Hi,


- typed UAV loads are only allowed for single-component 32-bit element types

Theoretically, you can either use a SRV to fetch from the texture (Texture2D<float4>) or you bind it as UAV and do 4 reads (RWTexture2D<float>). Caching should make the other three reads very fast, so I wouldn’t expect too much penalty.


- if my code contains for-loop with break: Loop termination conditions in varying flow control cannot depend on data read from a UAV

As for flow control depending on UAV reads, you can use a special modifier in front of the loop, see here.
[allow_uav_condition] for(...) { }

Cheers!

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!