vkd3d/tests/hlsl/sampler-state.shader_test
Elizabeth Figura 8fcbbfb8b1 tests/shader_runner: Test versions where the compilation result changes.
Adjust the algorithm for deciding for which profiles to test compilation.

We first ensure that if the compilation result changes (most often as the result
of a feature introduced in a specific version), we test the versions immediately
on either side of the change, to validate that vkd3d-shader is emulating the
same version behaviour.

We then ensure that we are testing at least one version from each set of sm1,
sm4, and sm6.
2024-12-17 16:35:09 +01:00

235 lines
3.2 KiB
Plaintext

[require]
options: backcompat
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
sampler2D sam = sampler_state
{
texture = NULL;
mipfilter = LINEAR;
};
float4 main(): sv_target
{
return tex2D(sam, float2(0, 0));
}
[pixel shader fail]
float4 main(): sv_target
{
sampler2D sam = sampler_state // Not allowed inside a function.
{
texture = NULL;
mipfilter = LINEAR;
};
return 0;
}
[pixel shader fail]
sampler sam;
float4 main(): sv_target
{
sampler_state
{
foo = BAR;
bar = FOO;
};
return tex2D(sam, float2(0, 0));
}
[pixel shader fail(sm<6)]
// cannot implicitly convert.
float4 f = sampler_state
{
texture = NULL;
mipfilter = LINEAR;
};
float4 main(): sv_target
{
return 0;
}
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
sampler sam[2] =
{
sampler_state
{
texture = NULL;
mipfilter = LINEAR;
},
sampler_state
{
texture = NULL;
mipfilter = LINEAR;
}
};
float4 main(): sv_target
{
return tex2D(sam[1], float2(0, 0));
}
[pixel shader fail]
sampler sam[2] =
{
sampler_state
{
texture = NULL;
mipfilter = LINEAR;
},
};
float4 main(): sv_target { return 0; }
[pixel shader]
sampler sam
{
FOO = sampler_state {};
};
float4 main(): sv_target { return 0; }
[pixel shader fail]
Texture2D tex;
float4 main(): sv_target
{
return tex.Sample(sampler_state {}, float2(0, 0));
}
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
sampler sam = sampler_state
{
texture = NULL;
mipfilter = LINEAR;
};
float4 main(): sv_target
{
sampler sam2 = sam; // pass around.
return tex2D(sam2, float2(0, 0));
}
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
sampler sam = sampler_state
{
foo = BAR;
bar = FOO;
mipfilter = PLACEHOLDER;
};
float4 main(): sv_target
{
return tex2D(sam, float2(0, 0));
}
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
// default value initializers make it more permissive but if types don't match
// then the whole initializer is discarded.
float4 f = {
sampler_state
{
foo = BAR;
bar = FOO;
},
1, 2, 3
};
float4 main(): sv_target
{
return 0;
}
[pixel shader fail]
sampler sam {} = sampler_state {};
float4 main() : sv_target { return 0; }
% This fails because of invalid types.
[pixel shader fail]
sampler sam = 1 + sampler_state {};
float4 main() : sv_target { return 0; }
[pixel shader fail]
sampler sam;
sampler_state {} = sam;
float4 main() : sv_target
{
return 0;
}
[pixel shader fail]
sampler_state {};
float4 main() : sv_target
{
return 0;
}
[require]
shader model < 6.0
options: backcompat
[pixel shader fail]
// Cannot implicitly convert.
// Causes segfault in DXC
Texture2D tex = sampler_state
{
foo = BAR;
bar = FOO;
};
sampler sam;
float4 main(): sv_target
{
return tex2D(sam, float2(0, 0));
}
[require]
shader model >= 5.0
options: backcompat
[pixel shader fail(sm>=5.1) todo(sm>=5.1)]
// Default values and sample_state work.
// Requires sm5.
struct
{
float4 f;
sampler sam;
float2 g;
} apple = {
1, 2, 3, 4,
sampler_state
{
texture = NULL;
mipfilter = LINEAR;
},
1, 1,
};
Texture2D tex;
float4 main(): sv_target
{
return tex.Sample(apple.sam, apple.g);
}