@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,128 @@
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_framebuffer_exports = {};
19
+ __export(webgl_framebuffer_exports, {
20
+ GjsifyWebGLFramebuffer: () => GjsifyWebGLFramebuffer,
21
+ WebGLFramebuffer: () => GjsifyWebGLFramebuffer
22
+ });
23
+ module.exports = __toCommonJS(webgl_framebuffer_exports);
24
+ var import_linkable = require("./linkable.js");
25
+ class GjsifyWebGLFramebuffer extends import_linkable.Linkable {
26
+ constructor(_, ctx) {
27
+ super(_);
28
+ this._binding = 0;
29
+ this._width = 0;
30
+ this._height = 0;
31
+ this._status = null;
32
+ this._ctx = ctx;
33
+ this._attachments = {};
34
+ this._attachments[ctx.COLOR_ATTACHMENT0] = null;
35
+ this._attachments[ctx.DEPTH_ATTACHMENT] = null;
36
+ this._attachments[ctx.STENCIL_ATTACHMENT] = null;
37
+ this._attachments[ctx.DEPTH_STENCIL_ATTACHMENT] = null;
38
+ this._attachmentLevel = {};
39
+ this._attachmentLevel[ctx.COLOR_ATTACHMENT0] = 0;
40
+ this._attachmentLevel[ctx.DEPTH_ATTACHMENT] = 0;
41
+ this._attachmentLevel[ctx.STENCIL_ATTACHMENT] = 0;
42
+ this._attachmentLevel[ctx.DEPTH_STENCIL_ATTACHMENT] = 0;
43
+ this._attachmentFace = {};
44
+ this._attachmentFace[ctx.COLOR_ATTACHMENT0] = 0;
45
+ this._attachmentFace[ctx.DEPTH_ATTACHMENT] = 0;
46
+ this._attachmentFace[ctx.STENCIL_ATTACHMENT] = 0;
47
+ this._attachmentFace[ctx.DEPTH_STENCIL_ATTACHMENT] = 0;
48
+ if (ctx._extensions.webgl_draw_buffers) {
49
+ const webGLDrawBuffers = ctx._extensions.webgl_draw_buffers;
50
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = null;
51
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = null;
52
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = null;
53
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = null;
54
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = null;
55
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = null;
56
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = null;
57
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = null;
58
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = null;
59
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = null;
60
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = null;
61
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = null;
62
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = null;
63
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = null;
64
+ this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = null;
65
+ this._attachments[ctx.NONE] = null;
66
+ this._attachments[ctx.BACK] = null;
67
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = 0;
68
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = 0;
69
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = 0;
70
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = 0;
71
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = 0;
72
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = 0;
73
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = 0;
74
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = 0;
75
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = 0;
76
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = 0;
77
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = 0;
78
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = 0;
79
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = 0;
80
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = 0;
81
+ this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = 0;
82
+ this._attachmentLevel[ctx.NONE] = null;
83
+ this._attachmentLevel[ctx.BACK] = null;
84
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = 0;
85
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = 0;
86
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = 0;
87
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = 0;
88
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = 0;
89
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = 0;
90
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = 0;
91
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = 0;
92
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = 0;
93
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = 0;
94
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = 0;
95
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = 0;
96
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = 0;
97
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = 0;
98
+ this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = 0;
99
+ this._attachmentFace[ctx.NONE] = null;
100
+ this._attachmentFace[ctx.BACK] = null;
101
+ }
102
+ }
103
+ _clearAttachment(attachment) {
104
+ const object = this._attachments[attachment];
105
+ if (!object) {
106
+ return;
107
+ }
108
+ this._attachments[attachment] = null;
109
+ this._unlink(object);
110
+ }
111
+ _setAttachment(object, attachment) {
112
+ const prevObject = this._attachments[attachment];
113
+ if (prevObject === object) {
114
+ return;
115
+ }
116
+ this._clearAttachment(attachment);
117
+ if (!object) {
118
+ return;
119
+ }
120
+ this._attachments[attachment] = object;
121
+ this._link(object);
122
+ }
123
+ _performDelete() {
124
+ const ctx = this._ctx;
125
+ delete ctx._framebuffers[this._ | 0];
126
+ ctx.deleteFramebuffer.call(ctx, this);
127
+ }
128
+ }
@@ -0,0 +1,45 @@
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_program_exports = {};
19
+ __export(webgl_program_exports, {
20
+ GjsifyWebGLProgram: () => GjsifyWebGLProgram,
21
+ WebGLProgram: () => GjsifyWebGLProgram
22
+ });
23
+ module.exports = __toCommonJS(webgl_program_exports);
24
+ var import_linkable = require("./linkable.js");
25
+ class GjsifyWebGLProgram extends import_linkable.Linkable {
26
+ constructor(_, ctx) {
27
+ super(_);
28
+ this._linkCount = 0;
29
+ this._linkStatus = false;
30
+ this._linkInfoLog = "not linked";
31
+ this._attributes = [];
32
+ this._uniforms = [];
33
+ this._ctx = ctx;
34
+ this._linkCount = 0;
35
+ this._linkStatus = false;
36
+ this._linkInfoLog = "not linked";
37
+ this._attributes = [];
38
+ this._uniforms = [];
39
+ }
40
+ _performDelete() {
41
+ const ctx = this._ctx;
42
+ delete ctx._programs[this._ | 0];
43
+ ctx._native.deleteProgram(this._ | 0);
44
+ }
45
+ }
@@ -0,0 +1,43 @@
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_renderbuffer_exports = {};
19
+ __export(webgl_renderbuffer_exports, {
20
+ GjsifyWebGLRenderbuffer: () => GjsifyWebGLRenderbuffer,
21
+ WebGLRenderbuffer: () => GjsifyWebGLRenderbuffer
22
+ });
23
+ module.exports = __toCommonJS(webgl_renderbuffer_exports);
24
+ var import_linkable = require("./linkable.js");
25
+ class GjsifyWebGLRenderbuffer extends import_linkable.Linkable {
26
+ constructor(_, ctx) {
27
+ super(_);
28
+ this._binding = 0;
29
+ this._width = 0;
30
+ this._height = 0;
31
+ this._format = 0;
32
+ this._ctx = ctx;
33
+ this._binding = 0;
34
+ this._width = 0;
35
+ this._height = 0;
36
+ this._format = 0;
37
+ }
38
+ _performDelete() {
39
+ const ctx = this._ctx;
40
+ delete ctx._renderbuffers[this._ | 0];
41
+ ctx._native.deleteRenderbuffer(this._);
42
+ }
43
+ }