yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

cheneym2Fix combined sampler documentation and warning (#6207)2ba6458eb

master
1.1 KiB32 linesraw
1//DIAGNOSTIC_TEST:SIMPLE:-target glsl -profile ps_4_0 -entry main -fvk-t-shift 5 all -fvk-t-shift 7 2  -fvk-s-shift -3 0 -fvk-u-shift 1 2 -no-codegen
2//DIAGNOSTIC_TEST:SIMPLE:-target glsl -profile ps_4_0 -entry main -no-codegen
3
4// This tests that combined texture sampler objects which have D3D style register assignments, but no vk::binding,
5// show an appropriate warning.
6// The warning should appear even if the user used -fvk-xxx-shift options, because those options do not serve to map
7// two register assignments of different types into a single vulkan binding.
8
9struct Data
10{
11    float a;
12    int b;
13};
14
15// Neither vk::binding, nor register, no warning
16Sampler2D 		cs0;
17
18// Only vk::binding, no warning
19[[vk::binding(0,0)]]
20Sampler2D 		cs1;
21
22// Both vk::binding and register, no warning
23[[vk::binding(1,0)]]
24Sampler2D 		cs2 : register(s0): register(t0);
25
26// Only register, should warn without recommending vk-xxx-shift, since that would not help map 2 d3d registers to one vk binding.
27Sampler2D 		cs3 : register(s1): register(t1);
28
29float4 main() : SV_TARGET
30{
31	return float4(1, 1, 1, 0);
32}