Hello,
in my engine i have a unique function that creates all kinds of buffers or textures and returns a userdefined resource object.
When allocating the needed memory i create by default ALLWAYS a SRV and a UAV and store the adresses in a global descriptor table defined as not shader accesible so lets call it the BackHeap.
In the application code i copy the needed descriptors from the backheap to the shader accesible frontheap in the needed order. Mostly this copy process is optimized and done only once for the lifetime of the resource.
When e.g.
- reading a texture or a buffer in the shader register(t2) i reference the SRV entry in the frontheap table
- writing a texture or a buffer (u5) i reference the UAV entry in the frontheap table.
Now lets only discuss => compute shaders
For some reason i did a test and it makes NO DIFFERENCE ( all cases work fine )
- copy the SRV entry from backheap to SRV entry in the frontheap ( this is the rule we should follow, right ? )
- copy the SRV entry from backheap to the UAV entry in the frontheap
to me this should be wrong, but i can write to the texture in the shader code
- copy the UAV entry from backheap to the SRV entry in the frontheap
this also works fine
Why do i need to create a UAV in Directx12 when i can use a SRV also to write to the resource ?
Is here a difference between compute shaders and raster shaders ?