Hello, I am trying to compile something and its not playing fair…
If I put X=0, X=1, or X=2 it works fine…
but if I try X=A, X=B, or X=C I get this error…
cannot map expression to cs_5_0 instruction set
I am able to show the source if required…
Right now however I’m trying to understand why I can assign a constant to a variable, but not a variable to a variable…
As requested…
#pragma kernel CSMain
float2 Off0,Off1,Off2,Off3;
sampler2D Noise;
RWTexture2D<float4> Result;
[numthreads(8,8,1)]
void CSMain (uint3 id : SV_DispatchThreadID)
{
float2 o0=id.xy;
float2 o1=id.xy;
float2 o2=id.xy;
float2 o3=id.xy;
o0+=Off0;
o1+=Off1;
o2+=Off2;
o3+=Off3;
float4 c0=tex2D(Noise,o0);
float4 c1=tex2D(Noise,o1);
float4 c2=tex2D(Noise,o2);
float4 c3=tex2D(Noise,o3);
float r=c0.r;
r*=c1.r;
r*=c2.r;
r*=c3.r;
float g=c0.g;
g*=c1.g;
g*=c2.g;
g*=c3.g;
float b=c0.b;
b*=c1.b;
b*=c2.b;
b*=c3.b;
float a=c0.a;
a*=c1.a;
a*=c2.a;
a*=c3.a;
float4 rslt = float4 ( r + g + b + a , 0 , 0 , 0 );
Result [ id.xy ] = rslt ;
}
The problem is with the last line - by making it a constant float4(0,0,0,0) the code works fine…
… such as …
Result [ id.xy ] = float4 ( 0,0,0,0 );