diff options
| author | cheneym2 <acheney@nvidia.com> | 2025-01-29 14:59:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-29 11:59:42 -0800 |
| commit | 2ba6458eba8bd2d4f4d2ffdd452ae089e5b50907 (patch) | |
| tree | df185018f91073eff6066b2e1569557c6d2df1a0 /tests | |
| parent | 605204374658fc6d7f647f9a57e9e322b8c83100 (diff) | |
Fix combined sampler documentation and warning (#6207)
* Fix combined sampler documentation and warning
* Update comment, show detailed '-fvk-t-shift' message in warning instead of generic '-fvk-xxx-shift'
* format code
---------
Co-authored-by: slangbot <186143334+slangbot@users.noreply.github.com>
Diffstat (limited to 'tests')
6 files changed, 52 insertions, 4 deletions
diff --git a/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl b/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl new file mode 100644 index 000000000..1506c638d --- /dev/null +++ b/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl @@ -0,0 +1,32 @@ +//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 +//DIAGNOSTIC_TEST:SIMPLE:-target glsl -profile ps_4_0 -entry main -no-codegen + +// This tests that combined texture sampler objects which have D3D style register assignments, but no vk::binding, +// show an appropriate warning. +// The warning should appear even if the user used -fvk-xxx-shift options, because those options do not serve to map +// two register assignments of different types into a single vulkan binding. + +struct Data +{ + float a; + int b; +}; + +// Neither vk::binding, nor register, no warning +Sampler2D cs0; + +// Only vk::binding, no warning +[[vk::binding(0,0)]] +Sampler2D cs1; + +// Both vk::binding and register, no warning +[[vk::binding(1,0)]] +Sampler2D cs2 : register(s0): register(t0); + +// Only register, should warn without recommending vk-xxx-shift, since that would not help map 2 d3d registers to one vk binding. +Sampler2D cs3 : register(s1): register(t1); + +float4 main() : SV_TARGET +{ + return float4(1, 1, 1, 0); +} diff --git a/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl.1.expected b/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl.1.expected new file mode 100644 index 000000000..87198b248 --- /dev/null +++ b/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl.1.expected @@ -0,0 +1,8 @@ +result code = 0 +standard error = { +tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl(25): warning 39013: shader parameter 'cs3' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan +Sampler2D cs3 : register(s1): register(t1); + ^~~~~~~~ +} +standard output = { +} diff --git a/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl.expected b/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl.expected new file mode 100644 index 000000000..87198b248 --- /dev/null +++ b/tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl.expected @@ -0,0 +1,8 @@ +result code = 0 +standard error = { +tests/diagnostics/hlsl-to-vulkan-sampler-diagnostic.hlsl(25): warning 39013: shader parameter 'cs3' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan +Sampler2D cs3 : register(s1): register(t1); + ^~~~~~~~ +} +standard output = { +} diff --git a/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl b/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl index 4c98b4e93..9734fda56 100644 --- a/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl +++ b/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl @@ -18,4 +18,4 @@ RWStructuredBuffer<int> u2 : register(u3, space2); float4 main() : SV_TARGET { return float4(1, 1, 1, 0); -}
\ No newline at end of file +} diff --git a/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected b/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected index 907572f9e..1f1e1a5a6 100644 --- a/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected +++ b/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected @@ -1,9 +1,9 @@ result code = -1 standard error = { -tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl(11): warning 39013: shader parameter 'c' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan +tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl(11): warning 39029: shader parameter 'c' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan, nor is `-fvk-b-shift` used. ConstantBuffer<Data> c : register(b2); ^~~~~~~~ -tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl(15): warning 39013: shader parameter 'u' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan +tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl(15): warning 39029: shader parameter 'u' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan, nor is `-fvk-u-shift` used. RWStructuredBuffer<Data> u : register(u11); ^~~~~~~~ tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl(15): error 39025: conflicting vulkan inferred binding for parameter 'c' overlap is 0 and 0 diff --git a/tests/diagnostics/vk-bindings.slang.expected b/tests/diagnostics/vk-bindings.slang.expected index 6997a7809..901705566 100644 --- a/tests/diagnostics/vk-bindings.slang.expected +++ b/tests/diagnostics/vk-bindings.slang.expected @@ -1,6 +1,6 @@ result code = -1 standard error = { -tests/diagnostics/vk-bindings.slang(6): warning 39013: shader parameter 't' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan +tests/diagnostics/vk-bindings.slang(6): warning 39029: shader parameter 't' has a 'register' specified for D3D, but no '[[vk::binding(...)]]` specified for Vulkan, nor is `-fvk-t-shift` used. Texture2D t : register(t0); ^~~~~~~~ tests/diagnostics/vk-bindings.slang(14): error 39015: shader parameter 'b' consumes whole descriptor sets, so the binding must be in the form '[[vk::binding(0, ...)]]'; the non-zero binding '2' is not allowed |
