MCPcopy
hub / github.com/visgl/deck.gl / _render

Method _render

modules/core/src/passes/layers-pass.ts:89–124  ·  view source on GitHub ↗
(options: LayersPassRenderOptions)

Source from the content-addressed store, hash-verified

87 }
88
89 protected _render(options: LayersPassRenderOptions): RenderStats[] {
90 const canvasContext = this.device.canvasContext!;
91 const framebuffer = options.target ?? canvasContext.getCurrentFramebuffer();
92 const [width, height] = canvasContext.getDrawingBufferSize();
93
94 // Explicitly specify clearColor and clearDepth, overriding render pass defaults.
95 const clearCanvas = options.clearCanvas ?? true;
96 const clearColor = options.clearColor ?? (clearCanvas ? [0, 0, 0, 0] : false);
97 const clearDepth = clearCanvas ? 1 : false;
98 const clearStencil = clearCanvas ? 0 : false;
99 const colorMask = options.colorMask ?? 0xf;
100
101 const parameters: RenderPassParameters = {viewport: [0, 0, width, height]};
102 if (options.colorMask) {
103 parameters.colorMask = colorMask;
104 }
105 if (options.scissorRect) {
106 parameters.scissorRect = options.scissorRect as NumberArray4;
107 }
108
109 const renderPass = this.device.beginRenderPass({
110 framebuffer,
111 parameters,
112 clearColor: clearColor as NumberArray4,
113 clearDepth,
114 clearStencil
115 });
116
117 try {
118 return this._drawLayers(renderPass, options);
119 } finally {
120 renderPass.end();
121 // TODO(ibgreen): WebGPU - submit may not be needed here but initial port had issues with out of render loop rendering
122 this.device.submit();
123 }
124 }
125
126 /** Draw a list of layers in a list of viewports */
127 private _drawLayers(renderPass: RenderPass, options: LayersPassRenderOptions) {

Callers 5

renderMethod · 0.95
renderMethod · 0.45
_drawPickingBufferMethod · 0.45
renderMethod · 0.45
redrawMethod · 0.45

Calls 2

_drawLayersMethod · 0.95
endMethod · 0.45

Tested by

no test coverage detected