@gjsify/webgl 0.3.13 → 0.3.15

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 (55) hide show
  1. package/lib/esm/conformance/attribs.spec.js +312 -293
  2. package/lib/esm/conformance/buffers.spec.js +217 -200
  3. package/lib/esm/conformance/context.spec.js +295 -295
  4. package/lib/esm/conformance/programs.spec.js +458 -445
  5. package/lib/esm/conformance/rendering-basic.spec.js +134 -128
  6. package/lib/esm/conformance/rendering.spec.js +502 -400
  7. package/lib/esm/conformance/setup.js +42 -31
  8. package/lib/esm/conformance/state.spec.js +360 -343
  9. package/lib/esm/conformance/textures.spec.js +330 -338
  10. package/lib/esm/conformance/uniforms.spec.js +465 -309
  11. package/lib/esm/conformance-test.js +24 -22
  12. package/lib/esm/extensions/ext-blend-minmax.js +16 -16
  13. package/lib/esm/extensions/ext-color-buffer-float.js +10 -11
  14. package/lib/esm/extensions/ext-color-buffer-half-float.js +10 -11
  15. package/lib/esm/extensions/ext-texture-filter-anisotropic.js +16 -16
  16. package/lib/esm/extensions/oes-element-index-unit.js +11 -12
  17. package/lib/esm/extensions/oes-standard-derivatives.js +15 -15
  18. package/lib/esm/extensions/oes-texture-float-linear.js +11 -12
  19. package/lib/esm/extensions/oes-texture-float.js +11 -12
  20. package/lib/esm/extensions/oes-texture-half-float.js +17 -17
  21. package/lib/esm/extensions/stackgl-destroy-context.js +10 -10
  22. package/lib/esm/extensions/stackgl-resize-drawing-buffer.js +10 -10
  23. package/lib/esm/html-canvas-element.js +64 -64
  24. package/lib/esm/index.js +29 -26
  25. package/lib/esm/linkable.js +49 -49
  26. package/lib/esm/test-utils.js +158 -107
  27. package/lib/esm/test.js +8 -4
  28. package/lib/esm/types/index.js +5 -5
  29. package/lib/esm/utils.js +164 -187
  30. package/lib/esm/webgl-active-info.js +10 -9
  31. package/lib/esm/webgl-bridge.js +162 -147
  32. package/lib/esm/webgl-buffer.js +17 -15
  33. package/lib/esm/webgl-context-attributes.js +23 -22
  34. package/lib/esm/webgl-context-base.js +3039 -3351
  35. package/lib/esm/webgl-drawing-buffer-wrapper.js +10 -9
  36. package/lib/esm/webgl-framebuffer.js +108 -106
  37. package/lib/esm/webgl-program.js +25 -23
  38. package/lib/esm/webgl-query.js +15 -13
  39. package/lib/esm/webgl-renderbuffer.js +23 -21
  40. package/lib/esm/webgl-rendering-context.js +173 -187
  41. package/lib/esm/webgl-sampler.js +15 -13
  42. package/lib/esm/webgl-shader-precision-format.js +10 -9
  43. package/lib/esm/webgl-shader.js +23 -21
  44. package/lib/esm/webgl-sync.js +15 -13
  45. package/lib/esm/webgl-texture-unit.js +12 -11
  46. package/lib/esm/webgl-texture.js +21 -19
  47. package/lib/esm/webgl-transform-feedback.js +15 -13
  48. package/lib/esm/webgl-uniform-location.js +14 -13
  49. package/lib/esm/webgl-vertex-array-object.js +20 -18
  50. package/lib/esm/webgl-vertex-attribute.js +149 -145
  51. package/lib/esm/webgl1.spec.js +1039 -650
  52. package/lib/esm/webgl2-rendering-context.js +1210 -1273
  53. package/lib/esm/webgl2.spec.js +1284 -1252
  54. package/package.json +9 -9
  55. package/lib/esm/@types/glsl-tokenizer/index.d.js +0 -0
@@ -1,21 +1,23 @@
1
1
  import { Linkable } from "./linkable.js";
