@gjsify/webgl 0.0.4 → 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.
Files changed (149) hide show
  1. package/README.md +78 -6
  2. package/lib/esm/canvas-webgl-widget.js +116 -0
  3. package/lib/esm/html-canvas-element.js +31 -50
  4. package/lib/esm/index.js +7 -0
  5. package/lib/esm/index.spec.js +629 -120
  6. package/lib/esm/test-utils.js +87 -0
  7. package/lib/esm/test.js +5 -1
  8. package/lib/esm/utils.js +1 -1
  9. package/lib/esm/webgl-active-info.js +2 -2
  10. package/lib/esm/webgl-buffer.js +2 -3
  11. package/lib/esm/webgl-context-attributes.js +2 -3
  12. package/lib/esm/webgl-framebuffer.js +3 -4
  13. package/lib/esm/webgl-program.js +2 -3
  14. package/lib/esm/webgl-query.js +15 -0
  15. package/lib/esm/webgl-renderbuffer.js +2 -3
  16. package/lib/esm/webgl-rendering-context.js +105 -101
  17. package/lib/esm/webgl-sampler.js +15 -0
  18. package/lib/esm/webgl-shader-precision-format.js +2 -3
  19. package/lib/esm/webgl-shader.js +2 -3
  20. package/lib/esm/webgl-sync.js +15 -0
  21. package/lib/esm/webgl-texture.js +2 -3
  22. package/lib/esm/webgl-transform-feedback.js +15 -0
  23. package/lib/esm/webgl-uniform-location.js +2 -3
  24. package/lib/esm/webgl-vertex-array-object.js +21 -0
  25. package/lib/esm/webgl2-rendering-context.js +591 -0
  26. package/lib/esm/webgl2.spec.js +578 -0
  27. package/lib/types/canvas-webgl-widget.d.ts +509 -0
  28. package/lib/types/extensions/ext-blend-minmax.d.ts +2 -2
  29. package/lib/types/extensions/ext-texture-filter-anisotropic.d.ts +2 -2
  30. package/lib/types/extensions/oes-element-index-unit.d.ts +2 -2
  31. package/lib/types/extensions/oes-standard-derivatives.d.ts +2 -2
  32. package/lib/types/extensions/oes-texture-float-linear.d.ts +2 -2
  33. package/lib/types/extensions/oes-texture-float.d.ts +2 -2
  34. package/lib/types/extensions/stackgl-destroy-context.d.ts +3 -3
  35. package/lib/types/extensions/stackgl-resize-drawing-buffer.d.ts +3 -3
  36. package/lib/types/html-canvas-element.d.ts +19 -31
  37. package/lib/types/index.d.ts +7 -0
  38. package/lib/types/test-utils.d.ts +45 -0
  39. package/lib/types/types/extension.d.ts +2 -2
  40. package/lib/types/utils.d.ts +14 -15
  41. package/lib/types/webgl-active-info.d.ts +1 -2
  42. package/lib/types/webgl-buffer.d.ts +5 -6
  43. package/lib/types/webgl-context-attributes.d.ts +1 -2
  44. package/lib/types/webgl-framebuffer.d.ts +4 -5
  45. package/lib/types/webgl-program.d.ts +4 -5
  46. package/lib/types/webgl-query.d.ts +7 -0
  47. package/lib/types/webgl-renderbuffer.d.ts +4 -5
  48. package/lib/types/webgl-rendering-context.d.ts +15 -13
  49. package/lib/types/webgl-sampler.d.ts +7 -0
  50. package/lib/types/webgl-shader-precision-format.d.ts +1 -2
  51. package/lib/types/webgl-shader.d.ts +4 -5
  52. package/lib/types/webgl-sync.d.ts +7 -0
  53. package/lib/types/webgl-texture-unit.d.ts +3 -3
  54. package/lib/types/webgl-texture.d.ts +6 -7
  55. package/lib/types/webgl-transform-feedback.d.ts +7 -0
  56. package/lib/types/webgl-uniform-location.d.ts +3 -4
  57. package/lib/types/webgl-vertex-array-object.d.ts +9 -0
  58. package/lib/types/webgl-vertex-attribute.d.ts +5 -5
  59. package/lib/types/webgl2-rendering-context.d.ts +124 -0
  60. package/package.json +27 -26
  61. package/prebuilds/linux-aarch64/Gwebgl-0.1.typelib +0 -0
  62. package/prebuilds/linux-aarch64/libgwebgl.so +0 -0
  63. package/prebuilds/linux-x86_64/Gwebgl-0.1.typelib +0 -0
  64. package/prebuilds/linux-x86_64/libgwebgl.so +0 -0
  65. package/lib/cjs/@types/glsl-tokenizer/index.d.js +0 -0
  66. package/lib/cjs/extensions/ext-blend-minmax.js +0 -18
  67. package/lib/cjs/extensions/ext-texture-filter-anisotropic.js +0 -18
  68. package/lib/cjs/extensions/oes-element-index-unit.js +0 -14
  69. package/lib/cjs/extensions/oes-standard-derivatives.js +0 -17
  70. package/lib/cjs/extensions/oes-texture-float-linear.js +0 -14
  71. package/lib/cjs/extensions/oes-texture-float.js +0 -14
  72. package/lib/cjs/extensions/stackgl-destroy-context.js +0 -12
  73. package/lib/cjs/extensions/stackgl-resize-drawing-buffer.js +0 -12
  74. package/lib/cjs/html-canvas-element.js +0 -70
  75. package/lib/cjs/index.js +0 -18
  76. package/lib/cjs/index.spec.js +0 -146
  77. package/lib/cjs/linkable.js +0 -50
  78. package/lib/cjs/test.js +0 -3
  79. package/lib/cjs/types/constructor.js +0 -0
  80. package/lib/cjs/types/extension.js +0 -0
  81. package/lib/cjs/types/index.js +0 -5
  82. package/lib/cjs/types/typed-array.js +0 -0
  83. package/lib/cjs/types/webgl-constants.js +0 -0
  84. package/lib/cjs/types/webgl-context-attribute-options.js +0 -0
  85. package/lib/cjs/utils.js +0 -212
  86. package/lib/cjs/webgl-active-info.js +0 -10
  87. package/lib/cjs/webgl-buffer.js +0 -18
  88. package/lib/cjs/webgl-context-attributes.js +0 -24
  89. package/lib/cjs/webgl-drawing-buffer-wrapper.js +0 -10
  90. package/lib/cjs/webgl-framebuffer.js +0 -109
  91. package/lib/cjs/webgl-program.js +0 -26
  92. package/lib/cjs/webgl-renderbuffer.js +0 -24
  93. package/lib/cjs/webgl-rendering-context.js +0 -3343
  94. package/lib/cjs/webgl-shader-precision-format.js +0 -11
  95. package/lib/cjs/webgl-shader.js +0 -23
  96. package/lib/cjs/webgl-texture-unit.js +0 -12
  97. package/lib/cjs/webgl-texture.js +0 -22
  98. package/lib/cjs/webgl-uniform-location.js +0 -15
  99. package/lib/cjs/webgl-vertex-attribute.js +0 -147
  100. package/meson.build +0 -39
  101. package/src/test/app.vala +0 -60
  102. package/src/ts/@types/glsl-tokenizer/index.d.ts +0 -18
  103. package/src/ts/extensions/angle-instanced-arrays.ts.off +0 -232
  104. package/src/ts/extensions/ext-blend-minmax.ts +0 -18
  105. package/src/ts/extensions/ext-texture-filter-anisotropic.ts +0 -18
  106. package/src/ts/extensions/oes-element-index-unit.ts +0 -14
  107. package/src/ts/extensions/oes-standard-derivatives.ts +0 -17
  108. package/src/ts/extensions/oes-texture-float-linear.ts +0 -14
  109. package/src/ts/extensions/oes-texture-float.ts +0 -14
  110. package/src/ts/extensions/oes-vertex-array-object.ts.off +0 -128
  111. package/src/ts/extensions/stackgl-destroy-context.ts +0 -12
  112. package/src/ts/extensions/stackgl-resize-drawing-buffer.ts +0 -14
  113. package/src/ts/extensions/webgl-draw-buffers.ts.off +0 -107
  114. package/src/ts/html-canvas-element.ts +0 -98
  115. package/src/ts/index.spec.ts +0 -186
  116. package/src/ts/index.ts +0 -21
  117. package/src/ts/linkable.ts +0 -55
  118. package/src/ts/test.ts +0 -6
  119. package/src/ts/types/constructor.ts +0 -3
  120. package/src/ts/types/extension.ts +0 -3
  121. package/src/ts/types/index.ts +0 -26
  122. package/src/ts/types/typed-array.ts +0 -1
  123. package/src/ts/types/webgl-constants.ts +0 -300
  124. package/src/ts/types/webgl-context-attribute-options.ts +0 -12
  125. package/src/ts/utils.ts +0 -266
  126. package/src/ts/webgl-active-info.ts +0 -13
  127. package/src/ts/webgl-buffer.ts +0 -21
  128. package/src/ts/webgl-context-attributes.ts +0 -24
  129. package/src/ts/webgl-drawing-buffer-wrapper.ts +0 -10
  130. package/src/ts/webgl-framebuffer.ts +0 -133
  131. package/src/ts/webgl-program.ts +0 -30
  132. package/src/ts/webgl-renderbuffer.ts +0 -28
  133. package/src/ts/webgl-rendering-context.ts +0 -4050
  134. package/src/ts/webgl-shader-precision-format.ts +0 -12
  135. package/src/ts/webgl-shader.ts +0 -29
  136. package/src/ts/webgl-texture-unit.ts +0 -16
  137. package/src/ts/webgl-texture.ts +0 -27
  138. package/src/ts/webgl-uniform-location.ts +0 -18
  139. package/src/ts/webgl-vertex-attribute.ts +0 -169
  140. package/src/vala/handle-types.vala +0 -23
  141. package/src/vala/webgl-rendering-context-base.vala +0 -1265
  142. package/src/vala/webgl-rendering-context.vala +0 -265
  143. package/src/vapi/epoxy.vapi +0 -14558
  144. package/src/vapi/glesv2.vapi +0 -670
  145. package/test.gjs.js +0 -39937
  146. package/test.gjs.js.meta.json +0 -1
  147. package/tmp/.tsbuildinfo +0 -1
  148. package/tsconfig.json +0 -38
  149. package/tsconfig.types.json +0 -7
