Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. GPUQueue
  4. submit()

GPUQueue: submit() method

Limited availability

This feature is not Baseline because it does not work in some of the most widely-used browsers.

Secure context: This feature is available only insecure contexts (HTTPS), in some or allsupporting browsers.

Note: This feature is available inWeb Workers.

Thesubmit() method of theGPUQueue interface schedules the execution of command buffers represented by one or moreGPUCommandBuffer objects by the GPU.

Syntax

js
submit(commandBuffers)

Parameters

commandBuffers

An array ofGPUCommandBuffer objects containing the commands to be enqueued for processing by the GPU. The array must not contain duplicateGPUCommandBuffer objects — each one can only be submitted once persubmit() call.

Return value

None (Undefined).

Validation

The following criteria must be met when callingsubmit(), otherwise aGPUValidationError is generated and theGPUQueue becomes invalid:

Examples

In ourbasic render demo, a number of commands are recorded via aGPUCommandEncoder:

js
// …// Create GPUCommandEncoderconst commandEncoder = device.createCommandEncoder();// Create GPURenderPassDescriptor to tell WebGPU which texture to draw into, then initiate render passconst renderPassDescriptor = {  colorAttachments: [    {      clearValue: clearColor,      loadOp: "clear",      storeOp: "store",      view: context.getCurrentTexture().createView(),    },  ],};const passEncoder = commandEncoder.beginRenderPass(renderPassDescriptor);// Draw a trianglepassEncoder.setPipeline(renderPipeline);passEncoder.setVertexBuffer(0, vertexBuffer);passEncoder.draw(3);// End the render passpassEncoder.end();// …

The commands encoded by theGPUCommandEncoder are recoded into aGPUCommandBuffer using theGPUCommandEncoder.finish() method. The command buffer is then passed into the queue via asubmit() call, ready to be processed by the GPU.

js
device.queue.submit([commandEncoder.finish()]);

Note:Study theWebGPU samples to find more queue examples.

Specifications

Specification
WebGPU
# dom-gpuqueue-submit

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2026 Movatter.jp