summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/compute/interface-shader-param-in-struct.slang25
-rw-r--r--tests/compute/interface-shader-param4.slang8
2 files changed, 30 insertions, 3 deletions
diff --git a/tests/compute/interface-shader-param-in-struct.slang b/tests/compute/interface-shader-param-in-struct.slang
index a4dad6ccb..04854906a 100644
--- a/tests/compute/interface-shader-param-in-struct.slang
+++ b/tests/compute/interface-shader-param-in-struct.slang
@@ -44,20 +44,39 @@ int test(
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out
RWStructuredBuffer<int> gOutputBuffer;
+// Note: even though `C` doesn't include any
+// uniform/ordinary dat as declared, it gets a
+// constant buffer allocated for it because
+// there is no way to rule out the possibility
+// that it *will* contain uniform/ordinary data
+// after specialization.
+//
+//TEST_INPUT:cbuffer(data=[0]):
cbuffer C
{
IRandomNumberGenerationStrategy gStrategy;
}
-//TEST_INPUT: globalExistentialType MyStrategy
-//TEST_INPUT:ubuffer(data=[1 2 4 8], stride=4):
-
struct Stuff
{
IModifier modifier;
int extra;
}
+// Note: the data for global-scope existential parameters
+// is being introduced *before* the entry point declaration,
+// because the default policy used by `slangc` (which the
+// render test also uses) is to specialize the parameters at
+// the global scope (producing a new layout) and then compose
+// that specialized global scope with the entry point.
+//
+// (The net result is that data related to global-scope
+// specialization always precedes the data for entry point
+// parameters in these tests today)
+//
+//TEST_INPUT: globalExistentialType MyStrategy
+//TEST_INPUT:ubuffer(data=[1 2 4 8], stride=4):
+
[numthreads(4, 1, 1)]
void computeMain(
//TEST_INPUT:cbuffer(data=[256]):
diff --git a/tests/compute/interface-shader-param4.slang b/tests/compute/interface-shader-param4.slang
index 317128613..625fc751c 100644
--- a/tests/compute/interface-shader-param4.slang
+++ b/tests/compute/interface-shader-param4.slang
@@ -46,6 +46,14 @@ int test(
//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out
RWStructuredBuffer<int> gOutputBuffer;
+// Note: a constant buffer register/binding is always claimed
+// for `gStrategy` during initial compilation (before specialization)
+// because the layout logic has no way of knowing if the type
+// that gets plugged in will involve uniform/ordinary data
+// or not.
+//
+//TEST_INPUT:cbuffer(data=[0]):
+//
ConstantBuffer<IRandomNumberGenerationStrategy> gStrategy;
// The concrete types we plug in for `gStrategy` and `modifier`