Skip to content

Commit

Permalink
[HTML5-Worker] Fix size-calculations for VertexBuffers
Browse files Browse the repository at this point in the history
  • Loading branch information
RobDangerous committed Jun 11, 2022
1 parent 534698c commit 7faeb94
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Backends/HTML5-Worker/kha/graphics4/VertexBuffer.hx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ class VertexBuffer {
public function lock(?start: Int, ?count: Int): Float32Array {
lockStart = start != null ? start : 0;
lockCount = count != null ? count : mySize;
return _data.subarray(lockStart * stride(), (lockStart + lockCount) * stride());
return _data.subarray(Std.int(lockStart * stride() / 4), Std.int((lockStart + lockCount) * stride() / 4));
}

public function unlock(?count: Int): Void {
Expand All @@ -80,7 +80,7 @@ class VertexBuffer {
Worker.postMessage({
command: 'updateVertexBuffer',
id: _id,
data: _data.subarray(lockStart * stride(), (lockStart + lockCount) * stride()).buffer,
data: _data.subarray(Std.int(lockStart * stride() / 4), Std.int((lockStart + lockCount) * stride() / 4)).buffer,
start: lockStart,
count: lockCount
});
Expand Down

0 comments on commit 7faeb94

Please sign in to comment.