Advertisement Jump to content
Sign in to follow this  
Alundra

[D3D11] Compute shader Problem RWTexture3D

This topic is 1863 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 all,

I have Texture3D initialized using R32G32_UINT data, SRV and UAV is created as well.

Here the code I use :

RWTexture3D<uint2> TestTexture3D: register(u0);

[numthreads(16, 16, 1)]
void main(uint3 dispatchThreadID : SV_DispatchThreadID)
{
  TestTexture3D[dispatchThreadID] = uint2(0, 0);
}
const UInt32 ThreadGroupCountX = CMath::Ceil( static_cast< float >( m_Width ) / 16.0f );
const UInt32 ThreadGroupCountY = CMath::Ceil( static_cast< float >( m_Height ) / 16.0f );
CDirect3D11Device::GetDeviceContext()->Dispatch( ThreadGroupCountX, ThreadGroupCountY, 256);

"TestTexture3D[dispatchThreadID] = uint2(0, 0);" is changed to 0 or 1 to see the change on output texture.

But the problem is I have value set on the bad coord.The result is like one rectangle of one color and after one rectangle of other.

Is it because of the texture is uint2 format and the GPU align data to uint4 ?

What is the best solution to avoid this problem ?

Thanks for the help

Edited by Alundra

Share this post


Link to post
Share on other sites
Advertisement

Solved using this texture desc :

D3D11_TEXTURE3D_DESC TextureDesc =
{
  m_GridWidth,
  m_GridHeight,
  256,
  1,
  DXGI_FORMAT_R32G32_UINT,
  D3D11_USAGE_DEFAULT,
  D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS,
  0,
  0
};
Apparently if the texture is D3D11_USAGE_DYNAMIC and D3D11_CPU_ACCESS_WRITE, that doesn't work.

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!