Looks like I am going a bit crazy … looks like the optimizer optimizes required stuff away?
Texture2D<uint2> tex_0p; // <-- missing in "Parameters"
Texture2D<uint2> tex_00;
Texture2D<uint2> tex_0n; // <-- missing in "Parameters"
uint2 ReadMata(Texture2D<uint2> tex, float x, float y)
{
return tex.Load(int3(x, y, 0));
}
uint2 PS_V(float4 screenPos : SV_Position) : SV_Target0
{
uint2 self = ReadMata(tex_00, screenPos.x + 0, screenPos.y + 0);
uint2 undr = ReadMata(tex_0n, screenPos.x + 0, screenPos.y + 0);
uint2 over = ReadMata(tex_0p, screenPos.x + 0, screenPos.y + 0);
float avg = 0;
avg = self.x + undr.x + over.x;
avg /= 3.0;
self.x = avg;
return self;
}
when calling that shader, there is no parameter for tex_0n / tex_0p … only tex_00 is there … why? did the optimizer think it’s unused somehow … does anyone spot why he assumes this?
PS: there are mutiple techniques / PixelShaders in the effect file and tex_0p/0n is only used in one of them (the first defined tho) - could that be the issue?
edit: if I add one of the missing textures to another techniques PS, it’s not ignored anymore … very weird … it’s just like the compiler totally ignores that one function in terms of object usage …
technique Default
{
pass P0
{
VertexShader = compile VS_SHADERMODEL VS();
PixelShader = compile PS_SHADERMODEL PS_V(); // <-- use all 3 textures
}
pass P1
{
VertexShader = compile VS_SHADERMODEL VS();
PixelShader = compile PS_SHADERMODEL PS_H(); // <-- uses only tex_00
}
};