summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/bindings/hlsl-to-vulkan-array.hlsl16
-rw-r--r--tests/bindings/hlsl-to-vulkan-array.hlsl.expected94
-rw-r--r--tests/bindings/hlsl-to-vulkan-combined.hlsl.expected8
-rw-r--r--tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl20
-rw-r--r--tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected178
-rw-r--r--tests/bindings/hlsl-to-vulkan-shift.hlsl2
-rw-r--r--tests/bindings/hlsl-to-vulkan-shift.hlsl.expected26
-rw-r--r--tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected11
8 files changed, 333 insertions, 22 deletions
diff --git a/tests/bindings/hlsl-to-vulkan-array.hlsl b/tests/bindings/hlsl-to-vulkan-array.hlsl
new file mode 100644
index 000000000..072f99914
--- /dev/null
+++ b/tests/bindings/hlsl-to-vulkan-array.hlsl
@@ -0,0 +1,16 @@
+//TEST:REFLECTION:-target glsl -profile ps_4_0 -entry main -fvk-t-shift 10 all -fvk-s-shift 100 all -fvk-u-shift 100 all -fvk-b-shift 1000 all
+
+struct Data
+{
+ Texture2D tex;
+ RWStructuredBuffer<float> structuredBuffer;
+ float a;
+ int b;
+};
+
+Data g_data[2];
+
+float4 main() : SV_TARGET
+{
+ return float4(1, 1, 1, 0);
+} \ No newline at end of file
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}
+ ]
+ }
+ ]
+ }
+ ]
+}
+}
diff --git a/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected b/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected
index 127d0fe4c..de67a3592 100644
--- a/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected
+++ b/tests/bindings/hlsl-to-vulkan-combined.hlsl.expected
@@ -6,7 +6,7 @@ standard output = {
"parameters": [
{
"name": "t0",
- "binding": {"kind": "descriptorTableSlot", "index": 7},
+ "binding": {"kind": "descriptorTableSlot", "index": 0},
"type": {
"kind": "resource",
"baseShape": "texture2D"
@@ -14,7 +14,7 @@ standard output = {
},
{
"name": "t1",
- "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 14},
+ "binding": {"kind": "descriptorTableSlot", "index": 1},
"type": {
"kind": "resource",
"baseShape": "texture2D"
@@ -41,11 +41,11 @@ standard output = {
"bindings": [
{
"name": "t0",
- "binding": {"kind": "descriptorTableSlot", "index": 7}
+ "binding": {"kind": "descriptorTableSlot", "index": 0}
},
{
"name": "t1",
- "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 14}
+ "binding": {"kind": "descriptorTableSlot", "index": 1}
}
]
}
diff --git a/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl b/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl
new file mode 100644
index 000000000..c7c25f6f1
--- /dev/null
+++ b/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl
@@ -0,0 +1,20 @@
+//TEST:REFLECTION:-target glsl -profile ps_4_0 -entry main -fvk-t-shift 10 all -fvk-s-shift 100 all -fvk-b-shift 0 all -fvk-u-shift 1000 all
+
+struct Data
+{
+ float a;
+ int b;
+};
+
+Texture2D t;
+SamplerState s;
+ConstantBuffer<Data> c;
+Texture2D t2;
+
+RWStructuredBuffer<Data> u;
+RWStructuredBuffer<int> u2;
+
+float4 main() : SV_TARGET
+{
+ return float4(1, 1, 1, 0);
+} \ No newline at end of file
diff --git a/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected b/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected
new file mode 100644
index 000000000..2d918deed
--- /dev/null
+++ b/tests/bindings/hlsl-to-vulkan-shift-implicit.hlsl.expected
@@ -0,0 +1,178 @@
+result code = 0
+standard error = {
+}
+standard output = {
+{
+ "parameters": [
+ {
+ "name": "t",
+ "binding": {"kind": "shaderResource", "index": 10},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ },
+ {
+ "name": "s",
+ "binding": {"kind": "samplerState", "index": 100},
+ "type": {
+ "kind": "samplerState"
+ }
+ },
+ {
+ "name": "c",
+ "binding": {"kind": "constantBuffer", "index": 0},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "name": "Data",
+ "fields": [
+ {
+ "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}
+ }
+ ]
+ },
+ "containerVarLayout": {
+ "binding": {"kind": "constantBuffer", "index": 0}
+ },
+ "elementVarLayout": {
+ "type": {
+ "kind": "struct",
+ "name": "Data",
+ "fields": [
+ {
+ "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}
+ }
+ ]
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 16}
+ }
+ }
+ },
+ {
+ "name": "t2",
+ "binding": {"kind": "shaderResource", "index": 11},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ },
+ {
+ "name": "u",
+ "binding": {"kind": "unorderedAccess", "index": 1000},
+ "type": {
+ "kind": "resource",
+ "baseShape": "structuredBuffer",
+ "access": "readWrite",
+ "resultType": {
+ "kind": "struct",
+ "name": "Data",
+ "fields": [
+ {
+ "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}
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "u2",
+ "binding": {"kind": "unorderedAccess", "index": 1001},
+ "type": {
+ "kind": "resource",
+ "baseShape": "structuredBuffer",
+ "access": "readWrite",
+ "resultType": {
+ "kind": "scalar",
+ "scalarType": "int32"
+ }
+ }
+ }
+ ],
+ "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": "t",
+ "binding": {"kind": "shaderResource", "index": 10, "used": 0}
+ },
+ {
+ "name": "s",
+ "binding": {"kind": "samplerState", "index": 100, "used": 0}
+ },
+ {
+ "name": "c",
+ "binding": {"kind": "constantBuffer", "index": 0, "used": 0}
+ },
+ {
+ "name": "t2",
+ "binding": {"kind": "shaderResource", "index": 11, "used": 0}
+ },
+ {
+ "name": "u",
+ "binding": {"kind": "unorderedAccess", "index": 1000, "used": 0}
+ },
+ {
+ "name": "u2",
+ "binding": {"kind": "unorderedAccess", "index": 1001, "used": 0}
+ }
+ ]
+ }
+ ]
+}
+}
diff --git a/tests/bindings/hlsl-to-vulkan-shift.hlsl b/tests/bindings/hlsl-to-vulkan-shift.hlsl
index 13f76297d..3083dd4d7 100644
--- a/tests/bindings/hlsl-to-vulkan-shift.hlsl
+++ b/tests/bindings/hlsl-to-vulkan-shift.hlsl
@@ -17,5 +17,5 @@ RWStructuredBuffer<int> u2 : register(u3, space2);
float4 main() : SV_TARGET
{
- return float4(1, 1, 1, 0);
+ return float4(1, 1, 1, 0) * c.a;
} \ No newline at end of file
diff --git a/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected b/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected
index 939f847ca..b79c76c43 100644
--- a/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected
+++ b/tests/bindings/hlsl-to-vulkan-shift.hlsl.expected
@@ -6,7 +6,7 @@ standard output = {
"parameters": [
{
"name": "t",
- "binding": {"kind": "descriptorTableSlot", "index": 5},
+ "binding": {"kind": "shaderResource", "index": 5},
"type": {
"kind": "resource",
"baseShape": "texture2D"
@@ -14,14 +14,14 @@ standard output = {
},
{
"name": "s",
- "binding": {"kind": "descriptorTableSlot", "index": 1},
+ "binding": {"kind": "samplerState", "index": 1},
"type": {
"kind": "samplerState"
}
},
{
"name": "c",
- "binding": {"kind": "descriptorTableSlot", "index": 3},
+ "binding": {"kind": "constantBuffer", "index": 3},
"type": {
"kind": "constantBuffer",
"elementType": {
@@ -47,7 +47,7 @@ standard output = {
]
},
"containerVarLayout": {
- "binding": {"kind": "descriptorTableSlot", "index": 0}
+ "binding": {"kind": "constantBuffer", "index": 0}
},
"elementVarLayout": {
"type": {
@@ -78,7 +78,7 @@ standard output = {
},
{
"name": "t2",
- "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 7},
+ "binding": {"kind": "shaderResource", "space": 2, "index": 7},
"type": {
"kind": "resource",
"baseShape": "texture2D"
@@ -86,7 +86,7 @@ standard output = {
},
{
"name": "u",
- "binding": {"kind": "descriptorTableSlot", "index": 11},
+ "binding": {"kind": "unorderedAccess", "index": 11},
"type": {
"kind": "resource",
"baseShape": "structuredBuffer",
@@ -117,7 +117,7 @@ standard output = {
},
{
"name": "u2",
- "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 4},
+ "binding": {"kind": "unorderedAccess", "space": 2, "index": 4},
"type": {
"kind": "resource",
"baseShape": "structuredBuffer",
@@ -149,27 +149,27 @@ standard output = {
"bindings": [
{
"name": "t",
- "binding": {"kind": "descriptorTableSlot", "index": 5}
+ "binding": {"kind": "shaderResource", "index": 5, "used": 0}
},
{
"name": "s",
- "binding": {"kind": "descriptorTableSlot", "index": 1}
+ "binding": {"kind": "samplerState", "index": 1, "used": 0}
},
{
"name": "c",
- "binding": {"kind": "descriptorTableSlot", "index": 3}
+ "binding": {"kind": "constantBuffer", "index": 3, "used": 1}
},
{
"name": "t2",
- "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 7}
+ "binding": {"kind": "shaderResource", "space": 2, "index": 7, "used": 0}
},
{
"name": "u",
- "binding": {"kind": "descriptorTableSlot", "index": 11}
+ "binding": {"kind": "unorderedAccess", "index": 11, "used": 0}
},
{
"name": "u2",
- "binding": {"kind": "descriptorTableSlot", "space": 2, "index": 4}
+ "binding": {"kind": "unorderedAccess", "space": 2, "index": 4, "used": 0}
}
]
}
diff --git a/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected b/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected
index a7e4e27bb..907572f9e 100644
--- a/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected
+++ b/tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl.expected
@@ -1,9 +1,12 @@
-result code = 0
+result code = -1
standard error = {
-tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl(11): warning 39016: unable to infer Vulkan binding for 'c', automatic layout will be used
+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
ConstantBuffer<Data> c : register(b2);
- ^
-tests/diagnostics/hlsl-to-vulkan-shift-diagnostic.hlsl(15): warning 39016: unable to infer Vulkan binding for 'u', automatic layout will be used
+ ^~~~~~~~
+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
+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
RWStructuredBuffer<Data> u : register(u11);
^
}