From bde858b31ac99b84ffba546d1022b34bb4621d49 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Thu, 12 Sep 2019 10:15:53 -0400 Subject: ParameterBlock support. (#1049) * Updated docs to reflect ParameterBlock support * Fixed CPU binding to handle ParameterBlocks * Updated parameter-block.slang to be able to work as a CPU test --- tools/render-test/cpu-memory-binding.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) (limited to 'tools') diff --git a/tools/render-test/cpu-memory-binding.cpp b/tools/render-test/cpu-memory-binding.cpp index 612c2fc57..c2d853aa8 100644 --- a/tools/render-test/cpu-memory-binding.cpp +++ b/tools/render-test/cpu-memory-binding.cpp @@ -183,6 +183,7 @@ SlangResult CPUMemoryBinding::_add(slang::VariableLayoutReflection* varLayout, s } break; } + case slang::TypeReflection::Kind::ParameterBlock: case slang::TypeReflection::Kind::ConstantBuffer: { SLANG_ASSERT(typeLayout->getSize() == sizeof(void*)); @@ -269,7 +270,8 @@ CPUMemoryBinding::Location CPUMemoryBinding::Location::toField(const char* name) // Strip constantBuffer wrapping { const auto kind = typeLayout->getKind(); - if (kind == slang::TypeReflection::Kind::ConstantBuffer) + if (kind == slang::TypeReflection::Kind::ConstantBuffer || + kind == slang::TypeReflection::Kind::ParameterBlock) { // Follow the pointer cur = *(uint8_t**)cur; @@ -344,6 +346,7 @@ SlangResult CPUMemoryBinding::setBufferContents(const Location& location, const const auto kind = typeLayout->getKind(); switch (kind) { + case slang::TypeReflection::Kind::ParameterBlock: case slang::TypeReflection::Kind::ConstantBuffer: { typeLayout = typeLayout->getElementTypeLayout(); @@ -373,6 +376,7 @@ SlangResult CPUMemoryBinding::setNewBuffer(const Location& location, const void* const auto kind = typeLayout->getKind(); switch (kind) { + case slang::TypeReflection::Kind::ParameterBlock: case slang::TypeReflection::Kind::ConstantBuffer: { // All should be allocated (!) @@ -441,12 +445,6 @@ SlangResult CPUMemoryBinding::setObject(const Location& location, void* object) default: break; - case slang::TypeReflection::Kind::ParameterBlock: - { - auto elementTypeLayout = typeLayout->getElementTypeLayout(); - SLANG_UNUSED(elementTypeLayout); - break; - } case slang::TypeReflection::Kind::TextureBuffer: { auto elementTypeLayout = typeLayout->getElementTypeLayout(); -- cgit v1.2.3