I compute PerlinNoise into RenderTexture via ComputeShader and then I need to apply a filter(also CompueShader) on this RenderTexture.
But if I read from my texture and write to the same, shader is reading only zero values.
I use this way:
public void Dispatch(RenderTexture texture) {
var tmpSource = RenderTexture.GetTemporary( texture.width, texture.height, 0, texture.format );
Graphics.Blit( texture, tmpSource );
shader.SetTexture( 0, “_Texture”, tmpSource );
shader.SetTexture( 0, “_Result”, texture );
shader.Dispatch(0, texture.width/32, texture.height/32, 1);
RenderTexture.ReleaseTemporary( tmpSource );
}
But if I call this method in EventType.MouseDrag and EventType.ScrollWheel events (two times for frame), I get problem that FilterShader is also getting empty RenderTexture. I think it is due to the combination Graphics.Blit and Dispatch. Maybe Dispatch is invoked before Graphics.Blit was completed.
How I can do it correctly?