mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
tests: Test sampler_state keyword syntax.
This commit is contained in:
parent
994e994231
commit
125bf74ef3
Notes:
Henri Verbeet
2024-10-02 22:37:40 +02:00
Approved-by: Elizabeth Figura (@zfigura) Approved-by: Henri Verbeet (@hverbeet) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/1112
@ -207,6 +207,7 @@ vkd3d_shader_tests = \
|
||||
tests/hlsl/sample-grad.shader_test \
|
||||
tests/hlsl/sample-level.shader_test \
|
||||
tests/hlsl/sampler-offset.shader_test \
|
||||
tests/hlsl/sampler-state.shader_test \
|
||||
tests/hlsl/sampler.shader_test \
|
||||
tests/hlsl/saturate.shader_test \
|
||||
tests/hlsl/shade-mode.shader_test \
|
||||
|
234
tests/hlsl/sampler-state.shader_test
Normal file
234
tests/hlsl/sampler-state.shader_test
Normal file
@ -0,0 +1,234 @@
|
||||
[require]
|
||||
options: backcompat
|
||||
|
||||
|
||||
[pixel shader todo fail(sm>=6)]
|
||||
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 todo fail(sm>=6)]
|
||||
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 todo]
|
||||
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 todo fail(sm>=6)]
|
||||
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 todo fail(sm>=6)]
|
||||
sampler sam = sampler_state
|
||||
{
|
||||
foo = BAR;
|
||||
bar = FOO;
|
||||
mipfilter = PLACEHOLDER;
|
||||
};
|
||||
|
||||
float4 main(): sv_target
|
||||
{
|
||||
return tex2D(sam, float2(0, 0));
|
||||
}
|
||||
|
||||
|
||||
[pixel shader todo fail(sm>=6)]
|
||||
// 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 todo fail(sm>=6)]
|
||||
// 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);
|
||||
}
|
Loading…
Reference in New Issue
Block a user