summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/interface-shader-param-in-struct.slang19
-rw-r--r--tests/compute/interface-shader-param3.slang34
-rw-r--r--tests/compute/interface-shader-param4.slang28
-rw-r--r--tests/reflection/parameter-block-explicit-space.slang.expected4
4 files changed, 30 insertions, 55 deletions
diff --git a/tests/compute/interface-shader-param-in-struct.slang b/tests/compute/interface-shader-param-in-struct.slang
index 2ffc70c36..b033bd31c 100644
--- a/tests/compute/interface-shader-param-in-struct.slang
+++ b/tests/compute/interface-shader-param-in-struct.slang
@@ -49,6 +49,9 @@ cbuffer C
IRandomNumberGenerationStrategy gStrategy;
}
+//TEST_INPUT: globalExistentialType MyStrategy
+//TEST_INPUT:ubuffer(data=[1 2 4 8], stride=4):dxbinding(1),glbinding(1)
+
struct Stuff
{
IModifier modifier;
@@ -107,21 +110,5 @@ struct MyModifier : IModifier
}
}
-//TEST_INPUT: globalExistentialType MyStrategy
//TEST_INPUT: entryPointExistentialType MyModifier
-
-// The concrete types we plug in for `gStrategy` and `modifier`
-// have buffer resources in them, so we need to assign them
-// data. The registers/bindings for these parameters will
-// always come after all other shader parameters, and their
-// relative order will match the relative order of their
-// declarations in the global order that Slang uses for
-// assigning bindings (all globals before all entry point parameters).
-//
-// Here's the data for `gStrategy`:
-//
-//TEST_INPUT:ubuffer(data=[1 2 4 8], stride=4):dxbinding(1),glbinding(1)
-//
-// Here's the data for `stuff.modifier`:
-//
//TEST_INPUT:ubuffer(data=[16 32 64 128], stride=4):dxbinding(2),glbinding(3)
diff --git a/tests/compute/interface-shader-param3.slang b/tests/compute/interface-shader-param3.slang
index 3c8b24be1..f4f45689c 100644
--- a/tests/compute/interface-shader-param3.slang
+++ b/tests/compute/interface-shader-param3.slang
@@ -45,17 +45,19 @@ int test(
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):dxbinding(0),glbinding(0),out
RWStructuredBuffer<int> gOutputBuffer;
-// Note: while we declare `gStrategy` here, there is no matching
-// line providing input data at this point. That is partly to
-// work around an apparent bug in the test runner, but it is also
-// to reflect the fact that this declaration does not cause a
-// constant buffer binding to be allocated, because just from
-// the declaration of `gStrategy` we cannot tell whether a
-// constant buffer binding is even needed (there might be no
-// uniform/ordinary data).
-//
ConstantBuffer<IRandomNumberGenerationStrategy> gStrategy;
+// Note: The current strategy we use for laying out shader
+// parameters in the presence of existential/interface types
+// is to always put global-scope parameters before any
+// entry-point parameters. As a result we need to provide
+// the buffer for the specialized version of `gStrategy`
+// here, and we will go ahead and provide the concrete
+// type argument at the same time.
+//
+//TEST_INPUT: globalExistentialType MyStrategy
+//TEST_INPUT:cbuffer(data=[1 0 0 0], stride=4):dxbinding(0),glbinding(1)
+
[numthreads(4, 1, 1)]
void computeMain(
@@ -81,7 +83,7 @@ void computeMain(
//
// Here's the incantation to make the test runner fill in the constant buffer:
//
-//TEST_INPUT:cbuffer(data=[256 0 0 0 16 0 0 0], stride=4):dxbinding(0),glbinding(1)
+//TEST_INPUT:cbuffer(data=[256 0 0 0 16 0 0 0], stride=4):dxbinding(1),glbinding(2)
//
// So, the value `256` will be used for `extra` and the value `16`
// will be written to the first four bytes of the concrete value
@@ -134,16 +136,4 @@ struct MyModifier : IModifier
}
}
-//TEST_INPUT: globalExistentialType MyStrategy
//TEST_INPUT: entryPointExistentialType MyModifier
-
-// Once the concrete types are plugged in, the compiler can
-// see that `gStrategy` needs a constant buffer register/binding.
-// It will alocate the location for `gStrategy` after all other
-// shader parameters, to ensure that different specializations
-// of the same shader will agree on the locations for all the
-// non-interface-type parameters.
-//
-//TEST_INPUT:cbuffer(data=[1 0 0 0], stride=4):dxbinding(1),glbinding(2)
-
-
diff --git a/tests/compute/interface-shader-param4.slang b/tests/compute/interface-shader-param4.slang
index 07c6951e0..51b6686ef 100644
--- a/tests/compute/interface-shader-param4.slang
+++ b/tests/compute/interface-shader-param4.slang
@@ -48,6 +48,18 @@ RWStructuredBuffer<int> gOutputBuffer;
ConstantBuffer<IRandomNumberGenerationStrategy> gStrategy;
+// The concrete types we plug in for `gStrategy` and `modifier`
+// have buffer resources in them, so we need to assign them
+// data. The registers/bindings for these parameters will
+// always come after all other shader parameters in the same
+// scope (global or entry-point).
+//
+// Here's the data for `gStrategy`:
+//
+//TEST_INPUT: globalExistentialType MyStrategy
+//TEST_INPUT:ubuffer(data=[1 2 4 8], stride=4):dxbinding(1),glbinding(1)
+
+
[numthreads(4, 1, 1)]
void computeMain(
@@ -112,21 +124,7 @@ struct MyModifier : IModifier
}
}
-//TEST_INPUT: globalExistentialType MyStrategy
-//TEST_INPUT: entryPointExistentialType MyModifier
-
-// The concrete types we plug in for `gStrategy` and `modifier`
-// have buffer resources in them, so we need to assign them
-// data. The registers/bindings for these parameters will
-// always come after all other shader parameters, and their
-// relative order will match the relative order of their
-// declarations in the global order that Slang uses for
-// assigning bindings (all globals before all entry point parameters).
-//
-// Here's the data for `gStrategy`:
-//
-//TEST_INPUT:ubuffer(data=[1 2 4 8], stride=4):dxbinding(1),glbinding(1)
-//
// Here's the data for `modifier`:
//
+//TEST_INPUT: entryPointExistentialType MyModifier
//TEST_INPUT:ubuffer(data=[16 32 64 128], stride=4):dxbinding(2),glbinding(3)
diff --git a/tests/reflection/parameter-block-explicit-space.slang.expected b/tests/reflection/parameter-block-explicit-space.slang.expected
index 04093f4ca..f7944c644 100644
--- a/tests/reflection/parameter-block-explicit-space.slang.expected
+++ b/tests/reflection/parameter-block-explicit-space.slang.expected
@@ -7,7 +7,7 @@ standard output = {
{
"name": "a",
"bindings": [
- {"kind": "constantBuffer", "space": 2, "index": 0, "count": 0},
+ {"kind": "constantBuffer", "index": 0, "count": 0},
{"kind": "registerSpace", "index": 2}
],
"type": {
@@ -58,7 +58,7 @@ standard output = {
{
"name": "b",
"bindings": [
- {"kind": "constantBuffer", "space": 3, "index": 0, "count": 0},
+ {"kind": "constantBuffer", "index": 0, "count": 0},
{"kind": "registerSpace", "index": 3}
],
"type": {