From a5987aad211d2e0b9391bdda4b67873ec9873074 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Wed, 19 Jul 2023 18:35:37 -0400 Subject: Support for vk-shift-* without explicit bindings (#3000) * Improvements to HLSLToVulkanLayoutOptions. * WIP vk-shift-* with HLSL like binding. Detecting clashes. * Shift example seems to be working correctly. One oddness is that "used" data is now reflected, as we only enable for D3D shader resource types. Now we use those with inferred VK mode they appear. * Implicit seems to work. * Disable inference with Sampler/CombinedTextureSampler. I guess? we could just use the HLSL texture register binding to infer. * Report overlapping ranges in diagnostic. The hlsl-to-vulkan-shift-diagnostic result might be surprising but it is correct, because u is automatically laid out so consumes DescriptorSlot 0, but that's already consumed by c. * First attempt at array layout with infer on Vulkan. * Fix the vulkan shift output. * Array example. --- tests/bindings/hlsl-to-vulkan-array.hlsl.expected | 94 +++++++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 tests/bindings/hlsl-to-vulkan-array.hlsl.expected (limited to 'tests/bindings/hlsl-to-vulkan-array.hlsl.expected') diff --git a/tests/bindings/hlsl-to-vulkan-array.hlsl.expected b/tests/bindings/hlsl-to-vulkan-array.hlsl.expected new file mode 100644 index 000000000..ab3e659ec --- /dev/null +++ b/tests/bindings/hlsl-to-vulkan-array.hlsl.expected @@ -0,0 +1,94 @@ +result code = 0 +standard error = { +} +standard output = { +{ + "parameters": [ + { + "name": "g_data", + "bindings": [ + {"kind": "uniform", "offset": 0, "size": 32}, + {"kind": "shaderResource", "index": 10}, + {"kind": "unorderedAccess", "index": 100} + ], + "type": { + "kind": "array", + "elementCount": 2, + "elementType": { + "kind": "struct", + "name": "Data", + "fields": [ + { + "name": "tex", + "type": { + "kind": "resource", + "baseShape": "texture2D" + }, + "binding": {"kind": "shaderResource", "index": 0} + }, + { + "name": "structuredBuffer", + "type": { + "kind": "resource", + "baseShape": "structuredBuffer", + "access": "readWrite", + "resultType": { + "kind": "scalar", + "scalarType": "float32" + } + }, + "binding": {"kind": "unorderedAccess", "index": 0} + }, + { + "name": "a", + "type": { + "kind": "scalar", + "scalarType": "float32" + }, + "binding": {"kind": "uniform", "offset": 0, "size": 4} + }, + { + "name": "b", + "type": { + "kind": "scalar", + "scalarType": "int32" + }, + "binding": {"kind": "uniform", "offset": 4, "size": 4} + } + ] + }, + "uniformStride": 16 + } + } + ], + "entryPoints": [ + { + "name": "main", + "stage:": "fragment", + "result:": { + "stage": "fragment", + "binding": {"kind": "varyingOutput", "index": 0}, + "semanticName": "SV_TARGET", + "type": { + "kind": "vector", + "elementCount": 4, + "elementType": { + "kind": "scalar", + "scalarType": "float32" + } + } + }, + "bindings": [ + { + "name": "g_data", + "bindings": [ + {"kind": "uniform", "offset": 0, "size": 32}, + {"kind": "shaderResource", "index": 10, "used": 0}, + {"kind": "unorderedAccess", "index": 100, "used": 0} + ] + } + ] + } + ] +} +} -- cgit v1.2.3