summaryrefslogtreecommitdiffstats
path: root/tools/render-test/render-test-main.cpp
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2024-05-01 16:44:22 -0700
committerGitHub <noreply@github.com>2024-05-01 16:44:22 -0700
commit0bb826f8b92aec330875d0b966c1f4a6b99988bf (patch)
treef0d086d4bfb93e302fcb8232816842ccfc182480 /tools/render-test/render-test-main.cpp
parent4533c825fe628e08228037b846ee9d10004fd56f (diff)
SPIRV: Fix performance issue when handling large arrays. (#4064)
* SPIRV: Fix performance issue when handling large arrays. * Add test for packing. * Fix clang.
Diffstat (limited to 'tools/render-test/render-test-main.cpp')
-rw-r--r--tools/render-test/render-test-main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/tools/render-test/render-test-main.cpp b/tools/render-test/render-test-main.cpp
index 02c0ea86a..fcdd4b54d 100644
--- a/tools/render-test/render-test-main.cpp
+++ b/tools/render-test/render-test-main.cpp
@@ -207,7 +207,10 @@ struct AssignValsFromLayoutContext
{
const InputBufferDesc& srcBuffer = srcVal->bufferDesc;
auto& bufferData = srcVal->bufferData;
- const size_t bufferSize = bufferData.getCount() * sizeof(uint32_t);
+ const size_t bufferSize = Math::Max((size_t)bufferData.getCount() * sizeof(uint32_t), (size_t)(srcBuffer.elementCount * srcBuffer.stride));
+ bufferData.reserve(bufferSize / sizeof(uint32_t));
+ for (size_t i = bufferData.getCount(); i < bufferSize / sizeof(uint32_t); i++)
+ bufferData.add(0);
ComPtr<IBufferResource> bufferResource;
SLANG_RETURN_ON_FAIL(ShaderRendererUtil::createBufferResource(srcBuffer, /*entry.isOutput,*/ bufferSize, bufferData.getBuffer(), device, bufferResource));
@@ -232,6 +235,7 @@ struct AssignValsFromLayoutContext
const InputBufferDesc& counterBufferDesc{
InputBufferType::StorageBuffer,
sizeof(uint32_t),
+ 1,
Format::Unknown,
};
SLANG_RETURN_ON_FAIL(ShaderRendererUtil::createBufferResource(