Hello,
I am trying to use a compute shader with RWTexture2D in order to modify an existing texture. It appears any time I read to and write from a RWTexture2D, it fails on NVidia hardware (but works fine on AMD). The RenderTextures are created with enableRandomWrite and it appears my setup is correct as I can either read OR write to the RWTexture2D, I just cannot do both at the same time (which is really what I need to do). Here is a super simple example of a shader that fails on NVidia:
#pragma kernel MainExample
RWTexture2D<float4> _rwTexture;
[numthreads(42, 24, 1)]
void MainExample(uint3 id : SV_DispatchThreadID, uint groupIndex : SV_GroupIndex)
{
// Brighten up the texture, it should now be pure white...
_rwTexture[id.xy] += float4(0.5, 0.5, 0.5, 0.0);
}
Again, this works fine on AMD. The DX11 docs say that any DX11-level card (SM5) should be able to do this (read and write from the same texture) and the cards I’m testing are DX11/SM5 (NVidia GTX 975M and 1050 Ti). Any clues to what is going wrong?