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

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.
@@ -15,40 +15,9 @@ export declare class WEBGLFramebuffer extends Framebuffer {
15
15
  constructor(device: WebGLDevice, props: FramebufferProps);
16
16
  /** destroys any auto created resources etc. */
17
17
  destroy(): void;
18
+ protected updateAttachments(): void;
18
19
  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
19
20
  protected createDepthStencilTexture(format: TextureFormat): Texture;
20
- /**
21
- * Attachment resize is expected to be a noop if size is same
22
- *
23
- protected override resizeAttachments(width: number, height: number): this {
24
- // for default framebuffer, just update the stored size
25
- if (this.handle === null) {
26
- // assert(width === undefined && height === undefined);
27
- this.width = this.gl.drawingBufferWidth;
28
- this.height = this.gl.drawingBufferHeight;
29
- return this;
30
- }
31
-
32
- if (width === undefined) {
33
- width = this.gl.drawingBufferWidth;
34
- }
35
- if (height === undefined) {
36
- height = this.gl.drawingBufferHeight;
37
- }
38
-
39
- // TODO Not clear that this is better than default destroy/create implementation
40
-
41
- for (const colorAttachment of this.colorAttachments) {
42
- colorAttachment.texture.clone({width, height});
43
- }
44
- if (this.depthStencilAttachment) {
45
- this.depthStencilAttachment.texture.resize({width, height});
46
- }
47
- return this;
48
- }
49
- */
50
- /** Attach one attachment */
51
- protected _attachTexture(attachmentPoint: GL, textureView: WEBGLTextureView): void;
52
21
  /**
53
22
  * @param attachment
54
23
  * @param texture
@@ -57,4 +26,34 @@ export declare class WEBGLFramebuffer extends Framebuffer {
57
26
  */
58
27
  protected _attachTextureView(attachment: GL, textureView: WEBGLTextureView): void;
59
28
  }
29
+ /**
30
+ * Attachment resize is expected to be a noop if size is same
31
+ *
32
+ protected override resizeAttachments(width: number, height: number): this {
33
+ // for default framebuffer, just update the stored size
34
+ if (this.handle === null) {
35
+ // assert(width === undefined && height === undefined);
36
+ this.width = this.gl.drawingBufferWidth;
37
+ this.height = this.gl.drawingBufferHeight;
38
+ return this;
39
+ }
40
+
41
+ if (width === undefined) {
42
+ width = this.gl.drawingBufferWidth;
43
+ }
44
+ if (height === undefined) {
45
+ height = this.gl.drawingBufferHeight;
46
+ }
47
+
48
+ // TODO Not clear that this is better than default destroy/create implementation
49
+
50
+ for (const colorAttachment of this.colorAttachments) {
51
+ colorAttachment.texture.clone({width, height});
52
+ }
53
+ if (this.depthStencilAttachment) {
54
+ this.depthStencilAttachment.texture.resize({width, height});
55
+ }
56
+ return this;
57
+ }
58
+ */
60
59
  //# sourceMappingURL=webgl-framebuffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AACnD,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AAGtD,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAEzD,iDAAiD;AACjD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,EAAE,WAAW,CAAC;IACpB,EAAE,EAAE,sBAAsB,CAAC;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,gBAAgB,EAAE,gBAAgB,EAAE,CAAM;IAC1C,sBAAsB,EAAE,gBAAgB,GAAG,IAAI,CAAQ;gBAE3C,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IAsDxD,+CAA+C;IACtC,OAAO,IAAI,IAAI;IAUxB,mGAAmG;cAChF,yBAAyB,CAAC,MAAM,EA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AAU,EAAE,EAAE,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI;CA8BlF;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BE"}
@@ -25,29 +25,7 @@ export class WEBGLFramebuffer extends Framebuffer {
25
25
  device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
26
26
  // Auto create textures for attachments if needed
27
27
  this.autoCreateAttachmentTextures();
28
- /** Attach from a map of attachments */
29
- // @ts-expect-error native bindFramebuffer is overridden by our state tracker
30
- const prevHandle = this.gl.bindFramebuffer(36160, this.handle);
31
- // Walk the attachments
32
- for (let i = 0; i < this.colorAttachments.length; ++i) {
33
- const attachment = this.colorAttachments[i];
34
- const attachmentPoint = 36064 + i;
35
- if (attachment) {
36
- this._attachTexture(attachmentPoint, attachment);
37
- }
38
- }
39
- if (this.depthStencilAttachment) {
40
- this._attachTexture(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format), this.depthStencilAttachment);
41
- }
42
- /** Check the status */
43
- // @ts-expect-error
44
- if (props.check !== false) {
45
- const status = this.gl.checkFramebufferStatus(36160);
46
- if (status !== 36053) {
47
- throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
48
- }
49
- }
50
- this.gl.bindFramebuffer(36160, prevHandle);
28
+ this.updateAttachments();
51
29
  }
52
30
  }
53
31
  /** destroys any auto created resources etc. */
@@ -58,6 +36,32 @@ export class WEBGLFramebuffer extends Framebuffer {
58
36
  // this.handle = null;
59
37
  }
60
38
  }
39
+ updateAttachments() {
40
+ /** Attach from a map of attachments */
41
+ // @ts-expect-error native bindFramebuffer is overridden by our state tracker
42
+ const prevHandle = this.gl.bindFramebuffer(36160, this.handle);
43
+ // Walk the attachments
44
+ for (let i = 0; i < this.colorAttachments.length; ++i) {
45
+ const attachment = this.colorAttachments[i];
46
+ if (attachment) {
47
+ const attachmentPoint = 36064 + i;
48
+ this._attachTextureView(attachmentPoint, attachment);
49
+ }
50
+ }
51
+ if (this.depthStencilAttachment) {
52
+ const attachmentPoint = getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format);
53
+ this._attachTextureView(attachmentPoint, this.depthStencilAttachment);
54
+ }
55
+ /** Check the status */
56
+ // @ts-expect-error
57
+ if (this.props.check !== false) {
58
+ const status = this.gl.checkFramebufferStatus(36160);
59
+ if (status !== 36053) {
60
+ throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
61
+ }
62
+ }
63
+ this.gl.bindFramebuffer(36160, prevHandle);
64
+ }
61
65
  // PRIVATE
62
66
  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
63
67
  createDepthStencilTexture(format) {
@@ -70,44 +74,6 @@ export class WEBGLFramebuffer extends Framebuffer {
70
74
  mipmaps: false
71
75
  });
72
76
  }
