Skip to content

Commit 6f5b680

Browse files
authored
WebGPU: fix missed handling of sentinel values (#19929)
Sentinel values come in as -1, but we were still incorrectly assuming WGPU_WHOLE_MAP_SIZE would come in as 0xFFFFFFFF.
1 parent b840dc7 commit 6f5b680

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/library_webgpu.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ wgpu${type}Release: function(id) { WebGPU.mgr${type}.release(id) },`;
7575
// Must be in sync with webgpu.h.
7676
COPY_STRIDE_UNDEFINED: 0xFFFFFFFF,
7777
LIMIT_U32_UNDEFINED: 0xFFFFFFFF,
78-
WHOLE_MAP_SIZE: 0xFFFFFFFF, // use 32-bit uint max
7978
MIP_LEVEL_COUNT_UNDEFINED: 0xFFFFFFFF,
8079
ARRAY_LAYER_COUNT_UNDEFINED: 0xFFFFFFFF,
8180
AdapterType: {
@@ -1842,7 +1841,7 @@ var LibraryWebGPU = {
18421841

18431842
if (size === 0) warnOnce('getMappedRange size=0 no longer means WGPU_WHOLE_MAP_SIZE');
18441843

1845-
if (size === {{{ gpu.WHOLE_MAP_SIZE }}}) size = undefined;
1844+
{{{ gpu.convertSentinelToUndefined('size') }}}
18461845

18471846
var mapped;
18481847
try {
@@ -1875,7 +1874,7 @@ var LibraryWebGPU = {
18751874

18761875
if (size === 0) warnOnce('getMappedRange size=0 no longer means WGPU_WHOLE_MAP_SIZE');
18771876

1878-
if (size === {{{ gpu.WHOLE_MAP_SIZE }}}) size = undefined;
1877+
{{{ gpu.convertSentinelToUndefined('size') }}}
18791878

18801879
if (bufferWrapper.mapMode !== {{{ gpu.MapMode.Write }}}) {
18811880
#if ASSERTIONS
@@ -1915,7 +1914,7 @@ var LibraryWebGPU = {
19151914
bufferWrapper.onUnmap = [];
19161915
var buffer = bufferWrapper.object;
19171916

1918-
if (size === {{{ gpu.WHOLE_MAP_SIZE }}}) size = undefined;
1917+
{{{ gpu.convertSentinelToUndefined('size') }}}
19191918

19201919
// `callback` takes (WGPUBufferMapAsyncStatus status, void * userdata)
19211920

0 commit comments

Comments
 (0)