diff options
| author | jsmall-nvidia <jsmall@nvidia.com> | 2019-09-03 14:36:55 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2019-09-03 14:36:55 -0400 |
| commit | b5b3a8d36c09631cbd4cf236c0280a314436748d (patch) | |
| tree | 2ae5a848815c9bcdd4006eaa2f81a8317f5df2a9 /tools/render-test/shader-input-layout.cpp | |
| parent | ce5fd43b0c9c60ad85e7c5a54161b37897640ea6 (diff) | |
CPU uniform entry point params (#1041)
* * Made entry point parameters a separate entry point
* Made CPUMemoryBinding work with entry point parameters/initialize constant buffers
* Added isCPUOnly to bindings, because entry point parameters do not layout like constant buffer
* entry-point-uniform.slang works on CPU
* EntryPointParams -> UniformEntryPointParams
Updated CPU documentation.
* Update cpu-target.md to removed completed issues.
* Only allocate CPU buffers if the size is > 0.
Small update to cpu-target doc.
Diffstat (limited to 'tools/render-test/shader-input-layout.cpp')
| -rw-r--r-- | tools/render-test/shader-input-layout.cpp | 41 |
1 files changed, 40 insertions, 1 deletions
diff --git a/tools/render-test/shader-input-layout.cpp b/tools/render-test/shader-input-layout.cpp index a59f30a24..810e31c2c 100644 --- a/tools/render-test/shader-input-layout.cpp +++ b/tools/render-test/shader-input-layout.cpp @@ -22,6 +22,40 @@ namespace renderer_test return -1; } + static bool _isCPUTarget(SlangCompileTarget target) + { + switch (target) + { + case SLANG_C_SOURCE: + case SLANG_CPP_SOURCE: + case SLANG_EXECUTABLE: + case SLANG_SHARED_LIBRARY: + case SLANG_HOST_CALLABLE: + { + return true; + } + default: return false; + } + } + + void ShaderInputLayout::updateForTarget(SlangCompileTarget target) + { + if (!_isCPUTarget(target)) + { + int count = int(entries.getCount()); + for (int i = 0; i < count; ++i) + { + auto& entry = entries[i]; + if (entry.isCPUOnly) + { + entries.removeAt(i); + i--; + count--; + } + } + } + } + void ShaderInputLayout::parse(const char * source) { entries.clear(); @@ -257,7 +291,12 @@ namespace renderer_test parser.Read(":"); while (!parser.IsEnd()) { - if (parser.LookAhead("dxbinding")) + if (parser.LookAhead("isCPUOnly")) + { + entry.isCPUOnly = true; + parser.ReadToken(); + } + else if (parser.LookAhead("dxbinding")) { parser.ReadToken(); parser.Read("("); |
