Hi guys,
I'm looking for people who are familiar with D3D11 and the new shader resource types which allow GPU/CPU access to the resource (ComputeShader type resources). I am trying to create a 1D texture resource which both the CPU and GPU can access for read/write operations. I am aware that the usage for this kind of a texture must be D3D11_USAGE_STAGING however I'm having issues getting the device to create for me the resource. My D3D11_TEXTURE1D_DESC looks like this:
D3D11_TEXTURE1D_DESC td = {};
td.Width = 3;
td.ArraySize = 1;
td.MipLevels = 1;
td.Format = DXGI_FORMAT_R32_UINT;
td.Usage = D3D11_USAGE_STAGING;
td.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE | D3D11_CPU_ACCESS_READ;
td.BindFlags = D3D11_BIND_SHADER_RESOURCE;
My intention that the texture would look something like this in memory:
unsigned int tex[] = {0, 0, 0}
The texture desc structure works when the usage is changed to D3D11_USAGE_DEFAULT and the CPUAccessFlags is changed to 0. This however breaks what I am trying to acheive as it removes any hope fo the CPU getting access to the modified data in the shader.
Has anyone been able to successfully use a 1DTexture as a resource type for CPU read/write access? I would be binding this to the pixel shader by the way. Thanks for any help you can provide!