Class GPURenderBundleEncoder
- Namespace
- CSharpToJavaScript.APIs.JS
- Assembly
- CSharpToJavaScript.dll
The GPURenderBundleEncoder interface of the {{domxref("WebGPU API", "WebGPU API", "", "nocode")}} is used to pre-record bundles of commands.
[Value("GPURenderBundleEncoder")]
public class GPURenderBundleEncoder
- Inheritance
-
GPURenderBundleEncoder
- Inherited Members
Remarks
The command bundles are encoded by calling the methods of GPURenderBundleEncoder; once the desired commands have been encoded, they are recorded into a GPURenderBundle object instance using the Finish(GPURenderBundleDescriptor) method. These render bundles can then be reused across multiple render passes by passing the GPURenderBundle objects into ExecuteBundles(List<GPURenderBundle>) calls.
In effect, this is like a partial render pass — GPURenderBundleEncoders have all the same functionality available as GPURenderPassEncoders, except that they can't begin and end occlusion queries, and can't set the scissor rect, viewport, blend constant, and stencil reference. The GPURenderBundle will inherit all these values from the GPURenderPassEncoder that executes it.
NOTE
Currently set vertex buffers, index buffers, bind groups, and pipeline are all cleared prior to executing a render bundle, and once the render bundle has finished executing.
Reusing pre-recoded commands can significantly improve app performance in situations where JavaScript draw call overhead is a bottleneck. Render bundles are most effective in situations where a batch of objects will be drawn the same way across multiple views or frames, with the only differences being the buffer content being used (such as updated matrix uniforms). A good example is VR rendering. Recording the rendering as a render bundle and then tweaking the view matrix and replaying it for each eye is a more efficient way to issue draw calls for both renderings of the scene.
A GPURenderBundleEncoder object instance is created via the CreateRenderBundleEncoder(GPURenderBundleEncoderDescriptor) property.
NOTE
The methods of
GPURenderBundleEncoderare functionally identical to their equivalents available on GPURenderPassEncoder, except for Finish(GPURenderBundleDescriptor), which is similar in purpose to Finish(GPUCommandBufferDescriptor).
-The WebGPU API
Constructors
GPURenderBundleEncoder()
public GPURenderBundleEncoder()
Methods
Finish(GPURenderBundleDescriptor)
The finish() method of the
GPURenderBundleEncoder interface completes recording of the current render bundle command sequence, returning a GPURenderBundle object that can be passed into a ExecuteBundles(List<GPURenderBundle>) call to execute those commands in a specific render pass.
[Value("finish")]
public GPURenderBundle Finish(GPURenderBundleDescriptor descriptor = null)
Parameters
descriptorGPURenderBundleDescriptor
Returns
- GPURenderBundle
A GPURenderBundle object instance.