@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,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
  import { GL } from '@luma.gl/constants';
4
5
  /** Check is uniform is of sampler type */
@@ -6,50 +7,50 @@ export function isSamplerUniform(type) {
6
7
  return SAMPLER_TYPES.includes(type);
7
8
  }
8
9
  const SAMPLER_TYPES = [
9
- GL.SAMPLER_2D,
10
- GL.SAMPLER_CUBE,
11
- GL.SAMPLER_3D,
12
- GL.SAMPLER_2D_SHADOW,
13
- GL.SAMPLER_2D_ARRAY,
14
- GL.SAMPLER_2D_ARRAY_SHADOW,
15
- GL.SAMPLER_CUBE_SHADOW,
16
- GL.INT_SAMPLER_2D,
17
- GL.INT_SAMPLER_3D,
18
- GL.INT_SAMPLER_CUBE,
19
- GL.INT_SAMPLER_2D_ARRAY,
20
- GL.UNSIGNED_INT_SAMPLER_2D,
21
- GL.UNSIGNED_INT_SAMPLER_3D,
22
- GL.UNSIGNED_INT_SAMPLER_CUBE,
23
- GL.UNSIGNED_INT_SAMPLER_2D_ARRAY
10
+ 35678,
11
+ 35680,
12
+ 35679,
13
+ 35682,
14
+ 36289,
15
+ 36292,
16
+ 36293,
17
+ 36298,
18
+ 36299,
19
+ 36300,
20
+ 36303,
21
+ 36306,
22
+ 36307,
23
+ 36308,
24
+ 36311
24
25
  ];
25
26
  // Composite types table
26
27
  const COMPOSITE_GL_TYPES = {
27
- [GL.FLOAT]: [GL.FLOAT, 1, 'float', 'f32', 'float32'],
28
- [GL.FLOAT_VEC2]: [GL.FLOAT, 2, 'vec2', 'vec2<f32>', 'float32x2'],
29
- [GL.FLOAT_VEC3]: [GL.FLOAT, 3, 'vec3', 'vec3<f32>', 'float32x3'],
30
- [GL.FLOAT_VEC4]: [GL.FLOAT, 4, 'vec4', 'vec4<f32>', 'float32x4'],
31
- [GL.INT]: [GL.INT, 1, 'int', 'i32', 'sint32'],
32
- [GL.INT_VEC2]: [GL.INT, 2, 'ivec2', 'vec2<i32>', 'sint32x2'],
33
- [GL.INT_VEC3]: [GL.INT, 3, 'ivec3', 'vec3<i32>', 'sint32x3'],
34
- [GL.INT_VEC4]: [GL.INT, 4, 'ivec4', 'vec4<i32>', 'sint32x4'],
35
- [GL.UNSIGNED_INT]: [GL.UNSIGNED_INT, 1, 'uint', 'u32', 'uint32'],
36
- [GL.UNSIGNED_INT_VEC2]: [GL.UNSIGNED_INT, 2, 'uvec2', 'vec2<u32>', 'uint32x2'],
37
- [GL.UNSIGNED_INT_VEC3]: [GL.UNSIGNED_INT, 3, 'uvec3', 'vec3<u32>', 'uint32x3'],
38
- [GL.UNSIGNED_INT_VEC4]: [GL.UNSIGNED_INT, 4, 'uvec4', 'vec4<u32>', 'uint32x4'],
39
- [GL.BOOL]: [GL.FLOAT, 1, 'bool', 'f32', 'float32'],
40
- [GL.BOOL_VEC2]: [GL.FLOAT, 2, 'bvec2', 'vec2<f32>', 'float32x2'],
41
- [GL.BOOL_VEC3]: [GL.FLOAT, 3, 'bvec3', 'vec3<f32>', 'float32x3'],
42
- [GL.BOOL_VEC4]: [GL.FLOAT, 4, 'bvec4', 'vec4<f32>', 'float32x4'],
28
+ [5126]: [5126, 1, 'float', 'f32', 'float32'],
29
+ [35664]: [5126, 2, 'vec2', 'vec2<f32>', 'float32x2'],
30
+ [35665]: [5126, 3, 'vec3', 'vec3<f32>', 'float32x3'],
31
+ [35666]: [5126, 4, 'vec4', 'vec4<f32>', 'float32x4'],
32
+ [5124]: [5124, 1, 'int', 'i32', 'sint32'],
33
+ [35667]: [5124, 2, 'ivec2', 'vec2<i32>', 'sint32x2'],
34
+ [35668]: [5124, 3, 'ivec3', 'vec3<i32>', 'sint32x3'],
35
+ [35669]: [5124, 4, 'ivec4', 'vec4<i32>', 'sint32x4'],
36
+ [5125]: [5125, 1, 'uint', 'u32', 'uint32'],
37
+ [36294]: [5125, 2, 'uvec2', 'vec2<u32>', 'uint32x2'],
38
+ [36295]: [5125, 3, 'uvec3', 'vec3<u32>', 'uint32x3'],
39
+ [36296]: [5125, 4, 'uvec4', 'vec4<u32>', 'uint32x4'],
40
+ [35670]: [5126, 1, 'bool', 'f32', 'float32'],
41
+ [35671]: [5126, 2, 'bvec2', 'vec2<f32>', 'float32x2'],
42
+ [35672]: [5126, 3, 'bvec3', 'vec3<f32>', 'float32x3'],
43
+ [35673]: [5126, 4, 'bvec4', 'vec4<f32>', 'float32x4'],
43
44
  // TODO - are sizes/components below correct?
44
- [GL.FLOAT_MAT2]: [GL.FLOAT, 8, 'mat2', 'mat2x2<f32>'], // 4
45
- [GL.FLOAT_MAT2x3]: [GL.FLOAT, 8, 'mat2x3', 'mat2x3<f32>'], // 6
46
- [GL.FLOAT_MAT2x4]: [GL.FLOAT, 8, 'mat2x4', 'mat2x4<f32>'], // 8
47
- [GL.FLOAT_MAT3x2]: [GL.FLOAT, 12, 'mat3x2', 'mat3x2<f32>'], // 6
48
- [GL.FLOAT_MAT3]: [GL.FLOAT, 12, 'mat3', 'mat3x3<f32>'], // 9
49
- [GL.FLOAT_MAT3x4]: [GL.FLOAT, 12, 'mat3x4', 'mat3x4<f32>'], // 12
50
- [GL.FLOAT_MAT4x2]: [GL.FLOAT, 16, 'mat4x2', 'mat4x2<f32>'], // 8
51
- [GL.FLOAT_MAT4x3]: [GL.FLOAT, 16, 'mat4x3', 'mat4x3<f32>'], // 12
52
- [GL.FLOAT_MAT4]: [GL.FLOAT, 16, 'mat4', 'mat4x4<f32>'] // 16
45
+ [35674]: [5126, 8, 'mat2', 'mat2x2<f32>'], // 4
46
+ [35685]: [5126, 8, 'mat2x3', 'mat2x3<f32>'], // 6
47
+ [35686]: [5126, 8, 'mat2x4', 'mat2x4<f32>'], // 8
48
+ [35687]: [5126, 12, 'mat3x2', 'mat3x2<f32>'], // 6
49
+ [35675]: [5126, 12, 'mat3', 'mat3x3<f32>'], // 9
50
+ [35688]: [5126, 12, 'mat3x4', 'mat3x4<f32>'], // 12
51
+ [35689]: [5126, 16, 'mat4x2', 'mat4x2<f32>'], // 8
52
+ [35690]: [5126, 16, 'mat4x3', 'mat4x3<f32>'], // 12
53
+ [35676]: [5126, 16, 'mat4', 'mat4x4<f32>'] // 16
53
54
  };
