🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Directx12 Limitation of function: SetComputeRootShaderResourceView

Started by
3 comments, last by evelyn4you 2 years, 10 months ago

hello,

with Directx12 api when setting Rootparameters we can use the function SetComputeRootShaderResourceView

Is this function only valid for buffers ?

When i try to use this function for a texture2d SRV my create pipelinestate call returns null.

I get no error message, although i have enabled debug layer and set the debug flag in DXGI creation.

If i use the function with e.g. accelerationstructure buffer in another portion of my code all works fine.

Can anyone confirm having used this function with a texture2d SRV ?

I did spend several hours to check my code, so maybe i try to do something that is out of specification.

Advertisement

hello,

sorry for pushing up this thread, but does really nobody know a answer ?

I have now solved my problem by adding a new rootparameter descriptor table to the rootsignature und setting the corresponding table before dispatching the compute shader, but this is NOT how things should be done.

Yes, you can only use non-formatted buffers (ConstantBuffer, StructuredBuffer, and ByteAddressBuffer), and ray tracing acceleration structures for “root” SRV and UAV descriptors. It's mentioned in the docs. You also can't ask for the GPU virtual address of a texture resource, so there's no way to get that to pass it to SetCompute/GraphicsRootShaderResourceView.

Textures and formatted buffers require the additional metadata contained in the full descriptor in order for the hardware to be able to read them. A pointer is enough to read or write to a buffer since they use a simple linear memory layout, but textures do not. Depending on the D3D12_TEXTURE_LAYOUT they are typically stored in one of several opaque swizzled texel orderings, and being able to sample with mip filtering often requires extra info such as the dimensions of the texture. And then of course there's the DXGI_FORMAT used for creating the texture, which determines how the hardware interprets the exact bits contained in each texel. Hence the reason for this restriction.

Hello MJP,

many, many thanks for your answer.

I have still another question in the same direction but i will open a new thread because of other people maybe searching for special topics

This topic is closed to new replies.

Advertisement