@luma.gl/webgl 9.0.0-beta.5 → 9.0.0-beta.7

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 (192) hide show
  1. package/dist/adapter/converters/device-parameters.d.ts.map +1 -1
  2. package/dist/adapter/converters/device-parameters.js +128 -71
  3. package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
  4. package/dist/adapter/converters/sampler-parameters.js +20 -19
  5. package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
  6. package/dist/adapter/converters/shader-formats.js +40 -20
  7. package/dist/adapter/converters/texture-formats.d.ts +16 -11
  8. package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
  9. package/dist/adapter/converters/texture-formats.js +224 -205
  10. package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
  11. package/dist/adapter/converters/vertex-formats.js +22 -21
  12. package/dist/adapter/device-helpers/webgl-device-features.d.ts +19 -5
  13. package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
  14. package/dist/adapter/device-helpers/webgl-device-features.js +89 -43
  15. package/dist/adapter/device-helpers/webgl-device-info.d.ts +2 -1
  16. package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -1
  17. package/dist/adapter/device-helpers/webgl-device-info.js +22 -19
  18. package/dist/adapter/device-helpers/webgl-device-limits.d.ts +33 -48
  19. package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -1
  20. package/dist/adapter/device-helpers/webgl-device-limits.js +42 -87
  21. package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -1
  22. package/dist/adapter/helpers/decode-webgl-types.js +47 -46
  23. package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
  24. package/dist/adapter/helpers/get-shader-layout.js +35 -34
  25. package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
  26. package/dist/adapter/helpers/parse-shader-compiler-log.js +3 -2
  27. package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
  28. package/dist/adapter/helpers/set-uniform.js +42 -41
  29. package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
  30. package/dist/adapter/helpers/webgl-topology-utils.js +40 -39
  31. package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
  32. package/dist/adapter/objects/constants-to-keys.js +2 -1
  33. package/dist/adapter/objects/webgl-renderbuffer.d.ts +2 -2
  34. package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
  35. package/dist/adapter/objects/webgl-renderbuffer.js +30 -17
  36. package/dist/adapter/objects/webgl-resource.d.ts +2 -24
  37. package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
  38. package/dist/adapter/objects/webgl-resource.js +6 -101
  39. package/dist/adapter/resources/webgl-buffer.d.ts +1 -1
  40. package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
  41. package/dist/adapter/resources/webgl-buffer.js +16 -15
  42. package/dist/adapter/resources/webgl-command-buffer.d.ts +1 -1
  43. package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
  44. package/dist/adapter/resources/webgl-command-buffer.js +32 -31
  45. package/dist/adapter/resources/webgl-command-encoder.d.ts +8 -3
  46. package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
  47. package/dist/adapter/resources/webgl-command-encoder.js +4 -2
  48. package/dist/adapter/resources/webgl-external-texture.js +6 -5
  49. package/dist/adapter/resources/webgl-framebuffer.d.ts +6 -10
  50. package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
  51. package/dist/adapter/resources/webgl-framebuffer.js +60 -53
  52. package/dist/adapter/resources/webgl-query-set.d.ts +44 -0
  53. package/dist/adapter/resources/webgl-query-set.d.ts.map +1 -0
  54. package/dist/adapter/resources/webgl-query-set.js +136 -0
  55. package/dist/adapter/resources/webgl-render-pass.d.ts +3 -1
  56. package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
  57. package/dist/adapter/resources/webgl-render-pass.js +20 -12
  58. package/dist/adapter/resources/webgl-render-pipeline.d.ts +4 -5
  59. package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
  60. package/dist/adapter/resources/webgl-render-pipeline.js +52 -61
  61. package/dist/adapter/resources/webgl-sampler.d.ts +1 -1
  62. package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
  63. package/dist/adapter/resources/webgl-sampler.js +5 -4
  64. package/dist/adapter/resources/webgl-shader.d.ts +3 -2
  65. package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
  66. package/dist/adapter/resources/webgl-shader.js +15 -9
  67. package/dist/adapter/resources/webgl-texture-view.d.ts +14 -0
  68. package/dist/adapter/resources/webgl-texture-view.d.ts.map +1 -0
  69. package/dist/adapter/resources/webgl-texture-view.js +18 -0
  70. package/dist/adapter/resources/webgl-texture.d.ts +6 -4
  71. package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
  72. package/dist/adapter/resources/webgl-texture.js +39 -32
  73. package/dist/adapter/resources/webgl-transform-feedback.d.ts +1 -1
  74. package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
  75. package/dist/adapter/resources/webgl-transform-feedback.js +10 -10
  76. package/dist/adapter/resources/webgl-vertex-array.d.ts +3 -3
  77. package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
  78. package/dist/adapter/resources/webgl-vertex-array.js +10 -9
  79. package/dist/adapter/webgl-canvas-context.d.ts +2 -2
  80. package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
  81. package/dist/adapter/webgl-canvas-context.js +3 -2
  82. package/dist/adapter/webgl-device.d.ts +35 -30
  83. package/dist/adapter/webgl-device.d.ts.map +1 -1
  84. package/dist/adapter/webgl-device.js +110 -109
  85. package/dist/classic/accessor.d.ts.map +1 -1
  86. package/dist/classic/accessor.js +8 -7
  87. package/dist/classic/clear.d.ts.map +1 -1
  88. package/dist/classic/clear.js +5 -4
  89. package/dist/classic/copy-and-blit.d.ts +1 -1
  90. package/dist/classic/copy-and-blit.d.ts.map +1 -1
  91. package/dist/classic/copy-and-blit.js +19 -19
  92. package/dist/classic/format-utils.d.ts.map +1 -1
  93. package/dist/classic/format-utils.js +16 -15
  94. package/dist/classic/typed-array-utils.d.ts.map +1 -1
  95. package/dist/classic/typed-array-utils.js +20 -19
  96. package/dist/context/debug/spector.d.ts.map +1 -1
  97. package/dist/context/debug/spector.js +2 -1
  98. package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
  99. package/dist/context/debug/webgl-developer-tools.js +7 -6
  100. package/dist/context/{context → helpers}/create-browser-context.d.ts.map +1 -1
  101. package/dist/context/{context → helpers}/create-browser-context.js +2 -1
  102. package/dist/context/{context/context-data.d.ts → helpers/webgl-context-data.d.ts} +2 -3
  103. package/dist/context/helpers/webgl-context-data.d.ts.map +1 -0
  104. package/dist/context/helpers/webgl-context-data.js +21 -0
  105. package/dist/context/helpers/webgl-extensions.d.ts +4 -0
  106. package/dist/context/helpers/webgl-extensions.d.ts.map +1 -0
  107. package/dist/context/helpers/webgl-extensions.js +10 -0
  108. package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
  109. package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
  110. package/dist/context/parameters/unified-parameter-api.js +7 -11
  111. package/dist/context/parameters/webgl-parameter-tables.d.ts +12 -13
  112. package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
  113. package/dist/context/parameters/webgl-parameter-tables.js +302 -295
  114. package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
  115. package/dist/context/state-tracker/deep-array-equal.js +2 -1
  116. package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
  117. package/dist/context/state-tracker/track-context-state.js +5 -4
  118. package/dist/context/state-tracker/with-parameters.d.ts +2 -3
  119. package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
  120. package/dist/context/state-tracker/with-parameters.js +6 -8
  121. package/dist/dist.dev.js +1635 -1387
  122. package/dist/index.cjs +1766 -1534
  123. package/dist/index.cjs.map +4 -4
  124. package/dist/index.d.ts +25 -25
  125. package/dist/index.d.ts.map +1 -1
  126. package/dist/index.js +24 -23
  127. package/dist/types.d.ts.map +1 -1
  128. package/dist/types.js +2 -1
  129. package/dist.min.js +6 -6
  130. package/package.json +4 -4
  131. package/src/adapter/converters/device-parameters.ts +114 -27
  132. package/src/adapter/converters/sampler-parameters.ts +12 -3
  133. package/src/adapter/converters/shader-formats.ts +47 -22
  134. package/src/adapter/converters/texture-formats.ts +138 -114
  135. package/src/adapter/converters/vertex-formats.ts +3 -3
  136. package/src/adapter/device-helpers/webgl-device-features.ts +102 -50
  137. package/src/adapter/device-helpers/webgl-device-info.ts +28 -19
  138. package/src/adapter/device-helpers/webgl-device-limits.ts +46 -150
  139. package/src/adapter/helpers/decode-webgl-types.ts +13 -7
  140. package/src/adapter/helpers/get-shader-layout.ts +4 -3
  141. package/src/adapter/helpers/parse-shader-compiler-log.ts +10 -6
  142. package/src/adapter/helpers/set-uniform.ts +2 -1
  143. package/src/adapter/helpers/webgl-topology-utils.ts +10 -3
  144. package/src/adapter/objects/constants-to-keys.ts +2 -1
  145. package/src/adapter/objects/webgl-renderbuffer.ts +36 -14
  146. package/src/adapter/objects/webgl-resource.ts +7 -125
  147. package/src/adapter/resources/webgl-buffer.ts +4 -3
  148. package/src/adapter/resources/webgl-command-buffer.ts +5 -5
  149. package/src/adapter/resources/webgl-command-encoder.ts +14 -11
  150. package/src/adapter/resources/webgl-external-texture.ts +6 -5
  151. package/src/adapter/resources/webgl-framebuffer.ts +61 -53
  152. package/src/adapter/resources/webgl-query-set.ts +171 -0
  153. package/src/adapter/resources/webgl-render-pass.ts +20 -11
  154. package/src/adapter/resources/webgl-render-pipeline.ts +54 -54
  155. package/src/adapter/resources/webgl-sampler.ts +2 -1
  156. package/src/adapter/resources/webgl-shader.ts +12 -5
  157. package/src/adapter/resources/webgl-texture-view.ts +28 -0
  158. package/src/adapter/resources/webgl-texture.ts +14 -3
  159. package/src/adapter/resources/webgl-transform-feedback.ts +2 -7
  160. package/src/adapter/resources/webgl-vertex-array.ts +4 -3
  161. package/src/adapter/webgl-canvas-context.ts +6 -4
  162. package/src/adapter/webgl-device.ts +116 -107
  163. package/src/classic/accessor.ts +5 -4
  164. package/src/classic/clear.ts +14 -8
  165. package/src/classic/copy-and-blit.ts +11 -4
  166. package/src/classic/format-utils.ts +2 -1
  167. package/src/classic/typed-array-utils.ts +3 -7
  168. package/src/context/debug/spector.ts +9 -6
  169. package/src/context/debug/webgl-developer-tools.ts +27 -14
  170. package/src/context/{context → helpers}/create-browser-context.ts +3 -2
  171. package/src/context/helpers/webgl-context-data.ts +31 -0
  172. package/src/context/helpers/webgl-extensions.ts +17 -0
  173. package/src/context/parameters/unified-parameter-api.ts +6 -17
  174. package/src/context/parameters/webgl-parameter-tables.ts +69 -32
  175. package/src/context/state-tracker/deep-array-equal.ts +2 -1
  176. package/src/context/state-tracker/track-context-state.ts +11 -6
  177. package/src/context/state-tracker/with-parameters.ts +8 -8
  178. package/src/index.ts +7 -6
  179. package/src/types.ts +2 -1
  180. package/dist/adapter/device-helpers/device-features.d.ts +0 -6
  181. package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
  182. package/dist/adapter/device-helpers/device-features.js +0 -65
  183. package/dist/adapter/device-helpers/device-limits.d.ts +0 -50
  184. package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
  185. package/dist/adapter/device-helpers/device-limits.js +0 -92
  186. package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
  187. package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
  188. package/dist/adapter/device-helpers/get-device-info.js +0 -87
  189. package/dist/context/context/context-data.d.ts.map +0 -1
  190. package/dist/context/context/context-data.js +0 -33
  191. package/src/context/context/context-data.ts +0 -44
  192. /package/dist/context/{context → helpers}/create-browser-context.d.ts +0 -0
