I'm programming gpgpu raymarching (volumetric raytracing) in directx11. I succesfully perform compute shader and save raymarched volume data to texture. Then i want to use same texture as SRV in normal graphic pipeline. But it doesnt work, texture is not visible.

Texture is ok, when i save it file it is what i expect. Texture rendering is ok too, when i render another SRV, it is ok. So problem is only in UAV->SRV. I also triple checked if pointers are ok. Please help, i'm getting mad about this.

Here is some code:

//before dispatch
D3D11_TEXTURE2D_DESC textureDesc;
ZeroMemory( &textureDesc, sizeof( textureDesc ) );
textureDesc.Width = xr;
textureDesc.Height = yr;
textureDesc.MipLevels = 1;
textureDesc.ArraySize = 1;
textureDesc.SampleDesc.Count = 1;
textureDesc.SampleDesc.Quality = 0;
textureDesc.Usage = D3D11_USAGE_DEFAULT;
textureDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
D3D->CreateTexture2D( &textureDesc, NULL, &pTexture );

ZeroMemory( &viewDescUAV, sizeof( viewDescUAV ) );
viewDescUAV.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
viewDescUAV.ViewDimension = D3D11_UAV_DIMENSION_TEXTURE2D;
viewDescUAV.Texture2D.MipSlice = 0;
D3DD->CreateUnorderedAccessView( pTexture, &viewDescUAV, &pTextureUAV );

//the getSRV function after dispatch.
ZeroMemory( &srvDesc, sizeof( srvDesc ) );
srvDesc.Format = DXGI_FORMAT_R32G32B32A32_FLOAT;
srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
srvDesc.Texture2D.MipLevels = 1;
D3DD->CreateShaderResourceView( pTexture, &srvDesc, &pTextureSRV);
  • \$\begingroup\$ Also i release UAV before creating and using SRV \$\endgroup\$
    – Notabene
    Commented Jan 8, 2011 at 0:48

1 Answer 1


I solved this. Problem was in releasing. You can't access compute shader's resources until it is fully unbind and released.

Edit you dont have to release it at all. Only "unplug" UAV from from gpu.

//code is shortened
//create UAV
D3D->CreateTexture2D( &textureDesc, NULL, &pTexture );
D3DD->CreateUnorderedAccessView( pTexture, &viewDescUAV, &pTextureUAV );


//pTextureUAV->release(); // You dont have to release (if you want to use UAV again)
outputTexH->SetUnorderedAccessView(NULL); // This is what is important

effpass->Apply(0,D3DC); // unbind compute shader

//create SRV on the texture, use it.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .