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

Function _drawLayer

modules/core/src/lib/layer.ts:1039–1109  ·  view source on GitHub ↗
({
    renderPass,
    shaderModuleProps = null,
    uniforms = {},
    parameters = {}
  }: {
    renderPass: RenderPass;
    shaderModuleProps: any;
    uniforms: any;
    parameters: LumaParameters;
  })

Source from the content-addressed store, hash-verified

1037
1038 // Calculates uniforms
1039 _drawLayer({
1040 renderPass,
1041 shaderModuleProps = null,
1042 uniforms = {},
1043 parameters = {}
1044 }: {
1045 renderPass: RenderPass;
1046 shaderModuleProps: any;
1047 uniforms: any;
1048 parameters: LumaParameters;
1049 }): void {
1050 this._updateAttributeTransition();
1051
1052 const currentProps = this.props;
1053 const context = this.context;
1054 // Overwrite this.props during redraw to use in-transition prop values
1055 // `internalState.propsInTransition` could be missing if `updateState` failed
1056 // @ts-ignore (TS2339) internalState is alwasy defined when this method is called
1057 this.props = this.internalState.propsInTransition || currentProps;
1058
1059 try {
1060 // TODO/ib - hack move to luma Model.draw
1061 if (shaderModuleProps) {
1062 this.setShaderModuleProps(shaderModuleProps);
1063 }
1064
1065 // Apply polygon offset to avoid z-fighting
1066 // TODO - move to draw-layers
1067 const {getPolygonOffset} = this.props;
1068 const offsets = (getPolygonOffset && getPolygonOffset(uniforms)) || [0, 0];
1069
1070 if (context.device instanceof WebGLDevice) {
1071 context.device.setParametersWebGL({polygonOffset: offsets});
1072 }
1073
1074 const webGPUDrawParameters =
1075 context.device instanceof WebGLDevice ? null : splitWebGPUDrawParameters(parameters);
1076
1077 applyModelParameters(this.getModels(), renderPass, parameters, webGPUDrawParameters);
1078
1079 // Call subclass lifecycle method
1080 if (context.device instanceof WebGLDevice) {
1081 context.device.withParametersWebGL(parameters, () => {
1082 const opts: DrawOptions = {renderPass, shaderModuleProps, uniforms, parameters, context};
1083
1084 // extensions
1085 for (const extension of this.props.extensions) {
1086 extension.draw.call(this, opts, extension);
1087 }
1088
1089 this.draw(opts);
1090 });
1091 } else {
1092 if (webGPUDrawParameters?.renderPassParameters) {
1093 renderPass.setParameters(webGPUDrawParameters.renderPassParameters);
1094 }
1095 const opts: DrawOptions = {renderPass, shaderModuleProps, uniforms, parameters, context};
1096

Callers

nothing calls this directly

Calls 4

applyModelParametersFunction · 0.85
drawMethod · 0.65
setShaderModulePropsMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…