I am new to reshade, but not new to programming as a whole. I tried to implement a compute shader using modern re shade, who’s information was then passed to a pixel shader that passed that data to the screen. However, I got the error
X4532 cannot map expression to cs_5_0 instruction set
.
Here’s some code that will reproduce the error
texture2D renderTarget { Width = BUFFER_WIDTH; Height = BUFFER_HEIGHT; Format = RGBA8; };
storage2D storageTarget{ Texture = renderTarget; };
sampler2D sampleTarget { Texture = renderTarget; MinFilter = POINT; MagFilter = POINT; };
void compute(uint3 id : SV_DispatchThreadID)
{
tex2Dstore(storageTarget, id.xy, tex2D(ReShade::BackBuffer, (float) id.xy * BUFFER_PIXEL_SIZE));
}
float3 finalPass(float4 vpos : SV_Position, float2 texcoord : TexCoord) : SV_Target
{
return tex2D(sampleTarget, texcoord).rgb;
}
technique test
{
pass
{
ComputeShader = compute<8, 8>;
DispatchSizeX = BUFFER_SCREEN_SIZE.x / 8.0f;
DispatchSizeY = BUFFER_SCREEN_SIZE.y / 8.0f;
}
pass
{
VertexShader = PostProcessVS;
PixelShader = finalPass;
}
}
This error shows up in vertex shaders commonly, because of mip map levels, but there is almost no information about this error showing up in pixel shaders online. I have no idea what I am doing wrong here, and because of the way REShade is compiled it makes it very difficult to verify if a change I have made has actually fixed the problem, or masked it behind another problem noticed by the compiler first. (Note: ReShade uses a language very similar to HLSL but they are not exactly the same, so if you are an HLSL veteran and something looks like a syntax error, this is why.)