Sign in to follow this  
Martin Perry

RWTexture2D - read and write

Recommended Posts

I create my RWTexture2D with this flags:

[code]textureDesc.BindFlags = D3D11_BIND_UNORDERED_ACCESS | D3D11_BIND_SHADER_RESOURCE;[/code]

In Compute Shader
[code]RWTexture2D<float4> data;[/code]


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:
[code]
- 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
[/code]

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
Hi,

[quote name='Martin Perry' timestamp='1330018023' post='4915907']
- typed UAV loads are only allowed for single-component 32-bit element types
[/quote]
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.

[quote name='Martin Perry' timestamp='1330018023' post='4915907']
- if my code contains for-loop with break: Loop termination conditions in varying flow control cannot depend on data read from a UAV
[/quote]
As for flow control depending on UAV reads, you can use a special modifier in front of the loop, see [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb509602%28v=vs.85%29.aspx"]here[/url].
[CODE][allow_uav_condition] for(...) { }[/CODE]

Cheers!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this