@gjsify/webgl 0.0.3 → 0.1.0
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/README.md +78 -6
- package/lib/esm/canvas-webgl-widget.js +116 -0
- package/lib/esm/html-canvas-element.js +31 -50
- package/lib/esm/index.js +7 -0
- package/lib/esm/index.spec.js +629 -120
- package/lib/esm/test-utils.js +87 -0
- package/lib/esm/test.js +5 -1
- package/lib/esm/utils.js +1 -1
- package/lib/esm/webgl-active-info.js +2 -2
- package/lib/esm/webgl-buffer.js +2 -3
- package/lib/esm/webgl-context-attributes.js +2 -3
- package/lib/esm/webgl-framebuffer.js +3 -4
- package/lib/esm/webgl-program.js +2 -3
- package/lib/esm/webgl-query.js +15 -0
- package/lib/esm/webgl-renderbuffer.js +2 -3
- package/lib/esm/webgl-rendering-context.js +105 -101
- package/lib/esm/webgl-sampler.js +15 -0
- package/lib/esm/webgl-shader-precision-format.js +2 -3
- package/lib/esm/webgl-shader.js +2 -3
- package/lib/esm/webgl-sync.js +15 -0
- package/lib/esm/webgl-texture.js +2 -3
- package/lib/esm/webgl-transform-feedback.js +15 -0
- package/lib/esm/webgl-uniform-location.js +2 -3
- package/lib/esm/webgl-vertex-array-object.js +21 -0
- package/lib/esm/webgl2-rendering-context.js +591 -0
- package/lib/esm/webgl2.spec.js +578 -0
- package/lib/types/canvas-webgl-widget.d.ts +509 -0
- package/lib/types/extensions/ext-blend-minmax.d.ts +2 -2
- package/lib/types/extensions/ext-texture-filter-anisotropic.d.ts +2 -2
- package/lib/types/extensions/oes-element-index-unit.d.ts +2 -2
- package/lib/types/extensions/oes-standard-derivatives.d.ts +2 -2
- package/lib/types/extensions/oes-texture-float-linear.d.ts +2 -2
- package/lib/types/extensions/oes-texture-float.d.ts +2 -2
- package/lib/types/extensions/stackgl-destroy-context.d.ts +3 -3
- package/lib/types/extensions/stackgl-resize-drawing-buffer.d.ts +3 -3
- package/lib/types/html-canvas-element.d.ts +19 -30
- package/lib/types/index.d.ts +7 -0
- package/lib/types/test-utils.d.ts +45 -0
- package/lib/types/types/extension.d.ts +2 -2
- package/lib/types/utils.d.ts +14 -15
- package/lib/types/webgl-active-info.d.ts +1 -2
- package/lib/types/webgl-buffer.d.ts +5 -6
- package/lib/types/webgl-context-attributes.d.ts +1 -2
- package/lib/types/webgl-framebuffer.d.ts +4 -5
- package/lib/types/webgl-program.d.ts +4 -5
- package/lib/types/webgl-query.d.ts +7 -0
- package/lib/types/webgl-renderbuffer.d.ts +4 -5
- package/lib/types/webgl-rendering-context.d.ts +15 -12
- package/lib/types/webgl-sampler.d.ts +7 -0
- package/lib/types/webgl-shader-precision-format.d.ts +1 -2
- package/lib/types/webgl-shader.d.ts +4 -5
- package/lib/types/webgl-sync.d.ts +7 -0
- package/lib/types/webgl-texture-unit.d.ts +3 -3
- package/lib/types/webgl-texture.d.ts +6 -7
- package/lib/types/webgl-transform-feedback.d.ts +7 -0
- package/lib/types/webgl-uniform-location.d.ts +3 -4
- package/lib/types/webgl-vertex-array-object.d.ts +9 -0
- package/lib/types/webgl-vertex-attribute.d.ts +5 -5
- package/lib/types/webgl2-rendering-context.d.ts +124 -0
- package/package.json +27 -26
- package/prebuilds/linux-aarch64/Gwebgl-0.1.typelib +0 -0
- package/prebuilds/linux-aarch64/libgwebgl.so +0 -0
- package/prebuilds/linux-x86_64/Gwebgl-0.1.typelib +0 -0
- package/prebuilds/linux-x86_64/libgwebgl.so +0 -0
- package/lib/cjs/@types/glsl-tokenizer/index.d.js +0 -0
- package/lib/cjs/extensions/ext-blend-minmax.js +0 -18
- package/lib/cjs/extensions/ext-texture-filter-anisotropic.js +0 -18
- package/lib/cjs/extensions/oes-element-index-unit.js +0 -14
- package/lib/cjs/extensions/oes-standard-derivatives.js +0 -17
- package/lib/cjs/extensions/oes-texture-float-linear.js +0 -14
- package/lib/cjs/extensions/oes-texture-float.js +0 -14
- package/lib/cjs/extensions/stackgl-destroy-context.js +0 -12
- package/lib/cjs/extensions/stackgl-resize-drawing-buffer.js +0 -12
- package/lib/cjs/html-canvas-element.js +0 -70
- package/lib/cjs/index.js +0 -18
- package/lib/cjs/index.spec.js +0 -146
- package/lib/cjs/linkable.js +0 -50
- package/lib/cjs/test.js +0 -3
- package/lib/cjs/types/constructor.js +0 -0
- package/lib/cjs/types/extension.js +0 -0
- package/lib/cjs/types/index.js +0 -5
- package/lib/cjs/types/typed-array.js +0 -0
- package/lib/cjs/types/webgl-constants.js +0 -0
- package/lib/cjs/types/webgl-context-attribute-options.js +0 -0
- package/lib/cjs/utils.js +0 -212
- package/lib/cjs/webgl-active-info.js +0 -10
- package/lib/cjs/webgl-buffer.js +0 -18
- package/lib/cjs/webgl-context-attributes.js +0 -24
- package/lib/cjs/webgl-drawing-buffer-wrapper.js +0 -10
- package/lib/cjs/webgl-framebuffer.js +0 -109
- package/lib/cjs/webgl-program.js +0 -26
- package/lib/cjs/webgl-renderbuffer.js +0 -24
- package/lib/cjs/webgl-rendering-context.js +0 -3343
- package/lib/cjs/webgl-shader-precision-format.js +0 -11
- package/lib/cjs/webgl-shader.js +0 -23
- package/lib/cjs/webgl-texture-unit.js +0 -12
- package/lib/cjs/webgl-texture.js +0 -22
- package/lib/cjs/webgl-uniform-location.js +0 -15
- package/lib/cjs/webgl-vertex-attribute.js +0 -147
- package/meson.build +0 -39
- package/src/test/app.vala +0 -60
- package/src/ts/@types/glsl-tokenizer/index.d.ts +0 -18
- package/src/ts/extensions/angle-instanced-arrays.ts.off +0 -232
- package/src/ts/extensions/ext-blend-minmax.ts +0 -18
- package/src/ts/extensions/ext-texture-filter-anisotropic.ts +0 -18
- package/src/ts/extensions/oes-element-index-unit.ts +0 -14
- package/src/ts/extensions/oes-standard-derivatives.ts +0 -17
- package/src/ts/extensions/oes-texture-float-linear.ts +0 -14
- package/src/ts/extensions/oes-texture-float.ts +0 -14
- package/src/ts/extensions/oes-vertex-array-object.ts.off +0 -128
- package/src/ts/extensions/stackgl-destroy-context.ts +0 -12
- package/src/ts/extensions/stackgl-resize-drawing-buffer.ts +0 -14
- package/src/ts/extensions/webgl-draw-buffers.ts.off +0 -107
- package/src/ts/html-canvas-element.ts +0 -98
- package/src/ts/index.spec.ts +0 -186
- package/src/ts/index.ts +0 -21
- package/src/ts/linkable.ts +0 -55
- package/src/ts/test.ts +0 -6
- package/src/ts/types/constructor.ts +0 -3
- package/src/ts/types/extension.ts +0 -3
- package/src/ts/types/index.ts +0 -26
- package/src/ts/types/typed-array.ts +0 -1
- package/src/ts/types/webgl-constants.ts +0 -300
- package/src/ts/types/webgl-context-attribute-options.ts +0 -12
- package/src/ts/utils.ts +0 -266
- package/src/ts/webgl-active-info.ts +0 -13
- package/src/ts/webgl-buffer.ts +0 -21
- package/src/ts/webgl-context-attributes.ts +0 -24
- package/src/ts/webgl-drawing-buffer-wrapper.ts +0 -10
- package/src/ts/webgl-framebuffer.ts +0 -133
- package/src/ts/webgl-program.ts +0 -30
- package/src/ts/webgl-renderbuffer.ts +0 -28
- package/src/ts/webgl-rendering-context.ts +0 -4050
- package/src/ts/webgl-shader-precision-format.ts +0 -12
- package/src/ts/webgl-shader.ts +0 -29
- package/src/ts/webgl-texture-unit.ts +0 -16
- package/src/ts/webgl-texture.ts +0 -27
- package/src/ts/webgl-uniform-location.ts +0 -18
- package/src/ts/webgl-vertex-attribute.ts +0 -169
- package/src/vala/handle-types.vala +0 -23
- package/src/vala/webgl-rendering-context-base.vala +0 -1265
- package/src/vala/webgl-rendering-context.vala +0 -265
- package/src/vapi/epoxy.vapi +0 -14558
- package/src/vapi/glesv2.vapi +0 -670
- package/test.gjs.js +0 -39972
- package/test.gjs.js.meta.json +0 -1
- package/tmp/.tsbuildinfo +0 -1
- package/tsconfig.json +0 -38
- package/tsconfig.types.json +0 -7
|
@@ -60,8 +60,10 @@ const availableExtensions = {
|
|
|
60
60
|
ext_blend_minmax: getEXTBlendMinMax,
|
|
61
61
|
ext_texture_filter_anisotropic: getEXTTextureFilterAnisotropic
|
|
62
62
|
};
|
|
63
|
-
class
|
|
63
|
+
class WebGLRenderingContext {
|
|
64
64
|
constructor(canvas, options = {}) {
|
|
65
|
+
this.unpackColorSpace = "srgb";
|
|
66
|
+
this.RGBA8 = 32856;
|
|
65
67
|
this.DEFAULT_ATTACHMENTS = [];
|
|
66
68
|
this.DEFAULT_COLOR_ATTACHMENTS = [];
|
|
67
69
|
/** context counter */
|
|
@@ -88,10 +90,13 @@ class GjsifyWebGLRenderingContext {
|
|
|
88
90
|
// Unpack alignment
|
|
89
91
|
this._unpackAlignment = 4;
|
|
90
92
|
this._packAlignment = 4;
|
|
93
|
+
// Viewport and scissor — tracked in JS to avoid crashing native getParameterx for array returns
|
|
94
|
+
this._viewport = new Int32Array([0, 0, 0, 0]);
|
|
95
|
+
this._scissorBox = new Int32Array([0, 0, 0, 0]);
|
|
91
96
|
this._attrib0Buffer = null;
|
|
92
97
|
this._textureUnits = [];
|
|
93
98
|
this._drawingBuffer = null;
|
|
94
|
-
this._native = new Gwebgl.WebGLRenderingContext(
|
|
99
|
+
this._native = new Gwebgl.WebGLRenderingContext({});
|
|
95
100
|
this._initGLConstants();
|
|
96
101
|
this.DEFAULT_ATTACHMENTS = [
|
|
97
102
|
this.COLOR_ATTACHMENT0,
|
|
@@ -216,8 +221,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
216
221
|
const errorLog = [];
|
|
217
222
|
for (let i = 0; i < tokens.length; ++i) {
|
|
218
223
|
const tok = tokens[i];
|
|
219
|
-
if (!tok)
|
|
220
|
-
continue;
|
|
224
|
+
if (!tok) continue;
|
|
221
225
|
switch (tok.type) {
|
|
222
226
|
case "ident":
|
|
223
227
|
if (!this._validGLSLIdentifier(tok.data)) {
|
|
@@ -255,7 +259,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
255
259
|
case "dFdx":
|
|
256
260
|
case "dFdy":
|
|
257
261
|
case "fwidth":
|
|
258
|
-
if (!this._extensions.oes_standard_derivatives) {
|
|
262
|
+
if (!this._extensions.oes_standard_derivatives && this._getGlslVersion(true) === "100") {
|
|
259
263
|
errorStatus = true;
|
|
260
264
|
errorLog.push(tok.line + ":" + tok.column + " " + tok.data + " not supported");
|
|
261
265
|
}
|
|
@@ -402,6 +406,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
402
406
|
}
|
|
403
407
|
}
|
|
404
408
|
for (let i = 0; i < numAttribs; ++i) {
|
|
409
|
+
if (program._attributes[i] < 0) continue;
|
|
405
410
|
this._native.bindAttribLocation(
|
|
406
411
|
program._ | 0,
|
|
407
412
|
program._attributes[i],
|
|
@@ -413,8 +418,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
413
418
|
program._uniforms.length = numUniforms;
|
|
414
419
|
for (let i = 0; i < numUniforms; ++i) {
|
|
415
420
|
const info = this.getActiveUniform(program, i);
|
|
416
|
-
if (info)
|
|
417
|
-
program._uniforms[i] = info;
|
|
421
|
+
if (info) program._uniforms[i] = info;
|
|
418
422
|
}
|
|
419
423
|
for (let i = 0; i < program._uniforms.length; ++i) {
|
|
420
424
|
if (program._uniforms[i].name.length > MAX_UNIFORM_LENGTH) {
|
|
@@ -528,8 +532,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
528
532
|
}
|
|
529
533
|
colorAttached = true;
|
|
530
534
|
const level = framebuffer._attachmentLevel[this.COLOR_ATTACHMENT0];
|
|
531
|
-
if (level === null)
|
|
532
|
-
throw new TypeError("level is null!");
|
|
535
|
+
if (level === null) throw new TypeError("level is null!");
|
|
533
536
|
width.push(colorAttachment._levelWidth[level]);
|
|
534
537
|
height.push(colorAttachment._levelHeight[level]);
|
|
535
538
|
} else if (colorAttachment instanceof WebGLRenderbuffer) {
|
|
@@ -789,20 +792,35 @@ class GjsifyWebGLRenderingContext {
|
|
|
789
792
|
}
|
|
790
793
|
}
|
|
791
794
|
_wrapShader(_type, source) {
|
|
795
|
+
const hasVersion = source.startsWith("#version") || source.includes("\n#version");
|
|
796
|
+
let preamble = "";
|
|
792
797
|
if (!this._extensions.oes_standard_derivatives && /#ifdef\s+GL_OES_standard_derivatives/.test(source)) {
|
|
793
|
-
|
|
794
|
-
}
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
798
|
+
preamble += "#undef GL_OES_standard_derivatives\n";
|
|
799
|
+
}
|
|
800
|
+
if (!this._extensions.webgl_draw_buffers) {
|
|
801
|
+
preamble += "#define gl_MaxDrawBuffers 1\n";
|
|
802
|
+
}
|
|
803
|
+
if (hasVersion) {
|
|
804
|
+
if (preamble) {
|
|
805
|
+
const newline = source.indexOf("\n");
|
|
806
|
+
if (newline !== -1) {
|
|
807
|
+
source = source.slice(0, newline + 1) + preamble + source.slice(newline + 1);
|
|
808
|
+
} else {
|
|
809
|
+
source = source + "\n" + preamble;
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
} else {
|
|
813
|
+
if (this.canvas) {
|
|
814
|
+
const glArea = this.canvas.getGlArea();
|
|
815
|
+
const es = glArea.get_use_es();
|
|
816
|
+
const version = this._getGlslVersion(es);
|
|
817
|
+
if (version) {
|
|
818
|
+
source = "#version " + version + "\n" + preamble + source;
|
|
819
|
+
} else if (preamble) {
|
|
820
|
+
source = preamble + source;
|
|
804
821
|
}
|
|
805
|
-
|
|
822
|
+
} else if (preamble) {
|
|
823
|
+
source = preamble + source;
|
|
806
824
|
}
|
|
807
825
|
}
|
|
808
826
|
return source;
|
|
@@ -982,8 +1000,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
982
1000
|
return this._native.compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, Uint8ArrayToVariant(arrayToUint8Array(data)));
|
|
983
1001
|
}
|
|
984
1002
|
readPixels(x = 0, y = 0, width = 0, height = 0, format = 0, type = 0, pixels) {
|
|
985
|
-
if (!pixels)
|
|
986
|
-
return;
|
|
1003
|
+
if (!pixels) return;
|
|
987
1004
|
if (!(this._extensions.oes_texture_float && type === this.FLOAT && format === this.RGBA)) {
|
|
988
1005
|
if (format === this.RGB || format === this.ALPHA || type !== this.UNSIGNED_BYTE) {
|
|
989
1006
|
this.setError(this.INVALID_OPERATION);
|
|
@@ -1052,7 +1069,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1052
1069
|
}
|
|
1053
1070
|
if (nWidth > 0 && nHeight > 0) {
|
|
1054
1071
|
const subPixels = new Uint8Array(nRowStride * nHeight);
|
|
1055
|
-
this._native.readPixels(
|
|
1072
|
+
const result = this._native.readPixels(
|
|
1056
1073
|
nx,
|
|
1057
1074
|
ny,
|
|
1058
1075
|
nWidth,
|
|
@@ -1061,17 +1078,18 @@ class GjsifyWebGLRenderingContext {
|
|
|
1061
1078
|
type,
|
|
1062
1079
|
Uint8ArrayToVariant(subPixels)
|
|
1063
1080
|
);
|
|
1081
|
+
const src = result && result.length > 0 ? result : subPixels;
|
|
1064
1082
|
const offset = 4 * (nx - x) + (ny - y) * rowStride;
|
|
1065
1083
|
for (let j = 0; j < nHeight; ++j) {
|
|
1066
1084
|
for (let i = 0; i < nWidth; ++i) {
|
|
1067
1085
|
for (let k = 0; k < 4; ++k) {
|
|
1068
|
-
pixelData[offset + j * rowStride + 4 * i + k] =
|
|
1086
|
+
pixelData[offset + j * rowStride + 4 * i + k] = src[j * nRowStride + 4 * i + k];
|
|
1069
1087
|
}
|
|
1070
1088
|
}
|
|
1071
1089
|
}
|
|
1072
1090
|
}
|
|
1073
1091
|
} else {
|
|
1074
|
-
this._native.readPixels(
|
|
1092
|
+
const result = this._native.readPixels(
|
|
1075
1093
|
x,
|
|
1076
1094
|
y,
|
|
1077
1095
|
width,
|
|
@@ -1080,6 +1098,9 @@ class GjsifyWebGLRenderingContext {
|
|
|
1080
1098
|
type,
|
|
1081
1099
|
Uint8ArrayToVariant(pixelData)
|
|
1082
1100
|
);
|
|
1101
|
+
if (result && result.length > 0) {
|
|
1102
|
+
pixelData.set(result);
|
|
1103
|
+
}
|
|
1083
1104
|
}
|
|
1084
1105
|
}
|
|
1085
1106
|
// https://github.com/stackgl/headless-gl/blob/ce1c08c0ef0c31d8c308cb828fd2f172c0bf5084/src/javascript/webgl-rendering-context.js#L3131
|
|
@@ -1314,8 +1335,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1314
1335
|
return false;
|
|
1315
1336
|
}
|
|
1316
1337
|
uniform1fv(location, value) {
|
|
1317
|
-
if (!location || this._checkUniformValueValid(location, value, "uniform1fv", 1, "f"))
|
|
1318
|
-
return;
|
|
1338
|
+
if (!location || !this._checkUniformValueValid(location, value, "uniform1fv", 1, "f")) return;
|
|
1319
1339
|
if (location?._array) {
|
|
1320
1340
|
const locs = location._array;
|
|
1321
1341
|
for (let i = 0; i < locs.length && i < value.length; ++i) {
|
|
@@ -1329,8 +1349,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1329
1349
|
this._native.uniform1f(location?._ | 0, value[0]);
|
|
1330
1350
|
}
|
|
1331
1351
|
uniform1iv(location, v) {
|
|
1332
|
-
if (!this._checkUniformValueValid(location, v, "uniform1iv", 1, "i"))
|
|
1333
|
-
return;
|
|
1352
|
+
if (!this._checkUniformValueValid(location, v, "uniform1iv", 1, "i")) return;
|
|
1334
1353
|
if (location?._array) {
|
|
1335
1354
|
const locs = location._array;
|
|
1336
1355
|
for (let i = 0; i < locs.length && i < v.length; ++i) {
|
|
@@ -1344,8 +1363,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1344
1363
|
this.uniform1i(location, v[0]);
|
|
1345
1364
|
}
|
|
1346
1365
|
uniform2fv(location, v) {
|
|
1347
|
-
if (!this._checkUniformValueValid(location, v, "uniform2fv", 2, "f"))
|
|
1348
|
-
return;
|
|
1366
|
+
if (!this._checkUniformValueValid(location, v, "uniform2fv", 2, "f")) return;
|
|
1349
1367
|
if (location?._array) {
|
|
1350
1368
|
const locs = location._array;
|
|
1351
1369
|
for (let i = 0; i < locs.length && 2 * i < v.length; ++i) {
|
|
@@ -1359,8 +1377,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1359
1377
|
this._native.uniform2f(location?._ || 0, v[0], v[1]);
|
|
1360
1378
|
}
|
|
1361
1379
|
uniform2iv(location, v) {
|
|
1362
|
-
if (!this._checkUniformValueValid(location, v, "uniform2iv", 2, "i"))
|
|
1363
|
-
return;
|
|
1380
|
+
if (!this._checkUniformValueValid(location, v, "uniform2iv", 2, "i")) return;
|
|
1364
1381
|
if (location?._array) {
|
|
1365
1382
|
const locs = location._array;
|
|
1366
1383
|
for (let i = 0; i < locs.length && 2 * i < v.length; ++i) {
|
|
@@ -1374,8 +1391,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1374
1391
|
this.uniform2i(location, v[0], v[1]);
|
|
1375
1392
|
}
|
|
1376
1393
|
uniform3fv(location, v) {
|
|
1377
|
-
if (!this._checkUniformValueValid(location, v, "uniform3fv", 3, "f"))
|
|
1378
|
-
return;
|
|
1394
|
+
if (!this._checkUniformValueValid(location, v, "uniform3fv", 3, "f")) return;
|
|
1379
1395
|
if (location?._array) {
|
|
1380
1396
|
const locs = location._array;
|
|
1381
1397
|
for (let i = 0; i < locs.length && 3 * i < v.length; ++i) {
|
|
@@ -1389,8 +1405,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1389
1405
|
this._native.uniform3f(location?._ || 0, v[0], v[1], v[2]);
|
|
1390
1406
|
}
|
|
1391
1407
|
uniform3iv(location, v) {
|
|
1392
|
-
if (!this._checkUniformValueValid(location, v, "uniform3iv", 3, "i"))
|
|
1393
|
-
return;
|
|
1408
|
+
if (!this._checkUniformValueValid(location, v, "uniform3iv", 3, "i")) return;
|
|
1394
1409
|
if (location?._array) {
|
|
1395
1410
|
const locs = location._array;
|
|
1396
1411
|
for (let i = 0; i < locs.length && 3 * i < v.length; ++i) {
|
|
@@ -1404,8 +1419,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1404
1419
|
this.uniform3i(location, v[0], v[1], v[2]);
|
|
1405
1420
|
}
|
|
1406
1421
|
uniform4fv(location, v) {
|
|
1407
|
-
if (!this._checkUniformValueValid(location, v, "uniform4fv", 4, "f"))
|
|
1408
|
-
return;
|
|
1422
|
+
if (!this._checkUniformValueValid(location, v, "uniform4fv", 4, "f")) return;
|
|
1409
1423
|
if (location?._array) {
|
|
1410
1424
|
const locs = location._array;
|
|
1411
1425
|
for (let i = 0; i < locs.length && 4 * i < v.length; ++i) {
|
|
@@ -1419,8 +1433,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1419
1433
|
this._native.uniform4f(location?._ || 0, v[0], v[1], v[2], v[3]);
|
|
1420
1434
|
}
|
|
1421
1435
|
uniform4iv(location, v) {
|
|
1422
|
-
if (!this._checkUniformValueValid(location, v, "uniform4iv", 4, "i"))
|
|
1423
|
-
return;
|
|
1436
|
+
if (!this._checkUniformValueValid(location, v, "uniform4iv", 4, "i")) return;
|
|
1424
1437
|
if (location?._array) {
|
|
1425
1438
|
const locs = location._array;
|
|
1426
1439
|
for (let i = 0; i < locs.length && 4 * i < v.length; ++i) {
|
|
@@ -1455,8 +1468,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1455
1468
|
return false;
|
|
1456
1469
|
}
|
|
1457
1470
|
uniformMatrix2fv(location, transpose, value) {
|
|
1458
|
-
if (!this._checkUniformMatrix(location, transpose, value, "uniformMatrix2fv", 2))
|
|
1459
|
-
return;
|
|
1471
|
+
if (!this._checkUniformMatrix(location, transpose, value, "uniformMatrix2fv", 2)) return;
|
|
1460
1472
|
const data = new Float32Array(value);
|
|
1461
1473
|
this._native.uniformMatrix2fv(
|
|
1462
1474
|
location?._ || 0,
|
|
@@ -1465,8 +1477,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1465
1477
|
);
|
|
1466
1478
|
}
|
|
1467
1479
|
uniformMatrix3fv(location, transpose, value) {
|
|
1468
|
-
if (!this._checkUniformMatrix(location, transpose, value, "uniformMatrix3fv", 3))
|
|
1469
|
-
return;
|
|
1480
|
+
if (!this._checkUniformMatrix(location, transpose, value, "uniformMatrix3fv", 3)) return;
|
|
1470
1481
|
const data = new Float32Array(value);
|
|
1471
1482
|
this._native.uniformMatrix3fv(
|
|
1472
1483
|
location?._ || 0,
|
|
@@ -1475,8 +1486,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1475
1486
|
);
|
|
1476
1487
|
}
|
|
1477
1488
|
uniformMatrix4fv(location, transpose, value) {
|
|
1478
|
-
if (!this._checkUniformMatrix(location, transpose, value, "uniformMatrix4fv", 4))
|
|
1479
|
-
return;
|
|
1489
|
+
if (!this._checkUniformMatrix(location, transpose, value, "uniformMatrix4fv", 4)) return;
|
|
1480
1490
|
const data = new Float32Array(value);
|
|
1481
1491
|
this._native.uniformMatrix4fv(
|
|
1482
1492
|
location?._ || 0,
|
|
@@ -1840,32 +1850,28 @@ class GjsifyWebGLRenderingContext {
|
|
|
1840
1850
|
}
|
|
1841
1851
|
createBuffer() {
|
|
1842
1852
|
const id = this._native.createBuffer();
|
|
1843
|
-
if (!id || id <= 0)
|
|
1844
|
-
return null;
|
|
1853
|
+
if (!id || id <= 0) return null;
|
|
1845
1854
|
const webGLBuffer = new WebGLBuffer(id, this);
|
|
1846
1855
|
this._buffers[id] = webGLBuffer;
|
|
1847
1856
|
return webGLBuffer;
|
|
1848
1857
|
}
|
|
1849
1858
|
createFramebuffer() {
|
|
1850
1859
|
const id = this._native.createFramebuffer();
|
|
1851
|
-
if (id <= 0)
|
|
1852
|
-
return null;
|
|
1860
|
+
if (id <= 0) return null;
|
|
1853
1861
|
const webGLFramebuffer = new WebGLFramebuffer(id, this);
|
|
1854
1862
|
this._framebuffers[id] = webGLFramebuffer;
|
|
1855
1863
|
return webGLFramebuffer;
|
|
1856
1864
|
}
|
|
1857
1865
|
createProgram() {
|
|
1858
1866
|
const id = this._native.createProgram();
|
|
1859
|
-
if (id <= 0)
|
|
1860
|
-
return null;
|
|
1867
|
+
if (id <= 0) return null;
|
|
1861
1868
|
const webGLProgram = new WebGLProgram(id, this);
|
|
1862
1869
|
this._programs[id] = webGLProgram;
|
|
1863
1870
|
return webGLProgram;
|
|
1864
1871
|
}
|
|
1865
1872
|
createRenderbuffer() {
|
|
1866
1873
|
const id = this._native.createRenderbuffer();
|
|
1867
|
-
if (id <= 0)
|
|
1868
|
-
return null;
|
|
1874
|
+
if (id <= 0) return null;
|
|
1869
1875
|
const webGLRenderbuffer = new WebGLRenderbuffer(id, this);
|
|
1870
1876
|
this._renderbuffers[id] = webGLRenderbuffer;
|
|
1871
1877
|
return webGLRenderbuffer;
|
|
@@ -1885,8 +1891,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
1885
1891
|
}
|
|
1886
1892
|
createTexture() {
|
|
1887
1893
|
const id = this._native.createTexture();
|
|
1888
|
-
if (id <= 0)
|
|
1889
|
-
return null;
|
|
1894
|
+
if (id <= 0) return null;
|
|
1890
1895
|
const webGlTexture = new WebGLTexture(id, this);
|
|
1891
1896
|
this._textures[id] = webGlTexture;
|
|
1892
1897
|
return webGlTexture;
|
|
@@ -2359,7 +2364,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
2359
2364
|
switch (pname) {
|
|
2360
2365
|
case this.BUFFER_SIZE:
|
|
2361
2366
|
case this.BUFFER_USAGE:
|
|
2362
|
-
return this._native.getBufferParameteriv(target | 0, pname | 0);
|
|
2367
|
+
return this._native.getBufferParameteriv(target | 0, pname | 0)[0];
|
|
2363
2368
|
default:
|
|
2364
2369
|
this.setError(this.INVALID_ENUM);
|
|
2365
2370
|
return null;
|
|
@@ -2433,27 +2438,34 @@ class GjsifyWebGLRenderingContext {
|
|
|
2433
2438
|
case this.TEXTURE_BINDING_CUBE_MAP:
|
|
2434
2439
|
return this._getActiveTextureUnit()._bindCube;
|
|
2435
2440
|
case this.VERSION:
|
|
2436
|
-
return "WebGL 1.0
|
|
2441
|
+
return "WebGL 1.0 " + VERSION;
|
|
2437
2442
|
case this.VENDOR:
|
|
2438
|
-
return "
|
|
2443
|
+
return "";
|
|
2439
2444
|
case this.RENDERER:
|
|
2440
2445
|
return "ANGLE";
|
|
2441
2446
|
case this.SHADING_LANGUAGE_VERSION:
|
|
2442
|
-
return "WebGL GLSL ES 1.0
|
|
2447
|
+
return "WebGL GLSL ES 1.0 ";
|
|
2443
2448
|
case this.COMPRESSED_TEXTURE_FORMATS:
|
|
2444
2449
|
return new Uint32Array(0);
|
|
2445
|
-
|
|
2450
|
+
// Int arrays — tracked in JS (native getParameterx crashes for array returns)
|
|
2446
2451
|
case this.SCISSOR_BOX:
|
|
2452
|
+
return new Int32Array(this._scissorBox);
|
|
2447
2453
|
case this.VIEWPORT:
|
|
2448
|
-
return new Int32Array(this.
|
|
2454
|
+
return new Int32Array(this._viewport);
|
|
2455
|
+
case this.MAX_VIEWPORT_DIMS:
|
|
2456
|
+
return new Int32Array([32767, 32767]);
|
|
2457
|
+
// Float arrays — return safe defaults (native getParameterx crashes for these)
|
|
2449
2458
|
case this.ALIASED_LINE_WIDTH_RANGE:
|
|
2450
2459
|
case this.ALIASED_POINT_SIZE_RANGE:
|
|
2460
|
+
return new Float32Array([1, 1]);
|
|
2451
2461
|
case this.DEPTH_RANGE:
|
|
2462
|
+
return new Float32Array([0, 1]);
|
|
2452
2463
|
case this.BLEND_COLOR:
|
|
2453
2464
|
case this.COLOR_CLEAR_VALUE:
|
|
2454
|
-
return new Float32Array(
|
|
2465
|
+
return new Float32Array([0, 0, 0, 0]);
|
|
2455
2466
|
case this.COLOR_WRITEMASK:
|
|
2456
2467
|
return this._native.getParameterbv(pname, 16);
|
|
2468
|
+
// return boolArray(this._native.getParameterbv(pname, 16));
|
|
2457
2469
|
case this.DEPTH_CLEAR_VALUE:
|
|
2458
2470
|
case this.LINE_WIDTH:
|
|
2459
2471
|
case this.POLYGON_OFFSET_FACTOR:
|
|
@@ -2612,6 +2624,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
2612
2624
|
case this.RENDERBUFFER_HEIGHT:
|
|
2613
2625
|
return renderbuffer._height;
|
|
2614
2626
|
case this.MAX_RENDERBUFFER_SIZE:
|
|
2627
|
+
// TODO?
|
|
2615
2628
|
case this.RENDERBUFFER_RED_SIZE:
|
|
2616
2629
|
case this.RENDERBUFFER_GREEN_SIZE:
|
|
2617
2630
|
case this.RENDERBUFFER_BLUE_SIZE:
|
|
@@ -2907,8 +2920,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
2907
2920
|
return this._native.hint(target, mode);
|
|
2908
2921
|
}
|
|
2909
2922
|
isBuffer(buffer) {
|
|
2910
|
-
if (!this._isObject(buffer, "isBuffer", WebGLBuffer))
|
|
2911
|
-
return false;
|
|
2923
|
+
if (!this._isObject(buffer, "isBuffer", WebGLBuffer)) return false;
|
|
2912
2924
|
return this._native.isBuffer(buffer?._);
|
|
2913
2925
|
}
|
|
2914
2926
|
isContextLost() {
|
|
@@ -2918,28 +2930,23 @@ class GjsifyWebGLRenderingContext {
|
|
|
2918
2930
|
return this._native.isEnabled(cap);
|
|
2919
2931
|
}
|
|
2920
2932
|
isFramebuffer(framebuffer) {
|
|
2921
|
-
if (!this._isObject(framebuffer, "isFramebuffer", WebGLFramebuffer))
|
|
2922
|
-
return false;
|
|
2933
|
+
if (!this._isObject(framebuffer, "isFramebuffer", WebGLFramebuffer)) return false;
|
|
2923
2934
|
return this._native.isFramebuffer(framebuffer?._);
|
|
2924
2935
|
}
|
|
2925
2936
|
isProgram(program) {
|
|
2926
|
-
if (!this._isObject(program, "isProgram", WebGLProgram))
|
|
2927
|
-
return false;
|
|
2937
|
+
if (!this._isObject(program, "isProgram", WebGLProgram)) return false;
|
|
2928
2938
|
return this._native.isProgram(program?._);
|
|
2929
2939
|
}
|
|
2930
2940
|
isRenderbuffer(renderbuffer) {
|
|
2931
|
-
if (!this._isObject(renderbuffer, "isRenderbuffer", WebGLRenderbuffer))
|
|
2932
|
-
return false;
|
|
2941
|
+
if (!this._isObject(renderbuffer, "isRenderbuffer", WebGLRenderbuffer)) return false;
|
|
2933
2942
|
return this._native.isRenderbuffer(renderbuffer?._);
|
|
2934
2943
|
}
|
|
2935
2944
|
isShader(shader) {
|
|
2936
|
-
if (!this._isObject(shader, "isShader", WebGLShader))
|
|
2937
|
-
return false;
|
|
2945
|
+
if (!this._isObject(shader, "isShader", WebGLShader)) return false;
|
|
2938
2946
|
return this._native.isShader(shader?._);
|
|
2939
2947
|
}
|
|
2940
2948
|
isTexture(texture) {
|
|
2941
|
-
if (!this._isObject(texture, "isTexture", WebGLTexture))
|
|
2942
|
-
return false;
|
|
2949
|
+
if (!this._isObject(texture, "isTexture", WebGLTexture)) return false;
|
|
2943
2950
|
return this._native.isTexture(texture?._);
|
|
2944
2951
|
}
|
|
2945
2952
|
lineWidth(width) {
|
|
@@ -3053,6 +3060,10 @@ class GjsifyWebGLRenderingContext {
|
|
|
3053
3060
|
return this._native.sampleCoverage(+value, !!invert);
|
|
3054
3061
|
}
|
|
3055
3062
|
scissor(x, y, width, height) {
|
|
3063
|
+
this._scissorBox[0] = x | 0;
|
|
3064
|
+
this._scissorBox[1] = y | 0;
|
|
3065
|
+
this._scissorBox[2] = width | 0;
|
|
3066
|
+
this._scissorBox[3] = height | 0;
|
|
3056
3067
|
return this._native.scissor(x | 0, y | 0, width | 0, height | 0);
|
|
3057
3068
|
}
|
|
3058
3069
|
shaderSource(shader, source) {
|
|
@@ -3081,11 +3092,11 @@ class GjsifyWebGLRenderingContext {
|
|
|
3081
3092
|
}
|
|
3082
3093
|
stencilMask(mask) {
|
|
3083
3094
|
this._checkStencil = true;
|
|
3084
|
-
return this._native.stencilMask(mask
|
|
3095
|
+
return this._native.stencilMask(mask >>> 0);
|
|
3085
3096
|
}
|
|
3086
3097
|
stencilMaskSeparate(face, mask) {
|
|
3087
3098
|
this._checkStencil = true;
|
|
3088
|
-
return this._native.stencilMaskSeparate(face | 0, mask
|
|
3099
|
+
return this._native.stencilMaskSeparate(face | 0, mask >>> 0);
|
|
3089
3100
|
}
|
|
3090
3101
|
stencilOp(fail, zfail, zpass) {
|
|
3091
3102
|
this._checkStencil = true;
|
|
@@ -3129,31 +3140,26 @@ class GjsifyWebGLRenderingContext {
|
|
|
3129
3140
|
}
|
|
3130
3141
|
}
|
|
3131
3142
|
uniform1f(location, x) {
|
|
3132
|
-
if (!this._checkUniformValid(location, x, "uniform1f", 1, "f"))
|
|
3133
|
-
return;
|
|
3143
|
+
if (!this._checkUniformValid(location, x, "uniform1f", 1, "f")) return;
|
|
3134
3144
|
return this._native.uniform1f(location?._ || 0, x);
|
|
3135
3145
|
}
|
|
3136
3146
|
uniform1i(location, x) {
|
|
3137
3147
|
return this._native.uniform1i(location?._ || 0, x);
|
|
3138
3148
|
}
|
|
3139
3149
|
uniform2f(location, x, y) {
|
|
3140
|
-
if (!this._checkUniformValid(location, x, "uniform2f", 2, "f"))
|
|
3141
|
-
return;
|
|
3150
|
+
if (!this._checkUniformValid(location, x, "uniform2f", 2, "f")) return;
|
|
3142
3151
|
return this._native.uniform2f(location?._ || 0, x, y);
|
|
3143
3152
|
}
|
|
3144
3153
|
uniform2i(location, x, y) {
|
|
3145
|
-
if (!this._checkUniformValid(location, x, "uniform2i", 2, "i"))
|
|
3146
|
-
return;
|
|
3154
|
+
if (!this._checkUniformValid(location, x, "uniform2i", 2, "i")) return;
|
|
3147
3155
|
this._native.uniform2i(location?._ || 0, x, y);
|
|
3148
3156
|
}
|
|
3149
3157
|
uniform3f(location, x, y, z) {
|
|
3150
|
-
if (!this._checkUniformValid(location, x, "uniform3f", 3, "f"))
|
|
3151
|
-
return;
|
|
3158
|
+
if (!this._checkUniformValid(location, x, "uniform3f", 3, "f")) return;
|
|
3152
3159
|
return this._native.uniform3f(location?._ || 0, x, y, z);
|
|
3153
3160
|
}
|
|
3154
3161
|
uniform3i(location, x, y, z) {
|
|
3155
|
-
if (!this._checkUniformValid(location, x, "uniform3i", 3, "i"))
|
|
3156
|
-
return;
|
|
3162
|
+
if (!this._checkUniformValid(location, x, "uniform3i", 3, "i")) return;
|
|
3157
3163
|
return this._native.uniform3i(location?._ || 0, x, y, z);
|
|
3158
3164
|
}
|
|
3159
3165
|
uniform4f(location, x, y, z, w) {
|
|
@@ -3164,8 +3170,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
3164
3170
|
return this._native.uniform4f(location?._ || 0, x, y, z, w);
|
|
3165
3171
|
}
|
|
3166
3172
|
uniform4i(location, x, y, z, w) {
|
|
3167
|
-
if (!this._checkUniformValid(location, x, "uniform4i", 4, "i"))
|
|
3168
|
-
return;
|
|
3173
|
+
if (!this._checkUniformValid(location, x, "uniform4i", 4, "i")) return;
|
|
3169
3174
|
return this._native.uniform4i(location?._ || 0, x, y, z, w);
|
|
3170
3175
|
}
|
|
3171
3176
|
useProgram(program) {
|
|
@@ -3197,8 +3202,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
3197
3202
|
}
|
|
3198
3203
|
vertexAttrib1f(index, x) {
|
|
3199
3204
|
index |= 0;
|
|
3200
|
-
if (!this._checkVertexIndex(index))
|
|
3201
|
-
return;
|
|
3205
|
+
if (!this._checkVertexIndex(index)) return;
|
|
3202
3206
|
const data = this._vertexGlobalState._attribs[index]._data;
|
|
3203
3207
|
data[3] = 1;
|
|
3204
3208
|
data[1] = data[2] = 0;
|
|
@@ -3219,8 +3223,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
3219
3223
|
}
|
|
3220
3224
|
vertexAttrib2f(index, x, y) {
|
|
3221
3225
|
index |= 0;
|
|
3222
|
-
if (!this._checkVertexIndex(index))
|
|
3223
|
-
return;
|
|
3226
|
+
if (!this._checkVertexIndex(index)) return;
|
|
3224
3227
|
const data = this._vertexGlobalState._attribs[index]._data;
|
|
3225
3228
|
data[3] = 1;
|
|
3226
3229
|
data[2] = 0;
|
|
@@ -3242,8 +3245,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
3242
3245
|
}
|
|
3243
3246
|
vertexAttrib3f(index, x, y, z) {
|
|
3244
3247
|
index |= 0;
|
|
3245
|
-
if (!this._checkVertexIndex(index))
|
|
3246
|
-
return;
|
|
3248
|
+
if (!this._checkVertexIndex(index)) return;
|
|
3247
3249
|
const data = this._vertexGlobalState._attribs[index]._data;
|
|
3248
3250
|
data[3] = 1;
|
|
3249
3251
|
data[2] = z;
|
|
@@ -3264,8 +3266,7 @@ class GjsifyWebGLRenderingContext {
|
|
|
3264
3266
|
return this._native.vertexAttrib3f(index | 0, +values[0], +values[1], +values[2]);
|
|
3265
3267
|
}
|
|
3266
3268
|
vertexAttrib4f(index = 0, x, y, z, w) {
|
|
3267
|
-
if (!this._checkVertexIndex(index))
|
|
3268
|
-
return;
|
|
3269
|
+
if (!this._checkVertexIndex(index)) return;
|
|
3269
3270
|
const data = this._vertexGlobalState._attribs[index]._data;
|
|
3270
3271
|
data[3] = w;
|
|
3271
3272
|
data[2] = z;
|
|
@@ -3334,10 +3335,13 @@ class GjsifyWebGLRenderingContext {
|
|
|
3334
3335
|
);
|
|
3335
3336
|
}
|
|
3336
3337
|
viewport(x, y, width, height) {
|
|
3338
|
+
this._viewport[0] = x | 0;
|
|
3339
|
+
this._viewport[1] = y | 0;
|
|
3340
|
+
this._viewport[2] = width | 0;
|
|
3341
|
+
this._viewport[3] = height | 0;
|
|
3337
3342
|
return this._native.viewport(x, y, width, height);
|
|
3338
3343
|
}
|
|
3339
3344
|
}
|
|
3340
3345
|
export {
|
|
3341
|
-
|
|
3342
|
-
GjsifyWebGLRenderingContext as WebGLRenderingContext
|
|
3346
|
+
WebGLRenderingContext
|
|
3343
3347
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Linkable } from "./linkable.js";
|
|
2
|
+
class WebGLSampler extends Linkable {
|
|
3
|
+
constructor(_, ctx) {
|
|
4
|
+
super(_);
|
|
5
|
+
this._ctx = ctx;
|
|
6
|
+
}
|
|
7
|
+
_performDelete() {
|
|
8
|
+
const ctx = this._ctx;
|
|
9
|
+
delete ctx._samplers[this._ | 0];
|
|
10
|
+
ctx._native2.deleteSampler(this._ | 0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
WebGLSampler
|
|
15
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class WebGLShaderPrecisionFormat {
|
|
2
2
|
constructor(_) {
|
|
3
3
|
this.rangeMin = _.rangeMin;
|
|
4
4
|
this.rangeMax = _.rangeMax;
|
|
@@ -6,6 +6,5 @@ class GjsifyWebGLShaderPrecisionFormat {
|
|
|
6
6
|
}
|
|
7
7
|
}
|
|
8
8
|
export {
|
|
9
|
-
|
|
10
|
-
GjsifyWebGLShaderPrecisionFormat as WebGLShaderPrecisionFormat
|
|
9
|
+
WebGLShaderPrecisionFormat
|
|
11
10
|
};
|
package/lib/esm/webgl-shader.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Linkable } from "./linkable.js";
|
|
2
|
-
class
|
|
2
|
+
class WebGLShader extends Linkable {
|
|
3
3
|
constructor(_, ctx, type) {
|
|
4
4
|
super(_);
|
|
5
5
|
this._source = "";
|
|
@@ -18,6 +18,5 @@ class GjsifyWebGLShader extends Linkable {
|
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
export {
|
|
21
|
-
|
|
22
|
-
GjsifyWebGLShader as WebGLShader
|
|
21
|
+
WebGLShader
|
|
23
22
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Linkable } from "./linkable.js";
|
|
2
|
+
class WebGLSync extends Linkable {
|
|
3
|
+
constructor(_, ctx) {
|
|
4
|
+
super(_);
|
|
5
|
+
this._ctx = ctx;
|
|
6
|
+
}
|
|
7
|
+
_performDelete() {
|
|
8
|
+
const ctx = this._ctx;
|
|
9
|
+
delete ctx._syncs[this._ | 0];
|
|
10
|
+
ctx._native2.deleteSync(this._ | 0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
WebGLSync
|
|
15
|
+
};
|
package/lib/esm/webgl-texture.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Linkable } from "./linkable.js";
|
|
2
|
-
class
|
|
2
|
+
class WebGLTexture extends Linkable {
|
|
3
3
|
constructor(_, ctx) {
|
|
4
4
|
super(_);
|
|
5
5
|
this._binding = 0;
|
|
@@ -17,6 +17,5 @@ class GjsifyWebGLTexture extends Linkable {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
export {
|
|
20
|
-
|
|
21
|
-
GjsifyWebGLTexture as WebGLTexture
|
|
20
|
+
WebGLTexture
|
|
22
21
|
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Linkable } from "./linkable.js";
|
|
2
|
+
class WebGLTransformFeedback extends Linkable {
|
|
3
|
+
constructor(_, ctx) {
|
|
4
|
+
super(_);
|
|
5
|
+
this._ctx = ctx;
|
|
6
|
+
}
|
|
7
|
+
_performDelete() {
|
|
8
|
+
const ctx = this._ctx;
|
|
9
|
+
delete ctx._transformFeedbacks[this._ | 0];
|
|
10
|
+
ctx._native2.deleteTransformFeedback(this._ | 0);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {
|
|
14
|
+
WebGLTransformFeedback
|
|
15
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
class
|
|
1
|
+
class WebGLUniformLocation {
|
|
2
2
|
constructor(_, program, info) {
|
|
3
3
|
this._linkCount = 0;
|
|
4
4
|
this._array = null;
|
|
@@ -10,6 +10,5 @@ class GjsifyWebGLUniformLocation {
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
export {
|
|
13
|
-
|
|
14
|
-
GjsifyWebGLUniformLocation as WebGLUniformLocation
|
|
13
|
+
WebGLUniformLocation
|
|
15
14
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Linkable } from "./linkable.js";
|
|
2
|
+
import { WebGLVertexArrayObjectState } from "./webgl-vertex-attribute.js";
|
|
3
|
+
class WebGLVertexArrayObject extends Linkable {
|
|
4
|
+
constructor(_, ctx) {
|
|
5
|
+
super(_);
|
|
6
|
+
this._ctx = ctx;
|
|
7
|
+
this._objectState = new WebGLVertexArrayObjectState(ctx);
|
|
8
|
+
}
|
|
9
|
+
_performDelete() {
|
|
10
|
+
const ctx = this._ctx;
|
|
11
|
+
if (ctx._vertexObjectState === this._objectState) {
|
|
12
|
+
ctx._vertexObjectState = ctx._defaultVertexObjectState;
|
|
13
|
+
}
|
|
14
|
+
this._objectState.cleanUp();
|
|
15
|
+
delete ctx._vertexArrayObjects[this._ | 0];
|
|
16
|
+
ctx._native2.deleteVertexArray(this._ | 0);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
export {
|
|
20
|
+
WebGLVertexArrayObject
|
|
21
|
+
};
|