From b5b3a8d36c09631cbd4cf236c0280a314436748d Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Tue, 3 Sep 2019 14:36:55 -0400 Subject: 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. --- tools/render-test/shader-input-layout.cpp | 41 ++++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'tools/render-test/shader-input-layout.cpp') 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("("); -- cgit v1.2.3