@gjsify/webgl 0.0.2

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 (154) hide show
  1. package/README.md +14 -0
  2. package/lib/cjs/@types/glsl-tokenizer/index.d.js +0 -0
  3. package/lib/cjs/extensions/ext-blend-minmax.js +37 -0
  4. package/lib/cjs/extensions/ext-texture-filter-anisotropic.js +37 -0
  5. package/lib/cjs/extensions/oes-element-index-unit.js +33 -0
  6. package/lib/cjs/extensions/oes-standard-derivatives.js +36 -0
  7. package/lib/cjs/extensions/oes-texture-float-linear.js +33 -0
  8. package/lib/cjs/extensions/oes-texture-float.js +33 -0
  9. package/lib/cjs/extensions/stackgl-destroy-context.js +31 -0
  10. package/lib/cjs/extensions/stackgl-resize-drawing-buffer.js +31 -0
  11. package/lib/cjs/html-canvas-element.js +89 -0
  12. package/lib/cjs/index.js +34 -0
  13. package/lib/cjs/index.spec.js +175 -0
  14. package/lib/cjs/linkable.js +69 -0
  15. package/lib/cjs/test.js +25 -0
  16. package/lib/cjs/types/constructor.js +15 -0
  17. package/lib/cjs/types/extension.js +15 -0
  18. package/lib/cjs/types/index.js +21 -0
  19. package/lib/cjs/types/typed-array.js +15 -0
  20. package/lib/cjs/types/webgl-constants.js +15 -0
  21. package/lib/cjs/types/webgl-context-attribute-options.js +15 -0
  22. package/lib/cjs/utils.js +241 -0
  23. package/lib/cjs/webgl-active-info.js +29 -0
  24. package/lib/cjs/webgl-buffer.js +37 -0
  25. package/lib/cjs/webgl-context-attributes.js +43 -0
  26. package/lib/cjs/webgl-drawing-buffer-wrapper.js +29 -0
  27. package/lib/cjs/webgl-framebuffer.js +128 -0
  28. package/lib/cjs/webgl-program.js +45 -0
  29. package/lib/cjs/webgl-renderbuffer.js +43 -0
  30. package/lib/cjs/webgl-rendering-context.js +3355 -0
  31. package/lib/cjs/webgl-shader-precision-format.js +30 -0
  32. package/lib/cjs/webgl-shader.js +42 -0
  33. package/lib/cjs/webgl-texture-unit.js +31 -0
  34. package/lib/cjs/webgl-texture.js +41 -0
  35. package/lib/cjs/webgl-uniform-location.js +34 -0
  36. package/lib/cjs/webgl-vertex-attribute.js +166 -0
  37. package/lib/esm/@types/glsl-tokenizer/index.d.js +0 -0
  38. package/lib/esm/extensions/ext-blend-minmax.js +18 -0
  39. package/lib/esm/extensions/ext-texture-filter-anisotropic.js +18 -0
  40. package/lib/esm/extensions/oes-element-index-unit.js +14 -0
  41. package/lib/esm/extensions/oes-standard-derivatives.js +17 -0
  42. package/lib/esm/extensions/oes-texture-float-linear.js +14 -0
  43. package/lib/esm/extensions/oes-texture-float.js +14 -0
  44. package/lib/esm/extensions/stackgl-destroy-context.js +12 -0
  45. package/lib/esm/extensions/stackgl-resize-drawing-buffer.js +12 -0
  46. package/lib/esm/html-canvas-element.js +70 -0
  47. package/lib/esm/index.js +18 -0
  48. package/lib/esm/index.spec.js +146 -0
  49. package/lib/esm/linkable.js +50 -0
  50. package/lib/esm/test.js +3 -0
  51. package/lib/esm/types/constructor.js +0 -0
  52. package/lib/esm/types/extension.js +0 -0
  53. package/lib/esm/types/index.js +5 -0
  54. package/lib/esm/types/typed-array.js +0 -0
  55. package/lib/esm/types/webgl-constants.js +0 -0
  56. package/lib/esm/types/webgl-context-attribute-options.js +0 -0
  57. package/lib/esm/utils.js +212 -0
  58. package/lib/esm/webgl-active-info.js +10 -0
  59. package/lib/esm/webgl-buffer.js +18 -0
  60. package/lib/esm/webgl-context-attributes.js +24 -0
  61. package/lib/esm/webgl-drawing-buffer-wrapper.js +10 -0
  62. package/lib/esm/webgl-framebuffer.js +109 -0
  63. package/lib/esm/webgl-program.js +26 -0
  64. package/lib/esm/webgl-renderbuffer.js +24 -0
  65. package/lib/esm/webgl-rendering-context.js +3343 -0
  66. package/lib/esm/webgl-shader-precision-format.js +11 -0
  67. package/lib/esm/webgl-shader.js +23 -0
  68. package/lib/esm/webgl-texture-unit.js +12 -0
  69. package/lib/esm/webgl-texture.js +22 -0
  70. package/lib/esm/webgl-uniform-location.js +15 -0
  71. package/lib/esm/webgl-vertex-attribute.js +147 -0
  72. package/lib/types/extensions/ext-blend-minmax.d.ts +7 -0
  73. package/lib/types/extensions/ext-texture-filter-anisotropic.d.ts +7 -0
  74. package/lib/types/extensions/oes-element-index-unit.d.ts +4 -0
  75. package/lib/types/extensions/oes-standard-derivatives.d.ts +6 -0
  76. package/lib/types/extensions/oes-texture-float-linear.d.ts +4 -0
  77. package/lib/types/extensions/oes-texture-float.d.ts +4 -0
  78. package/lib/types/extensions/stackgl-destroy-context.d.ts +6 -0
  79. package/lib/types/extensions/stackgl-resize-drawing-buffer.d.ts +6 -0
  80. package/lib/types/html-canvas-element.d.ts +38 -0
  81. package/lib/types/index.d.ts +18 -0
  82. package/lib/types/linkable.d.ts +13 -0
  83. package/lib/types/types/constructor.d.ts +3 -0
  84. package/lib/types/types/extension.d.ts +2 -0
  85. package/lib/types/types/index.d.ts +5 -0
  86. package/lib/types/types/typed-array.d.ts +1 -0
  87. package/lib/types/types/webgl-constants.d.ts +299 -0
  88. package/lib/types/types/webgl-context-attribute-options.d.ts +12 -0
  89. package/lib/types/utils.d.ts +32 -0
  90. package/lib/types/webgl-active-info.d.ts +7 -0
  91. package/lib/types/webgl-buffer.d.ts +10 -0
  92. package/lib/types/webgl-context-attributes.d.ts +14 -0
  93. package/lib/types/webgl-drawing-buffer-wrapper.d.ts +6 -0
  94. package/lib/types/webgl-framebuffer.d.ts +17 -0
  95. package/lib/types/webgl-program.d.ts +14 -0
  96. package/lib/types/webgl-renderbuffer.d.ts +12 -0
  97. package/lib/types/webgl-rendering-context.d.ts +260 -0
  98. package/lib/types/webgl-shader-precision-format.d.ts +7 -0
  99. package/lib/types/webgl-shader.d.ts +12 -0
  100. package/lib/types/webgl-texture-unit.d.ts +10 -0
  101. package/lib/types/webgl-texture.d.ts +14 -0
  102. package/lib/types/webgl-uniform-location.d.ts +18 -0
  103. package/lib/types/webgl-vertex-attribute.d.ts +38 -0
  104. package/meson.build +39 -0
  105. package/package.json +55 -0
  106. package/src/test/app.vala +60 -0
  107. package/src/ts/@types/glsl-tokenizer/index.d.ts +18 -0
  108. package/src/ts/extensions/angle-instanced-arrays.ts.off +232 -0
  109. package/src/ts/extensions/ext-blend-minmax.ts +18 -0
  110. package/src/ts/extensions/ext-texture-filter-anisotropic.ts +18 -0
  111. package/src/ts/extensions/oes-element-index-unit.ts +14 -0
  112. package/src/ts/extensions/oes-standard-derivatives.ts +17 -0
  113. package/src/ts/extensions/oes-texture-float-linear.ts +14 -0
  114. package/src/ts/extensions/oes-texture-float.ts +14 -0
  115. package/src/ts/extensions/oes-vertex-array-object.ts.off +128 -0
  116. package/src/ts/extensions/stackgl-destroy-context.ts +12 -0
  117. package/src/ts/extensions/stackgl-resize-drawing-buffer.ts +14 -0
  118. package/src/ts/extensions/webgl-draw-buffers.ts.off +107 -0
  119. package/src/ts/html-canvas-element.ts +98 -0
  120. package/src/ts/index.spec.ts +186 -0
  121. package/src/ts/index.ts +21 -0
  122. package/src/ts/linkable.ts +55 -0
  123. package/src/ts/test.ts +6 -0
  124. package/src/ts/types/constructor.ts +3 -0
  125. package/src/ts/types/extension.ts +3 -0
  126. package/src/ts/types/index.ts +26 -0
  127. package/src/ts/types/typed-array.ts +1 -0
  128. package/src/ts/types/webgl-constants.ts +300 -0
  129. package/src/ts/types/webgl-context-attribute-options.ts +12 -0
  130. package/src/ts/utils.ts +266 -0
  131. package/src/ts/webgl-active-info.ts +13 -0
  132. package/src/ts/webgl-buffer.ts +21 -0
  133. package/src/ts/webgl-context-attributes.ts +24 -0
  134. package/src/ts/webgl-drawing-buffer-wrapper.ts +10 -0
  135. package/src/ts/webgl-framebuffer.ts +133 -0
  136. package/src/ts/webgl-program.ts +30 -0
  137. package/src/ts/webgl-renderbuffer.ts +28 -0
  138. package/src/ts/webgl-rendering-context.ts +4050 -0
  139. package/src/ts/webgl-shader-precision-format.ts +12 -0
  140. package/src/ts/webgl-shader.ts +29 -0
  141. package/src/ts/webgl-texture-unit.ts +16 -0
  142. package/src/ts/webgl-texture.ts +27 -0
  143. package/src/ts/webgl-uniform-location.ts +18 -0
  144. package/src/ts/webgl-vertex-attribute.ts +169 -0
  145. package/src/vala/handle-types.vala +23 -0
  146. package/src/vala/webgl-rendering-context-base.vala +1265 -0
  147. package/src/vala/webgl-rendering-context.vala +265 -0
  148. package/src/vapi/epoxy.vapi +14558 -0
  149. package/src/vapi/glesv2.vapi +670 -0
  150. package/test.gjs.js +39972 -0
  151. package/test.gjs.js.meta.json +1 -0
  152. package/tmp/.tsbuildinfo +1 -0
  153. package/tsconfig.json +38 -0
  154. package/tsconfig.types.json +7 -0
