summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-09-12 10:15:53 -0400
committerGitHub <noreply@github.com>2019-09-12 10:15:53 -0400
commitbde858b31ac99b84ffba546d1022b34bb4621d49 (patch)
treeeac101eedb86189f6dc8fbdcba8c70f92daccf0e /tools
parent047daae9300c8a94d28383cf992ce00e3ad2da1e (diff)
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
Diffstat (limited to 'tools')
-rw-r--r--tools/render-test/cpu-memory-binding.cpp12
1 files changed, 5 insertions, 7 deletions
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();