Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. GPUComputePassEncoder
  4. end()

GPUComputePassEncoder: end() 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.

Theend() method of theGPUComputePassEncoder interface completes recording of the current compute pass command sequence.

Syntax

js
end()

Parameters

None.

Return value

None (Undefined).

Validation

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

Examples

In ourbasic compute demo, several commands are recorded via aGPUCommandEncoder. Most of these commands originate from theGPUComputePassEncoder created viaGPUCommandEncoder.beginComputePass().

js
const BUFFER_SIZE = 1000;// …// Create GPUCommandEncoder to encode commands to issue to the GPUconst commandEncoder = device.createCommandEncoder();// Initiate render passconst passEncoder = commandEncoder.beginComputePass();// Issue commandspassEncoder.setPipeline(computePipeline);passEncoder.setBindGroup(0, bindGroup);passEncoder.dispatchWorkgroups(Math.ceil(BUFFER_SIZE / 64));// End the render passpassEncoder.end();// Copy output buffer to staging buffercommandEncoder.copyBufferToBuffer(  output,  0, // Source offset  stagingBuffer,  0, // Destination offset  BUFFER_SIZE,);// End frame by passing array of command buffers to command queue for executiondevice.queue.submit([commandEncoder.finish()]);// …

Specifications

Specification
WebGPU
# dom-gpucomputepassencoder-end

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp