@luma.gl/webgl 9.1.0-alpha.12 → 9.1.0-alpha.13

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.1.0-alpha.12",
3
+ "version": "9.1.0-alpha.13",
4
4
  "description": "WebGL2 adapter for the luma.gl core API",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -43,9 +43,9 @@
43
43
  "@luma.gl/core": "9.1.0-alpha.10"
44
44
  },
45
45
  "dependencies": {
46
- "@luma.gl/constants": "9.1.0-alpha.12",
46
+ "@luma.gl/constants": "9.1.0-alpha.13",
47
47
  "@math.gl/types": "4.1.0-alpha.3",
48
48
  "@probe.gl/env": "^4.0.8"
49
49
  },
50
- "gitHead": "61b0080d5beb5284b8bdcec5cf59e13cda65295a"
50
+ "gitHead": "c2c641d67a5aec97467de13b0e3d8f9307ba03c2"
51
51
  }
@@ -39,39 +39,7 @@ export class WEBGLFramebuffer extends Framebuffer {
39
39
  // Auto create textures for attachments if needed
40
40
  this.autoCreateAttachmentTextures();
41
41
 
42
- /** Attach from a map of attachments */
43
- // @ts-expect-error native bindFramebuffer is overridden by our state tracker
44
- const prevHandle: WebGLFramebuffer | null = this.gl.bindFramebuffer(
45
- GL.FRAMEBUFFER,
46
- this.handle
47
- );
48
-
49
- // Walk the attachments
50
- for (let i = 0; i < this.colorAttachments.length; ++i) {
51
- const attachment = this.colorAttachments[i];
52
- const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
53
- if (attachment) {
54
- this._attachTexture(attachmentPoint, attachment);
55
- }
56
- }
57
-
58
- if (this.depthStencilAttachment) {
59
- this._attachTexture(
60
- getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format),
61
- this.depthStencilAttachment
62
- );
63
- }
64
-
65
- /** Check the status */
66
- // @ts-expect-error
67
- if (props.check !== false) {
68
- const status = this.gl.checkFramebufferStatus(GL.FRAMEBUFFER) as GL;
69
- if (status !== GL.FRAMEBUFFER_COMPLETE) {
70
- throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
71
- }
72
- }
73
-
74
- this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle);
42
+ this.updateAttachments();
75
43
  }
76
44
  }
77
45
 
@@ -84,6 +52,42 @@ export class WEBGLFramebuffer extends Framebuffer {
84
52
  }
85
53
  }
86
54
 
55
+ protected updateAttachments(): void {
56
+ /** Attach from a map of attachments */
57
+ // @ts-expect-error native bindFramebuffer is overridden by our state tracker
58
+ const prevHandle: WebGLFramebuffer | null = this.gl.bindFramebuffer(
59
+ GL.FRAMEBUFFER,
60
+ this.handle
61
+ );
62
+
63
+ // Walk the attachments
64
+ for (let i = 0; i < this.colorAttachments.length; ++i) {
65
+ const attachment = this.colorAttachments[i];
66
+ if (attachment) {
67
+ const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
68
+ this._attachTextureView(attachmentPoint, attachment);
69
+ }
70
+ }
71
+
72
+ if (this.depthStencilAttachment) {
73
+ const attachmentPoint = getDepthStencilAttachmentWebGL(
74
+ this.depthStencilAttachment.props.format
75
+ );
76
+ this._attachTextureView(attachmentPoint, this.depthStencilAttachment);
77
+ }
78
+
79
+ /** Check the status */
80
+ // @ts-expect-error
81
+ if (this.props.check !== false) {
82
+ const status = this.gl.checkFramebufferStatus(GL.FRAMEBUFFER) as GL;
83
+ if (status !== GL.FRAMEBUFFER_COMPLETE) {
84
+ throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
85
+ }
86
+ }
87
+
88
+ this.gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle);
89
+ }
90
+
87
91
  // PRIVATE
88
92
 
89
93
  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
@@ -129,15 +133,6 @@ export class WEBGLFramebuffer extends Framebuffer {
129
133
  }
130
134
  */
131
135
 
132
- /** Attach one attachment */
133
- protected _attachTexture(attachmentPoint: GL, textureView: WEBGLTextureView): void {
134
- // if (attachment instanceof WEBGLRenderbuffer) {
135
- // this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
136
- // return attachment;
137
- // }
138
- this._attachTextureView(attachmentPoint, textureView);
139
- }
140
-
141
136
  /**
142
137
  * @param attachment
143
138
  * @param texture