2
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
3
+
4
+ //#region src/ts/webgl-vertex-array-object.ts
5
+ var WebGLVertexArrayObject = class extends Linkable {
6
+ constructor(_, ctx) {
7
+ super(_);
8
+ this._ctx = ctx;
9
+ this._objectState = new WebGLVertexArrayObjectState(ctx);
10
+ }
11
+ _performDelete() {
12
+ const ctx = this._ctx;
13
+ if (ctx._vertexObjectState === this._objectState) {
14
+ ctx._vertexObjectState = ctx._defaultVertexObjectState;
15
+ }
16
+ this._objectState.cleanUp();
17
+ delete ctx._vertexArrayObjects[this._ | 0];
18
+ ctx._native2.deleteVertexArray(this._ | 0);
19
+ }
21
20
  };
21
+
22
+ //#endregion
23
+ export { WebGLVertexArrayObject };
@@ -1,147 +1,151 @@
1
1
  import { WebGLBuffer } from "./webgl-buffer.js";
2
- class WebGLVertexArrayObjectAttribute {
3
- constructor(ctx, idx) {
4
- this._isPointer = false;
5
- this._pointerBuffer = null;
6
- this._pointerOffset = 0;
7
- this._pointerSize = 0;
8
- this._pointerStride = 0;
9
- this._pointerType = 0;
10
- this._pointerNormal = false;
11
- this._divisor = 0;
12
- this._inputSize = 4;
13
- this._inputStride = 0;
14
- this._ctx = ctx;
15
- this._idx = idx;
16
- this._pointerType = ctx.FLOAT;
17
- this._clear();
18
- }
19
- _clear() {
20
- this._isPointer = false;
21
- this._pointerBuffer = null;
22
- this._pointerOffset = 0;
23
- this._pointerSize = 0;
24
- this._pointerStride = 0;
25
- this._pointerType = this._ctx.FLOAT;
26
- this._pointerNormal = false;
27
- this._divisor = 0;
28
- this._inputSize = 4;
29
- this._inputStride = 0;
30
- }
31
- }
32
- class WebGLVertexArrayGlobalAttribute {
33
- constructor(idx) {
34
- this._idx = 0;
35
- this._idx = idx;
36
- this._data = new Float32Array([0, 0, 0, 1]);
37
- }
38
- }
39
- class WebGLVertexArrayObjectState {
40
- constructor(ctx) {
41
- this._elementArrayBufferBinding = null;
42
- const numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
43
- this._attribs = new Array(numAttribs);
44
- for (let i = 0; i < numAttribs; ++i) {
45
- this._attribs[i] = new WebGLVertexArrayObjectAttribute(ctx, i);
46
- }
47
- this._elementArrayBufferBinding = null;
48
- }
49
- setElementArrayBuffer(buffer) {
50
- if (buffer !== null && !(buffer instanceof WebGLBuffer)) {
51
- throw new TypeError("setElementArrayBuffer(WebGLBuffer?)");
52
- }
53
- const current = this._elementArrayBufferBinding;
54
- if (current !== buffer) {
55
- if (current) {
56
- current._refCount -= 1;
57
- current._checkDelete();
58
- }
59
- if (buffer) {
60
- buffer._refCount += 1;
61
- }
62
- this._elementArrayBufferBinding = buffer;
63
- }
64
- }
65
- cleanUp() {
66
- const elementArrayBuffer = this._elementArrayBufferBinding;
67
- if (elementArrayBuffer) {
68
- elementArrayBuffer._refCount -= 1;
69
- elementArrayBuffer._checkDelete();
70
- this._elementArrayBufferBinding = null;
71
- }
72
- for (let i = 0; i < this._attribs.length; ++i) {
73
- const attrib = this._attribs[i];
74
- if (attrib._pointerBuffer) {
75
- attrib._pointerBuffer._refCount -= 1;
76
- attrib._pointerBuffer._checkDelete();
77
- }
78
- attrib._clear();
79
- }
80
- }
81
- releaseArrayBuffer(buffer) {
82
- if (!buffer) {
83
- return;
84
- }
85
- for (let i = 0; i < this._attribs.length; ++i) {
86
- const attrib = this._attribs[i];
87
- if (attrib._pointerBuffer === buffer) {
88
- attrib._pointerBuffer._refCount -= 1;
89
- attrib._pointerBuffer._checkDelete();
90
- attrib._clear();
91
- }
92
- }
93
- }
94
- setVertexAttribPointer(buffer, index, pointerSize, pointerOffset, pointerStride, pointerType, pointerNormal, inputStride, inputSize) {
95
- const attrib = this._attribs[index];
96
- if (buffer !== attrib._pointerBuffer) {
97
- if (attrib._pointerBuffer) {
98
- attrib._pointerBuffer._refCount -= 1;
99
- attrib._pointerBuffer._checkDelete();
100
- }
101
- if (buffer) {
102
- buffer._refCount += 1;
103
- }
104
- attrib._pointerBuffer = buffer;
105
- }
106
- attrib._pointerSize = pointerSize;
107
- attrib._pointerOffset = pointerOffset;
108
- attrib._pointerStride = pointerStride;
109
- attrib._pointerType = pointerType;
110
- attrib._pointerNormal = pointerNormal;
111
- attrib._inputStride = inputStride;
112
- attrib._inputSize = inputSize;
113
- }
114
- }
115
- class WebGLVertexArrayGlobalState {
116
- constructor(ctx) {
117
- this._arrayBufferBinding = null;
118
- const numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
119
- this._attribs = new Array(numAttribs);
120
- for (let i = 0; i < numAttribs; ++i) {
121
- this._attribs[i] = new WebGLVertexArrayGlobalAttribute(i);
122
- }
123
- this._arrayBufferBinding = null;
124
- }
125
- setArrayBuffer(buffer) {
126
- if (buffer !== null && !(buffer instanceof WebGLBuffer)) {
127
- throw new TypeError("setArrayBuffer(WebGLBuffer?)");
128
- }
129
- const current = this._arrayBufferBinding;
130
- if (current !== buffer) {
131
- if (current) {
132
- current._refCount -= 1;
133
- current._checkDelete();
134
- }
135
- if (buffer) {
136
- buffer._refCount += 1;
137
- }
138
- this._arrayBufferBinding = buffer;
139
- }
140
- }
141
- }
142
- export {
143
- WebGLVertexArrayGlobalAttribute,
144
- WebGLVertexArrayGlobalState,
145
- WebGLVertexArrayObjectAttribute,
146
- WebGLVertexArrayObjectState
2
+
3
+ //#region src/ts/webgl-vertex-attribute.ts
4
+ var WebGLVertexArrayObjectAttribute = class {
5
+ constructor(ctx, idx) {
6
+ this._isPointer = false;
7
+ this._pointerBuffer = null;
8
+ this._pointerOffset = 0;
9
+ this._pointerSize = 0;
10
+ this._pointerStride = 0;
11
+ this._pointerType = 0;
12
+ this._pointerNormal = false;
13
+ this._divisor = 0;
14
+ this._inputSize = 4;
15
+ this._inputStride = 0;
16
+ this._ctx = ctx;
17
+ this._idx = idx;
18
+ this._pointerType = ctx.FLOAT;
19
+ this._clear();
20
+ }
21
+ _clear() {
22
+ this._isPointer = false;
23
+ this._pointerBuffer = null;
24
+ this._pointerOffset = 0;
25
+ this._pointerSize = 0;
26
+ this._pointerStride = 0;
27
+ this._pointerType = this._ctx.FLOAT;
28
+ this._pointerNormal = false;
29
+ this._divisor = 0;
30
+ this._inputSize = 4;
31
+ this._inputStride = 0;
32
+ }
147
33
  };
34
+ var WebGLVertexArrayGlobalAttribute = class {
35
+ constructor(idx) {
36
+ this._idx = 0;
37
+ this._idx = idx;
38
+ this._data = new Float32Array([
39
+ 0,
40
+ 0,
41
+ 0,
42
+ 1
43
+ ]);
44
+ }
45
+ };
46
+ var WebGLVertexArrayObjectState = class {
47
+ constructor(ctx) {
48
+ this._elementArrayBufferBinding = null;
49
+ const numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
50
+ this._attribs = new Array(numAttribs);
51
+ for (let i = 0; i < numAttribs; ++i) {
52
+ this._attribs[i] = new WebGLVertexArrayObjectAttribute(ctx, i);
53
+ }
54
+ this._elementArrayBufferBinding = null;
55
+ }
56
+ setElementArrayBuffer(buffer) {
57
+ if (buffer !== null && !(buffer instanceof WebGLBuffer)) {
58
+ throw new TypeError("setElementArrayBuffer(WebGLBuffer?)");
59
+ }
60
+ const current = this._elementArrayBufferBinding;
61
+ if (current !== buffer) {
62
+ if (current) {
63
+ current._refCount -= 1;
64
+ current._checkDelete();
65
+ }
66
+ if (buffer) {
67
+ buffer._refCount += 1;
68
+ }
69
+ this._elementArrayBufferBinding = buffer;
70
+ }
71
+ }
72
+ cleanUp() {
73
+ const elementArrayBuffer = this._elementArrayBufferBinding;
74
+ if (elementArrayBuffer) {
75
+ elementArrayBuffer._refCount -= 1;
76
+ elementArrayBuffer._checkDelete();
77
+ this._elementArrayBufferBinding = null;
78
+ }
79
+ for (let i = 0; i < this._attribs.length; ++i) {
80
+ const attrib = this._attribs[i];
81
+ if (attrib._pointerBuffer) {
82
+ attrib._pointerBuffer._refCount -= 1;
83
+ attrib._pointerBuffer._checkDelete();
84
+ }
85
+ attrib._clear();
86
+ }
87
+ }
88
+ releaseArrayBuffer(buffer) {
89
+ if (!buffer) {
90
+ return;
91
+ }
92
+ for (let i = 0; i < this._attribs.length; ++i) {
93
+ const attrib = this._attribs[i];
94
+ if (attrib._pointerBuffer === buffer) {
95
+ attrib._pointerBuffer._refCount -= 1;
96
+ attrib._pointerBuffer._checkDelete();
97
+ attrib._clear();
98
+ }
99
+ }
100
+ }
101
+ setVertexAttribPointer(buffer, index, pointerSize, pointerOffset, pointerStride, pointerType, pointerNormal, inputStride, inputSize) {
102
+ const attrib = this._attribs[index];
103
+ if (buffer !== attrib._pointerBuffer) {
104
+ if (attrib._pointerBuffer) {
105
+ attrib._pointerBuffer._refCount -= 1;
106
+ attrib._pointerBuffer._checkDelete();
107
+ }
108
+ if (buffer) {
109
+ buffer._refCount += 1;
110
+ }
111
+ attrib._pointerBuffer = buffer;
112
+ }
113
+ attrib._pointerSize = pointerSize;
114
+ attrib._pointerOffset = pointerOffset;
115
+ attrib._pointerStride = pointerStride;
116
+ attrib._pointerType = pointerType;
117
+ attrib._pointerNormal = pointerNormal;
118
+ attrib._inputStride = inputStride;
119
+ attrib._inputSize = inputSize;
120
+ }
121
+ };
122
+ var WebGLVertexArrayGlobalState = class {
123
+ constructor(ctx) {
124
+ this._arrayBufferBinding = null;
125
+ const numAttribs = ctx.getParameter(ctx.MAX_VERTEX_ATTRIBS);
126
+ this._attribs = new Array(numAttribs);
127
+ for (let i = 0; i < numAttribs; ++i) {
128
+ this._attribs[i] = new WebGLVertexArrayGlobalAttribute(i);
129
+ }
130
+ this._arrayBufferBinding = null;
131
+ }
132
+ setArrayBuffer(buffer) {
133
+ if (buffer !== null && !(buffer instanceof WebGLBuffer)) {
134
+ throw new TypeError("setArrayBuffer(WebGLBuffer?)");
135
+ }
136
+ const current = this._arrayBufferBinding;
137
+ if (current !== buffer) {
138
+ if (current) {
139
+ current._refCount -= 1;
140
+ current._checkDelete();
141
+ }
142
+ if (buffer) {
143
+ buffer._refCount += 1;
144
+ }
145
+ this._arrayBufferBinding = buffer;
146
+ }
147
+ }
148
+ };
149
+
150
+ //#endregion
151
+ export { WebGLVertexArrayGlobalAttribute, WebGLVertexArrayGlobalState, WebGLVertexArrayObjectAttribute, WebGLVertexArrayObjectState };