Path: blob/main/src/closure-externs/webgpu-externs.js
4133 views
/*1* WebGPU globals2* Generated using https://github.com/kainino0x/webidl-to-closure-externs3* against the spec's WebIDL: https://gpuweb.github.io/gpuweb/webgpu.idl4*/56/** @type {?GPU} */7Navigator.prototype.gpu;89/** @type {?GPU} */10WorkerNavigator.prototype.gpu;1112const GPUBufferUsage = {};13/** @type {number} */14GPUBufferUsage.MAP_READ;15/** @type {number} */16GPUBufferUsage.MAP_WRITE;17/** @type {number} */18GPUBufferUsage.COPY_SRC;19/** @type {number} */20GPUBufferUsage.COPY_DST;21/** @type {number} */22GPUBufferUsage.INDEX;23/** @type {number} */24GPUBufferUsage.VERTEX;25/** @type {number} */26GPUBufferUsage.UNIFORM;27/** @type {number} */28GPUBufferUsage.STORAGE;29/** @type {number} */30GPUBufferUsage.INDIRECT;31/** @type {number} */32GPUBufferUsage.QUERY_RESOLVE;3334const GPUMapMode = {};35/** @type {number} */36GPUMapMode.READ;37/** @type {number} */38GPUMapMode.WRITE;3940const GPUTextureUsage = {};41/** @type {number} */42GPUTextureUsage.COPY_SRC;43/** @type {number} */44GPUTextureUsage.COPY_DST;45/** @type {number} */46GPUTextureUsage.TEXTURE_BINDING;47/** @type {number} */48GPUTextureUsage.STORAGE_BINDING;49/** @type {number} */50GPUTextureUsage.RENDER_ATTACHMENT;5152const GPUShaderStage = {};53/** @type {number} */54GPUShaderStage.VERTEX;55/** @type {number} */56GPUShaderStage.FRAGMENT;57/** @type {number} */58GPUShaderStage.COMPUTE;5960const GPUColorWrite = {};61/** @type {number} */62GPUColorWrite.RED;63/** @type {number} */64GPUColorWrite.GREEN;65/** @type {number} */66GPUColorWrite.BLUE;67/** @type {number} */68GPUColorWrite.ALPHA;69/** @type {number} */70GPUColorWrite.ALL;7172/** @constructor */73function GPUSupportedLimits() {}74/** @type {number} */75GPUSupportedLimits.prototype.maxTextureDimension1D;76/** @type {number} */77GPUSupportedLimits.prototype.maxTextureDimension2D;78/** @type {number} */79GPUSupportedLimits.prototype.maxTextureDimension3D;80/** @type {number} */81GPUSupportedLimits.prototype.maxTextureArrayLayers;82/** @type {number} */83GPUSupportedLimits.prototype.maxBindGroups;84/** @type {number} */85GPUSupportedLimits.prototype.maxBindGroupsPlusVertexBuffers;86/** @type {number} */87GPUSupportedLimits.prototype.maxBindingsPerBindGroup;88/** @type {number} */89GPUSupportedLimits.prototype.maxDynamicUniformBuffersPerPipelineLayout;90/** @type {number} */91GPUSupportedLimits.prototype.maxDynamicStorageBuffersPerPipelineLayout;92/** @type {number} */93GPUSupportedLimits.prototype.maxSampledTexturesPerShaderStage;94/** @type {number} */95GPUSupportedLimits.prototype.maxSamplersPerShaderStage;96/** @type {number} */97GPUSupportedLimits.prototype.maxStorageBuffersPerShaderStage;98/** @type {number} */99GPUSupportedLimits.prototype.maxStorageTexturesPerShaderStage;100/** @type {number} */101GPUSupportedLimits.prototype.maxUniformBuffersPerShaderStage;102/** @type {number} */103GPUSupportedLimits.prototype.maxUniformBufferBindingSize;104/** @type {number} */105GPUSupportedLimits.prototype.maxStorageBufferBindingSize;106/** @type {number} */107GPUSupportedLimits.prototype.minUniformBufferOffsetAlignment;108/** @type {number} */109GPUSupportedLimits.prototype.minStorageBufferOffsetAlignment;110/** @type {number} */111GPUSupportedLimits.prototype.maxVertexBuffers;112/** @type {number} */113GPUSupportedLimits.prototype.maxBufferSize;114/** @type {number} */115GPUSupportedLimits.prototype.maxVertexAttributes;116/** @type {number} */117GPUSupportedLimits.prototype.maxVertexBufferArrayStride;118/** @type {number} */119GPUSupportedLimits.prototype.maxInterStageShaderComponents;120/** @type {number} */121GPUSupportedLimits.prototype.maxInterStageShaderVariables;122/** @type {number} */123GPUSupportedLimits.prototype.maxColorAttachments;124/** @type {number} */125GPUSupportedLimits.prototype.maxColorAttachmentBytesPerSample;126/** @type {number} */127GPUSupportedLimits.prototype.maxComputeWorkgroupStorageSize;128/** @type {number} */129GPUSupportedLimits.prototype.maxComputeInvocationsPerWorkgroup;130/** @type {number} */131GPUSupportedLimits.prototype.maxComputeWorkgroupSizeX;132/** @type {number} */133GPUSupportedLimits.prototype.maxComputeWorkgroupSizeY;134/** @type {number} */135GPUSupportedLimits.prototype.maxComputeWorkgroupSizeZ;136/** @type {number} */137GPUSupportedLimits.prototype.maxComputeWorkgroupsPerDimension;138139/** @constructor */140function GPUSupportedFeatures() {}141/** @type {number} */142GPUSupportedFeatures.prototype.size;143/** @return {!Iterable<string>} */144GPUSupportedFeatures.prototype.entries = function() {};145/** @return {!Iterable<string>} */146GPUSupportedFeatures.prototype.keys = function() {};147/** @return {!Iterable<string>} */148GPUSupportedFeatures.prototype.values = function() {};149/** @return {undefined} */150GPUSupportedFeatures.prototype.forEach = function() {};151/** @return {boolean} */152GPUSupportedFeatures.prototype.has = function() {};153154/** @constructor */155function WGSLLanguageFeatures() {}156/** @type {number} */157WGSLLanguageFeatures.prototype.size;158/** @return {!Iterable<string>} */159WGSLLanguageFeatures.prototype.entries = function() {};160/** @return {!Iterable<string>} */161WGSLLanguageFeatures.prototype.keys = function() {};162/** @return {!Iterable<string>} */163WGSLLanguageFeatures.prototype.values = function() {};164/** @return {undefined} */165WGSLLanguageFeatures.prototype.forEach = function() {};166/** @return {boolean} */167WGSLLanguageFeatures.prototype.has = function() {};168169/** @constructor */170function GPUAdapterInfo() {}171/** @type {string} */172GPUAdapterInfo.prototype.vendor;173/** @type {string} */174GPUAdapterInfo.prototype.architecture;175/** @type {string} */176GPUAdapterInfo.prototype.device;177/** @type {string} */178GPUAdapterInfo.prototype.description;179180/** @constructor */181function GPU() {}182/** @return {!Promise<?GPUAdapter>} */183GPU.prototype.requestAdapter = function() {};184/** @return {string} */185GPU.prototype.getPreferredCanvasFormat = function() {};186/** @type {!WGSLLanguageFeatures} */187GPU.prototype.wgslLanguageFeatures;188189/** @constructor */190function GPUAdapter() {}191/** @type {!GPUSupportedFeatures} */192GPUAdapter.prototype.features;193/** @type {!GPUSupportedLimits} */194GPUAdapter.prototype.limits;195/** @type {boolean} */196GPUAdapter.prototype.isFallbackAdapter;197/** @return {!Promise<!GPUDevice>} */198GPUAdapter.prototype.requestDevice = function() {};199/** @return {!Promise<!GPUAdapterInfo>} */200GPUAdapter.prototype.requestAdapterInfo = function() {};201/** @type {!GPUAdapterInfo} */202GPUAdapter.prototype.info;203204/** @constructor */205function GPUDevice() {}206/** @type {string} */207GPUDevice.prototype.label;208/** @type {!GPUSupportedFeatures} */209GPUDevice.prototype.features;210/** @type {!GPUSupportedLimits} */211GPUDevice.prototype.limits;212/** @type {!GPUQueue} */213GPUDevice.prototype.queue;214/** @return {undefined} */215GPUDevice.prototype.destroy = function() {};216/** @return {!GPUBuffer} */217GPUDevice.prototype.createBuffer = function() {};218/** @return {!GPUTexture} */219GPUDevice.prototype.createTexture = function() {};220/** @return {!GPUSampler} */221GPUDevice.prototype.createSampler = function() {};222/** @return {!GPUExternalTexture} */223GPUDevice.prototype.importExternalTexture = function() {};224/** @return {!GPUBindGroupLayout} */225GPUDevice.prototype.createBindGroupLayout = function() {};226/** @return {!GPUPipelineLayout} */227GPUDevice.prototype.createPipelineLayout = function() {};228/** @return {!GPUBindGroup} */229GPUDevice.prototype.createBindGroup = function() {};230/** @return {!GPUShaderModule} */231GPUDevice.prototype.createShaderModule = function() {};232/** @return {!GPUComputePipeline} */233GPUDevice.prototype.createComputePipeline = function() {};234/** @return {!GPURenderPipeline} */235GPUDevice.prototype.createRenderPipeline = function() {};236/** @return {!Promise<!GPUComputePipeline>} */237GPUDevice.prototype.createComputePipelineAsync = function() {};238/** @return {!Promise<!GPURenderPipeline>} */239GPUDevice.prototype.createRenderPipelineAsync = function() {};240/** @return {!GPUCommandEncoder} */241GPUDevice.prototype.createCommandEncoder = function() {};242/** @return {!GPURenderBundleEncoder} */243GPUDevice.prototype.createRenderBundleEncoder = function() {};244/** @return {!GPUQuerySet} */245GPUDevice.prototype.createQuerySet = function() {};246/** @type {!Promise<!GPUDeviceLostInfo>} */247GPUDevice.prototype.lost;248/** @return {undefined} */249GPUDevice.prototype.pushErrorScope = function() {};250/** @return {!Promise<?GPUError>} */251GPUDevice.prototype.popErrorScope = function() {};252/** @type {!Function} */253GPUDevice.prototype.onuncapturederror;254/** @type {!GPUAdapterInfo} */255GPUDevice.prototype.adapterInfo;256257/** @constructor */258function GPUBuffer() {}259/** @type {string} */260GPUBuffer.prototype.label;261/** @type {number} */262GPUBuffer.prototype.size;263/** @type {number} */264GPUBuffer.prototype.usage;265/** @type {string} */266GPUBuffer.prototype.mapState;267/** @return {!Promise<undefined>} */268GPUBuffer.prototype.mapAsync = function() {};269/** @return {!ArrayBuffer} */270GPUBuffer.prototype.getMappedRange = function() {};271/** @return {undefined} */272GPUBuffer.prototype.unmap = function() {};273/** @return {undefined} */274GPUBuffer.prototype.destroy = function() {};275276/** @constructor */277function GPUTexture() {}278/** @type {string} */279GPUTexture.prototype.label;280/** @return {!GPUTextureView} */281GPUTexture.prototype.createView = function() {};282/** @return {undefined} */283GPUTexture.prototype.destroy = function() {};284/** @type {number} */285GPUTexture.prototype.width;286/** @type {number} */287GPUTexture.prototype.height;288/** @type {number} */289GPUTexture.prototype.depthOrArrayLayers;290/** @type {number} */291GPUTexture.prototype.mipLevelCount;292/** @type {number} */293GPUTexture.prototype.sampleCount;294/** @type {string} */295GPUTexture.prototype.dimension;296/** @type {string} */297GPUTexture.prototype.format;298/** @type {number} */299GPUTexture.prototype.usage;300301/** @constructor */302function GPUTextureView() {}303/** @type {string} */304GPUTextureView.prototype.label;305306/** @constructor */307function GPUExternalTexture() {}308/** @type {string} */309GPUExternalTexture.prototype.label;310311/** @constructor */312function GPUSampler() {}313/** @type {string} */314GPUSampler.prototype.label;315316/** @constructor */317function GPUBindGroupLayout() {}318/** @type {string} */319GPUBindGroupLayout.prototype.label;320321/** @constructor */322function GPUBindGroup() {}323/** @type {string} */324GPUBindGroup.prototype.label;325326/** @constructor */327function GPUPipelineLayout() {}328/** @type {string} */329GPUPipelineLayout.prototype.label;330331/** @constructor */332function GPUShaderModule() {}333/** @type {string} */334GPUShaderModule.prototype.label;335/** @return {!Promise<!GPUCompilationInfo>} */336GPUShaderModule.prototype.getCompilationInfo = function() {};337338/** @constructor */339function GPUCompilationMessage() {}340/** @type {string} */341GPUCompilationMessage.prototype.message;342/** @type {string} */343GPUCompilationMessage.prototype.type;344/** @type {number} */345GPUCompilationMessage.prototype.lineNum;346/** @type {number} */347GPUCompilationMessage.prototype.linePos;348/** @type {number} */349GPUCompilationMessage.prototype.offset;350/** @type {number} */351GPUCompilationMessage.prototype.length;352353/** @constructor */354function GPUCompilationInfo() {}355/** @type {!Array<!GPUCompilationMessage>} */356GPUCompilationInfo.prototype.messages;357358/** @constructor */359function GPUPipelineError() {}360/** @type {string} */361GPUPipelineError.prototype.reason;362363/** @constructor */364function GPUComputePipeline() {}365/** @type {string} */366GPUComputePipeline.prototype.label;367/** @return {!GPUBindGroupLayout} */368GPUComputePipeline.prototype.getBindGroupLayout = function() {};369370/** @constructor */371function GPURenderPipeline() {}372/** @type {string} */373GPURenderPipeline.prototype.label;374/** @return {!GPUBindGroupLayout} */375GPURenderPipeline.prototype.getBindGroupLayout = function() {};376377/** @constructor */378function GPUCommandBuffer() {}379/** @type {string} */380GPUCommandBuffer.prototype.label;381382/** @constructor */383function GPUCommandEncoder() {}384/** @type {string} */385GPUCommandEncoder.prototype.label;386/** @return {undefined} */387GPUCommandEncoder.prototype.pushDebugGroup = function() {};388/** @return {undefined} */389GPUCommandEncoder.prototype.popDebugGroup = function() {};390/** @return {undefined} */391GPUCommandEncoder.prototype.insertDebugMarker = function() {};392/** @return {!GPURenderPassEncoder} */393GPUCommandEncoder.prototype.beginRenderPass = function() {};394/** @return {!GPUComputePassEncoder} */395GPUCommandEncoder.prototype.beginComputePass = function() {};396/** @return {undefined} */397GPUCommandEncoder.prototype.copyBufferToBuffer = function() {};398/** @return {undefined} */399GPUCommandEncoder.prototype.copyBufferToTexture = function() {};400/** @return {undefined} */401GPUCommandEncoder.prototype.copyTextureToBuffer = function() {};402/** @return {undefined} */403GPUCommandEncoder.prototype.copyTextureToTexture = function() {};404/** @return {undefined} */405GPUCommandEncoder.prototype.clearBuffer = function() {};406/** @return {undefined} */407GPUCommandEncoder.prototype.resolveQuerySet = function() {};408/** @return {!GPUCommandBuffer} */409GPUCommandEncoder.prototype.finish = function() {};410411/** @constructor */412function GPUComputePassEncoder() {}413/** @type {string} */414GPUComputePassEncoder.prototype.label;415/** @return {undefined} */416GPUComputePassEncoder.prototype.pushDebugGroup = function() {};417/** @return {undefined} */418GPUComputePassEncoder.prototype.popDebugGroup = function() {};419/** @return {undefined} */420GPUComputePassEncoder.prototype.insertDebugMarker = function() {};421/** @return {undefined} */422GPUComputePassEncoder.prototype.setBindGroup = function() {};423/** @return {undefined} */424GPUComputePassEncoder.prototype.setBindGroup = function() {};425/** @return {undefined} */426GPUComputePassEncoder.prototype.setPipeline = function() {};427/** @return {undefined} */428GPUComputePassEncoder.prototype.dispatchWorkgroups = function() {};429/** @return {undefined} */430GPUComputePassEncoder.prototype.dispatchWorkgroupsIndirect = function() {};431/** @return {undefined} */432GPUComputePassEncoder.prototype.end = function() {};433434/** @constructor */435function GPURenderPassEncoder() {}436/** @type {string} */437GPURenderPassEncoder.prototype.label;438/** @return {undefined} */439GPURenderPassEncoder.prototype.pushDebugGroup = function() {};440/** @return {undefined} */441GPURenderPassEncoder.prototype.popDebugGroup = function() {};442/** @return {undefined} */443GPURenderPassEncoder.prototype.insertDebugMarker = function() {};444/** @return {undefined} */445GPURenderPassEncoder.prototype.setBindGroup = function() {};446/** @return {undefined} */447GPURenderPassEncoder.prototype.setBindGroup = function() {};448/** @return {undefined} */449GPURenderPassEncoder.prototype.setPipeline = function() {};450/** @return {undefined} */451GPURenderPassEncoder.prototype.setIndexBuffer = function() {};452/** @return {undefined} */453GPURenderPassEncoder.prototype.setVertexBuffer = function() {};454/** @return {undefined} */455GPURenderPassEncoder.prototype.draw = function() {};456/** @return {undefined} */457GPURenderPassEncoder.prototype.drawIndexed = function() {};458/** @return {undefined} */459GPURenderPassEncoder.prototype.drawIndirect = function() {};460/** @return {undefined} */461GPURenderPassEncoder.prototype.drawIndexedIndirect = function() {};462/** @return {undefined} */463GPURenderPassEncoder.prototype.setViewport = function() {};464/** @return {undefined} */465GPURenderPassEncoder.prototype.setScissorRect = function() {};466/** @return {undefined} */467GPURenderPassEncoder.prototype.setBlendConstant = function() {};468/** @return {undefined} */469GPURenderPassEncoder.prototype.setStencilReference = function() {};470/** @return {undefined} */471GPURenderPassEncoder.prototype.beginOcclusionQuery = function() {};472/** @return {undefined} */473GPURenderPassEncoder.prototype.endOcclusionQuery = function() {};474/** @return {undefined} */475GPURenderPassEncoder.prototype.executeBundles = function() {};476/** @return {undefined} */477GPURenderPassEncoder.prototype.end = function() {};478479/** @constructor */480function GPURenderBundle() {}481/** @type {string} */482GPURenderBundle.prototype.label;483484/** @constructor */485function GPURenderBundleEncoder() {}486/** @type {string} */487GPURenderBundleEncoder.prototype.label;488/** @return {undefined} */489GPURenderBundleEncoder.prototype.pushDebugGroup = function() {};490/** @return {undefined} */491GPURenderBundleEncoder.prototype.popDebugGroup = function() {};492/** @return {undefined} */493GPURenderBundleEncoder.prototype.insertDebugMarker = function() {};494/** @return {undefined} */495GPURenderBundleEncoder.prototype.setBindGroup = function() {};496/** @return {undefined} */497GPURenderBundleEncoder.prototype.setBindGroup = function() {};498/** @return {undefined} */499GPURenderBundleEncoder.prototype.setPipeline = function() {};500/** @return {undefined} */501GPURenderBundleEncoder.prototype.setIndexBuffer = function() {};502/** @return {undefined} */503GPURenderBundleEncoder.prototype.setVertexBuffer = function() {};504/** @return {undefined} */505GPURenderBundleEncoder.prototype.draw = function() {};506/** @return {undefined} */507GPURenderBundleEncoder.prototype.drawIndexed = function() {};508/** @return {undefined} */509GPURenderBundleEncoder.prototype.drawIndirect = function() {};510/** @return {undefined} */511GPURenderBundleEncoder.prototype.drawIndexedIndirect = function() {};512/** @return {!GPURenderBundle} */513GPURenderBundleEncoder.prototype.finish = function() {};514515/** @constructor */516function GPUQueue() {}517/** @type {string} */518GPUQueue.prototype.label;519/** @return {undefined} */520GPUQueue.prototype.submit = function() {};521/** @return {!Promise<undefined>} */522GPUQueue.prototype.onSubmittedWorkDone = function() {};523/** @return {undefined} */524GPUQueue.prototype.writeBuffer = function() {};525/** @return {undefined} */526GPUQueue.prototype.writeTexture = function() {};527/** @return {undefined} */528GPUQueue.prototype.copyExternalImageToTexture = function() {};529530/** @constructor */531function GPUQuerySet() {}532/** @type {string} */533GPUQuerySet.prototype.label;534/** @return {undefined} */535GPUQuerySet.prototype.destroy = function() {};536/** @type {string} */537GPUQuerySet.prototype.type;538/** @type {number} */539GPUQuerySet.prototype.count;540541/** @constructor */542function GPUCanvasContext() {}543/** @type {!HTMLCanvasElement|!OffscreenCanvas} */544GPUCanvasContext.prototype.canvas;545/** @return {undefined} */546GPUCanvasContext.prototype.configure = function() {};547/** @return {undefined} */548GPUCanvasContext.prototype.unconfigure = function() {};549/** @return {!GPUTexture} */550GPUCanvasContext.prototype.getCurrentTexture = function() {};551552/** @constructor */553function GPUDeviceLostInfo() {}554/** @type {string} */555GPUDeviceLostInfo.prototype.reason;556/** @type {string} */557GPUDeviceLostInfo.prototype.message;558559/** @constructor */560function GPUError() {}561/** @type {string} */562GPUError.prototype.message;563564/** @constructor */565function GPUValidationError() {}566567/** @constructor */568function GPUOutOfMemoryError() {}569570/** @constructor */571function GPUInternalError() {}572573/** @constructor */574function GPUUncapturedErrorEvent() {}575/** @type {!GPUError} */576GPUUncapturedErrorEvent.prototype.error;577578579