@luma.gl/webgl 9.1.0-alpha.9 → 9.1.0-beta.11

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.
Files changed (198) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts +3 -3
  2. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  3. package/dist/adapter/converters/device-parameters.js +1 -0
  4. package/dist/adapter/converters/device-parameters.js.map +1 -0
  5. package/dist/adapter/converters/sampler-parameters.js +7 -4
  6. package/dist/adapter/converters/sampler-parameters.js.map +1 -0
  7. package/dist/adapter/converters/shader-formats.js +1 -0
  8. package/dist/adapter/converters/shader-formats.js.map +1 -0
  9. package/dist/adapter/converters/vertex-formats.js +1 -0
  10. package/dist/adapter/converters/vertex-formats.js.map +1 -0
  11. package/dist/adapter/converters/webgl-texture-table.d.ts +40 -0
  12. package/dist/adapter/converters/webgl-texture-table.d.ts.map +1 -0
  13. package/dist/adapter/converters/webgl-texture-table.js +304 -0
  14. package/dist/adapter/converters/webgl-texture-table.js.map +1 -0
  15. package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
  16. package/dist/adapter/device-helpers/webgl-device-features.js +2 -2
  17. package/dist/adapter/device-helpers/webgl-device-features.js.map +1 -0
  18. package/dist/adapter/device-helpers/webgl-device-info.js +1 -0
  19. package/dist/adapter/device-helpers/webgl-device-info.js.map +1 -0
  20. package/dist/adapter/device-helpers/webgl-device-limits.js +1 -0
  21. package/dist/adapter/device-helpers/webgl-device-limits.js.map +1 -0
  22. package/dist/adapter/helpers/decode-webgl-types.js +1 -0
  23. package/dist/adapter/helpers/decode-webgl-types.js.map +1 -0
  24. package/dist/adapter/helpers/format-utils.d.ts.map +1 -0
  25. package/dist/{classic → adapter/helpers}/format-utils.js +7 -0
  26. package/dist/adapter/helpers/format-utils.js.map +1 -0
  27. package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
  28. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  29. package/dist/adapter/helpers/get-shader-layout.js +5 -4
  30. package/dist/adapter/helpers/get-shader-layout.js.map +1 -0
  31. package/dist/adapter/helpers/parse-shader-compiler-log.js +1 -0
  32. package/dist/adapter/helpers/parse-shader-compiler-log.js.map +1 -0
  33. package/dist/adapter/helpers/set-uniform.js +1 -0
  34. package/dist/adapter/helpers/set-uniform.js.map +1 -0
  35. package/dist/adapter/helpers/typed-array-utils.d.ts.map +1 -0
  36. package/dist/{classic → adapter/helpers}/typed-array-utils.js +1 -0
  37. package/dist/adapter/helpers/typed-array-utils.js.map +1 -0
  38. package/dist/adapter/helpers/webgl-texture-utils.d.ts +96 -25
  39. package/dist/adapter/helpers/webgl-texture-utils.d.ts.map +1 -1
  40. package/dist/adapter/helpers/webgl-texture-utils.js +225 -236
  41. package/dist/adapter/helpers/webgl-texture-utils.js.map +1 -0
  42. package/dist/adapter/helpers/webgl-topology-utils.js +1 -0
  43. package/dist/adapter/helpers/webgl-topology-utils.js.map +1 -0
  44. package/dist/adapter/resources/webgl-buffer.js +1 -0
  45. package/dist/adapter/resources/webgl-buffer.js.map +1 -0
  46. package/dist/adapter/resources/webgl-command-buffer.d.ts +59 -2
  47. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  48. package/dist/adapter/resources/webgl-command-buffer.js +89 -32
  49. package/dist/adapter/resources/webgl-command-buffer.js.map +1 -0
  50. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  51. package/dist/adapter/resources/webgl-command-encoder.js +4 -0
  52. package/dist/adapter/resources/webgl-command-encoder.js.map +1 -0
  53. package/dist/adapter/resources/webgl-external-texture.js +15 -0
  54. package/dist/adapter/resources/webgl-external-texture.js.map +1 -0
  55. package/dist/adapter/resources/webgl-framebuffer.d.ts +33 -35
  56. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  57. package/dist/adapter/resources/webgl-framebuffer.js +68 -73
  58. package/dist/adapter/resources/webgl-framebuffer.js.map +1 -0
  59. package/dist/adapter/resources/webgl-query-set.js +1 -0
  60. package/dist/adapter/resources/webgl-query-set.js.map +1 -0
  61. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  62. package/dist/adapter/resources/webgl-render-pass.js +30 -17
  63. package/dist/adapter/resources/webgl-render-pass.js.map +1 -0
  64. package/dist/adapter/resources/webgl-render-pipeline.d.ts +2 -4
  65. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  66. package/dist/adapter/resources/webgl-render-pipeline.js +33 -18
  67. package/dist/adapter/resources/webgl-render-pipeline.js.map +1 -0
  68. package/dist/adapter/resources/webgl-sampler.js +1 -0
  69. package/dist/adapter/resources/webgl-sampler.js.map +1 -0
  70. package/dist/adapter/resources/webgl-shader.d.ts +1 -0
  71. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  72. package/dist/adapter/resources/webgl-shader.js +8 -5
  73. package/dist/adapter/resources/webgl-shader.js.map +1 -0
  74. package/dist/adapter/resources/webgl-texture-view.js +1 -0
  75. package/dist/adapter/resources/webgl-texture-view.js.map +1 -0
  76. package/dist/adapter/resources/webgl-texture.d.ts +32 -20
  77. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  78. package/dist/adapter/resources/webgl-texture.js +158 -218
  79. package/dist/adapter/resources/webgl-texture.js.map +1 -0
  80. package/dist/adapter/resources/webgl-transform-feedback.js +1 -0
  81. package/dist/adapter/resources/webgl-transform-feedback.js.map +1 -0
  82. package/dist/adapter/resources/webgl-vertex-array.js +1 -0
  83. package/dist/adapter/resources/webgl-vertex-array.js.map +1 -0
  84. package/dist/adapter/webgl-adapter.d.ts.map +1 -1
  85. package/dist/adapter/webgl-adapter.js +5 -10
  86. package/dist/adapter/webgl-adapter.js.map +1 -0
  87. package/dist/adapter/webgl-canvas-context.d.ts +1 -0
  88. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  89. package/dist/adapter/webgl-canvas-context.js +4 -0
  90. package/dist/adapter/webgl-canvas-context.js.map +1 -0
  91. package/dist/adapter/webgl-device.d.ts +11 -14
  92. package/dist/adapter/webgl-device.d.ts.map +1 -1
  93. package/dist/adapter/webgl-device.js +60 -39
  94. package/dist/adapter/webgl-device.js.map +1 -0
  95. package/dist/context/debug/spector-types.js +2 -1
  96. package/dist/context/debug/spector-types.js.map +1 -0
  97. package/dist/context/debug/spector.d.ts +5 -5
  98. package/dist/context/debug/spector.d.ts.map +1 -1
  99. package/dist/context/debug/spector.js +7 -6
  100. package/dist/context/debug/spector.js.map +1 -0
  101. package/dist/context/debug/webgl-developer-tools.d.ts +2 -3
  102. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  103. package/dist/context/debug/webgl-developer-tools.js +7 -19
  104. package/dist/context/debug/webgl-developer-tools.js.map +1 -0
  105. package/dist/context/helpers/create-browser-context.d.ts +6 -22
  106. package/dist/context/helpers/create-browser-context.d.ts.map +1 -1
  107. package/dist/context/helpers/create-browser-context.js +41 -32
  108. package/dist/context/helpers/create-browser-context.js.map +1 -0
  109. package/dist/context/helpers/webgl-context-data.js +1 -0
  110. package/dist/context/helpers/webgl-context-data.js.map +1 -0
  111. package/dist/context/helpers/webgl-extensions.js +1 -0
  112. package/dist/context/helpers/webgl-extensions.js.map +1 -0
  113. package/dist/context/parameters/unified-parameter-api.js +1 -0
  114. package/dist/context/parameters/unified-parameter-api.js.map +1 -0
  115. package/dist/context/parameters/webgl-parameter-tables.d.ts +1 -1
  116. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  117. package/dist/context/parameters/webgl-parameter-tables.js +3 -2
  118. package/dist/context/parameters/webgl-parameter-tables.js.map +1 -0
  119. package/dist/context/polyfills/polyfill-webgl1-extensions.js +1 -0
  120. package/dist/context/polyfills/polyfill-webgl1-extensions.js.map +1 -0
  121. package/dist/context/state-tracker/deep-array-equal.js +1 -0
  122. package/dist/context/state-tracker/deep-array-equal.js.map +1 -0
  123. package/dist/context/state-tracker/webgl-state-tracker.js +1 -0
  124. package/dist/context/state-tracker/webgl-state-tracker.js.map +1 -0
  125. package/dist/context/state-tracker/with-parameters.js +1 -0
  126. package/dist/context/state-tracker/with-parameters.js.map +1 -0
  127. package/dist/deprecated/accessor.d.ts.map +1 -0
  128. package/dist/{classic → deprecated}/accessor.js +37 -1
  129. package/dist/deprecated/accessor.js.map +1 -0
  130. package/dist/dist.dev.js +2217 -2366
  131. package/dist/dist.min.js +2 -2
  132. package/dist/index.cjs +2098 -2240
  133. package/dist/index.cjs.map +4 -4
  134. package/dist/index.d.ts +2 -3
  135. package/dist/index.d.ts.map +1 -1
  136. package/dist/index.js +3 -4
  137. package/dist/index.js.map +1 -0
  138. package/dist/types.js +1 -0
  139. package/dist/types.js.map +1 -0
  140. package/dist/utils/fill-array.d.ts +4 -4
  141. package/dist/utils/fill-array.d.ts.map +1 -1
  142. package/dist/utils/fill-array.js +1 -0
  143. package/dist/utils/fill-array.js.map +1 -0
  144. package/dist/utils/load-script.js +1 -0
  145. package/dist/utils/load-script.js.map +1 -0
  146. package/dist/utils/split-uniforms-and-bindings.d.ts +1 -1
  147. package/dist/utils/split-uniforms-and-bindings.d.ts.map +1 -1
  148. package/dist/utils/split-uniforms-and-bindings.js +1 -0
  149. package/dist/utils/split-uniforms-and-bindings.js.map +1 -0
  150. package/dist/utils/uid.js +1 -0
  151. package/dist/utils/uid.js.map +1 -0
  152. package/package.json +5 -5
  153. package/src/adapter/converters/device-parameters.ts +3 -3
  154. package/src/adapter/converters/sampler-parameters.ts +6 -4
  155. package/src/adapter/converters/webgl-texture-table.ts +404 -0
  156. package/src/adapter/device-helpers/webgl-device-features.ts +5 -2
  157. package/src/{classic → adapter/helpers}/format-utils.ts +6 -0
  158. package/src/adapter/helpers/get-shader-layout.ts +7 -4
  159. package/src/adapter/helpers/webgl-texture-utils.ts +400 -57
  160. package/src/adapter/resources/webgl-command-buffer.ts +125 -41
  161. package/src/adapter/resources/webgl-command-encoder.ts +6 -0
  162. package/src/adapter/resources/webgl-external-texture.ts +14 -0
  163. package/src/adapter/resources/webgl-framebuffer.ts +77 -83
  164. package/src/adapter/resources/webgl-render-pass.ts +52 -41
  165. package/src/adapter/resources/webgl-render-pipeline.ts +44 -21
  166. package/src/adapter/resources/webgl-shader.ts +8 -6
  167. package/src/adapter/resources/webgl-texture.ts +183 -250
  168. package/src/adapter/webgl-adapter.ts +4 -12
  169. package/src/adapter/webgl-canvas-context.ts +4 -0
  170. package/src/adapter/webgl-device.ts +100 -72
  171. package/src/context/debug/spector-types.ts +1 -1
  172. package/src/context/debug/spector.ts +11 -11
  173. package/src/context/debug/webgl-developer-tools.ts +8 -31
  174. package/src/context/helpers/create-browser-context.ts +53 -63
  175. package/src/context/parameters/webgl-parameter-tables.ts +2 -2
  176. package/src/{classic → deprecated}/accessor.ts +44 -3
  177. package/src/index.ts +2 -5
  178. package/src/utils/fill-array.ts +4 -4
  179. package/src/utils/split-uniforms-and-bindings.ts +3 -3
  180. package/dist/adapter/converters/texture-formats.d.ts +0 -83
  181. package/dist/adapter/converters/texture-formats.d.ts.map +0 -1
  182. package/dist/adapter/converters/texture-formats.js +0 -511
  183. package/dist/classic/accessor.d.ts.map +0 -1
  184. package/dist/classic/clear.d.ts +0 -22
  185. package/dist/classic/clear.d.ts.map +0 -1
  186. package/dist/classic/clear.js +0 -86
  187. package/dist/classic/copy-and-blit.d.ts +0 -64
  188. package/dist/classic/copy-and-blit.d.ts.map +0 -1
  189. package/dist/classic/copy-and-blit.js +0 -194
  190. package/dist/classic/format-utils.d.ts.map +0 -1
  191. package/dist/classic/typed-array-utils.d.ts.map +0 -1
  192. package/src/adapter/converters/texture-formats.ts +0 -657
  193. package/src/classic/clear.ts +0 -115
  194. package/src/classic/copy-and-blit.ts +0 -323
  195. /package/dist/{classic → adapter/helpers}/format-utils.d.ts +0 -0
  196. /package/dist/{classic → adapter/helpers}/typed-array-utils.d.ts +0 -0
  197. /package/dist/{classic → deprecated}/accessor.d.ts +0 -0
  198. /package/src/{classic → adapter/helpers}/typed-array-utils.ts +0 -0
