diff options
| author | Tim Foley <tfoleyNV@users.noreply.github.com> | 2021-04-01 16:15:09 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-04-01 16:15:09 -0700 |
| commit | 0ec8e5b016e56ad491a418ab72a5be28dd83f3b4 (patch) | |
| tree | e7934e78346cd63a4d944e68dc90fcafebc40d42 /tests/compute/interface-shader-param.slang | |
| parent | 9475b11045089c9bc9773b16f7eb84f843db70c4 (diff) | |
Refactor D3D12 renderer root signature creation (#1779)
This change originated as an attempt to re-enable a test case, but it has ended up disabling more tests (for good reasons) than it re-enables.
The main change here is a significant overhaul of the way that the D3D12 render path extracts information from the Slang reflection API to produce a root signature.
There were also some supporting fixes in the reflection information to make sure it returns what the D3D12 back-end needed.
The big picture here is that the D3D12 path now uses the descriptor ranges stored in the reflection data more or less directly.
It still needs to use register/space offset information queried via the "old" reflection API, but it only does so at the top level now, for the program and entry points themselves.
All other layout information is derived directly from what Slang provides.
Smaller changes:
* The "flat" reflection API was expanded to include `getBindingRangeDescriptorRangeCount()` which was clearly missing.
* The "flat" reflection results for a constant buffer or parameter block that didn't contain any uniform data and was mapped to a plain constant buffer needed to be fixed up. That logic is still way to subtle to be trusted.
* Several additional tests were disabled that relied on static specialization, global/entry-point generi type parameters, structured buffers of interfaces or other features we don't officially support with shader objects right now. All of the affected tests were somehow passing by sheer luck and because they often passed in specialization arguments via explicit `TEST_INPUT` lines.
* The `inteface-shader-param` test is re-enabled now that we can properly describe its input with the new `set` mode on `TEST_INPUT`
* `ShaderCursor::getElement()` can now be used on structure types (in addition to arrays) to support by-index access to fields
* The `TEST_INPUT` system was expanded to support both by-name and by-index setting of structure fields for aggregates
* The `TEST_INPUT` system was expanded to allow an `out` prefix to mark parts of an expression as outputs on a `set` lines
* The `TEST_INPUT` system was expanded so that anything that would be allowed on a `TEST_INPUT` line by itself (like `ubuffer(...)`) can now be used as a sub-expression on a `set` line
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'tests/compute/interface-shader-param.slang')
| -rw-r--r-- | tests/compute/interface-shader-param.slang | 33 |
1 files changed, 7 insertions, 26 deletions
diff --git a/tests/compute/interface-shader-param.slang b/tests/compute/interface-shader-param.slang index e57ff1bc6..e7c6ceb6a 100644 --- a/tests/compute/interface-shader-param.slang +++ b/tests/compute/interface-shader-param.slang @@ -3,11 +3,11 @@ // Test using interface tops as top-level shader parameters // (whether global, or on an entry point). -//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -//DISABLED_TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_0 -use-dxil -//DISABLED_TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute -//DISABLE_TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute +//TEST(compute):COMPARE_COMPUTE_EX:-slang -compute -dx12 -profile sm_6_0 -use-dxil +//TEST(compute, vulkan):COMPARE_COMPUTE_EX:-vk -compute +//TEST(compute):COMPARE_COMPUTE_EX:-cpu -compute // First we will define some fake interfaces for testing. // Let's pretend we are doing some kind of random number @@ -70,43 +70,27 @@ int test( return modifiedVal; } -// The global-scope parameters for this example include -// some `uniform` parameters, and that will trigger -// the allocation of a global-scope constant buffer to -// hold them. Slang's layout rules mean that the buffer -// will be allocated before any other global-scope parameters. -// -// In this example, the buffer will not be needed after specialization, -// but we need to declare/allocate it here so that the application -// creates a descriptor table/set that matches what the shader -// signature expects. -// -//TEST_INPUT:cbuffer(data=[0], stride=4):name=gStrategy - - - // Now we'll define a shader entry point that will use // these interfaces to define its behavior. // // We'll start with the buffer for writing the test output. -//TEST_INPUT:ubuffer(data=[0 0 0 0], stride=4):out,name=gOutputBuffer +//TEST_INPUT:set gOutputBuffer = out ubuffer(data=[0 0 0 0], stride=4) RWStructuredBuffer<int> gOutputBuffer; // Now we'll define a global shader parameter for the // random number generation strategy. // -//__disabled__TEST_INPUT:object(type=MyStrategy):name=gStrategy +//TEST_INPUT:set gStrategy = new MyStrategy{} uniform IRandomNumberGenerationStrategy gStrategy; // The other parameter (for the modifier) will be attached // the entry point instead, so that we are testing both // cases. // -//__disabled__TEST_INPUT:object(type=MyModifier):name=modifier [numthreads(4, 1, 1)] void computeMain( -//TEST_INPUT:root_constants(data=[0], stride=4): +//TEST_INPUT:set modifier = new MyModifier{} uniform IModifier modifier, uint3 dispatchThreadID : SV_DispatchThreadID) { @@ -150,6 +134,3 @@ struct MyModifier : IModifier return val * 16; } } - -//TEST_INPUT: globalExistentialType MyStrategy -//TEST_INPUT: entryPointExistentialType MyModifier |
