Table of Contents

Class GPUComputePassEncoder

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The GPUComputePassEncoder interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} encodes commands related to controlling the compute shader stage, as issued by a GPUComputePipeline. It forms part of the overall encoding activity of a GPUCommandEncoder.

[Value("GPUComputePassEncoder")]
public class GPUComputePassEncoder
Inheritance
GPUComputePassEncoder
Inherited Members

Remarks

A compute pipeline contains a single compute stage in which a compute shader takes general data, processes it in parallel across a specified number of workgroups, then returns the result in one or more buffers.

A GPUComputePassEncoder object instance is created via the BeginComputePass(GPUComputePassDescriptor) property.

-The WebGPU API

See also on MDN

Constructors

GPUComputePassEncoder()

public GPUComputePassEncoder()

Methods

DispatchWorkgroups(ulong, ulong, ulong)

The dispatchWorkgroups() method of the
GPUComputePassEncoder interface dispatches a specific grid of workgroups to perform the work being done by the current GPUComputePipeline (i.e., set via SetPipeline(GPUComputePipeline)).

[Value("dispatchWorkgroups")]
public GlobalObject.Undefined DispatchWorkgroups(ulong workgroupCountX, ulong workgroupCountY = 0, ulong workgroupCountZ = 0)

Parameters

workgroupCountX ulong
workgroupCountY ulong
workgroupCountZ ulong

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

DispatchWorkgroupsIndirect(GPUBuffer, ulong)

The dispatchWorkgroupsIndirect() method of the
GPUComputePassEncoder interface dispatches a grid of workgroups, defined by the parameters of a GPUBuffer, to perform the work being done by the current GPUComputePipeline (i.e., set via SetPipeline(GPUComputePipeline)).

[Value("dispatchWorkgroupsIndirect")]
public GlobalObject.Undefined DispatchWorkgroupsIndirect(GPUBuffer indirectBuffer, ulong indirectOffset)

Parameters

indirectBuffer GPUBuffer
indirectOffset ulong

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

End()

The end() method of the
GPUComputePassEncoder interface completes recording of the current compute pass command sequence.

[Value("end")]
public GlobalObject.Undefined End()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

SetPipeline(GPUComputePipeline)

The setPipeline() method of the
GPUComputePassEncoder interface sets the GPUComputePipeline to use for this compute pass.

[Value("setPipeline")]
public GlobalObject.Undefined SetPipeline(GPUComputePipeline pipeline)

Parameters

pipeline GPUComputePipeline

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks