@luma.gl/webgl 9.0.5 → 9.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"device-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/device-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAgD,MAAM,eAAe,CAAC;AAClG,OAAO,EAAC,MAAM,EAAsB,UAAU,EAA+B,MAAM,eAAe,CAAC;AAEnG,OAAO,KAAK,EAGV,UAAU,EACV,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAO5B;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,OAAO,EACnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,YAAY,EACxB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAeH;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED,kCAAkC;AAClC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,QAsMzE;AAyBD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,UAAU,CAW5F;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,CAW9F"}
1
+ {"version":3,"file":"device-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/device-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAgD,MAAM,eAAe,CAAC;AAClG,OAAO,EAAC,MAAM,EAAsB,UAAU,EAA+B,MAAM,eAAe,CAAC;AAEnG,OAAO,KAAK,EAGV,UAAU,EACV,YAAY,EAIb,MAAM,oBAAoB,CAAC;AAO5B;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,OAAO,EACnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,YAAY,EACxB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAeH;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED,kCAAkC;AAClC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,QAuMzE;AAyBD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,UAAU,CAW5F;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,GAAG,eAAe,CAW9F"}
@@ -120,10 +120,10 @@ export function setDeviceParameters(device, parameters) {
120
120
  // // Handled by depthBias
121
121
  // },
122
122
  // WEBGL EXTENSIONS
123
- if (device.features.has('provoking-vertex-webgl')) {
124
- const extensions = webglDevice.getExtension('WEBGL_provoking_vertex');
125
- const ext = extensions.WEBGL_provoking_vertex;
126
- if (parameters.provokingVertex) {
123
+ if (parameters.provokingVertex) {
124
+ if (device.features.has('provoking-vertex-webgl')) {
125
+ const extensions = webglDevice.getExtension('WEBGL_provoking_vertex');
126
+ const ext = extensions.WEBGL_provoking_vertex;
127
127
  const vertex = map('provokingVertex', parameters.provokingVertex, {
128
128
  first: 36429,
129
129
  last: 36430
@@ -131,19 +131,21 @@ export function setDeviceParameters(device, parameters) {
131
131
  ext?.provokingVertexWEBGL(vertex);
132
132
  }
133
133
  }
134
- if (device.features.has('polygon-mode-webgl')) {
135
- const extensions = webglDevice.getExtension('WEBGL_polygon_mode');
136
- const ext = extensions.WEBGL_polygon_mode;
137
- if (parameters.polygonMode) {
138
- const mode = map('polygonMode', parameters.polygonMode, {
139
- fill: 6914,
140
- line: 6913
141
- });
142
- ext?.polygonModeWEBGL(1028, mode);
143
- ext?.polygonModeWEBGL(1029, mode);
144
- }
145
- if (parameters.polygonOffsetLine) {
146
- gl.enable(10754);
134
+ if (parameters.polygonMode || parameters.polygonOffsetLine) {
135
+ if (device.features.has('polygon-mode-webgl')) {
136
+ if (parameters.polygonMode) {
137
+ const extensions = webglDevice.getExtension('WEBGL_polygon_mode');
138
+ const ext = extensions.WEBGL_polygon_mode;
139
+ const mode = map('polygonMode', parameters.polygonMode, {
140
+ fill: 6914,
141
+ line: 6913
142
+ });
143
+ ext?.polygonModeWEBGL(1028, mode);
144
+ ext?.polygonModeWEBGL(1029, mode);
145
+ }
146
+ if (parameters.polygonOffsetLine) {
147
+ gl.enable(10754);
148
+ }
147
149
  }
148
150
  }
149
151
  if (device.features.has('shader-clip-cull-distance-webgl')) {
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAK,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAapD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,8DAA8D;IAC9D,YAAY,EAAE,YAAY,CAAC;gBAEf,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe;IAYvD,GAAG,IAAI,IAAI;IAQX,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa,IAAI,IAAI;IACrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAO5C;;OAEG;IACH,aAAa,CAAC,UAAU,GAAE,oBAAyB,GAAG,IAAI;IA+C1D,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKpC,iBAAiB,IAAI,IAAI;IAOlC;;OAEG;IACH,SAAS,CAAC,KAAK,IAAI,IAAI;IA+BvB;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,UAAU,GAAE,MAAU,EAAE,KAAK,GAAE,WAA0B;CAwCrF"}
1
+ {"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAK,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAcpD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,8DAA8D;IAC9D,YAAY,EAAE,YAAY,CAAC;gBAEf,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe;IAYvD,GAAG,IAAI,IAAI;IAQX,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa,IAAI,IAAI;IACrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAO5C;;OAEG;IACH,aAAa,CAAC,UAAU,GAAE,oBAAyB,GAAG,IAAI;IAqD1D,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKpC,iBAAiB,IAAI,IAAI;IAOlC;;OAEG;IACH,SAAS,CAAC,KAAK,IAAI,IAAI;IA+BvB;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,UAAU,GAAE,MAAU,EAAE,KAAK,GAAE,WAA0B;CAwCrF"}
@@ -11,6 +11,7 @@ const GL_DEPTH_BUFFER_BIT = 0x00000100;
11
11
  const GL_STENCIL_BUFFER_BIT = 0x00000400;
12
12
  const GL_COLOR_BUFFER_BIT = 0x00004000;
13
13
  const GL_COLOR = 0x1800;
14
+ const COLOR_CHANNELS = [0x1, 0x2, 0x4, 0x8]; // GPUColorWrite RED, GREEN, BLUE, ALPHA
14
15
  export class WEBGLRenderPass extends RenderPass {
15
16
  device;
16
17
  /** Parameters that should be applied before each draw call */
@@ -77,6 +78,9 @@ export class WEBGLRenderPass extends RenderPass {
77
78
  // Does this work?
78
79
  parameters[2967] = parameters.stencilReference;
79
80
  }
81
+ if (parameters.colorMask) {
82
+ glParameters.colorMask = COLOR_CHANNELS.map(channel => Boolean(channel & parameters.colorMask));
83
+ }
80
84
  this.glParameters = glParameters;
81
85
  setGLParameters(this.device.gl, glParameters);
82
86
  }
@@ -1,5 +1,5 @@
1
- import type { UniformValue, RenderPipelineProps, Binding } from '@luma.gl/core';
2
- import type { ShaderLayout } from '@luma.gl/core';
1
+ import type { RenderPipelineProps, RenderPipelineParameters, PrimitiveTopology } from '@luma.gl/core';
2
+ import type { ShaderLayout, UniformValue, Binding } from '@luma.gl/core';
3
3
  import type { RenderPass, VertexArray } from '@luma.gl/core';
4
4
  import { RenderPipeline } from '@luma.gl/core';
5
5
  import { WebGLDevice } from "../webgl-device.js";
@@ -40,7 +40,8 @@ export declare class WEBGLRenderPipeline extends RenderPipeline {
40
40
  */
41
41
  draw(options: {
42
42
  renderPass: RenderPass;
43
- /** vertex attributes */
43
+ parameters?: RenderPipelineParameters;
44
+ topology?: PrimitiveTopology;
44
45
  vertexArray: VertexArray;
45
46
  vertexCount?: number;
46
47
  indexCount?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-render-pipeline.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pipeline.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,YAAY,EAAE,mBAAmB,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAC9E,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,cAAc,EAAsC,MAAM,eAAe,CAAC;AAUlF,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,OAAO,EAAC,WAAW,EAAC,0BAAuB;AAK3C,OAAO,EAAC,sBAAsB,EAAC,sCAAmC;AAKlE,oCAAoC;AACpC,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,yDAAyD;IACzD,MAAM,EAAE,WAAW,CAAC;IACpB,yCAAyC;IACzC,MAAM,EAAE,YAAY,CAAC;IACrB,oBAAoB;IACpB,EAAE,EAAE,WAAW,CAAC;IAChB,sBAAsB;IACtB,EAAE,EAAE,WAAW,CAAC;IAChB,mEAAmE;IACnE,kBAAkB,EAAE,YAAY,CAAC;IAEjC,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC,CAAM;IAC5C,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,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O,CAAC,EAAE,OAAO,CAAC,EAAE;QAAC,eAAe,CAAC,EAAE,OAAO,CAAA;KAAC,GAAG,IAAI;IAyD3F;;;OAGG;IACH,IAAI,CAAC,OAAO,EAAE;QACZ,UAAU,EAAE,UAAU,CAAC;QACvB,UAAU,CAAC,EAAE,wBAAwB,CAAC;QACtC,QAAQ,CAAC,EAAE,iBAAiB,CAAC;QAC7B,WAAW,EAAE,WAAW,CAAC;QACzB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,sBAAsB,CAAC;KAC5C,GAAG,OAAO;IA6FF,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,YAAY,CAAC;cAkBhD,YAAY;IA2B5B,wFAAwF;IACxF,iBAAiB,CAAC,MAAM,EAAE,SAAS,GAAG,SAAS,GAAG,YAAY;IAmB9D;;;;OAIG;IACH,cAAc,IAAI,SAAS,GAAG,SAAS,GAAG,YAAY;IAmBtD,6DAA6D;IACvD,oBAAoB,IAAI,OAAO,CAAC,IAAI,CAAC;IAoB3C;;;;OAIG;IACH,sBAAsB;IAatB,iDAAiD;IACjD,cAAc;IAyFd;;;OAGG;IACH,cAAc;CASf"}
@@ -92,7 +92,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
92
92
  const validBindings = this.shaderLayout.bindings
93
93
  .map(binding => `"${binding.name}"`)
94
94
  .join(', ');
95
- if (options?.disableWarnings) {
95
+ if (!options?.disableWarnings) {
96
96
  log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
97
97
  }
98
98
  continue; // eslint-disable-line no-continue
@@ -128,14 +128,14 @@ export class WEBGLRenderPipeline extends RenderPipeline {
128
128
  * This function unifies those ways into a single call using common parameters with sane defaults
129
129
  */
130
130
  draw(options) {
131
- const { renderPass, vertexArray, vertexCount,
131
+ const { renderPass, parameters = this.props.parameters, topology = this.props.topology, vertexArray, vertexCount,
132
132
  // indexCount,
133
133
  instanceCount, firstVertex = 0,
134
134
  // firstIndex,
135
135
  // firstInstance,
136
136
  // baseVertex,
137
137
  transformFeedback } = options;
138
- const glDrawMode = getGLDrawMode(this.props.topology);
138
+ const glDrawMode = getGLDrawMode(topology);
139
139
  const isIndexed = Boolean(vertexArray.indexBuffer);
140
140
  const glIndexType = vertexArray.indexBuffer?.glIndexType;
141
141
  const isInstanced = Number(instanceCount) > 0;
@@ -167,7 +167,7 @@ export class WEBGLRenderPipeline extends RenderPipeline {
167
167
  this._applyBindings();
168
168
  this._applyUniforms();
169
169
  const webglRenderPass = renderPass;
170
- withDeviceAndGLParameters(this.device, this.props.parameters, webglRenderPass.glParameters, () => {
170
+ withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {
171
171
  if (isIndexed && isInstanced) {
172
172
  this.device.gl.drawElementsInstanced(glDrawMode, vertexCount || 0, // indexCount?
173
173
  glIndexType, firstVertex, instanceCount || 0);
@@ -62,11 +62,11 @@ export class WEBGLShader extends Shader {
62
62
  // Sync case - slower, but advantage is that it throws in the constructor, making break on error more useful
63
63
  if (!this.device.features.has('compilation-status-async-webgl')) {
64
64
  this._getCompilationStatus();
65
+ // The `Shader` base class will determine if debug window should be opened based on this.compilationStatus
66
+ this.debugShader();
65
67
  if (this.compilationStatus === 'error') {
66
68
  throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
67
69
  }
68
- // The `Shader` base class will determine if debug window should be opened based on this.compilationStatus
69
- this.debugShader();
70
70
  return;
71
71
  }
72
72
  // async case
package/dist/dist.dev.js CHANGED
@@ -2311,10 +2311,10 @@ var __exports__ = (() => {
2311
2311
  if (parameters.depthBias !== void 0) {
2312
2312
  gl.polygonOffset(parameters.depthBias, parameters.depthBiasSlopeScale || 0);
2313
2313
  }
2314
- if (device.features.has("provoking-vertex-webgl")) {
2315
- const extensions = webglDevice.getExtension("WEBGL_provoking_vertex");
2316
- const ext = extensions.WEBGL_provoking_vertex;
2317
- if (parameters.provokingVertex) {
2314
+ if (parameters.provokingVertex) {
2315
+ if (device.features.has("provoking-vertex-webgl")) {
2316
+ const extensions = webglDevice.getExtension("WEBGL_provoking_vertex");
2317
+ const ext = extensions.WEBGL_provoking_vertex;
2318
2318
  const vertex = map(
2319
2319
  "provokingVertex",
2320
2320
  parameters.provokingVertex,
@@ -2326,19 +2326,21 @@ var __exports__ = (() => {
2326
2326
  ext?.provokingVertexWEBGL(vertex);
2327
2327
  }
2328
2328
  }
2329
- if (device.features.has("polygon-mode-webgl")) {
2330
- const extensions = webglDevice.getExtension("WEBGL_polygon_mode");
2331
- const ext = extensions.WEBGL_polygon_mode;
2332
- if (parameters.polygonMode) {
2333
- const mode = map("polygonMode", parameters.polygonMode, {
2334
- fill: 6914 /* FILL_WEBGL */,
2335
- line: 6913 /* LINE_WEBGL */
2336
- });
2337
- ext?.polygonModeWEBGL(1028 /* FRONT */, mode);
2338
- ext?.polygonModeWEBGL(1029 /* BACK */, mode);
2339
- }
2340
- if (parameters.polygonOffsetLine) {
2341
- gl.enable(10754 /* POLYGON_OFFSET_LINE_WEBGL */);
2329
+ if (parameters.polygonMode || parameters.polygonOffsetLine) {
2330
+ if (device.features.has("polygon-mode-webgl")) {
2331
+ if (parameters.polygonMode) {
2332
+ const extensions = webglDevice.getExtension("WEBGL_polygon_mode");
2333
+ const ext = extensions.WEBGL_polygon_mode;
2334
+ const mode = map("polygonMode", parameters.polygonMode, {
2335
+ fill: 6914 /* FILL_WEBGL */,
2336
+ line: 6913 /* LINE_WEBGL */
2337
+ });
2338
+ ext?.polygonModeWEBGL(1028 /* FRONT */, mode);
2339
+ ext?.polygonModeWEBGL(1029 /* BACK */, mode);
2340
+ }
2341
+ if (parameters.polygonOffsetLine) {
2342
+ gl.enable(10754 /* POLYGON_OFFSET_LINE_WEBGL */);
2343
+ }
2342
2344
  }
2343
2345
  }
2344
2346
  if (device.features.has("shader-clip-cull-distance-webgl")) {
@@ -3971,10 +3973,10 @@ ${source2}`;
3971
3973
  }
3972
3974
  if (!this.device.features.has("compilation-status-async-webgl")) {
3973
3975
  this._getCompilationStatus();
3976
+ this.debugShader();
3974
3977
  if (this.compilationStatus === "error") {
3975
3978
  throw new Error(`GLSL compilation errors in ${this.props.stage} shader ${this.props.id}`);
3976
3979
  }
3977
- this.debugShader();
3978
3980
  return;
3979
3981
  }
3980
3982
  import_core14.log.once(1, "Shader compilation is asynchronous")();
@@ -4016,6 +4018,7 @@ ${source2}`;
4016
4018
  var GL_STENCIL_BUFFER_BIT = 1024;
4017
4019
  var GL_COLOR_BUFFER_BIT = 16384;
4018
4020
  var GL_COLOR = 6144;
4021
+ var COLOR_CHANNELS = [1, 2, 4, 8];
4019
4022
  var WEBGLRenderPass = class extends import_core15.RenderPass {
4020
4023
  device;
4021
4024
  /** Parameters that should be applied before each draw call */
@@ -4074,6 +4077,11 @@ ${source2}`;
4074
4077
  console.warn("RenderPassParameters.stencilReference not yet implemented in WebGL");
4075
4078
  parameters[2967 /* STENCIL_REF */] = parameters.stencilReference;
4076
4079
  }
4080
+ if (parameters.colorMask) {
4081
+ glParameters.colorMask = COLOR_CHANNELS.map(
4082
+ (channel) => Boolean(channel & parameters.colorMask)
4083
+ );
4084
+ }
4077
4085
  this.glParameters = glParameters;
4078
4086
  setGLParameters(this.device.gl, glParameters);
4079
4087
  }
@@ -4815,7 +4823,7 @@ ${source2}`;
4815
4823
  const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
4816
4824
  if (!binding) {
4817
4825
  const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
4818
- if (options?.disableWarnings) {
4826
+ if (!options?.disableWarnings) {
4819
4827
  import_core17.log.warn(
4820
4828
  `Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`
4821
4829
  )();
@@ -4852,6 +4860,8 @@ ${source2}`;
4852
4860
  draw(options) {
4853
4861
  const {
4854
4862
  renderPass,
4863
+ parameters = this.props.parameters,
4864
+ topology = this.props.topology,
4855
4865
  vertexArray,
4856
4866
  vertexCount,
4857
4867
  // indexCount,
@@ -4862,7 +4872,7 @@ ${source2}`;
4862
4872
  // baseVertex,
4863
4873
  transformFeedback
4864
4874
  } = options;
4865
- const glDrawMode = getGLDrawMode(this.props.topology);
4875
+ const glDrawMode = getGLDrawMode(topology);
4866
4876
  const isIndexed = Boolean(vertexArray.indexBuffer);
4867
4877
  const glIndexType = vertexArray.indexBuffer?.glIndexType;
4868
4878
  const isInstanced = Number(instanceCount) > 0;
@@ -4886,37 +4896,32 @@ ${source2}`;
4886
4896
  this._applyBindings();
4887
4897
  this._applyUniforms();
4888
4898
  const webglRenderPass = renderPass;
4889
- withDeviceAndGLParameters(
4890
- this.device,
4891
- this.props.parameters,
4892
- webglRenderPass.glParameters,
4893
- () => {
4894
- if (isIndexed && isInstanced) {
4895
- this.device.gl.drawElementsInstanced(
4896
- glDrawMode,
4897
- vertexCount || 0,
4898
- // indexCount?
4899
- glIndexType,
4900
- firstVertex,
4901
- instanceCount || 0
4902
- );
4903
- } else if (isIndexed) {
4904
- this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex);
4905
- } else if (isInstanced) {
4906
- this.device.gl.drawArraysInstanced(
4907
- glDrawMode,
4908
- firstVertex,
4909
- vertexCount || 0,
4910
- instanceCount || 0
4911
- );
4912
- } else {
4913
- this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);
4914
- }
4915
- if (transformFeedback) {
4916
- transformFeedback.end();
4917
- }
4899
+ withDeviceAndGLParameters(this.device, parameters, webglRenderPass.glParameters, () => {
4900
+ if (isIndexed && isInstanced) {
4901
+ this.device.gl.drawElementsInstanced(
4902
+ glDrawMode,
4903
+ vertexCount || 0,
4904
+ // indexCount?
4905
+ glIndexType,
4906
+ firstVertex,
4907
+ instanceCount || 0
4908
+ );
4909
+ } else if (isIndexed) {
4910
+ this.device.gl.drawElements(glDrawMode, vertexCount || 0, glIndexType, firstVertex);
4911
+ } else if (isInstanced) {
4912
+ this.device.gl.drawArraysInstanced(
4913
+ glDrawMode,
4914
+ firstVertex,
4915
+ vertexCount || 0,
4916
+ instanceCount || 0
4917
+ );
4918
+ } else {
4919
+ this.device.gl.drawArrays(glDrawMode, firstVertex, vertexCount || 0);
4918
4920
  }
4919
- );
4921
+ if (transformFeedback) {
4922
+ transformFeedback.end();
4923
+ }
4924
+ });
4920
4925
  vertexArray.unbindAfterRender(renderPass);
4921
4926
  return true;
4922
4927
  }