@@ -1,6 +1,6 @@
1
1
  import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/core';
2
2
  import { CommandBuffer } from '@luma.gl/core';
3
- import { GL } from '@luma.gl/constants';
3
+ import { GL, GLTextureTarget, GLTextureCubeMapTarget } from '@luma.gl/constants';
4
4
  import { WebGLDevice } from "../webgl-device.js";
5
5
  type CopyBufferToBufferCommand = {
6
6
  name: 'copy-buffer-to-buffer';
@@ -18,14 +18,71 @@ type CopyTextureToTextureCommand = {
18
18
  name: 'copy-texture-to-texture';
19
19
  options: CopyTextureToTextureOptions;
20
20
  };
21
- type Command = CopyBufferToBufferCommand | CopyBufferToTextureCommand | CopyTextureToBufferCommand | CopyTextureToTextureCommand;
21
+ type ClearTextureCommand = {
22
+ name: 'clear-texture';
23
+ options: {};
24
+ };
25
+ type ReadTextureCommand = {
26
+ name: 'read-texture';
27
+ options: {};
28
+ };
29
+ type Command = CopyBufferToBufferCommand | CopyBufferToTextureCommand | CopyTextureToBufferCommand | CopyTextureToTextureCommand | ClearTextureCommand | ReadTextureCommand;
22
30
  export declare class WEBGLCommandBuffer extends CommandBuffer {
23
31
  device: WebGLDevice;
24
32
  commands: Command[];
25
33
  constructor(device: WebGLDevice);
26
34
  submitCommands(commands?: Command[]): void;
27
35
  }
36
+ /** Clear one mip level of a texture *
37
+ function _clearTexture(device: WebGLDevice, options: ClearTextureOptions) {
38
+ const BORDER = 0;
39
+ const {dimension, width, height, depth = 0, mipLevel = 0} = options;
40
+ const {glInternalFormat, glFormat, glType, compressed} = options;
41
+ const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
42
+
43
+ switch (dimension) {
44
+ case '2d-array':
45
+ case '3d':
46
+ if (compressed) {
47
+ // prettier-ignore
48
+ device.gl.compressedTexImage3D(glTarget, mipLevel, glInternalFormat, width, height, depth, BORDER, null);
49
+ } else {
50
+ // prettier-ignore
51
+ device.gl.texImage3D( glTarget, mipLevel, glInternalFormat, width, height, depth, BORDER, glFormat, glType, null);
52
+ }
53
+ break;
54
+
55
+ case '2d':
56
+ case 'cube':
57
+ if (compressed) {
58
+ // prettier-ignore
59
+ device.gl.compressedTexImage2D(glTarget, mipLevel, glInternalFormat, width, height, BORDER, null);
60
+ } else {
61
+ // prettier-ignore
62
+ device.gl.texImage2D(glTarget, mipLevel, glInternalFormat, width, height, BORDER, glFormat, glType, null);
63
+ }
64
+ break;
65
+
66
+ default:
67
+ throw new Error(dimension);
68
+ }
69
+ }
70
+ */
71
+ /**
72
+ * In WebGL, cube maps specify faces by overriding target instead of using the depth parameter.
73
+ * @note We still bind the texture using GL.TEXTURE_CUBE_MAP, but we need to use the face-specific target when setting mip levels.
74
+ * @returns glTarget unchanged, if dimension !== 'cube'.
75
+ */
76
+ export declare function getWebGLCubeFaceTarget(glTarget: GLTextureTarget, dimension: '1d' | '2d' | '2d-array' | 'cube' | 'cube-array' | '3d', level: number): GLTextureTarget | GLTextureCubeMapTarget;
77
+ /**
78
+ * Returns number of components in a specific readPixels WebGL format
79
+ * @todo use shadertypes utils instead?
80
+ */
28
81
  export declare function glFormatToComponents(format: any): 1 | 2 | 3 | 4;
82
+ /**
83
+ * Return byte count for given readPixels WebGL type
84
+ * @todo use shadertypes utils instead?
85
+ */
29
86
  export declare function glTypeToBytes(type: GL): 1 | 2 | 4;
30
87
  export {};
31
88
  //# sourceMappingURL=webgl-command-buffer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,aAAa,EAAuB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAC,WAAW,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MAAM,KAAA,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAmB1D;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAcjD"}
@@ -4,7 +4,7 @@
4
4
  import { CommandBuffer, Texture } from '@luma.gl/core';
5
5
  import { GL } from '@luma.gl/constants';
6
6
  import { WEBGLTexture } from "./webgl-texture.js";
7
- import { getTextureFormatWebGL } from "../converters/texture-formats.js";
7
+ import { getTextureFormatWebGL } from "../converters/webgl-texture-table.js";
8
8
  export class WEBGLCommandBuffer extends CommandBuffer {
9
9
  device;
10
10
  commands = [];
@@ -27,13 +27,18 @@ export class WEBGLCommandBuffer extends CommandBuffer {
27
27
  case 'copy-texture-to-texture':
28
28
  _copyTextureToTexture(this.device, command.options);
29
29
  break;
30
+ // case 'clear-texture':
31
+ // _clearTexture(this.device, command.options);
32
+ // break;
33
+ default:
34
+ throw new Error(command.name);
30
35
  }
31
36
  }
32
37
  }
