summaryrefslogtreecommitdiffstats
path: root/tools/render-test/render-test-main.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2021-04-01 16:15:09 -0700
committerGitHub <noreply@github.com>2021-04-01 16:15:09 -0700
commit0ec8e5b016e56ad491a418ab72a5be28dd83f3b4 (patch)
treee7934e78346cd63a4d944e68dc90fcafebc40d42 /tools/render-test/render-test-main.cpp
parent9475b11045089c9bc9773b16f7eb84f843db70c4 (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 'tools/render-test/render-test-main.cpp')
-rw-r--r--tools/render-test/render-test-main.cpp28
1 files changed, 17 insertions, 11 deletions
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 27311d67a..db51339f1 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -274,19 +274,25 @@ struct AssignValsFromLayoutContext
if(field.name.getLength() == 0)
{
- StdWriters::getError().print("error: entries in `ShaderInputLayout` must include a name\n");
- return SLANG_E_INVALID_ARG;
+ // If no name was given, assume by-indexing matching is requested
+ auto fieldCursor = dstCursor.getElement(fieldIndex);
+ if(!fieldCursor.isValid())
+ {
+ StdWriters::getError().print("error: could not find shader parameter at index %d\n", (int)fieldIndex);
+ return SLANG_E_INVALID_ARG;
+ }
+ SLANG_RETURN_ON_FAIL(assign(fieldCursor, field.val));
}
-
- auto fieldCursor = dstCursor.getPath(field.name.getBuffer());
-
- if(!fieldCursor.isValid())
+ else
{
- StdWriters::getError().print("error: could not find shader parameter matching '%s'\n", field.name.begin());
- return SLANG_E_INVALID_ARG;
+ auto fieldCursor = dstCursor.getPath(field.name.getBuffer());
+ if(!fieldCursor.isValid())
+ {
+ StdWriters::getError().print("error: could not find shader parameter matching '%s'\n", field.name.begin());
+ return SLANG_E_INVALID_ARG;
+ }
+ SLANG_RETURN_ON_FAIL(assign(fieldCursor, field.val));
}
-
- assign(fieldCursor, field.val);
}
return SLANG_OK;
}
@@ -329,7 +335,7 @@ struct AssignValsFromLayoutContext
ComPtr<IShaderObject> shaderObject = device->createShaderObject(slangType);
- assign(ShaderCursor(shaderObject), srcVal->contentVal);
+ SLANG_RETURN_ON_FAIL(assign(ShaderCursor(shaderObject), srcVal->contentVal));
dstCursor.setObject(shaderObject);
return SLANG_OK;