@geastack/native-webgl-angle 0.1.15 → 0.1.16

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.
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",
@@ -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);
@@ -495,6 +499,10 @@ struct AngleWebGLState {
495
499
  PFNGLACTIVETEXTUREPROC glActiveTexture = nullptr;
496
500
  PFNGLATTACHSHADERPROC glAttachShader = nullptr;
497
501
  PFNGLBINDBUFFERPROC glBindBuffer = nullptr;
502
+ PFNGLBINDBUFFERBASEPROC glBindBufferBase = nullptr;
503
+ PFNGLBINDBUFFERRANGEPROC glBindBufferRange = nullptr;
504
+ PFNGLGETUNIFORMBLOCKINDEXPROC glGetUniformBlockIndex = nullptr;
505
+ PFNGLUNIFORMBLOCKBINDINGPROC glUniformBlockBinding = nullptr;
498
506
  PFNGLBINDFRAMEBUFFERPROC glBindFramebuffer = nullptr;
499
507
  PFNGLBINDRENDERBUFFERPROC glBindRenderbuffer = nullptr;
500
508
  PFNGLBINDTEXTUREPROC glBindTexture = nullptr;
@@ -1030,6 +1038,10 @@ static bool loadGlSymbols() {
1030
1038
  LOAD_GL(glActiveTexture, PFNGLACTIVETEXTUREPROC)
1031
1039
  LOAD_GL(glAttachShader, PFNGLATTACHSHADERPROC)
1032
1040
  LOAD_GL(glBindBuffer, PFNGLBINDBUFFERPROC)
1041
+ LOAD_GL(glBindBufferBase, PFNGLBINDBUFFERBASEPROC)
1042
+ LOAD_GL(glBindBufferRange, PFNGLBINDBUFFERRANGEPROC)
1043
+ LOAD_GL(glGetUniformBlockIndex, PFNGLGETUNIFORMBLOCKINDEXPROC)
1044
+ LOAD_GL(glUniformBlockBinding, PFNGLUNIFORMBLOCKBINDINGPROC)
1033
1045
  LOAD_GL(glBindFramebuffer, PFNGLBINDFRAMEBUFFERPROC)
1034
1046
  LOAD_GL(glBindRenderbuffer, PFNGLBINDRENDERBUFFERPROC)
1035
1047
  LOAD_GL(glBindTexture, PFNGLBINDTEXTUREPROC)
@@ -2402,6 +2414,23 @@ extern "C" void gea_three_webgl_draw_arrays(double mode, double first, double co
2402
2414
  extern "C" void gea_three_webgl_vertex_attrib_divisor(double index, double divisor) {
2403
2415
  geaTrapCheck("gea_three_webgl_vertex_attrib_divisor"); GEA_WEBGL_VOID("vertexAttribDivisor");
2404
2416
  gWebGL.glVertexAttribDivisor(asGLuint(index), asGLuint(divisor)); }
2417
+ // Indexed binds also set the target's generic binding. The host shadows only the
2418
+ // ARRAY_BUFFER and COPY_READ/WRITE bindings (bindNativeBuffer), and the uniform
2419
+ // staging path queries UNIFORM_BUFFER_BINDING instead of shadowing it, so neither
2420
+ // call needs to update a shadow.
2421
+ extern "C" void gea_three_webgl_bind_buffer_base(double target, double index, double buffer) {
2422
+ geaTrapCheck("gea_three_webgl_bind_buffer_base"); GEA_WEBGL_VOID("bindBufferBase");
2423
+ gWebGL.glBindBufferBase(asGLenum(target), asGLuint(index), asGLuint(buffer)); }
2424
+ extern "C" void gea_three_webgl_bind_buffer_range(double target, double index, double buffer, double offset, double size) {
2425
+ geaTrapCheck("gea_three_webgl_bind_buffer_range"); GEA_WEBGL_VOID("bindBufferRange");
2426
+ gWebGL.glBindBufferRange(asGLenum(target), asGLuint(index), asGLuint(buffer),
2427
+ static_cast<GLintptr>(offset), static_cast<GLsizeiptr>(size)); }
2428
+ extern "C" double gea_three_webgl_get_uniform_block_index(double program, std::string name) {
2429
+ geaTrapCheck("gea_three_webgl_get_uniform_block_index"); GEA_WEBGL_DOUBLE("getUniformBlockIndex");
2430
+ return gWebGL.glGetUniformBlockIndex(asGLuint(program), name.c_str()); }
2431
+ extern "C" void gea_three_webgl_uniform_block_binding(double program, double blockIndex, double binding) {
2432
+ geaTrapCheck("gea_three_webgl_uniform_block_binding"); GEA_WEBGL_VOID("uniformBlockBinding");
2433
+ gWebGL.glUniformBlockBinding(asGLuint(program), asGLuint(blockIndex), asGLuint(binding)); }
2405
2434
  extern "C" void gea_three_webgl_draw_elements_instanced(double mode, double count, double type, double offset, double instanceCount) {
2406
2435
  geaTrapCheck("gea_three_webgl_draw_elements_instanced"); GEA_WEBGL_VOID("drawElementsInstanced");
2407
2436
  gWebGL.glDrawElementsInstanced(asGLenum(mode), asGLsizei(count), asGLenum(type),
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.16",
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,
@@ -1260,10 +1264,18 @@ export class NativeWebGL2RenderingContext {
1260
1264
  getVertexAttrib(_index: number, _pname: number): number { return 0 }
1261
1265
  getVertexAttribOffset(_index: number, _pname: number): number { return 0 }
1262
1266
  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 {}
1267
+ getUniformBlockIndex(program: NativeProgram | null, uniformBlockName: string): number {
1268
+ return nativeWebGLGetUniformBlockIndex(nullableNativeHandle(program), uniformBlockName)
1269
+ }
1270
+ uniformBlockBinding(program: NativeProgram | null, uniformBlockIndex: number, uniformBlockBinding: number): void {
1271
+ nativeWebGLUniformBlockBinding(nullableNativeHandle(program), uniformBlockIndex, uniformBlockBinding)
1272
+ }
1273
+ bindBufferBase(target: number, index: number, buffer: NativeHandle | null): void {
1274
+ nativeWebGLBindBufferBase(target, index, nullableNativeHandle(buffer))
1275
+ }
1276
+ bindBufferRange(target: number, index: number, buffer: NativeHandle | null, offset: number, size: number): void {
1277
+ nativeWebGLBindBufferRange(target, index, nullableNativeHandle(buffer), offset, size)
1278
+ }
1267
1279
  fenceSync(_condition: number, _flags: number): NativeHandle | null {
1268
1280
  const sync = threeWebGLFenceSync()
1269
1281
  return sync ? createHandle('sync', sync) : null
@@ -366,6 +366,23 @@ 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 nativeWebGLBindBufferBase(target: number, index: number, buffer: number): void { threeWebGLBindBufferBase(target, index, buffer) }
370
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
371
+ declare function threeWebGLBindBufferBase(target: number, index: number, buffer: number): void
372
+ export function nativeWebGLBindBufferRange(target: number, index: number, buffer: number, offset: number, size: number): void {
373
+ threeWebGLBindBufferRange(target, index, buffer, offset, size)
374
+ }
375
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
376
+ declare function threeWebGLBindBufferRange(target: number, index: number, buffer: number, offset: number, size: number): void
377
+ export function nativeWebGLGetUniformBlockIndex(program: number, name: string): number { return threeWebGLGetUniformBlockIndex(program, name) }
378
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
379
+ declare function threeWebGLGetUniformBlockIndex(program: number, name: string): number
380
+ export function nativeWebGLUniformBlockBinding(program: number, blockIndex: number, binding: number): void {
381
+ threeWebGLUniformBlockBinding(program, blockIndex, binding)
382
+ }
383
+ /** @gea-host-inert Native state only; retains no script references and invokes no script. */
384
+ declare function threeWebGLUniformBlockBinding(program: number, blockIndex: number, binding: number): void
385
+
369
386
  export function nativeWebGLVertexAttribDivisor(index: number, divisor: number): void { threeWebGLVertexAttribDivisor(index, divisor) }
370
387
  /** @gea-host-inert Native state only; retains no script references and invokes no script. */
371
388
  declare function threeWebGLVertexAttribDivisor(index: number, divisor: number): void