Skip to main content

GPURenderPassEncoder

The GPURenderPassEncoder interface of the WebGPU API encodes commands related to controlling the vertex and fragment shader stages, as issued by a GPURenderPipeline. It forms part of the overall encoding activity of a GPUCommandEncoder. Available only in secure contexts.

MDN Reference

Extends

Methods

beginOcclusionQuery()

beginOcclusionQuery(queryIndex): void;

The beginOcclusionQuery() method of the GPURenderPassEncoder interface begins an occlusion query at the specified index of the relevant GPUQuerySet (provided as the value of the occlusionQuerySet descriptor property when invoking GPUCommandEncoder.beginRenderPass() to run the render pass).

MDN Reference

Parameters

ParameterType
queryIndexnumber

Returns

void


draw()

draw(
vertexCount,
instanceCount?,
firstVertex?,
firstInstance?
): void;

MDN Reference

Parameters

ParameterType
vertexCountnumber
instanceCount?number
firstVertex?number
firstInstance?number

Returns

void

Inherited from

GPURenderCommandsMixin.draw


drawIndexed()

drawIndexed(
indexCount,
instanceCount?,
firstIndex?,
baseVertex?,
firstInstance?
): void;

MDN Reference

Parameters

ParameterType
indexCountnumber
instanceCount?number
firstIndex?number
baseVertex?number
firstInstance?number

Returns

void

Inherited from

GPURenderCommandsMixin.drawIndexed


drawIndexedIndirect()

drawIndexedIndirect(indirectBuffer, indirectOffset): void;

MDN Reference

Parameters

ParameterType
indirectBufferGPUBuffer
indirectOffsetnumber

Returns

void

Inherited from

GPURenderCommandsMixin.drawIndexedIndirect


drawIndirect()

drawIndirect(indirectBuffer, indirectOffset): void;

MDN Reference

Parameters

ParameterType
indirectBufferGPUBuffer
indirectOffsetnumber

Returns

void

Inherited from

GPURenderCommandsMixin.drawIndirect


end()

end(): void;

The end() method of the GPURenderPassEncoder interface completes recording of the current render pass command sequence.

MDN Reference

Returns

void


endOcclusionQuery()

endOcclusionQuery(): void;

The endOcclusionQuery() method of the GPURenderPassEncoder interface ends an active occlusion query previously started with beginOcclusionQuery().

MDN Reference

Returns

void


executeBundles()

Call Signature

executeBundles(bundles): void;

The executeBundles() method of the GPURenderPassEncoder interface executes commands previously recorded into the referenced GPURenderBundles, as part of this render pass.

MDN Reference

Parameters
ParameterType
bundlesGPURenderBundle[]
Returns

void

Call Signature

executeBundles(bundles): void;

The executeBundles() method of the GPURenderPassEncoder interface executes commands previously recorded into the referenced GPURenderBundles, as part of this render pass.

MDN Reference

Parameters
ParameterType
bundlesIterable<GPURenderBundle>
Returns

void


insertDebugMarker()

insertDebugMarker(markerLabel): void;

MDN Reference

Parameters

ParameterType
markerLabelstring

Returns

void

Inherited from

GPUDebugCommandsMixin.insertDebugMarker


popDebugGroup()

popDebugGroup(): void;

MDN Reference

Returns

void

Inherited from

GPUDebugCommandsMixin.popDebugGroup


pushDebugGroup()

pushDebugGroup(groupLabel): void;

MDN Reference

Parameters

ParameterType
groupLabelstring

Returns

void

Inherited from

GPUDebugCommandsMixin.pushDebugGroup


setBindGroup()

Call Signature

setBindGroup(
index,
bindGroup,
dynamicOffsets?
): void;

MDN Reference

Parameters
ParameterType
indexnumber
bindGroupGPUBindGroup | null
dynamicOffsets?number[]
Returns

void

Inherited from

GPUBindingCommandsMixin.setBindGroup

Call Signature

setBindGroup(
index,
bindGroup,
dynamicOffsetsData,
dynamicOffsetsDataStart,
dynamicOffsetsDataLength
): void;
Parameters
ParameterType
indexnumber
bindGroupGPUBindGroup | null
dynamicOffsetsDataUint32Array<ArrayBufferLike>
dynamicOffsetsDataStartnumber
dynamicOffsetsDataLengthnumber
Returns

void

Inherited from

GPUBindingCommandsMixin.setBindGroup

Call Signature

setBindGroup(
index,
bindGroup,
dynamicOffsets?
): void;

MDN Reference

Parameters
ParameterType
indexnumber
bindGroupGPUBindGroup | null
dynamicOffsets?Iterable<number, any, any>
Returns

void

Inherited from

GPUBindingCommandsMixin.setBindGroup


setBlendConstant()

Call Signature

setBlendConstant(color): void;

The setBlendConstant() method of the GPURenderPassEncoder interface sets the constant blend color and alpha values used with "constant" and "one-minus-constant" blend factors (as set in the descriptor of the GPUDevice.createRenderPipeline() method, in the blend property).

MDN Reference

Parameters
ParameterType
colorGPUColor
Returns

void

Call Signature

setBlendConstant(color): void;

The setBlendConstant() method of the GPURenderPassEncoder interface sets the constant blend color and alpha values used with "constant" and "one-minus-constant" blend factors (as set in the descriptor of the GPUDevice.createRenderPipeline() method, in the blend property).

MDN Reference

Parameters
ParameterType
colorIterable<number>
Returns

void


setIndexBuffer()

setIndexBuffer(
buffer,
indexFormat,
offset?,
size?
): void;

MDN Reference

Parameters

ParameterType
bufferGPUBuffer
indexFormatGPUIndexFormat
offset?number
size?number

Returns

void

Inherited from

GPURenderCommandsMixin.setIndexBuffer


setPipeline()

setPipeline(pipeline): void;

MDN Reference

Parameters

ParameterType
pipelineGPURenderPipeline

Returns

void

Inherited from

GPURenderCommandsMixin.setPipeline


setScissorRect()

setScissorRect(
x,
y,
width,
height
): void;

The setScissorRect() method of the GPURenderPassEncoder interface sets the scissor rectangle used during the rasterization stage. After transformation into viewport coordinates any fragments that fall outside the scissor rectangle will be discarded.

MDN Reference

Parameters

ParameterType
xnumber
ynumber
widthnumber
heightnumber

Returns

void


setStencilReference()

setStencilReference(reference): void;

The setStencilReference() method of the GPURenderPassEncoder interface sets the stencil reference value using during stencil tests with the "replace" stencil operation (as set in the descriptor of the GPUDevice.createRenderPipeline() method, in the properties defining the various stencil operations).

MDN Reference

Parameters

ParameterType
referencenumber

Returns

void


setVertexBuffer()

setVertexBuffer(
slot,
buffer,
offset?,
size?
): void;

MDN Reference

Parameters

ParameterType
slotnumber
bufferGPUBuffer | null
offset?number
size?number

Returns

void

Inherited from

GPURenderCommandsMixin.setVertexBuffer


setViewport()

setViewport(
x,
y,
width,
height,
minDepth,
maxDepth
): void;

The setViewport() method of the GPURenderPassEncoder interface sets the viewport used during the rasterization stage to linearly map from normalized device coordinates to viewport coordinates.

MDN Reference

Parameters

ParameterType
xnumber
ynumber
widthnumber
heightnumber
minDepthnumber
maxDepthnumber

Returns

void

Properties

label

label: string;

MDN Reference

Inherited from

GPUObjectBase.label