Skip to content

Commit

Permalink
Fix crash when setting upload sliders to 0 (#485)
Browse files Browse the repository at this point in the history
  • Loading branch information
jdarpinian authored Jan 4, 2025
1 parent 0980f2f commit 09e2b6a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions sample/workloadSimulator/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -551,7 +551,8 @@ <h2><center>Web graphics workload simulator</center></h2>
// 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);
}
}

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

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.
Expand Down

0 comments on commit 09e2b6a

Please sign in to comment.