summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2018-11-30 10:42:42 -0800
committerGitHub <noreply@github.com>2018-11-30 10:42:42 -0800
commite40c106d6f8c4218de5a16450f201c0e395f8167 (patch)
tree3f50413628102d9fe7936afca96ab063d7f9be56 /tests
parentb51a582a0ed5943765c220152b1e15cda8c2a555 (diff)
Use register spaces by default for D3D12 targets (#734)
The change here is that the logical that used to be controlled by `-parameter-blocks-use-register-spaces` is now turned on unconditionally, meaning that a `ParameterBlock<X>` will get its own register `space` by default when targetting D3D Shader Model 5.1 and later. I had originally made this feature optional because I wasn't sure whether Shader Model 5.1 should default to using register spaces or not, because D3D 11 doesn't support spaces at the API level and MSDN documetnation made it sound like SM5.1 was available for D3D11 as well. Subsequent reading has led me to understand that MSDN is wrong on this front, and SM5.1 and later are D3D12-only, so it is always safe to use spaces. The new logic is now that we automatically use spaces for parameter blocks any time it is possible (SM5.1+ and any Vulkan target), and otherwise fall back to not using spaces (SM5.0 and earlier). I updated a reflection test case that was covering parameter blocks to confirm the output differs between SM5.0 and 5.1.
Diffstat (limited to 'tests')
-rw-r--r--tests/reflection/parameter-block.slang2
-rw-r--r--tests/reflection/parameter-block.slang.1.expected54
-rw-r--r--tests/reflection/parameter-block.slang.2.expected51
3 files changed, 107 insertions, 0 deletions
diff --git a/tests/reflection/parameter-block.slang b/tests/reflection/parameter-block.slang
index 5fbcbb959..5c91ed339 100644
--- a/tests/reflection/parameter-block.slang
+++ b/tests/reflection/parameter-block.slang
@@ -1,4 +1,6 @@
//TEST:REFLECTION:-stage fragment -target glsl
+//TEST:REFLECTION:-stage fragment -target hlsl -profile sm_5_0
+//TEST:REFLECTION:-stage fragment -target hlsl -profile sm_5_1
// Confirm that we do parameter binding correctly
// when we have both a parameter block *and* user-defined
diff --git a/tests/reflection/parameter-block.slang.1.expected b/tests/reflection/parameter-block.slang.1.expected
new file mode 100644
index 000000000..bbd52a784
--- /dev/null
+++ b/tests/reflection/parameter-block.slang.1.expected
@@ -0,0 +1,54 @@
+result code = 0
+standard error = {
+}
+standard output = {
+{
+ "parameters": [
+ {
+ "name": "a",
+ "bindings": [
+ {"kind": "shaderResource", "index": 0},
+ {"kind": "samplerState", "index": 0}
+ ],
+ "type": {
+ "kind": "parameterBlock",
+ "elementType": {
+ "kind": "struct",
+ "name": "Helper",
+ "fields": [
+ {
+ "name": "t",
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ },
+ "binding": {"kind": "shaderResource", "index": 0}
+ },
+ {
+ "name": "s",
+ "type": {
+ "kind": "samplerState"
+ },
+ "binding": {"kind": "samplerState", "index": 0}
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "b",
+ "binding": {"kind": "shaderResource", "index": 1},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ }
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
+ ]
+}
+}
diff --git a/tests/reflection/parameter-block.slang.2.expected b/tests/reflection/parameter-block.slang.2.expected
new file mode 100644
index 000000000..e692718e8
--- /dev/null
+++ b/tests/reflection/parameter-block.slang.2.expected
@@ -0,0 +1,51 @@
+result code = 0
+standard error = {
+}
+standard output = {
+{
+ "parameters": [
+ {
+ "name": "a",
+ "binding": {"kind": "registerSpace", "index": 1},
+ "type": {
+ "kind": "parameterBlock",
+ "elementType": {
+ "kind": "struct",
+ "name": "Helper",
+ "fields": [
+ {
+ "name": "t",
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ },
+ "binding": {"kind": "shaderResource", "index": 0}
+ },
+ {
+ "name": "s",
+ "type": {
+ "kind": "samplerState"
+ },
+ "binding": {"kind": "samplerState", "index": 0}
+ }
+ ]
+ }
+ }
+ },
+ {
+ "name": "b",
+ "binding": {"kind": "shaderResource", "index": 0},
+ "type": {
+ "kind": "resource",
+ "baseShape": "texture2D"
+ }
+ }
+ ],
+ "entryPoints": [
+ {
+ "name": "main",
+ "stage:": "fragment"
+ }
+ ]
+}
+}