73
- /**
74
- * Attachment resize is expected to be a noop if size is same
75
- *
76
- protected override resizeAttachments(width: number, height: number): this {
77
- // for default framebuffer, just update the stored size
78
- if (this.handle === null) {
79
- // assert(width === undefined && height === undefined);
80
- this.width = this.gl.drawingBufferWidth;
81
- this.height = this.gl.drawingBufferHeight;
82
- return this;
83
- }
84
-
85
- if (width === undefined) {
86
- width = this.gl.drawingBufferWidth;
87
- }
88
- if (height === undefined) {
89
- height = this.gl.drawingBufferHeight;
90
- }
91
-
92
- // TODO Not clear that this is better than default destroy/create implementation
93
-
94
- for (const colorAttachment of this.colorAttachments) {
95
- colorAttachment.texture.clone({width, height});
96
- }
97
- if (this.depthStencilAttachment) {
98
- this.depthStencilAttachment.texture.resize({width, height});
99
- }
100
- return this;
101
- }
102
- */
103
- /** Attach one attachment */
104
- _attachTexture(attachmentPoint, textureView) {
105
- // if (attachment instanceof WEBGLRenderbuffer) {
106
- // this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
107
- // return attachment;
108
- // }
109
- this._attachTextureView(attachmentPoint, textureView);
110
- }
111
77
  /**
112
78
  * @param attachment
113
79
  * @param texture
@@ -171,3 +137,33 @@ function _getFrameBufferStatus(status) {
171
137
  return `${status}`;
172
138
  }
173
139
  }
140
+ /**
141
+ * Attachment resize is expected to be a noop if size is same
142
+ *
143
+ protected override resizeAttachments(width: number, height: number): this {
144
+ // for default framebuffer, just update the stored size
145
+ if (this.handle === null) {
146
+ // assert(width === undefined && height === undefined);
147
+ this.width = this.gl.drawingBufferWidth;
148
+ this.height = this.gl.drawingBufferHeight;
149
+ return this;
150
+ }
151
+
152
+ if (width === undefined) {
153
+ width = this.gl.drawingBufferWidth;
154
+ }
155
+ if (height === undefined) {
156
+ height = this.gl.drawingBufferHeight;
157
+ }
158
+
159
+ // TODO Not clear that this is better than default destroy/create implementation
160
+
161
+ for (const colorAttachment of this.colorAttachments) {
162
+ colorAttachment.texture.clone({width, height});
163
+ }
164
+ if (this.depthStencilAttachment) {
165
+ this.depthStencilAttachment.texture.resize({width, height});
166
+ }
167
+ return this;
168
+ }
169
+ */
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-texture.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-texture.ts"],"names":[],"mappings":"AAYA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,gBAAgB,EAChB,OAAO,EACP,YAAY,EAGZ,eAAe,EACf,aAAa,EAEb,aAAa,EACb,aAAa,EACb,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,oBAAoB,EACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EAAC,OAAO,EAAM,MAAM,eAAe,CAAC;AAC3C,OAAO,EACL,EAAE,EACF,WAAW,EACX,mBAAmB,EACnB,iBAAiB,EACjB,eAAe,EAChB,MAAM,oBAAoB,CAAC;AAM5B,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AA2CtD;;GAEG;AACH,qBAAa,YAAa,SAAQ,OAAO;IACvC,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,EAAE,WAAW,C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B,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAI3C,2BAA2B;IAC3B,gBAAgB,CAAC,OAAO,EAAE,aAAa,EAAE,KAAK,SAAI,GAAG,IAAI;IAmBzD;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,aAAa,GAAG,IAAI;IAW3C;;;;;OAKG;IACH,kBAAkB,CAAC,IAAI,EAAE,eAAe,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IASlE;;;OAGG;IACH,mBAAmB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI;IAOjD;;;OAGG;IACH,uBAAuB,CAAC,IAAI,EAAE,oBAAoB,GAAG,IAAI;IAIzD,sBAAsB,CAAC,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,GAAE,MAAU,GAAG,IAAI;IAgB9F,8CAA8C;IAC9C,mBAAmB,CAAC,OAAO,KAAA,GAAG,IAAI;IAkClC,gBAAgB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,GAAG,EAAE,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,EAAE,EAAE,GAAG,CAAC;IAarE;;OAEG;IACH,qBAAqB,CAAC,UAAU,EAAE,mBAAmB,GAAG,IAAI;IAkG5D;;;OAGG;IACH,SAAS,CAAC,YAAY,CACpB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,aAAa,EAC1B,QAAQ,GAAE,EAAkB;IAgC9B,aAAa,IAAI,MAAM;IAIvB,IAAI,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM;IAYlC,MAAM,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;CAWjD"}
@@ -89,6 +89,7 @@ export class WEBGLTexture extends Texture {
89
89
  /** For automatically updating video */
90
90
  _video = null;
91
91
  constructor(device, props) {
92
+ props = Texture._fixProps(props);
92
93
  // Note: Clear out `props.data` so that we don't hold a reference to any big memory chunks
93
94
  super(device, { ...Texture.defaultProps, ...props, data: undefined });
94
95
  this.device = device;
@@ -10,6 +10,7 @@ import type { BufferProps, ShaderProps, SamplerProps, TextureProps, ExternalText
10
10
  import { WEBGLBuffer } from "./resources/webgl-buffer.js";
11
11
  import { WEBGLShader } from "./resources/webgl-shader.js";
12
12
  import { WEBGLSampler } from "./resources/webgl-sampler.js";
13
+ import { WEBGLTexture } from "./resources/webgl-texture.js";
13
14
  import { WEBGLFramebuffer } from "./resources/webgl-framebuffer.js";
14
15
  import { WEBGLRenderPass } from "./resources/webgl-render-pass.js";
15
16
  import { WEBGLRenderPipeline } from "./resources/webgl-render-pipeline.js";
@@ -57,7 +58,7 @@ export declare class WebGLDevice extends Device {
57
58
  isTextureFormatRenderable(format: TextureFormat): boolean;
58
59
  createCanvasContext(props?: CanvasContextProps): CanvasContext;
59
60
  createBuffer(props: BufferProps | ArrayBuffer | ArrayBufferView): WEBGLBuffer;
60
- _createTexture(props: TextureProps): Texture;
61
+ createTexture(props: TextureProps): WEBGLTexture;
61
62
  createExternalTexture(props: ExternalTextureProps): ExternalTexture;
62
63
  createSampler(props: SamplerProps): WEBGLSampler;
63
64
  createShader(props: ShaderProps): WEBGLShader;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-device.d.ts","sourceRoot":"","sources":["../../src/adapter/webgl-device.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,EACV,WAAW,EACX,UAAU,EACV,kBAAkB,EAClB,aAAa,EACb,MAAM,EACN,OAAO,EACP,WAAW,EACX,WAAW,EACX,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,MAAM,EAAE,aAAa,EAAM,MAAM,eAAe,CAAC;AACzD,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAIrD,OAAO,EAAC,mBAAmB,EAAC,kDAA+C;AAC3E,OAAO,EAAC,iBAAiB,EAAC,gD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AIpD,UAAU,CAAC,OAAO,CAAC,EAAE;QAC5B,WAAW,CAAC,EAAE,WAAW,CAAC;QAC1B,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,KAAK,CAAC,EAAE,GAAG,CAAC;QACZ,OAAO,CAAC,EAAE,GAAG,CAAC;KACf,GAAG,IAAI;IAIC,UAAU,IAAI,IAAI;IAS3B;;;OAGG;IACM,UAAU,IAAI,OAAO;IAgB9B,8DAA8D;IAC9D,SAAS,IAAI,IAAI;IAKjB,8CAA8C;IAC9C,QAAQ,IAAI,IAAI;IAKhB;;;OAGG;IACH,kBAAkB,CAAC,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAMlE;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,EAAE,sBAAsB,GAAG,MAAM;IAc7D,sBAAsB;IACtB,UAAU,EAAE,CAAC,UAAU,GAAG,IAAI,CAAC,EAAE,CAAC;IAElC;;;;;OAKG;IACH,yBAAyB,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,GAAG,IAAI;IA2BvE,gDAAgD;IAChD,YAAY,CAAC,IAAI,EAAE,MAAM,YAAY,GAAG,YAAY;CAIrD"}
@@ -134,8 +134,7 @@ export class WebGLDevice extends Device {
134
134
  const newProps = this._getBufferProps(props);
135
135
  return new WEBGLBuffer(this, newProps);
136
136
  }
137
- // _createTexture(props: TextureProps): WEBGLTexture {
138
- _createTexture(props) {
137
+ createTexture(props) {
139
138
  return new WEBGLTexture(this, props);
140
139
  }
141
140
  createExternalTexture(props) {
package/dist/dist.dev.js CHANGED
@@ -2897,6 +2897,7 @@ var __exports__ = (() => {
2897
2897
  /** For automatically updating video */
2898
2898
  _video = null;
2899
2899
  constructor(device, props) {
2900
+ props = import_core8.Texture._fixProps(props);
2900
2901
  super(device, { ...import_core8.Texture.defaultProps, ...props, data: void 0 });
2901
2902
  this.device = device;
2902
2903
  this.gl = this.device.gl;
@@ -3327,30 +3328,7 @@ var __exports__ = (() => {
3327
3328
  if (!isDefaultFramebuffer) {
3328
3329
  device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
3329
3330
  this.autoCreateAttachmentTextures();
3330
- const prevHandle = this.gl.bindFramebuffer(
3331
- 36160 /* FRAMEBUFFER */,
3332
- this.handle
3333
- );
3334
- for (let i = 0; i < this.colorAttachments.length; ++i) {
3335
- const attachment = this.colorAttachments[i];
3336
- const attachmentPoint = 36064 /* COLOR_ATTACHMENT0 */ + i;
3337
- if (attachment) {
3338
- this._attachTexture(attachmentPoint, attachment);
3339
- }
3340
- }
3341
- if (this.depthStencilAttachment) {
3342
- this._attachTexture(
3343
- getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format),
3344
- this.depthStencilAttachment
3345
- );
3346
- }
3347
- if (props.check !== false) {
3348
- const status = this.gl.checkFramebufferStatus(36160 /* FRAMEBUFFER */);
3349
- if (status !== 36053 /* FRAMEBUFFER_COMPLETE */) {
3350
- throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
3351
- }
3352
- }
3353
- this.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, prevHandle);
3331
+ this.updateAttachments();
3354
3332
  }
3355
3333
  }
3356
3334
  /** destroys any auto created resources etc. */
@@ -3360,6 +3338,32 @@ var __exports__ = (() => {
3360
3338
  this.gl.deleteFramebuffer(this.handle);
3361
3339
  }
3362
3340
  }
3341
+ updateAttachments() {
3342
+ const prevHandle = this.gl.bindFramebuffer(
3343
+ 36160 /* FRAMEBUFFER */,
3344
+ this.handle
3345
+ );
3346
+ for (let i = 0; i < this.colorAttachments.length; ++i) {
3347
+ const attachment = this.colorAttachments[i];
3348
+ if (attachment) {
3349
+ const attachmentPoint = 36064 /* COLOR_ATTACHMENT0 */ + i;
3350
+ this._attachTextureView(attachmentPoint, attachment);
3351
+ }
3352
+ }
3353
+ if (this.depthStencilAttachment) {
3354
+ const attachmentPoint = getDepthStencilAttachmentWebGL(
3355
+ this.depthStencilAttachment.props.format
3356
+ );
3357
+ this._attachTextureView(attachmentPoint, this.depthStencilAttachment);
3358
+ }
3359
+ if (this.props.check !== false) {
3360
+ const status = this.gl.checkFramebufferStatus(36160 /* FRAMEBUFFER */);
3361
+ if (status !== 36053 /* FRAMEBUFFER_COMPLETE */) {
3362
+ throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
3363
+ }
3364
+ }
3365
+ this.gl.bindFramebuffer(36160 /* FRAMEBUFFER */, prevHandle);
3366
+ }
3363
3367
  // PRIVATE
3364
3368
  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
3365
3369
  createDepthStencilTexture(format) {
@@ -3371,40 +3375,6 @@ var __exports__ = (() => {
3371
3375
  mipmaps: false
3372
3376
  });
3373
3377
  }
3374
- /**
3375
- * Attachment resize is expected to be a noop if size is same
3376
- *
3377
- protected override resizeAttachments(width: number, height: number): this {
3378
- // for default framebuffer, just update the stored size
3379
- if (this.handle === null) {
3380
- // assert(width === undefined && height === undefined);
3381
- this.width = this.gl.drawingBufferWidth;
3382
- this.height = this.gl.drawingBufferHeight;
3383
- return this;
3384
- }
3385
-
3386
- if (width === undefined) {
3387
- width = this.gl.drawingBufferWidth;
3388
- }
3389
- if (height === undefined) {
3390
- height = this.gl.drawingBufferHeight;
3391
- }
3392
-
3393
- // TODO Not clear that this is better than default destroy/create implementation
3394
-
3395
- for (const colorAttachment of this.colorAttachments) {
3396
- colorAttachment.texture.clone({width, height});
3397
- }
3398
- if (this.depthStencilAttachment) {
3399
- this.depthStencilAttachment.texture.resize({width, height});
3400
- }
3401
- return this;
3402
- }
3403
- */
3404
- /** Attach one attachment */
3405
- _attachTexture(attachmentPoint, textureView) {
3406
- this._attachTextureView(attachmentPoint, textureView);
3407
- }
3408
3378
  /**
3409
3379
  * @param attachment
3410
3380
  * @param texture
@@ -5864,8 +5834,7 @@ ${source2}`;
5864
5834
  const newProps = this._getBufferProps(props);
5865
5835
  return new WEBGLBuffer(this, newProps);
5866
5836
  }
5867
- // _createTexture(props: TextureProps): WEBGLTexture {
5868
- _createTexture(props) {
5837
+ createTexture(props) {
5869
5838
  return new WEBGLTexture(this, props);
5870
5839
  }
5871
5840
  createExternalTexture(props) {