From 09e2b6a3c70a16c4416453d057c407929bc5c2fe Mon Sep 17 00:00:00 2001 From: James Darpinian Date: Fri, 3 Jan 2025 22:37:03 -0800 Subject: [PATCH] Fix crash when setting upload sliders to 0 (#485) --- sample/workloadSimulator/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sample/workloadSimulator/index.html b/sample/workloadSimulator/index.html index 7b185b8f..b82c22bd 100644 --- a/sample/workloadSimulator/index.html +++ b/sample/workloadSimulator/index.html @@ -551,7 +551,8 @@

Web graphics workload simulator

// We want to actually use this data in rendering so the graphics driver // can't optimize away the upload. Fill the first few bytes with our real // vertex data. - bufferDataArray.set(vertices, 0); + if (bufferDataArray.length > 0) + bufferDataArray.set(vertices, 0); } } @@ -563,7 +564,8 @@

Web graphics workload simulator

if (mapAsyncArray.length * 4 != mapAsync.value * 1024 * 1024) { mapAsyncArray = new Float32Array(mapAsync.value * 1024 * 1024 / 4); - mapAsyncArray.set(vertices, 0); + if (mapAsyncArray.length > 0) + mapAsyncArray.set(vertices, 0); } // Calculate how many instances and draw calls we need based on slider values.