@@ -1,18 +1,21 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import {DeviceInfo} from '@luma.gl/core';
5
- import {GL} from '@luma.gl/constants';
6
+ import {GL, GLExtensions} from '@luma.gl/constants';
7
+ import {getWebGLExtension} from '../../context/helpers/webgl-extensions';
6
8
 
7
9
  /** @returns strings identifying the GPU vendor and driver. */
8
- export function getDeviceInfo(gl: WebGL2RenderingContext): DeviceInfo {
10
+ export function getDeviceInfo(gl: WebGL2RenderingContext, extensions: GLExtensions): DeviceInfo {
9
11
  // "Masked" info is always available, but don't contain much useful information
10
12
  const vendorMasked = gl.getParameter(GL.VENDOR);
11
13
  const rendererMasked = gl.getParameter(GL.RENDERER);
12
14
 
13
15
  // If we are lucky, unmasked info is available
14
16
  // https://www.khronos.org/registry/webgl/extensions/WEBGL_debug_renderer_info/
15
- const ext = gl.getExtension('WEBGL_debug_renderer_info');
17
+ getWebGLExtension(gl, 'WEBGL_debug_renderer_info', extensions);
18
+ const ext = extensions.WEBGL_debug_renderer_info;
16
19
  const vendorUnmasked = gl.getParameter(ext ? ext.UNMASKED_VENDOR_WEBGL : GL.VENDOR);
17
20
  const rendererUnmasked = gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : GL.RENDERER);
18
21
  const vendor = vendorUnmasked || vendorMasked;
@@ -47,44 +50,50 @@ export function getDeviceInfo(gl: WebGL2RenderingContext): DeviceInfo {
47
50
  }
48
51
 
49
52
  /** "Sniff" the GPU type from the info. This works best if unmasked info is available. */
50
- function identifyGPUVendor(vendor: string, renderer: string): 'nvidia' | 'intel' | 'apple' | 'amd' | 'software' | 'unknown' {
51
- if ((/NVIDIA/i.exec(vendor)) || (/NVIDIA/i.exec(renderer))) {
53
+ function identifyGPUVendor(
54
+ vendor: string,
55
+ renderer: string
56
+ ): 'nvidia' | 'intel' | 'apple' | 'amd' | 'software' | 'unknown' {
57
+ if (/NVIDIA/i.exec(vendor) || /NVIDIA/i.exec(renderer)) {
52
58
  return 'nvidia';
53
59
  }
54
- if ((/INTEL/i.exec(vendor)) || (/INTEL/i.exec(renderer))) {
60
+ if (/INTEL/i.exec(vendor) || /INTEL/i.exec(renderer)) {
55
61
  return 'intel';
56
62
  }
57
- if ((/Apple/i.exec(vendor)) || (/Apple/i.exec(renderer))) {
63
+ if (/Apple/i.exec(vendor) || /Apple/i.exec(renderer)) {
58
64
  return 'apple';
59
65
  }
60
66
  if (
61
- (/AMD/i.exec(vendor)) ||
62
- (/AMD/i.exec(renderer)) ||
63
- (/ATI/i.exec(vendor)) ||
64
- (/ATI/i.exec(renderer))
67
+ /AMD/i.exec(vendor) ||
68
+ /AMD/i.exec(renderer) ||
69
+ /ATI/i.exec(vendor) ||
70
+ /ATI/i.exec(renderer)
65
71
  ) {
66
72
  return 'amd';
67
73
  }
68
- if ((/SwiftShader/i.exec(vendor)) || (/SwiftShader/i.exec(renderer))) {
74
+ if (/SwiftShader/i.exec(vendor) || /SwiftShader/i.exec(renderer)) {
69
75
  return 'software';
70
76
  }
71
-
77
+
72
78
  return 'unknown';
73
79
  }
74
80
 
75
81
  /** "Sniff" the GPU backend from the info. This works best if unmasked info is available. */
76
82
  function identifyGPUBackend(vendor: string, renderer: string): 'opengl' | 'metal' | 'unknown' {
77
- if ((/Metal/i.exec(vendor)) || (/Metal/i.exec(renderer))) {
83
+ if (/Metal/i.exec(vendor) || /Metal/i.exec(renderer)) {
78
84
  return 'metal';
79
85
  }
80
- if ((/ANGLE/i.exec(vendor)) || (/ANGLE/i.exec(renderer))) {
86
+ if (/ANGLE/i.exec(vendor) || /ANGLE/i.exec(renderer)) {
81
87
  return 'opengl';
82
- }
88
+ }
83
89
  return 'unknown';
84
90
  }
85
91
 
86
- function identifyGPUType(vendor: string, renderer: string): 'discrete' | 'integrated' | 'cpu' | 'unknown' {
87
- if ((/SwiftShader/i.exec(vendor)) || (/SwiftShader/i.exec(renderer))) {
92
+ function identifyGPUType(
93
+ vendor: string,
94
+ renderer: string
95
+ ): 'discrete' | 'integrated' | 'cpu' | 'unknown' {
96
+ if (/SwiftShader/i.exec(vendor) || /SwiftShader/i.exec(renderer)) {
88
97
  return 'cpu';
89
98
  }
90
99
 
@@ -1,157 +1,53 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
- import type {DeviceLimits} from '@luma.gl/core';
5
+ import {DeviceLimits} from '@luma.gl/core';
5
6
  import {GL} from '@luma.gl/constants';
6
7
 
7
- /** Populate a WebGPU style device limits */
8
- export function getDeviceLimits(gl: WebGL2RenderingContext): DeviceLimits {
9
- return {
10
- maxTextureDimension1D: 0, // WebGL does not support 1D textures
11
- maxTextureDimension2D: gl.getParameter(GL.MAX_TEXTURE_SIZE),
12
- maxTextureDimension3D: gl.getParameter(GL.MAX_3D_TEXTURE_SIZE),
13
- maxTextureArrayLayers: gl.getParameter(GL.MAX_ARRAY_TEXTURE_LAYERS),
14
- maxBindGroups: 1, // TBD - if we emulate bind groups we could support any number...
15
- maxDynamicUniformBuffersPerPipelineLayout: 0, // TBD
16
- maxDynamicStorageBuffersPerPipelineLayout: 0, // TBD
17
- maxSampledTexturesPerShaderStage: gl.getParameter(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS), // TBD
18
- maxSamplersPerShaderStage: gl.getParameter(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS),
19
- maxStorageBuffersPerShaderStage: 0, // TBD
20
- maxStorageTexturesPerShaderStage: 0, // TBD
21
- maxUniformBuffersPerShaderStage: gl.getParameter(GL.MAX_UNIFORM_BUFFER_BINDINGS),
22
- maxUniformBufferBindingSize: gl.getParameter(GL.MAX_UNIFORM_BLOCK_SIZE),
23
- maxStorageBufferBindingSize: 0,
24
- minUniformBufferOffsetAlignment: gl.getParameter(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT),
25
- minStorageBufferOffsetAlignment: 0, // TBD
26
- maxVertexBuffers: 0,
27
- maxVertexAttributes: gl.getParameter(GL.MAX_VERTEX_ATTRIBS),
28
- maxVertexBufferArrayStride: 2048, // TBD, this is just the default value from WebGPU
29
- maxInterStageShaderComponents: gl.getParameter(GL.MAX_VARYING_COMPONENTS),
30
- maxComputeWorkgroupStorageSize: 0, // WebGL does not support compute shaders
31
- maxComputeInvocationsPerWorkgroup: 0, // WebGL does not support compute shaders
32
- maxComputeWorkgroupSizeX: 0, // WebGL does not support compute shaders
33
- maxComputeWorkgroupSizeY: 0, // WebGL does not support compute shaders
34
- maxComputeWorkgroupSizeZ: 0, // WebGL does not support compute shaders
35
- maxComputeWorkgroupsPerDimension: 0 // WebGL does not support compute shaders
36
- };
37
- }
38
-
39
- /** WebGL context limits */
40
- export type WebGLLimits = {
41
- [GL.ALIASED_LINE_WIDTH_RANGE]: [number, number];
42
- [GL.ALIASED_POINT_SIZE_RANGE]: [number, number];
43
- [GL.MAX_TEXTURE_SIZE]: number;
44
- [GL.MAX_CUBE_MAP_TEXTURE_SIZE]: number;
45
- [GL.MAX_TEXTURE_IMAGE_UNITS]: number;
46
- [GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: number;
47
- [GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: number;
48
- [GL.MAX_RENDERBUFFER_SIZE]: number;
49
- [GL.MAX_VARYING_VECTORS]: number;
50
- [GL.MAX_VERTEX_ATTRIBS]: number;
51
- [GL.MAX_VERTEX_UNIFORM_VECTORS]: number;
52
- [GL.MAX_FRAGMENT_UNIFORM_VECTORS]: number;
53
- [GL.MAX_VIEWPORT_DIMS]: [number, number];
54
-
55
- // Extensions
56
- [GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT]: number;
57
-
58
- // WebGL2 Limits
59
- [GL.MAX_3D_TEXTURE_SIZE]: number;
60
- [GL.MAX_ARRAY_TEXTURE_LAYERS]: number;
61
- // [GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: number;
62
- [GL.MAX_COLOR_ATTACHMENTS]: number;
63
- [GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: number;
64
- [GL.MAX_COMBINED_UNIFORM_BLOCKS]: number;
65
- [GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: number;
66
- [GL.MAX_DRAW_BUFFERS]: number;
67
- [GL.MAX_ELEMENT_INDEX]: number;
68
- [GL.MAX_ELEMENTS_INDICES]: number;
69
- [GL.MAX_ELEMENTS_VERTICES]: number;
70
- [GL.MAX_FRAGMENT_INPUT_COMPONENTS]: number;
71
- [GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: number;
72
- [GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: number;
73
- [GL.MAX_SAMPLES]: number;
74
- // [GL.MAX_SERVER_WAIT_TIMEOUT]: number;
75
- [GL.MAX_TEXTURE_LOD_BIAS]: number;
76
- [GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: number;
77
- [GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: number;
78
- [GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: number;
79
- [GL.MAX_UNIFORM_BLOCK_SIZE]: number;
80
- [GL.MAX_UNIFORM_BUFFER_BINDINGS]: number;
81
- [GL.MAX_VARYING_COMPONENTS]: number;
82
- [GL.MAX_VERTEX_OUTPUT_COMPONENTS]: number;
83
- [GL.MAX_VERTEX_UNIFORM_BLOCKS]: number;
84
- [GL.MAX_VERTEX_UNIFORM_COMPONENTS]: number;
85
- [GL.MIN_PROGRAM_TEXEL_OFFSET]: number;
86
- [GL.MAX_PROGRAM_TEXEL_OFFSET]: number;
87
- [GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: number;
88
- };
89
-
90
- export function getWebGLLimits(gl: WebGL2RenderingContext): WebGLLimits {
91
- function get<T = number>(pname: number): T {
92
- return gl.getParameter(pname) as T;
93
- }
94
- function get2(pname: number, defaultValue?: number): number;
95
- function get2<T>(pname: number, defaultValue: T): T;
96
- function get2<T>(pname: number, defaultValue: T): T {
97
- return (gl.getParameter(pname) as T) || defaultValue;
8
+ // prettier-ignore
9
+ export class WebGLDeviceLimits extends DeviceLimits {
10
+ get maxTextureDimension1D() { return 0; } // WebGL does not support 1D textures
11
+ get maxTextureDimension2D() { return this.getParameter(GL.MAX_TEXTURE_SIZE); }
12
+ get maxTextureDimension3D() { return this.getParameter(GL.MAX_3D_TEXTURE_SIZE); }
13
+ get maxTextureArrayLayers() { return this.getParameter(GL.MAX_ARRAY_TEXTURE_LAYERS); }
14
+ get maxBindGroups() { return 0; }
15
+ get maxDynamicUniformBuffersPerPipelineLayout() { return 0; } // TBD
16
+ get maxDynamicStorageBuffersPerPipelineLayout() { return 0; } // TBD
17
+ get maxSampledTexturesPerShaderStage() { return this.getParameter(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS); } // ) TBD
18
+ get maxSamplersPerShaderStage() { return this.getParameter(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS); }
19
+ get maxStorageBuffersPerShaderStage() { return 0; } // TBD
20
+ get maxStorageTexturesPerShaderStage() { return 0; } // TBD
21
+ get maxUniformBuffersPerShaderStage() { return this.getParameter(GL.MAX_UNIFORM_BUFFER_BINDINGS); }
22
+ get maxUniformBufferBindingSize() { return this.getParameter(GL.MAX_UNIFORM_BLOCK_SIZE); }
23
+ get maxStorageBufferBindingSize() { return 0; }
24
+ get minUniformBufferOffsetAlignment() { return this.getParameter(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT); }
25
+ get minStorageBufferOffsetAlignment() { return 0; }
26
+ get maxVertexBuffers() { return 16; } // WebGL 2 supports 16 buffers, see https://github.com/gpuweb/gpuweb/issues/4284
27
+ get maxVertexAttributes() { return this.getParameter(GL.MAX_VERTEX_ATTRIBS); }
28
+ get maxVertexBufferArrayStride() { return 2048; } // TBD, this is just the default value from WebGPU
29
+ get maxInterStageShaderComponents() { return this.getParameter(GL.MAX_VARYING_COMPONENTS); }
30
+ get maxComputeWorkgroupStorageSize() { return 0; } // WebGL does not support compute shaders
31
+ get maxComputeInvocationsPerWorkgroup() { return 0; } // WebGL does not support compute shaders
32
+ get maxComputeWorkgroupSizeX() { return 0; } // WebGL does not support compute shaders
33
+ get maxComputeWorkgroupSizeY() { return 0; } // WebGL does not support compute shaders
34
+ get maxComputeWorkgroupSizeZ() { return 0; } // WebGL does not support compute shaders
35
+ get maxComputeWorkgroupsPerDimension() { return 0;} // WebGL does not support compute shaders
36
+
37
+ // PRIVATE
38
+
39
+ protected gl: WebGL2RenderingContext;
40
+ protected limits: Partial<Record<GL, number>> = {};
41
+
42
+ constructor(gl: WebGL2RenderingContext) {
43
+ super();
44
+ this.gl = gl;
98
45
  }
99
- // function getMaxAnistropy() {
100
- // const extension = gl.getExtension('EXT_texture_filter_anisotropic');
101
- // }
102
- return {
103
- [GL.ALIASED_LINE_WIDTH_RANGE]: get(GL.ALIASED_LINE_WIDTH_RANGE),
104
- [GL.ALIASED_POINT_SIZE_RANGE]: get(GL.ALIASED_POINT_SIZE_RANGE),
105
- [GL.MAX_TEXTURE_SIZE]: get(GL.MAX_TEXTURE_SIZE),
106
- [GL.MAX_CUBE_MAP_TEXTURE_SIZE]: get(GL.MAX_CUBE_MAP_TEXTURE_SIZE), // GLint
107
- [GL.MAX_TEXTURE_IMAGE_UNITS]: get(GL.MAX_TEXTURE_IMAGE_UNITS), // GLint
108
- [GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS]: get(GL.MAX_COMBINED_TEXTURE_IMAGE_UNITS), // GLint
109
- [GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS]: get(GL.MAX_VERTEX_TEXTURE_IMAGE_UNITS), // GLint
110
- [GL.MAX_RENDERBUFFER_SIZE]: get(GL.MAX_RENDERBUFFER_SIZE), // GLint
111
- [GL.MAX_VARYING_VECTORS]: get(GL.MAX_VARYING_VECTORS), // GLint
112
- [GL.MAX_VERTEX_ATTRIBS]: get(GL.MAX_VERTEX_ATTRIBS), // GLint
113
- [GL.MAX_VERTEX_UNIFORM_VECTORS]: get(GL.MAX_VERTEX_UNIFORM_VECTORS), // GLint
114
- [GL.MAX_FRAGMENT_UNIFORM_VECTORS]: get(GL.MAX_FRAGMENT_UNIFORM_VECTORS), // GLint
115
- [GL.MAX_VIEWPORT_DIMS]: get(GL.MAX_VIEWPORT_DIMS),
116
46
 
117
- // Extensions
118
- [GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT]: get(GL.MAX_TEXTURE_MAX_ANISOTROPY_EXT), // getMaxAnistropy(),
119
-
120
- // WebGL2 Limits
121
- [GL.MAX_3D_TEXTURE_SIZE]: get2(GL.MAX_3D_TEXTURE_SIZE), // GLint
122
- [GL.MAX_ARRAY_TEXTURE_LAYERS]: get2(GL.MAX_ARRAY_TEXTURE_LAYERS), // GLint
123
- // [GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL]: get2(GL.MAX_CLIENT_WAIT_TIMEOUT_WEBGL), // GLint64
124
- [GL.MAX_COLOR_ATTACHMENTS]: get2(GL.MAX_COLOR_ATTACHMENTS), // GLint
125
- [GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS]: get2(
126
- GL.MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS
127
- ), // GLint64
128
- [GL.MAX_COMBINED_UNIFORM_BLOCKS]: get2(GL.MAX_COMBINED_UNIFORM_BLOCKS), // GLint
129
- [GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS]: get2(GL.MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS), // GLint64
130
- [GL.MAX_DRAW_BUFFERS]: get2(GL.MAX_DRAW_BUFFERS), // GLint
131
- [GL.MAX_ELEMENT_INDEX]: get2(GL.MAX_ELEMENT_INDEX), // GLint64
132
- [GL.MAX_ELEMENTS_INDICES]: get2(GL.MAX_ELEMENTS_INDICES), // GLint
133
- [GL.MAX_ELEMENTS_VERTICES]: get2(GL.MAX_ELEMENTS_VERTICES), // GLint
134
- [GL.MAX_FRAGMENT_INPUT_COMPONENTS]: get2(GL.MAX_FRAGMENT_INPUT_COMPONENTS), // GLint
135
- [GL.MAX_FRAGMENT_UNIFORM_BLOCKS]: get2(GL.MAX_FRAGMENT_UNIFORM_BLOCKS), // GLint
136
- [GL.MAX_FRAGMENT_UNIFORM_COMPONENTS]: get2(GL.MAX_FRAGMENT_UNIFORM_COMPONENTS), // GLint
137
- [GL.MAX_SAMPLES]: get2(GL.MAX_SAMPLES), // GLint
138
- // [GL.MAX_SERVER_WAIT_TIMEOUT]: get2(GL.MAX_SERVER_WAIT_TIMEOUT), // GLint64
139
- [GL.MAX_TEXTURE_LOD_BIAS]: get2(GL.MAX_TEXTURE_LOD_BIAS), // GLfloat
140
- [GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS]: get2(
141
- GL.MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS
142
- ), // GLint
143
- [GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS]: get2(GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS), // GLint
144
- [GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS]: get2(
145
- GL.MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS
146
- ), // GLint
147
- [GL.MAX_UNIFORM_BLOCK_SIZE]: get2(GL.MAX_UNIFORM_BLOCK_SIZE), // GLint64
148
- [GL.MAX_UNIFORM_BUFFER_BINDINGS]: get2(GL.MAX_UNIFORM_BUFFER_BINDINGS), // GLint
149
- [GL.MAX_VARYING_COMPONENTS]: get2(GL.MAX_VARYING_COMPONENTS), // GLint
150
- [GL.MAX_VERTEX_OUTPUT_COMPONENTS]: get2(GL.MAX_VERTEX_OUTPUT_COMPONENTS), // GLint
151
- [GL.MAX_VERTEX_UNIFORM_BLOCKS]: get2(GL.MAX_VERTEX_UNIFORM_BLOCKS), // GLint
152
- [GL.MAX_VERTEX_UNIFORM_COMPONENTS]: get2(GL.MAX_VERTEX_UNIFORM_COMPONENTS), // GLint
153
- [GL.MIN_PROGRAM_TEXEL_OFFSET]: get2(GL.MIN_PROGRAM_TEXEL_OFFSET), // GLint
154
- [GL.MAX_PROGRAM_TEXEL_OFFSET]: get2(GL.MAX_PROGRAM_TEXEL_OFFSET), // GLint
155
- [GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT]: get2(GL.UNIFORM_BUFFER_OFFSET_ALIGNMENT) // GLint
156
- };
47
+ protected getParameter(parameter: GL): number {
48
+ if (this.limits[parameter] === undefined) {
49
+ this.limits[parameter] = this.gl.getParameter(parameter);
50
+ }
51
+ return this.limits[parameter];
52
+ }
157
53
  }
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import {ShaderUniformType, ShaderAttributeType, VertexFormat} from '@luma.gl/core';
@@ -67,9 +68,11 @@ const COMPOSITE_GL_TYPES: Record<
67
68
  };
68
69
 
69
70
  /** Decomposes a composite type (GL.VEC3) into a basic type (GL.FLOAT) and components (3) */
70
- export function decodeGLUniformType(
71
- glUniformType: GL
72
- ): {format: ShaderUniformType; components: number; glType: GLDataType} {
71
+ export function decodeGLUniformType(glUniformType: GL): {
72
+ format: ShaderUniformType;
73
+ components: number;
74
+ glType: GLDataType;
75
+ } {
73
76
  const typeAndSize = COMPOSITE_GL_TYPES[glUniformType];
74
77
  if (!typeAndSize) {
75
78
  throw new Error('uniform');
@@ -87,11 +90,11 @@ export function decodeGLAttributeType(glAttributeType: GL): {
87
90
  } {
88
91
  const typeAndSize = COMPOSITE_GL_TYPES[glAttributeType];
89
92
  if (!typeAndSize) {
90
- throw new Error('attribute')
93
+ throw new Error('attribute');
91
94
  }
92
95
  const [, components, , shaderType, vertexFormat] = typeAndSize;
93
96
  // TODO sanity - if (shaderType.startsWith('mat' ...))
94
- const attributeType = shaderType as unknown as ShaderAttributeType
97
+ const attributeType = shaderType as unknown as ShaderAttributeType;
95
98
  return {attributeType, vertexFormat, components}; // , glType};
96
99
  }
97
100
 
@@ -107,7 +110,10 @@ export function decomposeCompositeGLDataType(
107
110
  return {type, components};
108
111
  }
109
112
 
110
- export function getCompositeGLDataType(type: GL, components): {glType: GLDataType; name: string} | null {
113
+ export function getCompositeGLDataType(
114
+ type: GL,
115
+ components
116
+ ): {glType: GLDataType; name: string} | null {
111
117
  switch (type) {
112
118
  case GL.BYTE:
113
119
  case GL.UNSIGNED_BYTE:
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import type {
@@ -105,7 +106,7 @@ function readAttributeDeclarations(
105
106
  if (location >= 0) {
106
107
  const {attributeType} = decodeGLAttributeType(compositeType);
107
108
 
108
- // Whether an attribute is instanced is essentially fixed by the structure of the shader code,
109
+ // Whether an attribute is instanced is essentially fixed by the structure of the shader code,
109
110
  // so it is arguably a static property of the shader.
110
111
  // There is no hint in the shader declarations
111
112
  // Heuristic: Any attribute name containing the word "instance" will be assumed to be instanced
@@ -115,7 +116,7 @@ function readAttributeDeclarations(
115
116
  name,
116
117
  location,
117
118
  stepMode,
118
- type: attributeType,
119
+ type: attributeType
119
120
  // size - for arrays, size is the number of elements in the array
120
121
  });
121
122
  }
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import type {CompilerMessage} from '@luma.gl/core';
@@ -8,7 +9,7 @@ import type {CompilerMessage} from '@luma.gl/core';
8
9
  * This follows documented WebGL conventions for compilation logs.
9
10
  * Based on https://github.com/wwwtyro/gl-format-compiler-error (public domain)
10
11
  */
11
- export function parseShaderCompilerLog(errLog: string) : readonly CompilerMessage[] {
12
+ export function parseShaderCompilerLog(errLog: string): readonly CompilerMessage[] {
12
13
  // Parse the error - note: browser and driver dependent
13
14
  const lines = errLog.split(/\r?\n/);
14
15
 
@@ -30,7 +31,7 @@ export function parseShaderCompilerLog(errLog: string) : readonly CompilerMessag
30
31
  lineNum: 0,
31
32
  linePos: 0
32
33
  });
33
- continue; // eslint-disable-line no-continue
34
+ continue; // eslint-disable-line no-continue
34
35
  }
35
36
 
36
37
  const [messageType, linePosition, lineNumber, ...rest] = segments;
@@ -50,15 +51,18 @@ export function parseShaderCompilerLog(errLog: string) : readonly CompilerMessag
50
51
  type: getMessageType(messageType),
51
52
  lineNum,
52
53
  linePos // TODO
53
- })
54
+ });
54
55
  }
55
56
 
56
57
  return messages;
57
58
  }
58
59
 
59
60
  /** Ensure supported type */
60
- function getMessageType(messageType: string): 'warning' | 'error' | 'info' {
61
+ function getMessageType(messageType: string): 'warning' | 'error' | 'info' {
61
62
  const MESSAGE_TYPES = ['warning', 'error', 'info'];
62
63
  const lowerCaseType = messageType.toLowerCase();
63
- return (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as 'warning' | 'error' | 'info';
64
+ return (MESSAGE_TYPES.includes(lowerCaseType) ? lowerCaseType : 'info') as
65
+ | 'warning'
66
+ | 'error'
67
+ | 'info';
64
68
  }
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  /* eslint-disable */
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import {GL, GLPrimitiveTopology, GLPrimitive} from '@luma.gl/constants';
@@ -27,7 +28,10 @@ export function getPrimitiveDrawMode(drawMode: GLPrimitiveTopology): GLPrimitive
27
28
  }
28
29
 
29
30
  // Counts the number of complete "primitives" given a number of vertices and a drawMode
30
- export function getPrimitiveCount(options: {drawMode: GLPrimitiveTopology, vertexCount: number}): number {
31
+ export function getPrimitiveCount(options: {
32
+ drawMode: GLPrimitiveTopology;
33
+ vertexCount: number;
34
+ }): number {
31
35
  const {drawMode, vertexCount} = options;
32
36
  switch (drawMode) {
33
37
  case GL.POINTS:
@@ -48,7 +52,10 @@ export function getPrimitiveCount(options: {drawMode: GLPrimitiveTopology, verte
48
52
  }
49
53
 
50
54
  // Counts the number of vertices after splitting the vertex stream into separate "primitives"
51
- export function getVertexCount(options: {drawMode: GLPrimitiveTopology, vertexCount: number}): number {
55
+ export function getVertexCount(options: {
56
+ drawMode: GLPrimitiveTopology;
57
+ vertexCount: number;
58
+ }): number {
52
59
  const {drawMode, vertexCount} = options;
53
60
  const primitiveCount = getPrimitiveCount({drawMode, vertexCount});
54
61
  switch (getPrimitiveDrawMode(drawMode)) {
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import {assert} from '@luma.gl/core';
@@ -1,4 +1,5 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
 
4
5
  import {assert, ResourceProps, TextureFormat} from '@luma.gl/core';
@@ -6,7 +7,10 @@ import {GL} from '@luma.gl/constants';
6
7
  import {WebGLDevice} from '../webgl-device';
7
8
  import {WebGLResource} from './webgl-resource';
8
9
  import {isRenderbufferFormatSupported} from '../converters/texture-formats';
9
- import {convertTextureFormatToGL, getTextureFormatBytesPerPixel} from '../converters/texture-formats';
10
+ import {
11
+ convertTextureFormatToGL,
12
+ getTextureFormatBytesPerPixel
13
+ } from '../converters/texture-formats';
10
14
 
11
15
  export type RenderbufferProps = ResourceProps & {
12
16
  format: TextureFormat;
@@ -32,23 +36,35 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
32
36
  userData: undefined,
33
37
  format: undefined, // 'depth16unorm'
34
38
  width: 1,
35
- height: 1,
39
+ height: 1,
36
40
  samples: 0
37
- };
41
+ };
38
42
 
39
- override get [Symbol.toStringTag](): string { return 'Renderbuffer'; }
43
+ override get [Symbol.toStringTag](): string {
44
+ return 'Renderbuffer';
45
+ }
40
46
 
41
- get width(): number { return this.props.width; }
42
- get height(): number { return this.props.height; }
43
- get format(): TextureFormat { return this.props.format; }
44
- get samples(): number { return this.props.samples; }
45
- get attachment() { return }
47
+ get width(): number {
48
+ return this.props.width;
49
+ }
50
+ get height(): number {
51
+ return this.props.height;
52
+ }
53
+ get format(): TextureFormat {
54
+ return this.props.format;
55
+ }
56
+ get samples(): number {
57
+ return this.props.samples;
58
+ }
59
+ get attachment() {
60
+ return;
61
+ }
46
62
 
47
63
  /** WebGL format constant */
48
64
  glFormat: GL;
49
65
 
50
66
  static isTextureFormatSupported(device: WebGLDevice, format: TextureFormat): boolean {
51
- return isRenderbufferFormatSupported(device.gl, format);
67
+ return isRenderbufferFormatSupported(device.gl, format, device._extensions);
52
68
  }
53
69
 
54
70
  constructor(device: WebGLDevice, props: RenderbufferProps) {
@@ -61,7 +77,7 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
61
77
  this._initialize(this.props);
62
78
  }
63
79
 
64
- resize(size: {width: number, height: number}): void {
80
+ resize(size: {width: number; height: number}): void {
65
81
  // Don't resize if width/height haven't changed
66
82
  if (size.width !== this.width || size.height !== this.height) {
67
83
  Object.assign(this.props, {...size, format: this.format, samples: this.samples});
@@ -81,7 +97,13 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
81
97
  this.gl.bindRenderbuffer(GL.RENDERBUFFER, this.handle);
82
98
 
83
99
  if (samples !== 0) {
84
- this.gl.renderbufferStorageMultisample(GL.RENDERBUFFER, samples, this.glFormat, width, height);
100
+ this.gl.renderbufferStorageMultisample(
101
+ GL.RENDERBUFFER,
102
+ samples,
103
+ this.glFormat,
104
+ width,
105
+ height
106
+ );
85
107
  } else {
86
108
  this.gl.renderbufferStorage(GL.RENDERBUFFER, this.glFormat, width, height);
87
109
  }
@@ -89,7 +111,7 @@ export class WEBGLRenderbuffer extends WebGLResource<RenderbufferProps> {
89
111
  this.gl.bindRenderbuffer(GL.RENDERBUFFER, null);
90
112
 
91
113
  this.trackAllocatedMemory(
92
- width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.glFormat)
114
+ width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.format)
93
115
  );
94
116
  }
95
117