Skip to content

Commit 9de1f3e

Browse files
authored
Move WebGPU Closure Externs to their own file, and update the externs list to the latest WebGPU spec as of 2nd of November 2022. (#18135)
1 parent 2fa65b1 commit 9de1f3e

File tree

3 files changed

+45
-40
lines changed

3 files changed

+45
-40
lines changed

src/closure-externs/closure-externs.js

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -261,46 +261,6 @@ var currentFrame;
261261
var currentTime;
262262
var sampleRate;
263263

264-
/*
265-
* WebGPU globals
266-
*/
267-
var GPUBufferUsage;
268-
var GPUColorWrite;
269-
var GPUMapMode;
270-
var GPUShaderStage;
271-
var GPUTextureUsage;
272-
var GPU;
273-
var GPUAdapter;
274-
var GPUBindGroup;
275-
var GPUBindGroupLayout;
276-
var GPUBuffer;
277-
var GPUCanvasContext;
278-
var GPUCommandBuffer;
279-
var GPUCommandEncoder;
280-
var GPUCompilationInfo;
281-
var GPUCompilationMessage;
282-
var GPUComputePassEncoder;
283-
var GPUComputePipeline;
284-
var GPUDevice;
285-
var GPUDeviceLostInfo;
286-
var GPUExternalTexture;
287-
var GPUOutOfMemoryError;
288-
var GPUPipelineLayout;
289-
var GPUQuerySet;
290-
var GPUQueue;
291-
var GPURenderBundle;
292-
var GPURenderBundleEncoder;
293-
var GPURenderPassEncoder;
294-
var GPURenderPipeline;
295-
var GPUSampler;
296-
var GPUShaderModule;
297-
var GPUSupportedFeatures;
298-
var GPUSupportedLimits;
299-
var GPUTexture;
300-
var GPUTextureView;
301-
var GPUUncapturedErrorEvent;
302-
var GPUValidationError;
303-
304264
/*
305265
* Avoid closure minifying anything to "id". See #13965
306266
*/
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* WebGPU globals
3+
*/
4+
var GPU;
5+
var GPUAdapter;
6+
var GPUAdapterInfo;
7+
var GPUBindGroup;
8+
var GPUBindGroupLayout;
9+
var GPUBuffer;
10+
var GPUBufferUsage;
11+
var GPUCanvasContext;
12+
var GPUColorWrite;
13+
var GPUCommandBuffer;
14+
var GPUCommandEncoder;
15+
var GPUCompilationInfo;
16+
var GPUCompilationMessage;
17+
var GPUComputePassEncoder;
18+
var GPUComputePipeline;
19+
var GPUDevice;
20+
var GPUDeviceLostInfo;
21+
var GPUError;
22+
var GPUExternalTexture;
23+
var GPUInternalError;
24+
var GPUMapMode;
25+
var GPUOutOfMemoryError;
26+
var GPUPipelineLayout;
27+
var GPUQuerySet;
28+
var GPUQueue;
29+
var GPURenderBundle;
30+
var GPURenderBundleEncoder;
31+
var GPURenderPassEncoder;
32+
var GPURenderPipeline;
33+
var GPUSampler;
34+
var GPUShaderModule;
35+
var GPUShaderStage;
36+
var GPUSupportedFeatures;
37+
var GPUSupportedLimits;
38+
var GPUTexture;
39+
var GPUTextureUsage;
40+
var GPUTextureView;
41+
var GPUUncapturedErrorEvent;
42+
var GPUValidationError;

tools/building.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ def closure_compiler(filename, pretty, advanced=True, extra_closure_args=None):
557557
# should not minify these symbol names.
558558
CLOSURE_EXTERNS = [path_from_root('src/closure-externs/closure-externs.js')]
559559

560+
if settings.USE_WEBGPU:
561+
CLOSURE_EXTERNS += [path_from_root('src/closure-externs/webgpu-externs.js')]
562+
560563
# Closure compiler needs to know about all exports that come from the wasm module, because to optimize for small code size,
561564
# the exported symbols are added to global scope via a foreach loop in a way that evades Closure's static analysis. With an explicit
562565
# externs file for the exports, Closure is able to reason about the exports.

0 commit comments

Comments
 (0)