Jump to content



RWTexture2D - read and write

  • You cannot reply to this topic
1 reply to this topic

#1 Martin Perry   Members   -  Reputation: 107

Like
0Likes
Like

Posted 23 February 2012 - 11:27 AM

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

Ad:

#2 Tsus   Members   -  Reputation: 296

Like
0Likes
Like

Posted 23 February 2012 - 12:23 PM

Hi,

View PostMartin Perry, on 23 February 2012 - 11:27 AM, said:

- 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.

View PostMartin Perry, on 23 February 2012 - 11:27 AM, said:

- 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!
Acagamics e.V. – IGDA Student Game Development Club (University of Magdeburg, Germany)






We are working on generating results for this topic
PARTNERS