@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
|
@@ -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 }
|
package/src/ts/webgl-program.ts
DELETED
|
@@ -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 }
|