I have the Compute Shader:
#pragma kernel CSRed
#pragma kernel CSGreen
#pragma kernel CSBlue
RWTexture2D _Texture;
//#define SIZE 32
[numthreads(SIZE,SIZE,1)]
void CSRed (uint2 id : SV_DispatchThreadID)
{
float w, h;
_Texture.GetDimensions(w, h);
_Texture[id] = float4(id.x/w, 0, 0, 1);
#endif
}
[numthreads(SIZE,SIZE,1)]
void CSGreen (uint2 id : SV_DispatchThreadID)
{
float w, h;
_Texture.GetDimensions(w, h);
_Texture[id] = float4(0, id.x/w, 0, 1);
}
[numthreads(SIZE,SIZE,1)]
void CSBlue (uint2 id : SV_DispatchThreadID)
{
float w, h;
_Texture.GetDimensions(w, h);
_Texture[id] = float4(0, 0, id.x/w, 1);
}
And I want to pass **#define SIZE 32** from C# code.
How can I do it?
↧