@luma.gl/webgl 9.3.2 → 9.3.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/webgl",
3
- "version": "9.3.2",
3
+ "version": "9.3.4",
4
4
  "description": "WebGL2 adapter for the luma.gl core API",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -61,5 +61,5 @@
61
61
  "@math.gl/types": "^4.1.0",
62
62
  "@probe.gl/env": "^4.1.1"
63
63
  },
64
- "gitHead": "8f60fca63dc43702af5b16d0381fd97d7ace7dc9"
64
+ "gitHead": "f430daba8be25561034dca6bb0af3ea487c9d1c8"
65
65
  }
@@ -36,19 +36,20 @@ export class WEBGLFramebuffer extends Framebuffer {
36
36
  // default framebuffer handle is null, so we can't set debug metadata...
37
37
  device._setWebGLDebugMetadata(this.handle, this, {spector: this.props});
38
38
 
39
- // Auto create textures for attachments if needed
40
- this.autoCreateAttachmentTextures();
39
+ if (!props.handle) {
40
+ // Auto create textures for attachments if needed
41
+ this.autoCreateAttachmentTextures();
41
42
 
42
- this.updateAttachments();
43
+ this.updateAttachments();
44
+ }
43
45
  }
44
46
  }
45
47
 
46
48
  /** destroys any auto created resources etc. */
47
49
  override destroy(): void {
48
50
  super.destroy(); // destroys owned resources etc.
49
- if (!this.destroyed && this.handle !== null) {
51
+ if (!this.destroyed && this.handle !== null && !this.props.handle) {
50
52
  this.gl.deleteFramebuffer(this.handle);
51
- // this.handle = null;
52
53
  }
53
54
  }
54
55
 
@@ -35,7 +35,7 @@ export class WEBGLRenderPass extends RenderPass {
35
35
  // If no viewport is provided, apply reasonably defaults
36
36
  let viewport: NumberArray4 | undefined;
37
37
  if (!props?.parameters?.viewport) {
38
- if (!isDefaultFramebuffer) {
38
+ if (!isDefaultFramebuffer && webglFramebuffer) {
39
39
  // Set the viewport to the size of the framebuffer
40
40
  const {width, height} = webglFramebuffer;
41
41
  viewport = [0, 0, width, height];
@@ -51,13 +51,11 @@ export class WEBGLRenderPass extends RenderPass {
51
51
  this.setParameters({viewport, ...this.props.parameters});
52
52
 
53
53
  // Specify mapping of draw buffer locations to color attachments
54
- // Default framebuffers can only be set to GL.BACK or GL.NONE
55
- if (!isDefaultFramebuffer) {
54
+ if (!isDefaultFramebuffer && webglFramebuffer?.colorAttachments.length) {
56
55
  const drawBuffers = webglFramebuffer.colorAttachments.map((_, i) => GL.COLOR_ATTACHMENT0 + i);
57
56
  this.device.gl.drawBuffers(drawBuffers);
58
- } else {
59
- // Default framebuffer only supports GL.BACK/GL.NONE draw buffers, even when
60
- // passed through an explicit framebuffer wrapper.
57
+ } else if (isDefaultFramebuffer) {
58
+ // Default framebuffer only supports GL.BACK/GL.NONE draw buffers
61
59
  this.device.gl.drawBuffers([GL.BACK]);
62
60
  }
63
61