Table of Contents

Class GPURenderPassEncoder

Namespace
CSharpToJavaScript.APIs.JS
Assembly
CSharpToJavaScript.dll

The GPURenderPassEncoder interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} 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.

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

Remarks

A render pipeline renders graphics to GPUTexture attachments, typically intended for display in a {{htmlelement("canvas")}} element, but it could also render to textures used for other purposes that never appear onscreen. It has two main stages:

A GPURenderPassEncoder object instance is created via the BeginRenderPass(GPURenderPassDescriptor) property.

-The WebGPU API

See also on MDN

Constructors

GPURenderPassEncoder()

public GPURenderPassEncoder()

Methods

BeginOcclusionQuery(ulong)

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 BeginRenderPass(GPURenderPassDescriptor) to run the render pass).

[Value("beginOcclusionQuery")]
public GlobalObject.Undefined BeginOcclusionQuery(ulong queryIndex)

Parameters

queryIndex ulong

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

End()

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

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

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

EndOcclusionQuery()

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

[Value("endOcclusionQuery")]
public GlobalObject.Undefined EndOcclusionQuery()

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

ExecuteBundles(List<GPURenderBundle>)

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

[Value("executeBundles")]
public GlobalObject.Undefined ExecuteBundles(List<GPURenderBundle> bundles)

Parameters

bundles List<GPURenderBundle>

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

NOTE

After calling executeBundles() the currently set vertex buffers, index buffers, bind groups, and pipeline are all cleared, even if no bundles are actually executed.

-The WebGPU API

See also on MDN

SetBlendConstant(Union219)

The setBlendConstant() method of the
GPURenderPassEncoder interface sets the constant blend color and alpha values used with &quot;constant&quot; and &quot;one-minus-constant&quot; blend factors (as set in the descriptor of the CreateRenderPipeline(GPURenderPipelineDescriptor) method, in the blend property).

[Value("setBlendConstant")]
public GlobalObject.Undefined SetBlendConstant(Union219 color)

Parameters

color Union219

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

SetScissorRect(ulong, ulong, ulong, ulong)

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.

[Value("setScissorRect")]
public GlobalObject.Undefined SetScissorRect(ulong x, ulong y, ulong width, ulong height)

Parameters

x ulong
y ulong
width ulong
height ulong

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

SetStencilReference(ulong)

The setStencilReference() method of the
GPURenderPassEncoder interface sets the stencil reference value using during stencil tests with the &quot;replace&quot; stencil operation (as set in the descriptor of the CreateRenderPipeline(GPURenderPipelineDescriptor) method, in the properties defining the various stencil operations).

[Value("setStencilReference")]
public GlobalObject.Undefined SetStencilReference(ulong reference)

Parameters

reference ulong

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks

SetViewport(Number, Number, Number, Number, Number, Number)

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.

[Value("setViewport")]
public GlobalObject.Undefined SetViewport(Number x, Number y, Number width, Number height, Number minDepth, Number maxDepth)

Parameters

x Number
y Number
width Number
height Number
minDepth Number
maxDepth Number

Returns

GlobalObject.Undefined

None (GlobalObject.Undefined).

Remarks