@geastack/native-webgl-angle 0.1.15 → 0.1.17

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.
@@ -16,6 +16,9 @@ export const nativeUploadFunctions = [
16
16
  ['threeWebGLTexImage3D', 'gea_three_webgl_tex_image_3d_native', ['target', 'level', 'internalFormat', 'width', 'height', 'depth', 'format', 'type'], 'gea_three_webgl_tex_image_3d_bytes', ['target', 'level', 'internalFormat', 'width', 'height', 'depth', 'format', 'type'], textureElementKind],
17
17
  ['threeWebGLTexSubImage3D', 'gea_three_webgl_tex_sub_image_3d_native', ['target', 'level', 'xoffset', 'yoffset', 'zoffset', 'width', 'height', 'depth', 'format', 'type'], 'gea_three_webgl_tex_sub_image_3d_bytes', ['target', 'level', 'xoffset', 'yoffset', 'zoffset', 'width', 'height', 'depth', 'format', 'type'], textureElementKind],
18
18
  ['threeWebGLTexSubImage2D', 'gea_three_webgl_tex_sub_image_2d_native', ['target', 'level', 'xoffset', 'yoffset', 'width', 'height', 'format', 'type'], 'gea_three_webgl_tex_sub_image_2d_bytes', ['target', 'level', 'xoffset', 'yoffset', 'width', 'height', 'format', 'type'], textureElementKind],
19
+ // Compressed blocks are opaque bytes.
20
+ ['threeWebGLCompressedTexImage2D', 'gea_three_webgl_compressed_tex_image_2d_native', ['target', 'level', 'internalFormat', 'width', 'height'], 'gea_three_webgl_compressed_tex_image_2d_bytes', ['target', 'level', 'internalFormat', 'width', 'height'], '4'],
21
+ ['threeWebGLCompressedTexSubImage2D', 'gea_three_webgl_compressed_tex_sub_image_2d_native', ['target', 'level', 'xoffset', 'yoffset', 'width', 'height', 'format'], 'gea_three_webgl_compressed_tex_sub_image_2d_bytes', ['target', 'level', 'xoffset', 'yoffset', 'width', 'height', 'format'], '4'],
19
22
  ].map(([name, binding, parameters, raw, rawParameters, kind, range]) => {
20
23
  const declaration = `extern "C" void ${raw}(${rawParameters.map(p => `double ${p}`).join(', ')}, const void* bytes, double byteLength);
21
24
  template <typename Source> inline void ${binding}(${parameters.map(p => `double ${p}`).join(', ')}, const Source& values${range ? ', double sourceOffset, double length' : ''}) {
package/geatsc-plugin.mjs CHANGED
@@ -77,6 +77,30 @@ function nativeVoidMemberCallContract(
77
77
  const hostFunctions = [
78
78
  ['threeWebGLCopyTexImage2D','gea_three_webgl_copy_tex_image_2d','void','extern "C" void gea_three_webgl_copy_tex_image_2d(double,double,double,double,double,double,double,double);'],
79
79
  ['threeWebGLCopyTexSubImage2D','gea_three_webgl_copy_tex_sub_image_2d','void','extern "C" void gea_three_webgl_copy_tex_sub_image_2d(double,double,double,double,double,double,double,double);'],
80
+ [
81
+ "threeWebGLBindBufferBase",
82
+ "gea_three_webgl_bind_buffer_base",
83
+ "void",
84
+ 'extern "C" void gea_three_webgl_bind_buffer_base(double target, double index, double buffer);',
85
+ ],
86
+ [
87
+ "threeWebGLBindBufferRange",
88
+ "gea_three_webgl_bind_buffer_range",
89
+ "void",
90
+ 'extern "C" void gea_three_webgl_bind_buffer_range(double target, double index, double buffer, double offset, double size);',
91
+ ],
92
+ [
93
+ "threeWebGLGetUniformBlockIndex",
94
+ "gea_three_webgl_get_uniform_block_index",
95
+ "double",
96
+ 'extern "C" double gea_three_webgl_get_uniform_block_index(double program, std::string name);',
97
+ ],
98
+ [
99
+ "threeWebGLUniformBlockBinding",
100
+ "gea_three_webgl_uniform_block_binding",
101
+ "void",
102
+ 'extern "C" void gea_three_webgl_uniform_block_binding(double program, double blockIndex, double binding);',
103
+ ],
80
104
  [
81
105
  "threeWebGLVertexAttribDivisor",
82
106
  "gea_three_webgl_vertex_attrib_divisor",
@@ -114,6 +138,18 @@ inline double gea_three_resource_read_native(std::string name, const gea::Ref<ge
114
138
  ['threeWebGLTimerEnd','gea_three_webgl_timer_end','void','extern "C" void gea_three_webgl_timer_end();'],
115
139
  ['threeWebGLTimerResult','gea_three_webgl_timer_result','double','extern "C" double gea_three_webgl_timer_result(double);'],
116
140
  ['threeWebGLRenderbufferStorageMultisample','gea_three_webgl_renderbuffer_storage_multisample','void','extern "C" void gea_three_webgl_renderbuffer_storage_multisample(double,double,double,double,double);'],
141
+ [
142
+ "threeWebGLPushDebugGroup",
143
+ "gea_three_webgl_push_debug_group",
144
+ "void",
145
+ 'extern "C" void gea_three_webgl_push_debug_group(std::string label);',
146
+ ],
147
+ [
148
+ "threeWebGLPopDebugGroup",
149
+ "gea_three_webgl_pop_debug_group",
150
+ "void",
151
+ 'extern "C" void gea_three_webgl_pop_debug_group();',
152
+ ],
117
153
  [
118
154
  "threeNativeProfilePhase",
119
155
  "gea_three_native_profile_phase",
@@ -2099,8 +2135,29 @@ const transformSource = ({ fileName, text }) => {
2099
2135
  if (normalized.endsWith("/three/src/renderers/WebGLRenderer.js")) {
2100
2136
  transformed =
2101
2137
  // Forward slashes: a Windows path's backslashes would be escapes in this literal.
2102
- `import { nativeProfilePhase } from '${fileURLToPath(new URL("./src/nativeWebGLHost.ts", import.meta.url)).replaceAll("\\", "/")}';\n` +
2138
+ `import { nativeProfilePhase, nativePushDebugGroup, nativePopDebugGroup } from '${fileURLToPath(new URL("./src/nativeWebGLHost.ts", import.meta.url)).replaceAll("\\", "/")}';\n` +
2103
2139
  transformed;
2140
+ transformed = replaceOne(
2141
+ transformed,
2142
+ "\t\t\tif ( _isContextLost === true ) return;\n",
2143
+ "\t\t\tif ( _isContextLost === true ) return;\n\n\t\t\tnativePushDebugGroup( scene.name !== '' ? scene.name : ( camera.name !== '' ? camera.name : scene.type ) );\n",
2144
+ fileName,
2145
+ "WebGLRenderer render debug group begin",
2146
+ );
2147
+ transformed = replaceOne(
2148
+ transformed,
2149
+ "\t\t\t\t_nodesHandler.renderEnd();\n\n\t\t\t}\n\n\t\t};",
2150
+ "\t\t\t\t_nodesHandler.renderEnd();\n\n\t\t\t}\n\n\t\t\tnativePopDebugGroup();\n\n\t\t};",
2151
+ fileName,
2152
+ "WebGLRenderer render debug group end",
2153
+ );
2154
+ transformed = replaceOne(
2155
+ transformed,
2156
+ "\t\t\tif ( opaqueObjects.length > 0 ) renderObjects( opaqueObjects, scene, camera );\n\t\t\tif ( transmissiveObjects.length > 0 ) renderObjects( transmissiveObjects, scene, camera );\n\t\t\tif ( transparentObjects.length > 0 ) renderObjects( transparentObjects, scene, camera );\n",
2157
+ "\t\t\tif ( opaqueObjects.length > 0 ) {\n\n\t\t\t\tnativePushDebugGroup( 'opaque' );\n\t\t\t\trenderObjects( opaqueObjects, scene, camera );\n\t\t\t\tnativePopDebugGroup();\n\n\t\t\t}\n\n\t\t\tif ( transmissiveObjects.length > 0 ) {\n\n\t\t\t\tnativePushDebugGroup( 'transmissive' );\n\t\t\t\trenderObjects( transmissiveObjects, scene, camera );\n\t\t\t\tnativePopDebugGroup();\n\n\t\t\t}\n\n\t\t\tif ( transparentObjects.length > 0 ) {\n\n\t\t\t\tnativePushDebugGroup( 'transparent' );\n\t\t\t\trenderObjects( transparentObjects, scene, camera );\n\t\t\t\tnativePopDebugGroup();\n\n\t\t\t}\n",
2158
+ fileName,
2159
+ "WebGLRenderer render list debug groups",
2160
+ );
2104
2161
  transformed = replaceOne(
2105
2162
  transformed,
2106
2163
  "if ( scene.matrixWorldAutoUpdate === true ) scene.updateMatrixWorld();",
@@ -6402,6 +6459,23 @@ ${wiringText.replace(/\t\t\t\t/g, "\t\t\t\t")}
6402
6459
  );
6403
6460
  }
6404
6461
  if (normalized.endsWith("/three/src/renderers/webgl/WebGLShadowMap.js")) {
6462
+ transformed =
6463
+ `import { nativePushDebugGroup, nativePopDebugGroup } from '${fileURLToPath(new URL("./src/nativeWebGLHost.ts", import.meta.url)).replaceAll("\\", "/")}';\n` +
6464
+ transformed;
6465
+ transformed = replaceOne(
6466
+ transformed,
6467
+ "\t\tif ( lights.length === 0 ) return;\n",
6468
+ "\t\tif ( lights.length === 0 ) return;\n\n\t\tnativePushDebugGroup( 'shadow map' );\n",
6469
+ fileName,
6470
+ "WebGLShadowMap debug group begin",
6471
+ );
6472
+ transformed = replaceOne(
6473
+ transformed,
6474
+ "\t\tscope.needsUpdate = false;\n\n\t\trenderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n",
6475
+ "\t\tscope.needsUpdate = false;\n\n\t\trenderer.setRenderTarget( currentRenderTarget, activeCubeFace, activeMipmapLevel );\n\n\t\tnativePopDebugGroup();\n",
6476
+ fileName,
6477
+ "WebGLShadowMap debug group end",
6478
+ );
6405
6479
  // An app that replaces `shadowMap.render` (the browser's cached sun shadow)
6406
6480
  // cannot do so natively: the field holds a `this`-bound function expression
6407
6481
  // no app function converts to. This hook is an ordinary function-typed
@@ -347,6 +347,10 @@ using PFNEGLSWAPINTERVALPROC = EGLBoolean (*)(EGLDisplay, EGLint);
347
347
  using PFNGLACTIVETEXTUREPROC = void (*)(GLenum);
348
348
  using PFNGLATTACHSHADERPROC = void (*)(GLuint, GLuint);
349
349
  using PFNGLBINDBUFFERPROC = void (*)(GLenum, GLuint);
350
+ using PFNGLBINDBUFFERBASEPROC = void (*)(GLenum, GLuint, GLuint);
351
+ using PFNGLBINDBUFFERRANGEPROC = void (*)(GLenum, GLuint, GLuint, GLintptr, GLsizeiptr);
352
+ using PFNGLGETUNIFORMBLOCKINDEXPROC = GLuint (*)(GLuint, const char *);
353
+ using PFNGLUNIFORMBLOCKBINDINGPROC = void (*)(GLuint, GLuint, GLuint);
350
354
  using PFNGLBINDFRAMEBUFFERPROC = void (*)(GLenum, GLuint);
351
355
  using PFNGLBINDRENDERBUFFERPROC = void (*)(GLenum, GLuint);
352
356
  using PFNGLBINDTEXTUREPROC = void (*)(GLenum, GLuint);
@@ -429,6 +433,8 @@ using PFNGLTEXSUBIMAGE3DPROC = void (*)(GLenum, GLint, GLint, GLint, GLint, GLsi
429
433
  using PFNGLTEXSTORAGE3DPROC = void (*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei, GLsizei);
430
434
  using PFNGLFRAMEBUFFERTEXTURELAYERPROC = void (*)(GLenum, GLenum, GLuint, GLint, GLint);
431
435
  using PFNGLTEXSTORAGE2DPROC = void (*)(GLenum, GLsizei, GLenum, GLsizei, GLsizei);
436
+ using PFNGLCOMPRESSEDTEXIMAGE2DPROC = void (*)(GLenum, GLint, GLenum, GLsizei, GLsizei, GLint, GLsizei, const void *);
437
+ using PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC = void (*)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLsizei, const void *);
432
438
  using PFNGLUNIFORM1FPROC = void (*)(GLint, GLfloat);
433
439
  using PFNGLUNIFORM1FVPROC = void (*)(GLint, GLsizei, const GLfloat *);
434
440
  using PFNGLUNIFORM1IPROC = void (*)(GLint, GLint);
@@ -495,6 +501,12 @@ struct AngleWebGLState {
495
501
  PFNGLACTIVETEXTUREPROC glActiveTexture = nullptr;
496
502
  PFNGLATTACHSHADERPROC glAttachShader = nullptr;
497
503
  PFNGLBINDBUFFERPROC glBindBuffer = nullptr;
504
+ PFNGLBINDBUFFERBASEPROC glBindBufferBase = nullptr;
505
+ PFNGLBINDBUFFERRANGEPROC glBindBufferRange = nullptr;
506
+ PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex = nullptr;
507
+ PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding = nullptr;
508
+ void (*glPushGroupMarkerEXT)(GLsizei, const GLchar *) = nullptr;
509
+ void (*glPopGroupMarkerEXT)() = nullptr;
498
510
  PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer = nullptr;
499
511
  PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer = nullptr;
500
512
  PFNGLBINDTEXTUREPROC glBindTexture = nullptr;
@@ -579,6 +591,9 @@ struct AngleWebGLState {
579
591
  PFNGLTEXPARAMETERIPROC glTexParameteri = nullptr;
580
592
  PFNGLTEXSUBIMAGE2DPROC glTexSubImage2D = nullptr;
581
593
  PFNGLTEXSTORAGE2DPROC glTexStorage2D = nullptr;
594
+ // Compressed uploads are optional too: a GLES without them drops the call.
595
+ PFNGLCOMPRESSEDTEXIMAGE2DPROC glCompressedTexImage2D = nullptr;
596
+ PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC glCompressedTexSubImage2D = nullptr;
582
597
  // Array/3D entry points are optional: a GLES without them still starts,
583
598
  // and uploads to those targets report GL_INVALID_OPERATION in the log.
584
599
  PFNGLTEXIMAGE3DPROC glTexImage3D = nullptr;
@@ -1030,6 +1045,15 @@ static bool loadGlSymbols() {
1030
1045
  LOAD_GL(glActiveTexture, PFNGLACTIVETEXTUREPROC)
1031
1046
  LOAD_GL(glAttachShader, PFNGLATTACHSHADERPROC)
1032
1047
  LOAD_GL(glBindBuffer, PFNGLBINDBUFFERPROC)
1048
+ // Uniform-buffer entry points are optional like the array/3D ones: a GLES
1049
+ // without them (threejs-rendozer exports none) still starts, and only a
1050
+ // program that uses uniform groups loses them, with a log line per call.
1051
+ gWebGL.glBindBufferBase = loadGl<PFNGLBINDBUFFERBASEPROC>("glBindBufferBase");
1052
+ gWebGL.glBindBufferRange = loadGl<PFNGLBINDBUFFERRANGEPROC>("glBindBufferRange");
1053
+ gWebGL.glGetUniformBlockIndex = loadGl<PFNGLGETUNIFORMBLOCKINDEXPROC>("glGetUniformBlockIndex");
1054
+ gWebGL.glUniformBlockBinding = loadGl<PFNGLUNIFORMBLOCKBINDINGPROC>("glUniformBlockBinding");
1055
+ gWebGL.glPushGroupMarkerEXT = loadGl<decltype(gWebGL.glPushGroupMarkerEXT)>("glPushGroupMarkerEXT");
1056
+ gWebGL.glPopGroupMarkerEXT = loadGl<decltype(gWebGL.glPopGroupMarkerEXT)>("glPopGroupMarkerEXT");
1033
1057
  LOAD_GL(glBindFramebuffer, PFNGLBINDFRAMEBUFFERPROC)
1034
1058
  LOAD_GL(glBindRenderbuffer, PFNGLBINDRENDERBUFFERPROC)
1035
1059
  LOAD_GL(glBindTexture, PFNGLBINDTEXTUREPROC)
@@ -1117,6 +1141,8 @@ static bool loadGlSymbols() {
1117
1141
  LOAD_GL(glTexParameteri, PFNGLTEXPARAMETERIPROC)
1118
1142
  LOAD_GL(glTexSubImage2D, PFNGLTEXSUBIMAGE2DPROC)
1119
1143
  LOAD_GL(glTexStorage2D, PFNGLTEXSTORAGE2DPROC)
1144
+ gWebGL.glCompressedTexImage2D = loadGl<PFNGLCOMPRESSEDTEXIMAGE2DPROC>("glCompressedTexImage2D");
1145
+ gWebGL.glCompressedTexSubImage2D = loadGl<PFNGLCOMPRESSEDTEXSUBIMAGE2DPROC>("glCompressedTexSubImage2D");
1120
1146
  gWebGL.glTexImage3D = loadGl<PFNGLTEXIMAGE3DPROC>("glTexImage3D");
1121
1147
  gWebGL.glTexSubImage3D = loadGl<PFNGLTEXSUBIMAGE3DPROC>("glTexSubImage3D");
1122
1148
  gWebGL.glTexStorage3D = loadGl<PFNGLTEXSTORAGE3DPROC>("glTexStorage3D");
@@ -2402,6 +2428,35 @@ extern "C" void gea_three_webgl_draw_arrays(double mode, double first, double co
2402
2428
  extern "C" void gea_three_webgl_vertex_attrib_divisor(double index, double divisor) {
2403
2429
  geaTrapCheck("gea_three_webgl_vertex_attrib_divisor"); GEA_WEBGL_VOID("vertexAttribDivisor");
2404
2430
  gWebGL.glVertexAttribDivisor(asGLuint(index), asGLuint(divisor)); }
2431
+ static bool requireGl(const void *fn, const char *name);
2432
+ // Indexed binds also set the target's generic binding. The host shadows only the
2433
+ // ARRAY_BUFFER and COPY_READ/WRITE bindings (bindNativeBuffer), and the uniform
2434
+ // staging path queries UNIFORM_BUFFER_BINDING instead of shadowing it, so neither
2435
+ // call needs to update a shadow.
2436
+ extern "C" void gea_three_webgl_bind_buffer_base(double target, double index, double buffer) {
2437
+ geaTrapCheck("gea_three_webgl_bind_buffer_base"); GEA_WEBGL_VOID("bindBufferBase");
2438
+ if (!requireGl(reinterpret_cast<const void *>(gWebGL.glBindBufferBase), "glBindBufferBase")) return;
2439
+ gWebGL.glBindBufferBase(asGLenum(target), asGLuint(index), asGLuint(buffer)); }
2440
+ extern "C" void gea_three_webgl_bind_buffer_range(double target, double index, double buffer, double offset, double size) {
2441
+ geaTrapCheck("gea_three_webgl_bind_buffer_range"); GEA_WEBGL_VOID("bindBufferRange");
2442
+ if (!requireGl(reinterpret_cast<const void *>(gWebGL.glBindBufferRange), "glBindBufferRange")) return;
2443
+ gWebGL.glBindBufferRange(asGLenum(target), asGLuint(index), asGLuint(buffer),
2444
+ static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size)); }
2445
+ extern "C" double gea_three_webgl_get_uniform_block_index(double program, std::string name) {
2446
+ geaTrapCheck("gea_three_webgl_get_uniform_block_index"); GEA_WEBGL_DOUBLE("getUniformBlockIndex");
2447
+ // GL_INVALID_INDEX: the block is reported as absent.
2448
+ if (!requireGl(reinterpret_cast<const void *>(gWebGL.glGetUniformBlockIndex), "glGetUniformBlockIndex")) return 4294967295.0;
2449
+ return gWebGL.glGetUniformBlockIndex(asGLuint(program), name.c_str()); }
2450
+ extern "C" void gea_three_webgl_uniform_block_binding(double program, double blockIndex, double binding) {
2451
+ geaTrapCheck("gea_three_webgl_uniform_block_binding"); GEA_WEBGL_VOID("uniformBlockBinding");
2452
+ if (!requireGl(reinterpret_cast<const void *>(gWebGL.glUniformBlockBinding), "glUniformBlockBinding")) return;
2453
+ gWebGL.glUniformBlockBinding(asGLuint(program), asGLuint(blockIndex), asGLuint(binding)); }
2454
+ extern "C" void gea_three_webgl_push_debug_group(std::string label) {
2455
+ geaTrapCheck("gea_three_webgl_push_debug_group"); GEA_WEBGL_VOID("pushDebugGroup");
2456
+ if (gWebGL.glPushGroupMarkerEXT) gWebGL.glPushGroupMarkerEXT(static_cast<GLsizei>(label.size()), label.c_str()); }
2457
+ extern "C" void gea_three_webgl_pop_debug_group() {
2458
+ geaTrapCheck("gea_three_webgl_pop_debug_group"); GEA_WEBGL_VOID("popDebugGroup");
2459
+ if (gWebGL.glPopGroupMarkerEXT) gWebGL.glPopGroupMarkerEXT(); }
2405
2460
  extern "C" void gea_three_webgl_draw_elements_instanced(double mode, double count, double type, double offset, double instanceCount) {
2406
2461
  geaTrapCheck("gea_three_webgl_draw_elements_instanced"); GEA_WEBGL_VOID("drawElementsInstanced");
2407
2462
  gWebGL.glDrawElementsInstanced(asGLenum(mode), asGLsizei(count), asGLenum(type),
@@ -2650,6 +2705,18 @@ extern "C" void gea_three_webgl_tex_sub_image_3d_bytes(double target, double lev
2650
2705
  gWebGL.glTexSubImage3D(asGLenum(target), asGLint(level), asGLint(xoffset), asGLint(yoffset), asGLint(zoffset), asGLsizei(width), asGLsizei(height), asGLsizei(depth), asGLenum(format), asGLenum(type), bytes);
2651
2706
  }
2652
2707
 
2708
+ extern "C" void gea_three_webgl_compressed_tex_image_2d_bytes(double target, double level, double internalFormat, double width, double height, const void* bytes, double byteLength) {
2709
+ GEA_WEBGL_VOID("compressedTexImage2DBytes");
2710
+ if (!requireGl(reinterpret_cast<const void *>(gWebGL.glCompressedTexImage2D), "glCompressedTexImage2D")) return;
2711
+ gWebGL.glCompressedTexImage2D(asGLenum(target), asGLint(level), asGLenum(internalFormat), asGLsizei(width), asGLsizei(height), 0, asGLsizei(byteLength), bytes);
2712
+ }
2713
+
2714
+ extern "C" void gea_three_webgl_compressed_tex_sub_image_2d_bytes(double target, double level, double xoffset, double yoffset, double width, double height, double format, const void* bytes, double byteLength) {
2715
+ GEA_WEBGL_VOID("compressedTexSubImage2DBytes");
2716
+ if (!requireGl(reinterpret_cast<const void *>(gWebGL.glCompressedTexSubImage2D), "glCompressedTexSubImage2D")) return;
2717
+ gWebGL.glCompressedTexSubImage2D(asGLenum(target), asGLint(level), asGLint(xoffset), asGLint(yoffset), asGLsizei(width), asGLsizei(height), asGLenum(format), asGLsizei(byteLength), bytes);
2718
+ }
2719
+
2653
2720
  extern "C" void gea_three_webgl_tex_storage_3d(double target, double levels, double internalFormat, double width, double height, double depth) {
2654
2721
  GEA_WEBGL_VOID("texStorage3D");
2655
2722
  if (!requireGl(reinterpret_cast<const void *>(gWebGL.glTexStorage3D), "glTexStorage3D")) return;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geastack/native-webgl-angle",
3
- "version": "0.1.15",
3
+ "version": "0.1.17",
4
4
  "description": "Typed native WebGL compatibility layer backed by ANGLE/Metal",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -54,7 +54,7 @@
54
54
  "test:host-effects": "node test/native-host-effects-contract.test.mjs",
55
55
  "test:allocation-contracts": "node test/render-sort-contract.test.mjs && node test/upload-array-contract.test.mjs && node test/draw-dispatch-contract.test.mjs && node test/native-upload-transport.test.mjs && node test/fixed-uniform-contract.test.mjs && node test/uniform-binding-contract.test.mjs && node test/buffer-streaming-contract.test.mjs",
56
56
  "check": "tsc -p tsconfig.json --noEmit",
57
- "test": "node test/native-blending-contract.test.mjs && node test/native-transform-contract.test.mjs && node test/troika-three-text.test.mjs && node test/typed-void-contract.test.mjs && node test/info-log-contract.test.mjs && node test/resource-host-contract.test.mjs && node test/instancing-transport-contract.test.mjs && node test/automatic-instancing-contract.test.mjs && node test/jsdoc-fold-contract.test.mjs && node test/gea-native-declaration.test.mjs",
57
+ "test": "node test/native-blending-contract.test.mjs && node test/native-transform-contract.test.mjs && node test/troika-three-text.test.mjs && node test/typed-void-contract.test.mjs && node test/info-log-contract.test.mjs && node test/resource-host-contract.test.mjs && node test/instancing-transport-contract.test.mjs && node test/automatic-instancing-contract.test.mjs && node test/jsdoc-fold-contract.test.mjs && node test/gea-native-declaration.test.mjs && node test/native-host-effects-contract.test.mjs && node test/uniform-buffer-contract.test.mjs",
58
58
  "test:package": "node --experimental-vm-modules test/package.test.mjs"
59
59
  },
60
60
  "dependencies": {
@@ -47,6 +47,10 @@ import {
47
47
  nativeWebGLDrawArraysInstanced,
48
48
  nativeWebGLDrawElementsInstanced,
49
49
  nativeWebGLVertexAttribDivisor,
50
+ nativeWebGLBindBufferBase,
51
+ nativeWebGLBindBufferRange,
52
+ nativeWebGLGetUniformBlockIndex,
53
+ nativeWebGLUniformBlockBinding,
50
54
  nativeWebGLDrawBuffers,
51
55
  nativeWebGLDrawElements,
52
56
  nativeWebGLEnable,
@@ -273,6 +277,10 @@ declare function threeWebGLTexImage2D(target: number, level: number, internalFor
273
277
  /** @gea-host-inert Reads its arguments, writes GL state only; never calls back into script. */
274
278
  declare function threeWebGLTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, values: BufferSourceLike): void
275
279
  /** @gea-host-inert Reads its arguments, writes GL state only; never calls back into script. */
280
+ declare function threeWebGLCompressedTexImage2D(target: number, level: number, internalFormat: number, width: number, height: number, values: BufferSourceLike): void
281
+ /** @gea-host-inert Reads its arguments, writes GL state only; never calls back into script. */
282
+ declare function threeWebGLCompressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, values: BufferSourceLike): void
283
+ /** @gea-host-inert Reads its arguments, writes GL state only; never calls back into script. */
276
284
  declare function threeWebGLTexStorage2D(target: number, levels: number, internalFormat: number, width: number, height: number): void
277
285
  /** @gea-host-inert Reads its arguments, writes GL state only; never calls back into script. */
278
286
  declare function threeWebGLTexImage3D(target: number, level: number, internalFormat: number, width: number, height: number, depth: number, format: number, type: number, values: BufferSourceLike): void
@@ -939,7 +947,10 @@ export class NativeWebGL2RenderingContext {
939
947
  }
940
948
 
941
949
  isContextLost(): boolean { return false }
942
- getSupportedExtensions(): string[] { return ['EXT_texture_filter_anisotropic', 'OES_texture_float_linear', 'EXT_color_buffer_float'] }
950
+ getSupportedExtensions(): string[] {
951
+ return ['EXT_texture_filter_anisotropic', 'OES_texture_float_linear', 'EXT_color_buffer_float', 'WEBGL_compressed_texture_s3tc',
952
+ 'WEBGL_compressed_texture_s3tc_srgb', 'EXT_texture_compression_rgtc', 'EXT_texture_compression_bptc']
953
+ }
943
954
 
944
955
  getExtension(name: string): WebGLExtension | null {
945
956
  // One shared shape for every supported name -- see `WebGLExtension`. The
@@ -951,7 +962,11 @@ export class NativeWebGL2RenderingContext {
951
962
  name === 'WEBGL_debug_renderer_info' ||
952
963
  name === 'OES_texture_float_linear' ||
953
964
  name === 'EXT_color_buffer_float' ||
954
- name === 'EXT_color_buffer_half_float'
965
+ name === 'EXT_color_buffer_half_float' ||
966
+ name === 'WEBGL_compressed_texture_s3tc' ||
967
+ name === 'WEBGL_compressed_texture_s3tc_srgb' ||
968
+ name === 'EXT_texture_compression_rgtc' ||
969
+ name === 'EXT_texture_compression_bptc'
955
970
  ) {
956
971
  return new WebGLExtension()
957
972
  }
@@ -1150,8 +1165,12 @@ export class NativeWebGL2RenderingContext {
1150
1165
  texSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, type: number, pixels: BufferSourceLike): void {
1151
1166
  threeWebGLTexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels)
1152
1167
  }
1153
- compressedTexImage2D(_target: number, _level: number, _internalFormat: number, _width: number, _height: number, _border: number, _data: BufferSourceLike): void {}
1154
- compressedTexSubImage2D(_target: number, _level: number, _xoffset: number, _yoffset: number, _width: number, _height: number, _format: number, _data: BufferSourceLike): void {}
1168
+ compressedTexImage2D(target: number, level: number, internalFormat: number, width: number, height: number, _border: number, data: BufferSourceLike): void {
1169
+ threeWebGLCompressedTexImage2D(target, level, internalFormat, width, height, data)
1170
+ }
1171
+ compressedTexSubImage2D(target: number, level: number, xoffset: number, yoffset: number, width: number, height: number, format: number, data: BufferSourceLike): void {
1172
+ threeWebGLCompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, data)
1173
+ }
1155
1174
  compressedTexImage3D(_target: number, _level: number, _internalFormat: number, _width: number, _height: number, _depth: number, _border: number, _data: BufferSourceLike): void {}
1156
1175
  compressedTexSubImage3D(_target: number, _level: number, _xoffset: number, _yoffset: number, _zoffset: number, _width: number, _height: number, _depth: number, _format: number, _data: BufferSourceLike): void {}
1157
1176
  texStorage2D(target: number, levels: number, internalFormat: number, width: number, height: number): void {
@@ -1260,10 +1279,18 @@ export class NativeWebGL2RenderingContext {
1260
1279
  getVertexAttrib(_index: number, _pname: number): number { return 0 }
1261
1280
  getVertexAttribOffset(_index: number, _pname: number): number { return 0 }
1262
1281
  getUniform(_program: NativeProgram | null, _location: NativeHandle | null): number { return 0 }
1263
- getUniformBlockIndex(_program: NativeProgram | null, _uniformBlockName: string): number { return 0 }
1264
- uniformBlockBinding(_program: NativeProgram | null, _uniformBlockIndex: number, _uniformBlockBinding: number): void {}
1265
- bindBufferBase(_target: number, _index: number, _buffer: NativeHandle | null): void {}
1266
- bindBufferRange(_target: number, _index: number, _buffer: NativeHandle | null, _offset: number, _size: number): void {}
1282
+ getUniformBlockIndex(program: NativeProgram | null, uniformBlockName: string): number {
1283
+ return nativeWebGLGetUniformBlockIndex(nullableNativeHandle(program), uniformBlockName)
1284
+ }
1285
+ uniformBlockBinding(program: NativeProgram | null, uniformBlockIndex: number, uniformBlockBinding: number): void {
1286
+ nativeWebGLUniformBlockBinding(nullableNativeHandle(program), uniformBlockIndex, uniformBlockBinding)
1287
+ }
1288
+ bindBufferBase(target: number, index: number, buffer: NativeHandle | null): void {
1289
+ nativeWebGLBindBufferBase(target, index, nullableNativeHandle(buffer))
1290
+ }
1291
+ bindBufferRange(target: number, index: number, buffer: NativeHandle | null, offset: number, size: number): void {
1292
+ nativeWebGLBindBufferRange(target, index, nullableNativeHandle(buffer), offset, size)
1293
+ }
1267
1294
  fenceSync(_condition: number, _flags: number): NativeHandle | null {
1268
1295
  const sync = threeWebGLFenceSync()
1269
1296
  return sync ? createHandle('sync', sync) : null
@@ -366,6 +366,30 @@ declare function threeWebGLGetError(): number
366
366
  declare function threeNativeProfilePhase(phase: number): void
367
367
  export function nativeProfilePhase(phase: number): void { threeNativeProfilePhase(phase) }
368
368
 
369
+ export function nativePushDebugGroup(label: string): void { threeWebGLPushDebugGroup(label) }
370
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
371
+ declare function threeWebGLPushDebugGroup(label: string): void
372
+ export function nativePopDebugGroup(): void { threeWebGLPopDebugGroup() }
373
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
374
+ declare function threeWebGLPopDebugGroup(): void
375
+
376
+ export function nativeWebGLBindBufferBase(target: number, index: number, buffer: number): void { threeWebGLBindBufferBase(target, index, buffer) }
377
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
378
+ declare function threeWebGLBindBufferBase(target: number, index: number, buffer: number): void
379
+ export function nativeWebGLBindBufferRange(target: number, index: number, buffer: number, offset: number, size: number): void {
380
+ threeWebGLBindBufferRange(target, index, buffer, offset, size)
381
+ }
382
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
383
+ declare function threeWebGLBindBufferRange(target: number, index: number, buffer: number, offset: number, size: number): void
384
+ export function nativeWebGLGetUniformBlockIndex(program: number, name: string): number { return threeWebGLGetUniformBlockIndex(program, name) }
385
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
386
+ declare function threeWebGLGetUniformBlockIndex(program: number, name: string): number
387
+ export function nativeWebGLUniformBlockBinding(program: number, blockIndex: number, binding: number): void {
388
+ threeWebGLUniformBlockBinding(program, blockIndex, binding)
389
+ }
390
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
391
+ declare function threeWebGLUniformBlockBinding(program: number, blockIndex: number, binding: number): void
392
+
369
393
  export function nativeWebGLVertexAttribDivisor(index: number, divisor: number): void { threeWebGLVertexAttribDivisor(index, divisor) }
370
394
  /** @gea-host-inert Native state only; retains no script references and invokes no script. */
371
395
  declare function threeWebGLVertexAttribDivisor(index: number, divisor: number): void