54
55
  /** Decomposes a composite type (GL.VEC3) into a basic type (GL.FLOAT) and components (3) */
55
56
  export function decodeGLUniformType(glUniformType) {
@@ -82,11 +83,11 @@ export function decomposeCompositeGLDataType(compositeGLDataType) {
82
83
  }
83
84
  export function getCompositeGLDataType(type, components) {
84
85
  switch (type) {
85
- case GL.BYTE:
86
- case GL.UNSIGNED_BYTE:
87
- case GL.SHORT:
88
- case GL.UNSIGNED_SHORT:
89
- type = GL.FLOAT;
86
+ case 5120:
87
+ case 5121:
88
+ case 5122:
89
+ case 5123:
90
+ type = 5126;
90
91
  break;
91
92
  default:
92
93
  }
@@ -1 +1 @@
1
- {"version":3,"file":"get-shader-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-shader-layout.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,eAAe,CAAC;AAMvB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,CA2D/F"}
1
+ {"version":3,"file":"get-shader-layout.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/get-shader-layout.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,YAAY,EAKb,MAAM,eAAe,CAAC;AAMvB;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,sBAAsB,EAAE,OAAO,EAAE,YAAY,GAAG,YAAY,CA2D/F"}
@@ -1,8 +1,9 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
  import { GL } from '@luma.gl/constants';
4
- import { Accessor } from '../../classic/accessor'; // TODO - should NOT depend on classic API
5
- import { decodeGLUniformType, decodeGLAttributeType, isSamplerUniform } from './decode-webgl-types';
5
+ import { Accessor } from "../../classic/accessor.js"; // TODO - should NOT depend on classic API
6
+ import { decodeGLUniformType, decodeGLAttributeType, isSamplerUniform } from "./decode-webgl-types.js";
6
7
  /**
7
8
  * Extract metadata describing binding information for a program's shaders
8
9
  * Note: `linkProgram()` needs to have been called
@@ -69,7 +70,7 @@ export function getShaderLayout(gl, program) {
69
70
  */
70
71
  function readAttributeDeclarations(gl, program) {
71
72
  const attributes = [];
72
- const count = gl.getProgramParameter(program, gl.ACTIVE_ATTRIBUTES);
73
+ const count = gl.getProgramParameter(program, 35721);
73
74
  for (let index = 0; index < count; index++) {
74
75
  const activeInfo = gl.getActiveAttrib(program, index);
75
76
  if (!activeInfo) {
@@ -80,7 +81,7 @@ function readAttributeDeclarations(gl, program) {
80
81
  // Add only user provided attributes, for built-in attributes like `gl_InstanceID` location will be < 0
81
82
  if (location >= 0) {
82
83
  const { attributeType } = decodeGLAttributeType(compositeType);
83
- // Whether an attribute is instanced is essentially fixed by the structure of the shader code,
84
+ // Whether an attribute is instanced is essentially fixed by the structure of the shader code,
84
85
  // so it is arguably a static property of the shader.
85
86
  // There is no hint in the shader declarations
86
87
  // Heuristic: Any attribute name containing the word "instance" will be assumed to be instanced
@@ -89,7 +90,7 @@ function readAttributeDeclarations(gl, program) {
89
90
  name,
90
91
  location,
91
92
  stepMode,
92
- type: attributeType,
93
+ type: attributeType
93
94
  // size - for arrays, size is the number of elements in the array
94
95
  });
95
96
  }
@@ -105,7 +106,7 @@ function readAttributeDeclarations(gl, program) {
105
106
  */
106
107
  function readVaryings(gl, program) {
107
108
  const varyings = [];
108
- const count = gl.getProgramParameter(program, GL.TRANSFORM_FEEDBACK_VARYINGS);
109
+ const count = gl.getProgramParameter(program, 35971);
109
110
  for (let location = 0; location < count; location++) {
110
111
  const activeInfo = gl.getTransformFeedbackVarying(program, location);
111
112
  if (!activeInfo) {
@@ -127,7 +128,7 @@ function readVaryings(gl, program) {
127
128
  */
128
129
  function readUniformBindings(gl, program) {
129
130
  const uniforms = [];
130
- const uniformCount = gl.getProgramParameter(program, GL.ACTIVE_UNIFORMS);
131
+ const uniformCount = gl.getProgramParameter(program, 35718);
131
132
  for (let i = 0; i < uniformCount; i++) {
132
133
  const activeInfo = gl.getActiveUniform(program, i);
133
134
  if (!activeInfo) {
@@ -168,27 +169,27 @@ function readUniformBindings(gl, program) {
168
169
  function readUniformBlocks(gl, program) {
169
170
  const getBlockParameter = (blockIndex, pname) => gl.getActiveUniformBlockParameter(program, blockIndex, pname);
170
171
  const uniformBlocks = [];
171
- const blockCount = gl.getProgramParameter(program, GL.ACTIVE_UNIFORM_BLOCKS);
172
+ const blockCount = gl.getProgramParameter(program, 35382);
172
173
  for (let blockIndex = 0; blockIndex < blockCount; blockIndex++) {
173
174
  const blockInfo = {
174
175
  name: gl.getActiveUniformBlockName(program, blockIndex) || '',
175
- location: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_BINDING),
176
- byteLength: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_DATA_SIZE),
177
- vertex: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER),
178
- fragment: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER),
179
- uniformCount: getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORMS),
176
+ location: getBlockParameter(blockIndex, 35391),
177
+ byteLength: getBlockParameter(blockIndex, 35392),
178
+ vertex: getBlockParameter(blockIndex, 35396),
179
+ fragment: getBlockParameter(blockIndex, 35398),
180
+ uniformCount: getBlockParameter(blockIndex, 35394),
180
181
  uniforms: []
181
182
  };
182
- const uniformIndices = getBlockParameter(blockIndex, GL.UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) || [];
183
- const uniformType = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_TYPE); // Array of GLenum indicating the types of the uniforms.
184
- const uniformArrayLength = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_SIZE); // Array of GLuint indicating the sizes of the uniforms.
183
+ const uniformIndices = getBlockParameter(blockIndex, 35395) || [];
184
+ const uniformType = gl.getActiveUniforms(program, uniformIndices, 35383); // Array of GLenum indicating the types of the uniforms.
185
+ const uniformArrayLength = gl.getActiveUniforms(program, uniformIndices, 35384); // Array of GLuint indicating the sizes of the uniforms.
185
186
  // const uniformBlockIndex = gl.getActiveUniforms(
186
187
  // program,
187
188
  // uniformIndices,
188
189
  // GL.UNIFORM_BLOCK_INDEX
189
190
  // ); // Array of GLint indicating the block indices of the uniforms.
190
- const uniformOffset = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_OFFSET); // Array of GLint indicating the uniform buffer offsets.
191
- const uniformStride = gl.getActiveUniforms(program, uniformIndices, GL.UNIFORM_ARRAY_STRIDE); // Array of GLint indicating the strides between the elements.
191
+ const uniformOffset = gl.getActiveUniforms(program, uniformIndices, 35387); // Array of GLint indicating the uniform buffer offsets.
192
+ const uniformStride = gl.getActiveUniforms(program, uniformIndices, 35388); // Array of GLint indicating the strides between the elements.
192
193
  // const uniformMatrixStride = gl.getActiveUniforms(
193
194
  // program,
194
195
  // uniformIndices,
@@ -237,21 +238,21 @@ function readUniformBlocks(gl, program) {
237
238
  }
238
239
  */
239
240
  const SAMPLER_UNIFORMS_GL_TO_GPU = {
240
- [GL.SAMPLER_2D]: ['2d', 'float'],
241
- [GL.SAMPLER_CUBE]: ['cube', 'float'],
242
- [GL.SAMPLER_3D]: ['3d', 'float'],
243
- [GL.SAMPLER_2D_SHADOW]: ['3d', 'depth'],
244
- [GL.SAMPLER_2D_ARRAY]: ['2d-array', 'float'],
245
- [GL.SAMPLER_2D_ARRAY_SHADOW]: ['2d-array', 'depth'],
246
- [GL.SAMPLER_CUBE_SHADOW]: ['cube', 'float'],
247
- [GL.INT_SAMPLER_2D]: ['2d', 'sint'],
248
- [GL.INT_SAMPLER_3D]: ['3d', 'sint'],
249
- [GL.INT_SAMPLER_CUBE]: ['cube', 'sint'],
250
- [GL.INT_SAMPLER_2D_ARRAY]: ['2d-array', 'uint'],
251
- [GL.UNSIGNED_INT_SAMPLER_2D]: ['2d', 'uint'],
252
- [GL.UNSIGNED_INT_SAMPLER_3D]: ['3d', 'uint'],
253
- [GL.UNSIGNED_INT_SAMPLER_CUBE]: ['cube', 'uint'],
254
- [GL.UNSIGNED_INT_SAMPLER_2D_ARRAY]: ['2d-array', 'uint']
241
+ [35678]: ['2d', 'float'],
242
+ [35680]: ['cube', 'float'],
243
+ [35679]: ['3d', 'float'],
244
+ [35682]: ['3d', 'depth'],
245
+ [36289]: ['2d-array', 'float'],
246
+ [36292]: ['2d-array', 'depth'],
247
+ [36293]: ['cube', 'float'],
248
+ [36298]: ['2d', 'sint'],
249
+ [36299]: ['3d', 'sint'],
250
+ [36300]: ['cube', 'sint'],
251
+ [36303]: ['2d-array', 'uint'],
252
+ [36306]: ['2d', 'uint'],
253
+ [36307]: ['3d', 'uint'],
254
+ [36308]: ['cube', 'uint'],
255
+ [36311]: ['2d-array', 'uint']
255
256
  };
256
257
  function getSamplerInfo(type) {
257
258
  const sampler = SAMPLER_UNIFORMS_GL_TO_GPU[type];
@@ -1 +1 @@
1
- {"version":3,"file":"parse-shader-compiler-log.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/parse-shader-compiler-log.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAI,SAAS,eAAe,EAAE,CA8ClF"}
1
+ {"version":3,"file":"parse-shader-compiler-log.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/parse-shader-compiler-log.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,eAAe,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,eAAe,EAAE,CA8CjF"}
@@ -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
  * Parse a WebGL-format GLSL compilation log into an array of WebGPU style message records.
@@ -23,7 +24,7 @@ export function parseShaderCompilerLog(errLog) {
23
24
  lineNum: 0,
24
25
  linePos: 0
25
26
  });
26
- continue; // eslint-disable-line no-continue
27
+ continue; // eslint-disable-line no-continue
27
28
  }
28
29
  const [messageType, linePosition, lineNumber, ...rest] = segments;
29
30
  let lineNum = parseInt(lineNumber, 10);
@@ -1 +1 @@
1
- {"version":3,"file":"set-uniform.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/set-uniform.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAK,eAAe,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEtE,8DAA8D;AAE9D,wBAAgB,UAAU,CACxB,EAAE,EAAE,sBAAsB,EAC1B,QAAQ,EAAE,oBAAoB,EAC9B,IAAI,EAAE,eAAe,GAAG,aAAa,EACrC,KAAK,EAAE,YAAY,GAClB,IAAI,CAwEN"}
1
+ {"version":3,"file":"set-uniform.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/set-uniform.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAK,eAAe,EAAE,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEtE,8DAA8D;AAE9D,wBAAgB,UAAU,CACxB,EAAE,EAAE,sBAAsB,EAC1B,QAAQ,EAAE,oBAAoB,EAC9B,IAAI,EAAE,eAAe,GAAG,aAAa,EACrC,KAAK,EAAE,YAAY,GAClB,IAAI,CAwEN"}
@@ -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
  import { GL } from '@luma.gl/constants';
4
5
  /** Set a raw uniform (without type conversion and caching) */
@@ -16,54 +17,54 @@ export function setUniform(gl, location, type, value) {
16
17
  const arrayValue = typeof uniformValue === 'number' ? [uniformValue] : uniformValue;
17
18
  // prettier-ignore
18
19
  switch (type) {
19
- case GL.SAMPLER_2D:
20
- case GL.SAMPLER_CUBE:
21
- case GL.SAMPLER_3D:
22
- case GL.SAMPLER_2D_SHADOW:
23
- case GL.SAMPLER_2D_ARRAY:
24
- case GL.SAMPLER_2D_ARRAY_SHADOW:
25
- case GL.SAMPLER_CUBE_SHADOW:
26
- case GL.INT_SAMPLER_2D:
27
- case GL.INT_SAMPLER_3D:
28
- case GL.INT_SAMPLER_CUBE:
29
- case GL.INT_SAMPLER_2D_ARRAY:
30
- case GL.UNSIGNED_INT_SAMPLER_2D:
31
- case GL.UNSIGNED_INT_SAMPLER_3D:
32
- case GL.UNSIGNED_INT_SAMPLER_CUBE:
33
- case GL.UNSIGNED_INT_SAMPLER_2D_ARRAY:
20
+ case 35678:
21
+ case 35680:
22
+ case 35679:
23
+ case 35682:
24
+ case 36289:
25
+ case 36292:
26
+ case 36293:
27
+ case 36298:
28
+ case 36299:
29
+ case 36300:
30
+ case 36303:
31
+ case 36306:
32
+ case 36307:
33
+ case 36308:
34
+ case 36311:
34
35
  if (typeof value !== 'number') {
35
36
  throw new Error('samplers must be set to integers');
36
37
  }
37
38
  return gl.uniform1i(location, value);
38
- case GL.FLOAT: return gl.uniform1fv(location, arrayValue);
39
- case GL.FLOAT_VEC2: return gl.uniform2fv(location, arrayValue);
40
- case GL.FLOAT_VEC3: return gl.uniform3fv(location, arrayValue);
41
- case GL.FLOAT_VEC4: return gl.uniform4fv(location, arrayValue);
42
- case GL.INT: return gl.uniform1iv(location, arrayValue);
43
- case GL.INT_VEC2: return gl.uniform2iv(location, arrayValue);
44
- case GL.INT_VEC3: return gl.uniform3iv(location, arrayValue);
45
- case GL.INT_VEC4: return gl.uniform4iv(location, arrayValue);
46
- case GL.BOOL: return gl.uniform1iv(location, arrayValue);
47
- case GL.BOOL_VEC2: return gl.uniform2iv(location, arrayValue);
48
- case GL.BOOL_VEC3: return gl.uniform3iv(location, arrayValue);
49
- case GL.BOOL_VEC4: return gl.uniform4iv(location, arrayValue);
39
+ case 5126: return gl.uniform1fv(location, arrayValue);
40
+ case 35664: return gl.uniform2fv(location, arrayValue);
41
+ case 35665: return gl.uniform3fv(location, arrayValue);
42
+ case 35666: return gl.uniform4fv(location, arrayValue);
43
+ case 5124: return gl.uniform1iv(location, arrayValue);
44
+ case 35667: return gl.uniform2iv(location, arrayValue);
45
+ case 35668: return gl.uniform3iv(location, arrayValue);
46
+ case 35669: return gl.uniform4iv(location, arrayValue);
47
+ case 35670: return gl.uniform1iv(location, arrayValue);
48
+ case 35671: return gl.uniform2iv(location, arrayValue);
49
+ case 35672: return gl.uniform3iv(location, arrayValue);
50
+ case 35673: return gl.uniform4iv(location, arrayValue);
50
51
  // WEBGL2 - unsigned integers
51
- case GL.UNSIGNED_INT: return gl2.uniform1uiv(location, arrayValue, 1);
52
- case GL.UNSIGNED_INT_VEC2: return gl2.uniform2uiv(location, arrayValue, 2);
53
- case GL.UNSIGNED_INT_VEC3: return gl2.uniform3uiv(location, arrayValue, 3);
54
- case GL.UNSIGNED_INT_VEC4: return gl2.uniform4uiv(location, arrayValue, 4);
52
+ case 5125: return gl2.uniform1uiv(location, arrayValue, 1);
53
+ case 36294: return gl2.uniform2uiv(location, arrayValue, 2);
54
+ case 36295: return gl2.uniform3uiv(location, arrayValue, 3);
55
+ case 36296: return gl2.uniform4uiv(location, arrayValue, 4);
55
56
  // WebGL2 - quadratic matrices
56
57
  // false: don't transpose the matrix
57
- case GL.FLOAT_MAT2: return gl.uniformMatrix2fv(location, false, arrayValue);
58
- case GL.FLOAT_MAT3: return gl.uniformMatrix3fv(location, false, arrayValue);
59
- case GL.FLOAT_MAT4: return gl.uniformMatrix4fv(location, false, arrayValue);
58
+ case 35674: return gl.uniformMatrix2fv(location, false, arrayValue);
59
+ case 35675: return gl.uniformMatrix3fv(location, false, arrayValue);
60
+ case 35676: return gl.uniformMatrix4fv(location, false, arrayValue);
60
61
  // WebGL2 - rectangular matrices
61
- case GL.FLOAT_MAT2x3: return gl2.uniformMatrix2x3fv(location, false, arrayValue);
62
- case GL.FLOAT_MAT2x4: return gl2.uniformMatrix2x4fv(location, false, arrayValue);
63
- case GL.FLOAT_MAT3x2: return gl2.uniformMatrix3x2fv(location, false, arrayValue);
64
- case GL.FLOAT_MAT3x4: return gl2.uniformMatrix3x4fv(location, false, arrayValue);
65
- case GL.FLOAT_MAT4x2: return gl2.uniformMatrix4x2fv(location, false, arrayValue);
66
- case GL.FLOAT_MAT4x3: return gl2.uniformMatrix4x3fv(location, false, arrayValue);
62
+ case 35685: return gl2.uniformMatrix2x3fv(location, false, arrayValue);
63
+ case 35686: return gl2.uniformMatrix2x4fv(location, false, arrayValue);
64
+ case 35687: return gl2.uniformMatrix3x2fv(location, false, arrayValue);
65
+ case 35688: return gl2.uniformMatrix3x4fv(location, false, arrayValue);
66
+ case 35689: return gl2.uniformMatrix4x2fv(location, false, arrayValue);
67
+ case 35690: return gl2.uniformMatrix4x3fv(location, false, arrayValue);
67
68
  }
68
69
  throw new Error('Illegal uniform');
69
70
  }
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-topology-utils.d.ts","sourceRoot":"","sources":["../../../src/adapter/helpers/webgl-topology-utils.ts"],"names":[],"mappings":"AAGA,OAAO,EAAC,EAAE,EAAE,mBAAmB,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AACxE,OAAO,EAAC,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAGhD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,mBAAmB,GAAG,WAAW,CAmB/E;AAGD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IAAC,QAAQ,EAAE,mBAAmB,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAC,GAAG,MAAM,CAkBvG;AAGD,wBAAgB,cAAc,CAAC,OAAO,EAAE;IAAC,QAA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C,YAAY,CAYlB;AAED,oDAAoD;AACpD,wBAAgB,cAAc,CAAC,QAAQ,EAAE,iBAAiB,GAAG,EAAE,CAAC,MAAM,GAAG,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,SAAS,CAY/F"}
@@ -1,23 +1,24 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
  import { GL } from '@luma.gl/constants';
4
5
  // Counts the number of complete primitives given a number of vertices and a drawMode
5
6
  export function getPrimitiveDrawMode(drawMode) {
6
7
  switch (drawMode) {
7
- case GL.POINTS:
8
- return GL.POINTS;
9
- case GL.LINES:
10
- return GL.LINES;
11
- case GL.LINE_STRIP:
12
- return GL.LINES;
13
- case GL.LINE_LOOP:
14
- return GL.LINES;
15
- case GL.TRIANGLES:
16
- return GL.TRIANGLES;
17
- case GL.TRIANGLE_STRIP:
18
- return GL.TRIANGLES;
19
- case GL.TRIANGLE_FAN:
20
- return GL.TRIANGLES;
8
+ case 0:
9
+ return 0;
10
+ case 1:
11
+ return 1;
12
+ case 3:
13
+ return 1;
14
+ case 2:
15
+ return 1;
16
+ case 4:
17
+ return 4;
18
+ case 5:
19
+ return 4;
20
+ case 6:
21
+ return 4;
21
22
  default:
22
23
  throw new Error('drawMode');
23
24
  }
@@ -26,17 +27,17 @@ export function getPrimitiveDrawMode(drawMode) {
26
27
  export function getPrimitiveCount(options) {
27
28
  const { drawMode, vertexCount } = options;
28
29
  switch (drawMode) {
29
- case GL.POINTS:
30
- case GL.LINE_LOOP:
30
+ case 0:
31
+ case 2:
31
32
  return vertexCount;
32
- case GL.LINES:
33
+ case 1:
33
34
  return vertexCount / 2;
34
- case GL.LINE_STRIP:
35
+ case 3:
35
36
  return vertexCount - 1;
36
- case GL.TRIANGLES:
37
+ case 4:
37
38
  return vertexCount / 3;
38
- case GL.TRIANGLE_STRIP:
39
- case GL.TRIANGLE_FAN:
39
+ case 5:
40
+ case 6:
40
41
  return vertexCount - 2;
41
42
  default:
42
43
  throw new Error('drawMode');
@@ -47,11 +48,11 @@ export function getVertexCount(options) {
47
48
  const { drawMode, vertexCount } = options;
48
49
  const primitiveCount = getPrimitiveCount({ drawMode, vertexCount });
49
50
  switch (getPrimitiveDrawMode(drawMode)) {
50
- case GL.POINTS:
51
+ case 0:
51
52
  return primitiveCount;
52
- case GL.LINES:
53
+ case 1:
53
54
  return primitiveCount * 2;
54
- case GL.TRIANGLES:
55
+ case 4:
55
56
  return primitiveCount * 3;
56
57
  default:
57
58
  throw new Error('drawMode');
@@ -61,13 +62,13 @@ export function getVertexCount(options) {
61
62
  export function getGLDrawMode(topology) {
62
63
  // prettier-ignore
63
64
  switch (topology) {
64
- case 'point-list': return GL.POINTS;
65
- case 'line-list': return GL.LINES;
66
- case 'line-strip': return GL.LINE_STRIP;
67
- case 'line-loop-webgl': return GL.LINE_LOOP;
68
- case 'triangle-list': return GL.TRIANGLES;
69
- case 'triangle-strip': return GL.TRIANGLE_STRIP;
70
- case 'triangle-fan-webgl': return GL.TRIANGLE_FAN;
65
+ case 'point-list': return 0;
66
+ case 'line-list': return 1;
67
+ case 'line-strip': return 3;
68
+ case 'line-loop-webgl': return 2;
69
+ case 'triangle-list': return 4;
70
+ case 'triangle-strip': return 5;
71
+ case 'triangle-fan-webgl': return 6;
71
72
  default: throw new Error(topology);
72
73
  }
73
74
  }
@@ -75,13 +76,13 @@ export function getGLDrawMode(topology) {
75
76
  export function getGLPrimitive(topology) {
76
77
  // prettier-ignore
77
78
  switch (topology) {
78
- case 'point-list': return GL.POINTS;
79
- case 'line-list': return GL.LINES;
80
- case 'line-strip': return GL.LINES;
81
- case 'line-loop-webgl': return GL.LINES;
82
- case 'triangle-list': return GL.TRIANGLES;
83
- case 'triangle-strip': return GL.TRIANGLES;
84
- case 'triangle-fan-webgl': return GL.TRIANGLES;
79
+ case 'point-list': return 0;
80
+ case 'line-list': return 1;
81
+ case 'line-strip': return 1;
82
+ case 'line-loop-webgl': return 1;
83
+ case 'triangle-list': return 4;
84
+ case 'triangle-strip': return 4;
85
+ case 'triangle-fan-webgl': return 4;
85
86
  default: throw new Error(topology);
86
87
  }
87
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"constants-to-keys.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/constants-to-keys.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAGtC,wBAAgB,WAAW,CAAC,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE,CAkB7E"}
1
+ {"version":3,"file":"constants-to-keys.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/constants-to-keys.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAGtC,wBAAgB,WAAW,CAAC,EAAE,EAAE,sBAAsB,EAAE,IAAI,EAAE,MAAM,GAAG,EAAE,GAAG,EAAE,CAkB7E"}
@@ -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
  import { assert } from '@luma.gl/core';
4
5
  // Resolve a WebGL enumeration name (returns itself if already a number)
@@ -1,7 +1,7 @@
1
1
  import { ResourceProps, TextureFormat } from '@luma.gl/core';
2
2
  import { GL } from '@luma.gl/constants';
3
- import { WebGLDevice } from '../webgl-device';
4
- import { WebGLResource } from './webgl-resource';
3
+ import { WebGLDevice } from "../webgl-device.js";
4
+ import { WebGLResource } from "./webgl-resource.js";
5
5
  export type RenderbufferProps = ResourceProps & {
6
6
  format: TextureFormat;
7
7
  width?: number;
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-renderbuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-renderbuffer.ts"],"names":[],"mappings":"AAGA,OAAO,EAAS,aAAa,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACnE,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Ib,aAAa,IAAI,IAAI;IAKrB,WAAW,CAAC,MAAM,EAAE,iBAAiB,GAAG,IAAI;CAGtD"}
@@ -1,10 +1,11 @@
1
- // luma.gl, MIT license
1
+ // luma.gl
2
+ // SPDX-License-Identifier: MIT
2
3
  // Copyright (c) vis.gl contributors
3
4
  import { assert } from '@luma.gl/core';
4
5
  import { GL } from '@luma.gl/constants';
5
- import { WebGLResource } from './webgl-resource';
6
- import { isRenderbufferFormatSupported } from '../converters/texture-formats';
7
- import { convertTextureFormatToGL, getTextureFormatBytesPerPixel } from '../converters/texture-formats';
6
+ import { WebGLResource } from "./webgl-resource.js";
7
+ import { isRenderbufferFormatSupported } from "../converters/texture-formats.js";
8
+ import { convertTextureFormatToGL, getTextureFormatBytesPerPixel } from "../converters/texture-formats.js";
8
9
  /**
9
10
  * Renderbuffers are GPU objects that contain images.
10
11
  * In contrast to Textures they are optimized for use as render targets, with Framebuffers.
@@ -25,16 +26,28 @@ export class WEBGLRenderbuffer extends WebGLResource {
25
26
  height: 1,
26
27
  samples: 0
27
28
  };
28
- get [Symbol.toStringTag]() { return 'Renderbuffer'; }
29
- get width() { return this.props.width; }
30
- get height() { return this.props.height; }
31
- get format() { return this.props.format; }
32
- get samples() { return this.props.samples; }
33
- get attachment() { return; }
29
+ get [Symbol.toStringTag]() {
30
+ return 'Renderbuffer';
31
+ }
32
+ get width() {
33
+ return this.props.width;
34
+ }
35
+ get height() {
36
+ return this.props.height;
37
+ }
38
+ get format() {
39
+ return this.props.format;
40
+ }
41
+ get samples() {
42
+ return this.props.samples;
43
+ }
44
+ get attachment() {
45
+ return;
46
+ }
34
47
  /** WebGL format constant */
35
48
  glFormat;
36
49
  static isTextureFormatSupported(device, format) {
37
- return isRenderbufferFormatSupported(device.gl, format);
50
+ return isRenderbufferFormatSupported(device.gl, format, device._extensions);
38
51
  }
39
52
  constructor(device, props) {
40
53
  // TODO - remove temporary sanity check
@@ -58,15 +71,15 @@ export class WEBGLRenderbuffer extends WebGLResource {
58
71
  const { format, width, height, samples } = props;
59
72
  assert(format, 'Needs format');
60
73
  this.trackDeallocatedMemory();
61
- this.gl.bindRenderbuffer(GL.RENDERBUFFER, this.handle);
74
+ this.gl.bindRenderbuffer(36161, this.handle);
62
75
  if (samples !== 0) {
63
- this.gl.renderbufferStorageMultisample(GL.RENDERBUFFER, samples, this.glFormat, width, height);
76
+ this.gl.renderbufferStorageMultisample(36161, samples, this.glFormat, width, height);
64
77
  }
65
78
  else {
66
- this.gl.renderbufferStorage(GL.RENDERBUFFER, this.glFormat, width, height);
79
+ this.gl.renderbufferStorage(36161, this.glFormat, width, height);
67
80
  }
68
- this.gl.bindRenderbuffer(GL.RENDERBUFFER, null);
69
- this.trackAllocatedMemory(width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.glFormat));
81
+ this.gl.bindRenderbuffer(36161, null);
82
+ this.trackAllocatedMemory(width * height * (samples || 1) * getTextureFormatBytesPerPixel(this.format));
70
83
  }
71
84
  // RESOURCE IMPLEMENTATION
72
85
  _createHandle() {
@@ -77,6 +90,6 @@ export class WEBGLRenderbuffer extends WebGLResource {
77
90
  this.trackDeallocatedMemory();
78
91
  }
79
92
  _bindHandle(handle) {
80
- this.gl.bindRenderbuffer(GL.RENDERBUFFER, handle);
93
+ this.gl.bindRenderbuffer(36161, handle);
81
94
  }
82
95
  }