33
38
  }
34
39
  function _copyBufferToBuffer(device, options) {
35
- const source = options.source;
36
- const destination = options.destination;
40
+ const source = options.sourceBuffer;
41
+ const destination = options.destinationBuffer;
37
42
  // {In WebGL2 we can p}erform the copy on the GPU
38
43
  // Use GL.COPY_READ_BUFFER+GL.COPY_WRITE_BUFFER avoid disturbing other targets and locking type
39
44
  device.gl.bindBuffer(36662, source.handle);
@@ -56,19 +61,19 @@ function _copyBufferToTexture(device, options) {
56
61
  function _copyTextureToBuffer(device, options) {
57
62
  const {
58
63
  /** Texture to copy to/from. */
59
- source,
64
+ sourceTexture,
60
65
  /** Mip-map level of the texture to copy to/from. (Default 0) */
61
66
  mipLevel = 0,
62
67
  /** Defines which aspects of the texture to copy to/from. */
63
68
  aspect = 'all',
64
69
  /** Width to copy */
65
- width = options.source.width,
70
+ width = options.sourceTexture.width,
66
71
  /** Height to copy */
67
- height = options.source.height, depthOrArrayLayers = 0,
72
+ height = options.sourceTexture.height, depthOrArrayLayers = 0,
68
73
  /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
69
74
  origin = [0, 0],
70
75
  /** Destination buffer */
71
- destination,
76
+ destinationBuffer,
72
77
  /** Offset, in bytes, from the beginning of the buffer to the start of the image data (default 0) */
73
78
  byteOffset = 0,
74
79
  /**
@@ -84,17 +89,17 @@ function _copyTextureToBuffer(device, options) {
84
89
  rowsPerImage } = options;
85
90
  // TODO - Not possible to read just stencil or depth part in WebGL?
86
91
  if (aspect !== 'all') {
87
- throw new Error('not supported');
92
+ throw new Error('aspect not supported in WebGL');
88
93
  }
89
94
  // TODO - mipLevels are set when attaching texture to framebuffer
90
95
  if (mipLevel !== 0 || depthOrArrayLayers !== 0 || bytesPerRow || rowsPerImage) {
91
96
  throw new Error('not implemented');
92
97
  }
93
98
  // Asynchronous read (PIXEL_PACK_BUFFER) is WebGL2 only feature
94
- const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
99
+ const { framebuffer, destroyFramebuffer } = getFramebuffer(sourceTexture);
95
100
  let prevHandle;
96
101
  try {
97
- const webglBuffer = destination;
102
+ const webglBuffer = destinationBuffer;
98
103
  const sourceWidth = width || framebuffer.width;
99
104
  const sourceHeight = height || framebuffer.height;
100
105
  const sourceParams = getTextureFormatWebGL(framebuffer.colorAttachments[0].texture.props.format);
@@ -148,7 +153,7 @@ export function readPixelsToBuffer(
148
153
  function _copyTextureToTexture(device, options) {
149
154
  const {
150
155
  /** Texture to copy to/from. */
151
- source,
156
+ sourceTexture,
152
157
  /** Mip-map level of the texture to copy to (Default 0) */
153
158
  destinationMipLevel = 0,
154
159
  /** Defines which aspects of the texture to copy to/from. */
@@ -158,7 +163,7 @@ function _copyTextureToTexture(device, options) {
158
163
  /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to. */
159
164
  destinationOrigin = [0, 0],
160
165
  /** Texture to copy to/from. */
161
- destination
166
+ destinationTexture
162
167
  /** Mip-map level of the texture to copy to/from. (Default 0) */
163
168
  // destinationMipLevel = options.mipLevel,
164
169
  /** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
@@ -166,10 +171,10 @@ function _copyTextureToTexture(device, options) {
166
171
  /** Defines which aspects of the texture to copy to/from. */
167
172
  // destinationAspect = options.aspect,
168
173
  } = options;
169
- let { width = options.destination.width, height = options.destination.height
174
+ let { width = options.destinationTexture.width, height = options.destinationTexture.height
170
175
  // depthOrArrayLayers = 0
171
176
  } = options;
172
- const { framebuffer, destroyFramebuffer } = getFramebuffer(source);
177
+ const { framebuffer, destroyFramebuffer } = getFramebuffer(sourceTexture);
173
178
  const [sourceX, sourceY] = origin;
174
179
  const [destinationX, destinationY, destinationZ] = destinationOrigin;
175
180
  // @ts-expect-error native bindFramebuffer is overridden by our state tracker
@@ -178,8 +183,8 @@ function _copyTextureToTexture(device, options) {
178
183
  // const prevBuffer = gl.readBuffer(attachment);
179
184
  let texture = null;
180
185
  let textureTarget;
181
- if (destination instanceof WEBGLTexture) {
182
- texture = destination;
186
+ if (destinationTexture instanceof WEBGLTexture) {
187
+ texture = destinationTexture;
183
188
  width = Number.isFinite(width) ? width : texture.width;
184
189
  height = Number.isFinite(height) ? height : texture.height;
185
190
  texture.bind(0);
@@ -207,7 +212,69 @@ function _copyTextureToTexture(device, options) {
207
212
  framebuffer.destroy();
208
213
  }
209
214
  }
210
- // Returns number of components in a specific readPixels WebGL format
215
+ /** Clear one mip level of a texture *
216
+ function _clearTexture(device: WebGLDevice, options: ClearTextureOptions) {
217
+ const BORDER = 0;
218
+ const {dimension, width, height, depth = 0, mipLevel = 0} = options;
219
+ const {glInternalFormat, glFormat, glType, compressed} = options;
220
+ const glTarget = getWebGLCubeFaceTarget(options.glTarget, dimension, depth);
221
+
222
+ switch (dimension) {
223
+ case '2d-array':
224
+ case '3d':
225
+ if (compressed) {
226
+ // prettier-ignore
227
+ device.gl.compressedTexImage3D(glTarget, mipLevel, glInternalFormat, width, height, depth, BORDER, null);
228
+ } else {
229
+ // prettier-ignore
230
+ device.gl.texImage3D( glTarget, mipLevel, glInternalFormat, width, height, depth, BORDER, glFormat, glType, null);
231
+ }
232
+ break;
233
+
234
+ case '2d':
235
+ case 'cube':
236
+ if (compressed) {
237
+ // prettier-ignore
238
+ device.gl.compressedTexImage2D(glTarget, mipLevel, glInternalFormat, width, height, BORDER, null);
239
+ } else {
240
+ // prettier-ignore
241
+ device.gl.texImage2D(glTarget, mipLevel, glInternalFormat, width, height, BORDER, glFormat, glType, null);
242
+ }
243
+ break;
244
+
245
+ default:
246
+ throw new Error(dimension);
247
+ }
248
+ }
249
+ */
250
+ // function _readTexture(device: WebGLDevice, options: CopyTextureToBufferOptions) {}
251
+ // HELPERS
252
+ /**
253
+ * In WebGL, cube maps specify faces by overriding target instead of using the depth parameter.
254
+ * @note We still bind the texture using GL.TEXTURE_CUBE_MAP, but we need to use the face-specific target when setting mip levels.
255
+ * @returns glTarget unchanged, if dimension !== 'cube'.
256
+ */
257
+ export function getWebGLCubeFaceTarget(glTarget, dimension, level) {
258
+ return dimension === 'cube' ? 34069 + level : glTarget;
259
+ }
260
+ /** Wrap a texture in a framebuffer so that we can use WebGL APIs that work on framebuffers */
261
+ function getFramebuffer(source) {
262
+ if (source instanceof Texture) {
263
+ const { width, height, id } = source;
264
+ const framebuffer = source.device.createFramebuffer({
265
+ id: `framebuffer-for-${id}`,
266
+ width,
267
+ height,
268
+ colorAttachments: [source]
269
+ });
270
+ return { framebuffer, destroyFramebuffer: true };
271
+ }
272
+ return { framebuffer: source, destroyFramebuffer: false };
273
+ }
274
+ /**
275
+ * Returns number of components in a specific readPixels WebGL format
276
+ * @todo use shadertypes utils instead?
277
+ */
211
278
  export function glFormatToComponents(format) {
212
279
  switch (format) {
213
280
  case 6406:
@@ -228,7 +295,10 @@ export function glFormatToComponents(format) {
228
295
  throw new Error('GLFormat');
229
296
  }
230
297
  }
231
- // Return byte count for given readPixels WebGL type
298
+ /**
299
+ * Return byte count for given readPixels WebGL type
300
+ * @todo use shadertypes utils instead?
301
+ */
232
302
  export function glTypeToBytes(type) {
233
303
  switch (type) {
234
304
  case 5121:
@@ -244,17 +314,4 @@ export function glTypeToBytes(type) {
244
314
  throw new Error('GLType');
245
315
  }
246
316
  }
247
- // Helper methods
248
- function getFramebuffer(source) {
249
- if (source instanceof Texture) {
250
- const { width, height, id } = source;
251
- const framebuffer = source.device.createFramebuffer({
252
- id: `framebuffer-for-${id}`,
253
- width,
254
- height,
255
- colorAttachments: [source]
256
- });
257
- return { framebuffer, destroyFramebuffer: true };
258
- }
259
- return { framebuffer: source, destroyFramebuffer: false };
260
- }
317
+ //# sourceMappingURL=webgl-command-buffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-command-buffer.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAUpC,OAAO,EAAC,aAAa,EAAE,OAAO,EAAc,MAAM,eAAe,CAAC;AAClE,OAAO,EACL,EAAE,EAMH,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAE7C,OAAO,EAAC,qBAAqB,EAAC,6CAA0C;AAwCxE,MAAM,OAAO,kBAAmB,SAAQ,aAAa;IACnD,MAAM,CAAc;IACpB,QAAQ,GAAc,EAAE,CAAC;IAEzB,YAAY,MAAmB;QAC7B,KAAK,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QAClB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAED,cAAc,CAAC,WAAsB,IAAI,CAAC,QAAQ;QAChD,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC/B,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;gBACrB,KAAK,uBAAuB;oBAC1B,mBAAmB,CAAC,IAAI,CAAC,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;oBAClD,MAAM;gBACR,KAAK,wBA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ACjD,CAAC;IACD,OAAO,EAAC,WAAW,EAAE,MAAqC,EAAE,kBAAkB,EAAE,KAAK,EAAC,CAAC;AACzF,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,oBAAoB,CAAC,MAAM;IACzC,QAAQ,MAAM,EAAE,CAAC;QACf,UAAc;QACd,WAAa;QACb;YACE,OAAO,CAAC,CAAC;QACX,WAAc;QACd;YACE,OAAO,CAAC,CAAC;QACX,UAAY;QACZ;YACE,OAAO,CAAC,CAAC;QACX,UAAa;QACb;YACE,OAAO,CAAC,CAAC;QACX,kDAAkD;QAClD;YACE,MAAM,IAAI,KAAK,CAAC,UAAU,CAAC,CAAC;IAChC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,IAAQ;IACpC,QAAQ,IAAI,EAAE,CAAC;QACb;YACE,OAAO,CAAC,CAAC;QACX,WAA6B;QAC7B,WAA+B;QAC/B;YACE,OAAO,CAAC,CAAC;QACX;YACE,OAAO,CAAC,CAAC;QACX,gDAAgD;QAChD;YACE,MAAM,IAAI,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC9B,CAAC;AACH,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,QAAQ,EACR,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,kBAAkB,EAAC,kCAA+B;AAC1D,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;gBAE/B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B,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAI5D,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;IAIvD,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAI9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAQvD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa;IAEb,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAE5C,eAAe,CACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,GACA,IAAI;CACR"}
@@ -30,8 +30,12 @@ export class WEBGLCommandEncoder extends CommandEncoder {
30
30
  copyTextureToTexture(options) {
31
31
  this.commandBuffer.commands.push({ name: 'copy-texture-to-texture', options });
32
32
  }
33
+ // clearTexture(options: ClearTextureOptions): void {
34
+ // this.commandBuffer.commands.push({name: 'copy-texture-to-texture', options});
35
+ // }
33
36
  pushDebugGroup(groupLabel) { }
34
37
  popDebugGroup() { }
35
38
  insertDebugMarker(markerLabel) { }
36
39
  resolveQuerySet(querySet, destination, options) { }
37
40
  }
41
+ //# sourceMappingURL=webgl-command-encoder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-command-encoder.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC,OAAO,EAAC,cAAc,EAAsB,MAAM,eAAe,CAAC;AAYlE,OAAO,EAAC,kBAAkB,EAAC,kCAA+B;AAG1D,MAAM,OAAO,mBAAoB,SAAQ,cAAc;IAC5C,MAAM,CAAc;IAEpB,aAAa,CAAqB;IAE3C,YAAY,MA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));
72
72
  return this;
73
73
  }
74
+ }
75
+
76
+ initialize() {
77
+ // TODO - Video handling, move to ExternalTexture?
78
+ // if (isVideo) {
79
+ // this._video = {
80
+ // video: data,
81
+ // // TODO - should we be using the sampler parameters here?
82
+ // parameters: {},
83
+ // // @ts-expect-error HTMLVideoElement.HAVE_CURRENT_DATA is not declared
84
+ // lastTime: data.readyState >= HTMLVideoElement.HAVE_CURRENT_DATA ? data.currentTime : -1
85
+ // };
86
+ // }
87
+ }
74
88
 
75
89
  update(): this {
76
90
  if (this._video) {
@@ -92,3 +106,4 @@ export class WEBGLExternalTexture extends WEBGLTexture {
92
106
 
93
107
 
94
108
  */
109
+ //# sourceMappingURL=webgl-external-texture.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-external-texture.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-external-texture.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwGE"}
@@ -1,5 +1,5 @@
1
- import type { FramebufferProps, TextureFormat } from '@luma.gl/core';
2
- import { Framebuffer, Texture } from '@luma.gl/core';
1
+ import type { FramebufferProps } from '@luma.gl/core';
2
+ import { Framebuffer } from '@luma.gl/core';
3
3
  import { GL } from '@luma.gl/constants';
4
4
  import { WebGLDevice } from "../webgl-device.js";
5
5
  import { WEBGLTexture } from "./webgl-texture.js";
@@ -15,40 +15,8 @@ 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
- 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
20
  /**
53
21
  * @param attachment
54
22
  * @param texture
@@ -57,4 +25,34 @@ export declare class WEBGLFramebuffer extends Framebuffer {
57
25
  */
58
26
  protected _attachTextureView(attachment: GL, textureView: WEBGLTextureView): void;
59
27
  }
28
+ /**
29
+ * Attachment resize is expected to be a noop if size is same
30
+ *
31
+ protected override resizeAttachments(width: number, height: number): this {
32
+ // for default framebuffer, just update the stored size
33
+ if (this.handle === null) {
34
+ // assert(width === undefined && height === undefined);
35
+ this.width = this.gl.drawingBufferWidth;
36
+ this.height = this.gl.drawingBufferHeight;
37
+ return this;
38
+ }
39
+
40
+ if (width === undefined) {
41
+ width = this.gl.drawingBufferWidth;
42
+ }
43
+ if (height === undefined) {
44
+ height = this.gl.drawingBufferHeight;
45
+ }
46
+
47
+ // TODO Not clear that this is better than default destroy/create implementation
48
+
49
+ for (const colorAttachment of this.colorAttachments) {
50
+ colorAttachment.texture.clone({width, height});
51
+ }
52
+ if (this.depthStencilAttachment) {
53
+ this.depthStencilAttachment.texture.resize({width, height});
54
+ }
55
+ return this;
56
+ }
57
+ */
60
58
  //# 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,EAAE,aAAa,GAAG,OAAO;IAW5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;MA6BE;IAEF,4BAA4B;IAC5B,SAAS,CAAC,cAAc,CAAC,eAAe,EAAE,EAAE,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI;IAQlF;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI;CA8BlF"}
1
+ {"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAC,MAAM,eAAe,CAAC;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,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;IAsBxD,+CAA+C;IACtC,OAAO,IAAI,IAAI;IAQxB,SAAS,CAAC,iBAAiB,IAAI,IAAI;IAqCnC,mGAAmG;IAYnG;;;;;OAKG;IACH,SAAS,CAAC,kBAAkB,CAAC,UAAU,EAAE,EAAE,EAAE,WAAW,EAAE,gBAAgB,GAAG,IAAI;CA8BlF;AAqCD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BE"}
@@ -3,8 +3,7 @@
3
3
  // Copyright (c) vis.gl contributors
4
4
  import { Framebuffer } from '@luma.gl/core';
5
5
  import { GL } from '@luma.gl/constants';
6
- import { WEBGLTexture } from "./webgl-texture.js";
7
- import { getDepthStencilAttachmentWebGL } from "../converters/texture-formats.js";
6
+ import { getDepthStencilAttachmentWebGL } from "../converters/webgl-texture-table.js";
8
7
  /** luma.gl Framebuffer, WebGL implementation */
9
8
  export class WEBGLFramebuffer extends Framebuffer {
10
9
  device;
@@ -25,29 +24,7 @@ export class WEBGLFramebuffer extends Framebuffer {
25
24
  device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
26
25
  // Auto create textures for attachments if needed
27
26
  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);
27
+ this.updateAttachments();
51
28
  }
52
29
  }
53
30
  /** destroys any auto created resources etc. */
@@ -58,56 +35,43 @@ export class WEBGLFramebuffer extends Framebuffer {
58
35
  // this.handle = null;
59
36
  }
60
37
  }
38
+ updateAttachments() {
39
+ /** Attach from a map of attachments */
40
+ // @ts-expect-error native bindFramebuffer is overridden by our state tracker
41
+ const prevHandle = this.gl.bindFramebuffer(36160, this.handle);
42
+ // Walk the attachments
43
+ for (let i = 0; i < this.colorAttachments.length; ++i) {
44
+ const attachment = this.colorAttachments[i];
45
+ if (attachment) {
46
+ const attachmentPoint = 36064 + i;
47
+ this._attachTextureView(attachmentPoint, attachment);
48
+ }
49
+ }
50
+ if (this.depthStencilAttachment) {
51
+ const attachmentPoint = getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format);
52
+ this._attachTextureView(attachmentPoint, this.depthStencilAttachment);
53
+ }
54
+ /** Check the status */
55
+ if (this.device.props.debug) {
56
+ const status = this.gl.checkFramebufferStatus(36160);
57
+ if (status !== 36053) {
58
+ throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
59
+ }
60
+ }
61
+ this.gl.bindFramebuffer(36160, prevHandle);
62
+ }
61
63
  // PRIVATE
62
64
  /** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
63
- createDepthStencilTexture(format) {
64
- // return new WEBGLRenderbuffer(this.device, {
65
- return new WEBGLTexture(this.device, {
66
- id: `${this.id}-depth-stencil`,
67
- format,
68
- width: this.width,
69
- height: this.height,
70
- mipmaps: false
71
- });
72
- }
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
- }
65
+ // protected override createDepthStencilTexture(format: TextureFormat): Texture {
66
+ // // return new WEBGLRenderbuffer(this.device, {
67
+ // return new WEBGLTexture(this.device, {
68
+ // id: `${this.id}-depth-stencil`,
69
+ // format,
70
+ // width: this.width,
71
+ // height: this.height,
72
+ // mipmaps: false
73
+ // });
74
+ // }
111
75
  /**
112
76
  * @param attachment
113
77
  * @param texture
@@ -171,3 +135,34 @@ function _getFrameBufferStatus(status) {
171
135
  return `${status}`;
172
136
  }
173
137
  }
138
+ /**
139
+ * Attachment resize is expected to be a noop if size is same
140
+ *
141
+ protected override resizeAttachments(width: number, height: number): this {
142
+ // for default framebuffer, just update the stored size
143
+ if (this.handle === null) {
144
+ // assert(width === undefined && height === undefined);
145
+ this.width = this.gl.drawingBufferWidth;
146
+ this.height = this.gl.drawingBufferHeight;
147
+ return this;
148
+ }
149
+
150
+ if (width === undefined) {
151
+ width = this.gl.drawingBufferWidth;
152
+ }
153
+ if (height === undefined) {
154
+ height = this.gl.drawingBufferHeight;
155
+ }
156
+
157
+ // TODO Not clear that this is better than default destroy/create implementation
158
+
159
+ for (const colorAttachment of this.colorAttachments) {
160
+ colorAttachment.texture.clone({width, height});
161
+ }
162
+ if (this.depthStencilAttachment) {
163
+ this.depthStencilAttachment.texture.resize({width, height});
164
+ }
165
+ return this;
166
+ }
167
+ */
168
+ //# sourceMappingURL=webgl-framebuffer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"webgl-framebuffer.js","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,oCAAoC;AAGpC,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAItC,OAAO,EAAC,8BAA8B,EAAC,6CAA0C;AAIjF,iDAAiD;AACjD,MAAM,OAAO,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,CAAc;IACpB,EAAE,CAAyB;IAC3B,MAAM,CAAmB;IAEzB,gBAAgB,GAAuB,EAAE,CAAC;IAC1C,sBAAsB,GAA4B,IAAI,CAAC;IAEvD,YAAY,MAAmB,EAAE,KAAuB;QACtD,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;QAErB,2CAA2C;QAC3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;QAC5B,2BAA2B;QAC3B,oFAAoF;QACpF;YACE,OAAO,GAAG,MAAM,EAAE,CAAC;IACvB,CAAC;AACH,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BE"}
@@ -134,3 +134,4 @@ export class WEBGLQuerySet extends QuerySet {
134
134
  return this._pollingPromise;
135
135
  }
136
136
  }
137
+ //# sourceMappingURL=webgl-query-set.js.map