summaryrefslogtreecommitdiffstats
path: root/tests/reflection
diff options
context:
space:
mode:
Diffstat (limited to 'tests/reflection')
-rw-r--r--tests/reflection/matrix-layout.slang28
-rw-r--r--tests/reflection/matrix-layout.slang.1.expected121
-rw-r--r--tests/reflection/matrix-layout.slang.expected121
3 files changed, 270 insertions, 0 deletions
diff --git a/tests/reflection/matrix-layout.slang b/tests/reflection/matrix-layout.slang
new file mode 100644
index 000000000..a0c1cdff1
--- /dev/null
+++ b/tests/reflection/matrix-layout.slang
@@ -0,0 +1,28 @@
+//TEST:REFLECTION:-profile ps_4_0 -target hlsl
+//TEST:REFLECTION:-profile ps_4_0 -target hlsl -matrix-layout-row-major
+
+// Test that we apply matrix layout rules correctly.
+
+cbuffer A
+{
+ float3x4 aa;
+ row_major float3x4 ab;
+ column_major float3x4 ac;
+}
+
+struct SB
+{
+ float3x4 ba;
+ row_major float3x4 bb;
+ column_major float3x4 bc;
+};
+
+cbuffer B
+{
+ SB b;
+}
+
+float4 main() : SV_Target
+{
+ return 0.0;
+} \ No newline at end of file
diff --git a/tests/reflection/matrix-layout.slang.1.expected b/tests/reflection/matrix-layout.slang.1.expected
new file mode 100644
index 000000000..eb06adede
--- /dev/null
+++ b/tests/reflection/matrix-layout.slang.1.expected
@@ -0,0 +1,121 @@
+result code = 0
+standard error = {
+}
+standard output = {
+{
+ "parameters": [
+ {
+ "name": "A",
+ "binding": {"kind": "constantBuffer", "index": 0},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "aa",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 48}
+ },
+ {
+ "name": "ab",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 48, "size": 48}
+ },
+ {
+ "name": "ac",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 96, "size": 64}
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "B",
+ "binding": {"kind": "constantBuffer", "index": 1},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "b",
+ "type": {
+ "kind": "struct",
+ "name": "SB",
+ "fields": [
+ {
+ "name": "ba",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 48}
+ },
+ {
+ "name": "bb",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 48, "size": 48}
+ },
+ {
+ "name": "bc",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 96, "size": 64}
+ }
+ ]
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 160}
+ }
+ ]
+ }
+ }
+ }
+ ]
+}
+}
diff --git a/tests/reflection/matrix-layout.slang.expected b/tests/reflection/matrix-layout.slang.expected
new file mode 100644
index 000000000..afd2001fb
--- /dev/null
+++ b/tests/reflection/matrix-layout.slang.expected
@@ -0,0 +1,121 @@
+result code = 0
+standard error = {
+}
+standard output = {
+{
+ "parameters": [
+ {
+ "name": "A",
+ "binding": {"kind": "constantBuffer", "index": 0},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "aa",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 64}
+ },
+ {
+ "name": "ab",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 64, "size": 48}
+ },
+ {
+ "name": "ac",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 112, "size": 64}
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "B",
+ "binding": {"kind": "constantBuffer", "index": 1},
+ "type": {
+ "kind": "constantBuffer",
+ "elementType": {
+ "kind": "struct",
+ "fields": [
+ {
+ "name": "b",
+ "type": {
+ "kind": "struct",
+ "name": "SB",
+ "fields": [
+ {
+ "name": "ba",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 64}
+ },
+ {
+ "name": "bb",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 64, "size": 48}
+ },
+ {
+ "name": "bc",
+ "type": {
+ "kind": "matrix",
+ "rowCount": 3,
+ "columnCount": 4,
+ "elementType": {
+ "kind": "scalar",
+ "scalarType": "float32"
+ }
+ },
+ "binding": {"kind": "uniform", "offset": 112, "size": 64}
+ }
+ ]
+ },
+ "binding": {"kind": "uniform", "offset": 0, "size": 176}
+ }
+ ]
+ }
+ }
+ }
+ ]
+}
+}