From 9c17d0be79834a8ebe2888aed8905bae355cb674 Mon Sep 17 00:00:00 2001 From: jsmall-nvidia Date: Fri, 11 Oct 2019 14:14:08 -0400 Subject: Support for unbounded array of arrays (#1078) * WIP: Unsized arrays on CPU. * unbounded-array-of-array working on CPU. * Remove some left over comments. --- tools/render-test/cpu-compute-util.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'tools/render-test/cpu-compute-util.cpp') diff --git a/tools/render-test/cpu-compute-util.cpp b/tools/render-test/cpu-compute-util.cpp index 688e6b254..ef5755275 100644 --- a/tools/render-test/cpu-compute-util.cpp +++ b/tools/render-test/cpu-compute-util.cpp @@ -191,9 +191,24 @@ static CPUComputeUtil::Resource* _newOneTexture2D(int elemCount) const auto kind = typeLayout->getKind(); switch (kind) { - case slang::TypeReflection::Kind::Vector: - case slang::TypeReflection::Kind::Matrix: case slang::TypeReflection::Kind::Array: + { + auto elementCount = int(typeLayout->getElementCount()); + if (elementCount == 0) + { + if (srcEntry.type == ShaderInputType::Array) + { + // We need to set the size + CPUMemoryBinding::Buffer buffer; + SLANG_RETURN_ON_FAIL(binding.setArrayCount(location, srcEntry.arrayDesc.size, buffer)); + } + break; + } + SLANG_RETURN_ON_FAIL(binding.setInplace(location, srcEntry.bufferData.getBuffer(), srcEntry.bufferData.getCount() * sizeof(unsigned int))); + break; + } + case slang::TypeReflection::Kind::Vector: + case slang::TypeReflection::Kind::Matrix: case slang::TypeReflection::Kind::Scalar: case slang::TypeReflection::Kind::Struct: { -- cgit v1.2.3