- Home /
Question by
Deni35 · Jun 27, 2016 at 04:26 PM ·
bugcompute shaderrender texture
Problem with ComputeShader and RHalf RenderTexture
There is a simply compute shader:
#pragma kernel CSMain
RWTexture2D<float> _Texture;
[numthreads(32, 32, 1)]
void CSMain (uint2 id : SV_DispatchThreadID)
{
_Texture[id] += 0.1;
}
Code which creates a RHalf RW texture:
texture = new RenderTexture( 32, 32, 0, RenderTextureFormat.RHalf, RenderTextureReadWrite.Linear );
texture.enableRandomWrite = true;
texture.filterMode = FilterMode.Point;
texture.Create();
And shader using:
shader.SetTexture( 0, "_Texture", texture );
shader.Dispatch( 0, texture.width/32, texture.height/32, 1 );
But I'm getting a strange behavior.
Why is it?
RFloat works good.
Also just setting constant value works good.
But reading and writing RHalf doesn't work.
Comment