@@ -1,133 +0,0 @@
1
- import { Linkable } from './linkable.js'
2
- // import { gl } from './native-gl.js'
3
-
4
- import type { GjsifyWebGLRenderingContext } from './webgl-rendering-context.js';
5
- // import type { WebGLDrawBuffers } from './extensions/webgl-draw-buffers.js';
6
- type WebGLDrawBuffers = any;
7
-
8
- export class GjsifyWebGLFramebuffer extends Linkable implements WebGLFramebuffer {
9
-
10
- _ctx: GjsifyWebGLRenderingContext;
11
- _binding = 0
12
-
13
- _width = 0
14
- _height = 0
15
- _status: number | null = null
16
-
17
- _attachments: Record<GLenum, WebGLTexture | WebGLRenderbuffer | null>;
18
- _attachmentLevel: Record<GLenum, number | null>;
19
- _attachmentFace: Record<GLenum, number | null>;
20
-
21
- constructor(_: WebGLFramebuffer & number, ctx: GjsifyWebGLRenderingContext) {
22
- super(_)
23
- this._ctx = ctx
24
-
25
- this._attachments = {}
26
- this._attachments[ctx.COLOR_ATTACHMENT0] = null
27
- this._attachments[ctx.DEPTH_ATTACHMENT] = null
28
- this._attachments[ctx.STENCIL_ATTACHMENT] = null
29
- this._attachments[ctx.DEPTH_STENCIL_ATTACHMENT] = null
30
-
31
- this._attachmentLevel = {}
32
- this._attachmentLevel[ctx.COLOR_ATTACHMENT0] = 0
33
- this._attachmentLevel[ctx.DEPTH_ATTACHMENT] = 0
34
- this._attachmentLevel[ctx.STENCIL_ATTACHMENT] = 0
35
- this._attachmentLevel[ctx.DEPTH_STENCIL_ATTACHMENT] = 0
36
-
37
- this._attachmentFace = {}
38
- this._attachmentFace[ctx.COLOR_ATTACHMENT0] = 0
39
- this._attachmentFace[ctx.DEPTH_ATTACHMENT] = 0
40
- this._attachmentFace[ctx.STENCIL_ATTACHMENT] = 0
41
- this._attachmentFace[ctx.DEPTH_STENCIL_ATTACHMENT] = 0
42
-
43
- if (ctx._extensions.webgl_draw_buffers) {
44
- const webGLDrawBuffers: WebGLDrawBuffers = ctx._extensions.webgl_draw_buffers;
45
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = null
46
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = null
47
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = null
48
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = null
49
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = null
50
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = null
51
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = null
52
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = null
53
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = null
54
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = null
55
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = null
56
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = null
57
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = null
58
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = null
59
- this._attachments[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = null
60
- this._attachments[ctx.NONE] = null
61
- this._attachments[ctx.BACK] = null
62
-
63
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = 0
64
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = 0
65
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = 0
66
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = 0
67
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = 0
68
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = 0
69
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = 0
70
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = 0
71
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = 0
72
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = 0
73
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = 0
74
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = 0
75
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = 0
76
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = 0
77
- this._attachmentLevel[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = 0
78
- this._attachmentLevel[ctx.NONE] = null
79
- this._attachmentLevel[ctx.BACK] = null
80
-
81
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT1_WEBGL] = 0
82
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT2_WEBGL] = 0
83
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT3_WEBGL] = 0
84
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT4_WEBGL] = 0
85
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT5_WEBGL] = 0
86
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT6_WEBGL] = 0
87
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT7_WEBGL] = 0
88
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT8_WEBGL] = 0
89
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT9_WEBGL] = 0
90
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT10_WEBGL] = 0
91
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT11_WEBGL] = 0
92
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT12_WEBGL] = 0
93
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT13_WEBGL] = 0
94
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT14_WEBGL] = 0
95
- this._attachmentFace[webGLDrawBuffers.COLOR_ATTACHMENT15_WEBGL] = 0
96
- this._attachmentFace[ctx.NONE] = null
97
- this._attachmentFace[ctx.BACK] = null
98
- }
99
- }
100
-
101
- _clearAttachment(attachment: GLenum) {
102
- const object = this._attachments[attachment]
103
- if (!object) {
104
- return
105
- }
106
- this._attachments[attachment] = null
107
- this._unlink(object)
108
- }
109
-
110
- _setAttachment(object: WebGLTexture | WebGLRenderbuffer | null, attachment: GLenum) {
111
- const prevObject = this._attachments[attachment]
112
- if (prevObject === object) {
113
- return
114
- }
115
-
116
- this._clearAttachment(attachment)
117
- if (!object) {
118
- return
119
- }
120
-
121
- this._attachments[attachment] = object
122
-
123
- this._link(object)
124
- }
125
-
126
- _performDelete() {
127
- const ctx = this._ctx
128
- delete ctx._framebuffers[this._ | 0]
129
- ctx.deleteFramebuffer.call(ctx, this)
130
- }
131
- }
132
-
133
- export { GjsifyWebGLFramebuffer as WebGLFramebuffer }
@@ -1,30 +0,0 @@
1
- import { Linkable } from './linkable.js'
2
- import { WebGLActiveInfo } from './webgl-active-info.js';
3
-
4
- import type { GjsifyWebGLRenderingContext } from './webgl-rendering-context.js';
5
-
6
- export class GjsifyWebGLProgram extends Linkable implements WebGLProgram {
7
- _ctx: GjsifyWebGLRenderingContext;
8
- _linkCount = 0
9
- _linkStatus = false
10
- _linkInfoLog: string | null = 'not linked'
11
- _attributes: number[] = []
12
- _uniforms: WebGLActiveInfo[] = []
13
- constructor(_: WebGLProgram & number, ctx: GjsifyWebGLRenderingContext) {
14
- super(_)
15
- this._ctx = ctx
16
- this._linkCount = 0
17
- this._linkStatus = false
18
- this._linkInfoLog = 'not linked'
19
- this._attributes = []
20
- this._uniforms = []
21
- }
22
-
23
- _performDelete() {
24
- const ctx = this._ctx
25
- delete ctx._programs[this._ | 0]
26
- ctx._native.deleteProgram(this._ | 0)
27
- }
28
- }
29
-
30
- export { GjsifyWebGLProgram as WebGLProgram }
@@ -1,28 +0,0 @@
1
- import { Linkable } from './linkable.js'
2
- // import { gl } from './native-gl.js'
3
-
4
- import type { GjsifyWebGLRenderingContext } from './webgl-rendering-context.js';
5
-
6
- export class GjsifyWebGLRenderbuffer extends Linkable implements WebGLRenderbuffer {
7
- _ctx: GjsifyWebGLRenderingContext;
8
- _binding = 0;
9
- _width = 0;
10
- _height = 0;
11
- _format = 0;
12
- constructor (_: WebGLRenderbuffer & number, ctx: GjsifyWebGLRenderingContext) {
13
- super(_)
14
- this._ctx = ctx
15
- this._binding = 0
16
- this._width = 0
17
- this._height = 0
18
- this._format = 0
19
- }
20
-
21
- _performDelete () {
22
- const ctx = this._ctx
23
- delete ctx._renderbuffers[this._ | 0]
24
- ctx._native.deleteRenderbuffer(this._)
25
- }
26
- }
27
-
28
- export { GjsifyWebGLRenderbuffer as WebGLRenderbuffer }