[ComputeShader]Fails to compile...

#pragma kernel CSMain

RWTexture2D<float4> Result;
Texture2D<float4> Gradient; SamplerState samplerGradient;
Texture2D<float4> Noise; SamplerState samplerNoise;
float Intensity;
float2 GradientOffset;
float2 NoiseOffset;

[numthreads(8,8,1)]
void CSMain (uint3 dtid : SV_DispatchThreadID)
{
    Result[dtid.xy] = tex2D(samplerGradient, dtid.xy + GradientOffset.xy) + tex2D(samplerNoise, dtid.xy + NoiseOffset.xy)*Intensity;
}

Very unhelpfully I get this message…

cannot map expression to cs_5_0 instruction set

Now I have no idea?!?

This is a shader-themed question, which is under the graphics forum

sorry…

No problem, but you should check the forum description next time, just to make sure. This post might be moved by a moderator though

:slight_smile:

1 Like

Like that, exactly, thank you @hippocoder for giving an example