Skip to content

Commit f8f7f92

Browse files
xdestiny110Jerry.Zhuang
andauthored
rename string-number map to avoid override (#21032)
Co-authored-by: Jerry.Zhuang <[email protected]>
1 parent 7e808f1 commit f8f7f92

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/library_webgpu.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -330,21 +330,21 @@ var LibraryWebGPU = {
330330
},
331331

332332
// Map from enum string back to enum number, for callbacks.
333-
BufferMapState: {
333+
Int_BufferMapState: {
334334
'unmapped': 0,
335335
'pending': 1,
336336
'mapped': 2,
337337
},
338-
CompilationMessageType : {
338+
Int_CompilationMessageType : {
339339
'error': 0,
340340
'warning': 1,
341341
'info': 2,
342342
},
343-
DeviceLostReason: {
343+
Int_DeviceLostReason: {
344344
'undefined': 0,
345345
'destroyed': 1,
346346
},
347-
PreferredFormat: {
347+
Int_PreferredFormat: {
348348
'rgba8unorm': 0x12,
349349
'bgra8unorm': 0x17,
350350
},
@@ -1814,7 +1814,7 @@ var LibraryWebGPU = {
18141814
messageStringPtrs.push(messagePtr);
18151815
stringToUTF8(compilationMessage.message, messagePtr, messageSize);
18161816
{{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.message, 'messagePtr', '*') }}};
1817-
{{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.type, 'WebGPU.CompilationMessageType[compilationMessage.type]', 'i32') }}};
1817+
{{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.type, 'WebGPU.Int_CompilationMessageType[compilationMessage.type]', 'i32') }}};
18181818
{{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.lineNum, 'compilationMessage.lineNum', 'i64') }}};
18191819
{{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.linePos, 'compilationMessage.linePos', 'i64') }}};
18201820
{{{ makeSetValue('compilationMessagePtr', C_STRUCTS.WGPUCompilationMessage.offset, 'compilationMessage.offset', 'i64') }}};
@@ -1911,7 +1911,7 @@ var LibraryWebGPU = {
19111911

19121912
wgpuBufferGetMapState: (bufferId) => {
19131913
var buffer = WebGPU.mgrBuffer.get(bufferId);
1914-
return WebGPU.BufferMapState[buffer.mapState];
1914+
return WebGPU.Int_BufferMapState[buffer.mapState];
19151915
},
19161916

19171917
// In webgpu.h offset and size are passed in as size_t.
@@ -2579,7 +2579,7 @@ var LibraryWebGPU = {
25792579
if (deviceLostCallbackPtr) {
25802580
device["lost"].then((info) => {
25812581
callUserCallback(() => WebGPU.errorCallback(deviceLostCallbackPtr,
2582-
WebGPU.DeviceLostReason[info.reason], info.message, deviceLostUserdataPtr));
2582+
WebGPU.Int_DeviceLostReason[info.reason], info.message, deviceLostUserdataPtr));
25832583
});
25842584
}
25852585
{{{ makeDynCall('vippp', 'callback') }}}({{{ gpu.RequestDeviceStatus.Success }}}, deviceId, 0, userdata);
@@ -2606,7 +2606,7 @@ var LibraryWebGPU = {
26062606

26072607
wgpuSurfaceGetPreferredFormat: (surfaceId, adapterId) => {
26082608
var format = navigator["gpu"]["getPreferredCanvasFormat"]();
2609-
return WebGPU.PreferredFormat[format];
2609+
return WebGPU.Int_PreferredFormat[format];
26102610
},
26112611

26122612
// WGPUSwapChain

0 commit comments

Comments
 (0)