@luma.gl/webgl 9.0.0-beta.9 → 9.0.3

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.
package/dist/index.cjs CHANGED
@@ -1348,12 +1348,8 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
1348
1348
  getWebGLExtension(gl, "EXT_color_buffer_float", extensions);
1349
1349
  }
1350
1350
  *[Symbol.iterator]() {
1351
- for (const feature of Object.keys(WEBGL_FEATURES)) {
1352
- if (this.has(feature)) {
1353
- yield feature;
1354
- }
1355
- }
1356
- for (const feature of Object.keys(TEXTURE_FEATURES)) {
1351
+ const features = this.getFeatures();
1352
+ for (const feature of features) {
1357
1353
  if (this.has(feature)) {
1358
1354
  yield feature;
1359
1355
  }
@@ -1377,10 +1373,15 @@ var WebGLDeviceFeatures = class extends import_core3.DeviceFeatures {
1377
1373
  }
1378
1374
  // FOR DEVICE
1379
1375
  initializeFeatures() {
1380
- for (const feature of this) {
1376
+ const features = this.getFeatures().filter((feature) => feature !== "polygon-mode-webgl");
1377
+ for (const feature of features) {
1378
+ this.has(feature);
1381
1379
  }
1382
1380
  }
1383
1381
  // IMPLEMENTATION
1382
+ getFeatures() {
1383
+ return [...Object.keys(WEBGL_FEATURES), ...Object.keys(TEXTURE_FEATURES)];
1384
+ }
1384
1385
  /** Extract all WebGL features */
1385
1386
  getWebGLFeature(feature) {
1386
1387
  const featureInfo = WEBGL_FEATURES[feature];
@@ -3866,9 +3867,9 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
3866
3867
  this.device.gl.transformFeedbackVaryings(this.handle, varyings, bufferMode);
3867
3868
  }
3868
3869
  this._linkShaders();
3869
- import_core17.log.time(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3870
+ import_core17.log.time(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3870
3871
  this.introspectedLayout = getShaderLayout(this.device.gl, this.handle);
3871
- import_core17.log.timeEnd(0, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3872
+ import_core17.log.timeEnd(1, `RenderPipeline ${this.id} - shaderLayout introspection`)();
3872
3873
  this.shaderLayout = (0, import_core18.mergeShaderLayout)(this.introspectedLayout, props.shaderLayout);
3873
3874
  switch (this.props.topology) {
3874
3875
  case "triangle-fan-webgl":
@@ -3888,12 +3889,14 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
3888
3889
  * Bindings include: textures, samplers and uniform buffers
3889
3890
  * @todo needed for portable model
3890
3891
  */
3891
- setBindings(bindings) {
3892
+ setBindings(bindings, options) {
3892
3893
  for (const [name, value] of Object.entries(bindings)) {
3893
3894
  const binding = this.shaderLayout.bindings.find((binding2) => binding2.name === name) || this.shaderLayout.bindings.find((binding2) => binding2.name === `${name}Uniforms`);
3894
3895
  if (!binding) {
3895
3896
  const validBindings = this.shaderLayout.bindings.map((binding2) => `"${binding2.name}"`).join(", ");
3896
- import_core17.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
3897
+ if (options == null ? void 0 : options.disableWarnings) {
3898
+ import_core17.log.warn(`Unknown binding "${name}" in render pipeline "${this.id}", expected one of ${validBindings}`)();
3899
+ }
3897
3900
  continue;
3898
3901
  }
3899
3902
  if (!value) {
@@ -4134,9 +4137,9 @@ var WEBGLRenderPipeline = class extends import_core17.RenderPipeline {
4134
4137
  texture = value.texture;
4135
4138
  } else if (value instanceof WEBGLTexture) {
4136
4139
  texture = value;
4137
- } else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTexture) {
4140
+ } else if (value instanceof WEBGLFramebuffer && value.colorAttachments[0] instanceof WEBGLTextureView) {
4138
4141
  import_core17.log.warn("Passing framebuffer in texture binding may be deprecated. Use fbo.colorAttachments[0] instead")();
4139
- texture = value.colorAttachments[0];
4142
+ texture = value.colorAttachments[0].texture;
4140
4143
  } else {
4141
4144
  throw new Error("No texture");
4142
4145
  }
@@ -4434,6 +4437,7 @@ var WEBGLVertexArray = class extends import_core21.VertexArray {
4434
4437
  this.device.gl.bindVertexArray(this.handle);
4435
4438
  this.device.gl.bindBuffer(34963, buffer ? buffer.handle : null);
4436
4439
  this.indexBuffer = buffer;
4440
+ this.device.gl.bindVertexArray(null);
4437
4441
  }
4438
4442
  /** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
4439
4443
  setBuffer(location, attributeBuffer) {
@@ -4452,20 +4456,15 @@ var WEBGLVertexArray = class extends import_core21.VertexArray {
4452
4456
  this.device.gl.enableVertexAttribArray(location);
4453
4457
  this.device.gl.vertexAttribDivisor(location, divisor || 0);
4454
4458
  this.attributes[location] = buffer;
4459
+ this.device.gl.bindVertexArray(null);
4455
4460
  }
4456
4461
  /** Set a location in vertex attributes array to a constant value, disables the location */
4457
4462
  setConstantWebGL(location, value) {
4458
4463
  this._enable(location, false);
4459
4464
  this.attributes[location] = value;
4460
4465
  }
4461
- init = false;
4462
4466
  bindBeforeRender() {
4463
4467
  this.device.gl.bindVertexArray(this.handle);
4464
- if (!this.init) {
4465
- const webglBuffer = this.indexBuffer;
4466
- this.device.gl.bindBuffer(34963, (webglBuffer == null ? void 0 : webglBuffer.handle) || null);
4467
- this.init = true;
4468
- }
4469
4468
  this._applyConstantAttributes();
4470
4469
  }
4471
4470
  unbindAfterRender() {