Skip to content

Commit 09e2b6a

Browse files
authored
Fix crash when setting upload sliders to 0 (#485)
1 parent 0980f2f commit 09e2b6a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

sample/workloadSimulator/index.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,8 @@ <h2><center>Web graphics workload simulator</center></h2>
551551
// We want to actually use this data in rendering so the graphics driver
552552
// can't optimize away the upload. Fill the first few bytes with our real
553553
// vertex data.
554-
bufferDataArray.set(vertices, 0);
554+
if (bufferDataArray.length > 0)
555+
bufferDataArray.set(vertices, 0);
555556
}
556557
}
557558

@@ -563,7 +564,8 @@ <h2><center>Web graphics workload simulator</center></h2>
563564

564565
if (mapAsyncArray.length * 4 != mapAsync.value * 1024 * 1024) {
565566
mapAsyncArray = new Float32Array(mapAsync.value * 1024 * 1024 / 4);
566-
mapAsyncArray.set(vertices, 0);
567+
if (mapAsyncArray.length > 0)
568+
mapAsyncArray.set(vertices, 0);
567569
}
568570

569571
// Calculate how many instances and draw calls we need based on slider values.

0 commit comments

Comments
 (0)