@@ -0,0 +1,30 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var webgl_shader_precision_format_exports = {};
19
+ __export(webgl_shader_precision_format_exports, {
20
+ GjsifyWebGLShaderPrecisionFormat: () => GjsifyWebGLShaderPrecisionFormat,
21
+ WebGLShaderPrecisionFormat: () => GjsifyWebGLShaderPrecisionFormat
22
+ });
23
+ module.exports = __toCommonJS(webgl_shader_precision_format_exports);
24
+ class GjsifyWebGLShaderPrecisionFormat {
25
+ constructor(_) {
26
+ this.rangeMin = _.rangeMin;
27
+ this.rangeMax = _.rangeMax;
28
+ this.precision = _.precision;
29
+ }
30
+ }
@@ -0,0 +1,42 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var webgl_shader_exports = {};
19
+ __export(webgl_shader_exports, {
20
+ GjsifyWebGLShader: () => GjsifyWebGLShader,
21
+ WebGLShader: () => GjsifyWebGLShader
22
+ });
23
+ module.exports = __toCommonJS(webgl_shader_exports);
24
+ var import_linkable = require("./linkable.js");
25
+ class GjsifyWebGLShader extends import_linkable.Linkable {
26
+ constructor(_, ctx, type) {
27
+ super(_);
28
+ this._source = "";
29
+ this._compileStatus = false;
30
+ this._compileInfo = "";
31
+ this._type = type;
32
+ this._ctx = ctx;
33
+ this._source = "";
34
+ this._compileStatus = false;
35
+ this._compileInfo = "";
36
+ }
37
+ _performDelete() {
38
+ const ctx = this._ctx;
39
+ delete ctx._shaders[this._ | 0];
40
+ ctx._native.deleteShader(this._ | 0);
41
+ }
42
+ }
@@ -0,0 +1,31 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var webgl_texture_unit_exports = {};
19
+ __export(webgl_texture_unit_exports, {
20
+ WebGLTextureUnit: () => WebGLTextureUnit
21
+ });
22
+ module.exports = __toCommonJS(webgl_texture_unit_exports);
23
+ class WebGLTextureUnit {
24
+ constructor(ctx, idx) {
25
+ this._mode = 0;
26
+ this._bind2D = null;
27
+ this._bindCube = null;
28
+ this._ctx = ctx;
29
+ this._idx = idx;
30
+ }
31
+ }
@@ -0,0 +1,41 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var webgl_texture_exports = {};
19
+ __export(webgl_texture_exports, {
20
+ GjsifyWebGLTexture: () => GjsifyWebGLTexture,
21
+ WebGLTexture: () => GjsifyWebGLTexture
22
+ });
23
+ module.exports = __toCommonJS(webgl_texture_exports);
24
+ var import_linkable = require("./linkable.js");
25
+ class GjsifyWebGLTexture extends import_linkable.Linkable {
26
+ constructor(_, ctx) {
27
+ super(_);
28
+ this._binding = 0;
29
+ this._levelWidth = new Int32Array(32);
30
+ this._levelHeight = new Int32Array(32);
31
+ this._format = 0;
32
+ this._type = 0;
33
+ this._complete = true;
34
+ this._ctx = ctx;
35
+ }
36
+ _performDelete() {
37
+ const ctx = this._ctx;
38
+ delete ctx._textures[this._ | 0];
39
+ ctx._native.deleteTexture(this._ | 0);
40
+ }
41
+ }
@@ -0,0 +1,34 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var webgl_uniform_location_exports = {};
19
+ __export(webgl_uniform_location_exports, {
20
+ GjsifyWebGLUniformLocation: () => GjsifyWebGLUniformLocation,
21
+ WebGLUniformLocation: () => GjsifyWebGLUniformLocation
22
+ });
23
+ module.exports = __toCommonJS(webgl_uniform_location_exports);
24
+ class GjsifyWebGLUniformLocation {
25
+ constructor(_, program, info) {
26
+ this._linkCount = 0;
27
+ this._array = null;
28
+ this._ = _;
29
+ this._program = program;
30
+ this._linkCount = program._linkCount;
31
+ this._activeInfo = info;
32
+ this._array = null;
33
+ }
34
+ }
@@ -0,0 +1,166 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
+ var __getOwnPropNames = Object.getOwnPropertyNames;
4
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
5
+ var __export = (target, all) => {
6
+ for (var name in all)
7
+ __defProp(target, name, { get: all[name], enumerable: true });
8
+ };
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") {
11
+ for (let key of __getOwnPropNames(from))
12
+ if (!__hasOwnProp.call(to, key) && key !== except)
13
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
+ }
15
+ return to;
16
+ };
17
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
+ var webgl_vertex_attribute_exports = {};
19
+ __export(webgl_vertex_attribute_exports, {
20
+ WebGLVertexArrayGlobalAttribute: () => WebGLVertexArrayGlobalAttribute,
21
+ WebGLVertexArrayGlobalState: () => WebGLVertexArrayGlobalState,
22
+ WebGLVertexArrayObjectAttribute: () => WebGLVertexArrayObjectAttribute,
23
+ WebGLVertexArrayObjectState: () => WebGLVertexArrayObjectState
24
+ });
25
+ module.exports = __toCommonJS(webgl_vertex_attribute_exports);
26
+ var import_webgl_buffer = require("./webgl-buffer.js");
27
+ class WebGLVertexArrayObjectAttribute {
28
+ constructor(ctx, idx) {
29
+ this._isPointer = false;
30
+ this._pointerBuffer = null;
31
+ this._pointerOffset = 0;
32
+ this._pointerSize = 0;
33
+ this._pointerStride = 0;
34
+ this._pointerType = 0;
35
+ this._pointerNormal = false;
36
+ this._divisor = 0;
37
+ this._inputSize = 4;
38
+ this._inputStride = 0;
39
+ this._ctx = ctx;
40
+ this._idx = idx;
41
+ this._pointerType = ctx.FLOAT;
42
+ this._clear();
43
+ }
44
+ _clear() {
45
+ this._isPointer = false;
46
+ this._pointerBuffer = null;
47
+ this._pointerOffset = 0;
48
+ this._pointerSize = 0;
49
+ this._pointerStride = 0;
50
+ this._pointerType = this._ctx.FLOAT;
51
+ this._pointerNormal = false;
52
+ this._divisor = 0;
53
+ this._inputSize = 4;
54
+ this._inputStride = 0;
55
+ }
56
+ }
57
+ class WebGLVertexArrayGlobalAttribute {
58
+ constructor(idx) {
59
+ this._idx = 0;
60
+ this._idx = idx;
61
+ this._data = new Float32Array([0, 0, 0, 1]);
62
+ }
63
+ }
64
+ class WebGLVertexArrayObjectState {
65
+ constructor(ctx) {
66
+ this._elementArrayBufferBinding = null;
67
+ const numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
68
+ this._attribs = new Array(numAttribs);
69
+ for (let i = 0; i < numAttribs; ++i) {
70
+ this._attribs[i] = new WebGLVertexArrayObjectAttribute(ctx, i);
71
+ }
72
+ this._elementArrayBufferBinding = null;
73
+ }
74
+ setElementArrayBuffer(buffer) {
75
+ if (buffer !== null && !(buffer instanceof import_webgl_buffer.WebGLBuffer)) {
76
+ throw new TypeError("setElementArrayBuffer(WebGLBuffer?)");
77
+ }
78
+ const current = this._elementArrayBufferBinding;
79
+ if (current !== buffer) {
80
+ if (current) {
81
+ current._refCount -= 1;
82
+ current._checkDelete();
83
+ }
84
+ if (buffer) {
85
+ buffer._refCount += 1;
86
+ }
87
+ this._elementArrayBufferBinding = buffer;
88
+ }
89
+ }
90
+ cleanUp() {
91
+ const elementArrayBuffer = this._elementArrayBufferBinding;
92
+ if (elementArrayBuffer) {
93
+ elementArrayBuffer._refCount -= 1;
94
+ elementArrayBuffer._checkDelete();
95
+ this._elementArrayBufferBinding = null;
96
+ }
97
+ for (let i = 0; i < this._attribs.length; ++i) {
98
+ const attrib = this._attribs[i];
99
+ if (attrib._pointerBuffer) {
100
+ attrib._pointerBuffer._refCount -= 1;
101
+ attrib._pointerBuffer._checkDelete();
102
+ }
103
+ attrib._clear();
104
+ }
105
+ }
106
+ releaseArrayBuffer(buffer) {
107
+ if (!buffer) {
108
+ return;
109
+ }
110
+ for (let i = 0; i < this._attribs.length; ++i) {
111
+ const attrib = this._attribs[i];
112
+ if (attrib._pointerBuffer === buffer) {
113
+ attrib._pointerBuffer._refCount -= 1;
114
+ attrib._pointerBuffer._checkDelete();
115
+ attrib._clear();
116
+ }
117
+ }
118
+ }
119
+ setVertexAttribPointer(buffer, index, pointerSize, pointerOffset, pointerStride, pointerType, pointerNormal, inputStride, inputSize) {
120
+ const attrib = this._attribs[index];
121
+ if (buffer !== attrib._pointerBuffer) {
122
+ if (attrib._pointerBuffer) {
123
+ attrib._pointerBuffer._refCount -= 1;
124
+ attrib._pointerBuffer._checkDelete();
125
+ }
126
+ if (buffer) {
127
+ buffer._refCount += 1;
128
+ }
129
+ attrib._pointerBuffer = buffer;
130
+ }
131
+ attrib._pointerSize = pointerSize;
132
+ attrib._pointerOffset = pointerOffset;
133
+ attrib._pointerStride = pointerStride;
134
+ attrib._pointerType = pointerType;
135
+ attrib._pointerNormal = pointerNormal;
136
+ attrib._inputStride = inputStride;
137
+ attrib._inputSize = inputSize;
138
+ }
139
+ }
140
+ class WebGLVertexArrayGlobalState {
141
+ constructor(ctx) {
142
+ this._arrayBufferBinding = null;
143
+ const numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
144
+ this._attribs = new Array(numAttribs);
145
+ for (let i = 0; i < numAttribs; ++i) {
146
+ this._attribs[i] = new WebGLVertexArrayGlobalAttribute(i);
147
+ }
148
+ this._arrayBufferBinding = null;
149
+ }
150
+ setArrayBuffer(buffer) {
151
+ if (buffer !== null && !(buffer instanceof import_webgl_buffer.WebGLBuffer)) {
152
+ throw new TypeError("setArrayBuffer(WebGLBuffer?)");
153
+ }
154
+ const current = this._arrayBufferBinding;
155
+ if (current !== buffer) {
156
+ if (current) {
157
+ current._refCount -= 1;
158
+ current._checkDelete();
159
+ }
160
+ if (buffer) {
161
+ buffer._refCount += 1;
162
+ }
163
+ this._arrayBufferBinding = buffer;
164
+ }
165
+ }
166
+ }
File without changes
@@ -0,0 +1,18 @@
1
+ class EXTBlendMinMax {
2
+ constructor() {
3
+ this.MIN_EXT = 32775;
4
+ this.MAX_EXT = 32776;
5
+ }
6
+ }
7
+ function getEXTBlendMinMax(context) {
8
+ let result = null;
9
+ const exts = context.getSupportedExtensions();
10
+ if (exts && exts.indexOf("EXT_blend_minmax") >= 0) {
11
+ result = new EXTBlendMinMax();
12
+ }
13
+ return result;
14
+ }
15
+ export {
16
+ EXTBlendMinMax,
17
+ getEXTBlendMinMax
18
+ };
@@ -0,0 +1,18 @@
1
+ class EXTTextureFilterAnisotropic {
2
+ constructor() {
3
+ this.TEXTURE_MAX_ANISOTROPY_EXT = 34046;
4
+ this.MAX_TEXTURE_MAX_ANISOTROPY_EXT = 34047;
5
+ }
6
+ }
7
+ function getEXTTextureFilterAnisotropic(context) {
8
+ let result = null;
9
+ const exts = context.getSupportedExtensions();
10
+ if (exts && exts.indexOf("EXT_texture_filter_anisotropic") >= 0) {
11
+ result = new EXTTextureFilterAnisotropic();
12
+ }
13
+ return result;
14
+ }
15
+ export {
16
+ EXTTextureFilterAnisotropic,
17
+ getEXTTextureFilterAnisotropic
18
+ };
@@ -0,0 +1,14 @@
1
+ class OESElementIndexUint {
2
+ }
3
+ function getOESElementIndexUint(context) {
4
+ let result = null;
5
+ const exts = context.getSupportedExtensions();
6
+ if (exts && exts.indexOf("OES_element_index_uint") >= 0) {
7
+ result = new OESElementIndexUint();
8
+ }
9
+ return result;
10
+ }
11
+ export {
12
+ OESElementIndexUint,
13
+ getOESElementIndexUint
14
+ };
@@ -0,0 +1,17 @@
1
+ class OESStandardDerivatives {
2
+ constructor() {
3
+ this.FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 35723;
4
+ }
5
+ }
6
+ function getOESStandardDerivatives(context) {
7
+ let result = null;
8
+ const exts = context.getSupportedExtensions();
9
+ if (exts && exts.indexOf("OES_standard_derivatives") >= 0) {
10
+ result = new OESStandardDerivatives();
11
+ }
12
+ return result;
13
+ }
14
+ export {
15
+ OESStandardDerivatives,
16
+ getOESStandardDerivatives
17
+ };
@@ -0,0 +1,14 @@
1
+ class OESTextureFloatLinear {
2
+ }
3
+ function getOESTextureFloatLinear(context) {
4
+ let result = null;
5
+ const exts = context.getSupportedExtensions();
6
+ if (exts && exts.indexOf("OES_texture_float_linear") >= 0) {
7
+ result = new OESTextureFloatLinear();
8
+ }
9
+ return result;
10
+ }
11
+ export {
12
+ OESTextureFloatLinear,
13
+ getOESTextureFloatLinear
14
+ };
@@ -0,0 +1,14 @@
1
+ class OESTextureFloat {
2
+ }
3
+ function getOESTextureFloat(context) {
4
+ let result = null;
5
+ const exts = context.getSupportedExtensions();
6
+ if (exts && exts.indexOf("OES_texture_float") >= 0) {
7
+ result = new OESTextureFloat();
8
+ }
9
+ return result;
10
+ }
11
+ export {
12
+ OESTextureFloat,
13
+ getOESTextureFloat
14
+ };
@@ -0,0 +1,12 @@
1
+ class STACKGLDestroyContext {
2
+ constructor(ctx) {
3
+ this.destroy = ctx.destroy.bind(ctx);
4
+ }
5
+ }
6
+ function getSTACKGLDestroyContext(ctx) {
7
+ return new STACKGLDestroyContext(ctx);
8
+ }
9
+ export {
10
+ STACKGLDestroyContext,
11
+ getSTACKGLDestroyContext
12
+ };
@@ -0,0 +1,12 @@
1
+ class STACKGLResizeDrawingBuffer {
2
+ constructor(ctx) {
3
+ this.resize = ctx.resize.bind(ctx);
4
+ }
5
+ }
6
+ function getSTACKGLResizeDrawingBuffer(ctx) {
7
+ return new STACKGLResizeDrawingBuffer(ctx);
8
+ }
9
+ export {
10
+ STACKGLResizeDrawingBuffer,
11
+ getSTACKGLResizeDrawingBuffer
12
+ };
@@ -0,0 +1,70 @@
1
+ import { warnNotImplemented, notImplemented } from "@gjsify/utils";
2
+ import { GjsifyWebGLRenderingContext } from "./webgl-rendering-context.js";
3
+ class GjsifyHTMLCanvasElement {
4
+ constructor(gtkGlArea) {
5
+ this.gtkGlArea = gtkGlArea;
6
+ }
7
+ _getGlArea() {
8
+ return this.gtkGlArea;
9
+ }
10
+ /** Gets the height of a canvas element on a document. */
11
+ get height() {
12
+ return this.gtkGlArea.get_allocated_height();
13
+ }
14
+ get clientHeight() {
15
+ return this.height;
16
+ }
17
+ /** Sets the height of a canvas element on a document. */
18
+ set height(_height) {
19
+ warnNotImplemented("GjsifyHTMLCanvasElement.set_height");
20
+ }
21
+ /** Gets the width of a canvas element on a document. */
22
+ get width() {
23
+ return this.gtkGlArea.get_allocated_width();
24
+ }
25
+ /** Sets the width of a canvas element on a document. */
26
+ set width(_width) {
27
+ warnNotImplemented("GjsifyHTMLCanvasElement.set_width");
28
+ }
29
+ get clientWidth() {
30
+ return this.width;
31
+ }
32
+ captureStream(_frameRequestRate) {
33
+ notImplemented("HTMLCanvasElement.captureStream");
34
+ return new MediaStream();
35
+ }
36
+ getContext(contextId, options) {
37
+ switch (contextId) {
38
+ case "webgl":
39
+ if (this._webgl) {
40
+ return this._webgl;
41
+ }
42
+ this._webgl = new GjsifyWebGLRenderingContext(this, options);
43
+ return this._webgl;
44
+ default:
45
+ warnNotImplemented(`GjsifyHTMLCanvasElement.getContext("${contextId}")`);
46
+ }
47
+ return null;
48
+ }
49
+ toBlob(_callback, _type, _quality) {
50
+ notImplemented("HTMLCanvasElement.toBlob");
51
+ }
52
+ /**
53
+ * Returns the content of the current canvas as an image that you can use as a source for another canvas or an HTML element.
54
+ * @param _type The standard MIME type for the image format to return. If you do not specify this parameter, the default value is a PNG format image.
55
+ */
56
+ toDataURL(_type, _quality) {
57
+ notImplemented("HTMLCanvasElement.toDataURL");
58
+ return "";
59
+ }
60
+ addEventListener(_type, _listener, _options) {
61
+ notImplemented("HTMLCanvasElement.addEventListener");
62
+ }
63
+ removeEventListener(_type, _listener, _options) {
64
+ notImplemented("HTMLCanvasElement.removeEventListener");
65
+ }
66
+ }
67
+ export {
68
+ GjsifyHTMLCanvasElement,
69
+ GjsifyHTMLCanvasElement as HTMLCanvasElement
70
+ };
@@ -0,0 +1,18 @@
1
+ import "@girs/gjs";
2
+ import "@girs/gio-2.0";
3
+ import "@girs/gtk-4.0";
4
+ export * from "./html-canvas-element.js";
5
+ export * from "./webgl-active-info.js";
6
+ export * from "./webgl-buffer.js";
7
+ export * from "./webgl-context-attributes.js";
8
+ export * from "./webgl-drawing-buffer-wrapper.js";
9
+ export * from "./webgl-framebuffer.js";
10
+ export * from "./webgl-program.js";
11
+ export * from "./webgl-renderbuffer.js";
12
+ export * from "./webgl-rendering-context.js";
13
+ export * from "./webgl-shader-precision-format.js";
14
+ export * from "./webgl-shader.js";
15
+ export * from "./webgl-texture-unit.js";
16
+ export * from "./webgl-texture.js";
17
+ export * from "./webgl-uniform-location.js";
18
+ export * from "./webgl-vertex-attribute.js";