@luma.gl/webgl 9.0.0-beta.6 → 9.0.0-beta.7
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/dist/adapter/converters/device-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/device-parameters.js +81 -84
- package/dist/adapter/converters/sampler-parameters.js +17 -17
- package/dist/adapter/converters/shader-formats.js +12 -12
- package/dist/adapter/converters/texture-formats.d.ts +10 -8
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +175 -168
- package/dist/adapter/converters/vertex-formats.js +20 -20
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +2 -1
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +14 -2
- package/dist/adapter/device-helpers/webgl-device-info.js +5 -5
- package/dist/adapter/device-helpers/webgl-device-limits.js +10 -10
- package/dist/adapter/helpers/decode-webgl-types.js +45 -45
- package/dist/adapter/helpers/get-shader-layout.js +29 -29
- package/dist/adapter/helpers/set-uniform.js +40 -40
- package/dist/adapter/helpers/webgl-topology-utils.js +38 -38
- package/dist/adapter/objects/webgl-renderbuffer.js +6 -6
- package/dist/adapter/objects/webgl-resource.js +1 -2
- package/dist/adapter/resources/webgl-buffer.js +14 -14
- package/dist/adapter/resources/webgl-command-buffer.js +25 -25
- package/dist/adapter/resources/webgl-external-texture.js +3 -3
- package/dist/adapter/resources/webgl-framebuffer.d.ts +2 -4
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +41 -36
- package/dist/adapter/resources/webgl-query-set.js +6 -6
- package/dist/adapter/resources/webgl-render-pass.js +5 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +19 -13
- package/dist/adapter/resources/webgl-sampler.js +2 -2
- package/dist/adapter/resources/webgl-shader.js +4 -4
- package/dist/adapter/resources/webgl-texture.d.ts +2 -1
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +29 -27
- package/dist/adapter/resources/webgl-transform-feedback.js +8 -8
- package/dist/adapter/resources/webgl-vertex-array.d.ts +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +5 -5
- package/dist/adapter/webgl-device.d.ts +6 -3
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +22 -17
- package/dist/classic/accessor.js +4 -4
- package/dist/classic/clear.js +2 -2
- package/dist/classic/copy-and-blit.js +15 -16
- package/dist/classic/format-utils.d.ts +2 -2
- package/dist/classic/format-utils.js +14 -14
- package/dist/classic/typed-array-utils.js +18 -18
- package/dist/context/parameters/unified-parameter-api.d.ts +3 -4
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +4 -9
- package/dist/context/parameters/webgl-parameter-tables.d.ts +2 -13
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +292 -298
- package/dist/context/state-tracker/with-parameters.d.ts +1 -2
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +2 -5
- package/dist/dist.dev.js +877 -840
- package/dist/index.cjs +1253 -1188
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist.min.js +6 -6
- package/package.json +4 -4
- package/src/adapter/converters/device-parameters.ts +9 -11
- package/src/adapter/converters/texture-formats.ts +64 -61
- package/src/adapter/device-helpers/webgl-device-features.ts +22 -2
- package/src/adapter/objects/webgl-renderbuffer.ts +1 -1
- package/src/adapter/objects/webgl-resource.ts +1 -1
- package/src/adapter/resources/webgl-external-texture.ts +3 -3
- package/src/adapter/resources/webgl-framebuffer.ts +29 -26
- package/src/adapter/resources/webgl-render-pass.ts +3 -3
- package/src/adapter/resources/webgl-render-pipeline.ts +13 -6
- package/src/adapter/resources/webgl-texture.ts +7 -3
- package/src/adapter/webgl-device.ts +24 -19
- package/src/classic/clear.ts +2 -2
- package/src/context/parameters/unified-parameter-api.ts +4 -16
- package/src/context/state-tracker/with-parameters.ts +2 -7
- package/src/index.ts +4 -4
- package/dist/adapter/device-helpers/device-features.d.ts +0 -6
- package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-features.js +0 -65
- package/dist/adapter/device-helpers/device-limits.d.ts +0 -50
- package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js +0 -92
- package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js +0 -87
- package/dist/context/context/context-data.d.ts +0 -14
- package/dist/context/context/context-data.d.ts.map +0 -1
- package/dist/context/context/context-data.js +0 -33
- package/dist/context/context/create-browser-context.d.ts +0 -35
- package/dist/context/context/create-browser-context.d.ts.map +0 -1
- package/dist/context/context/create-browser-context.js +0 -66
|
@@ -6,98 +6,98 @@ import { GL } from '@luma.gl/constants';
|
|
|
6
6
|
// DEFAULT SETTINGS - FOR FAST CACHE INITIALIZATION AND CONTEXT RESETS
|
|
7
7
|
/* eslint-disable no-shadow */
|
|
8
8
|
export const GL_PARAMETER_DEFAULTS = {
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
15
|
-
[
|
|
16
|
-
[
|
|
17
|
-
[
|
|
18
|
-
[
|
|
19
|
-
[
|
|
20
|
-
[
|
|
21
|
-
[
|
|
22
|
-
[
|
|
23
|
-
[
|
|
24
|
-
[
|
|
25
|
-
[
|
|
26
|
-
[
|
|
27
|
-
[
|
|
9
|
+
[3042]: false,
|
|
10
|
+
[32773]: new Float32Array([0, 0, 0, 0]),
|
|
11
|
+
[32777]: 32774,
|
|
12
|
+
[34877]: 32774,
|
|
13
|
+
[32969]: 1,
|
|
14
|
+
[32968]: 0,
|
|
15
|
+
[32971]: 1,
|
|
16
|
+
[32970]: 0,
|
|
17
|
+
[3106]: new Float32Array([0, 0, 0, 0]), // TBD
|
|
18
|
+
[3107]: [true, true, true, true],
|
|
19
|
+
[2884]: false,
|
|
20
|
+
[2885]: 1029,
|
|
21
|
+
[2929]: false,
|
|
22
|
+
[2931]: 1,
|
|
23
|
+
[2932]: 513,
|
|
24
|
+
[2928]: new Float32Array([0, 1]), // TBD
|
|
25
|
+
[2930]: true,
|
|
26
|
+
[3024]: true,
|
|
27
|
+
[35725]: null,
|
|
28
28
|
// FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
|
|
29
|
-
[
|
|
30
|
-
[
|
|
31
|
-
[
|
|
32
|
-
[
|
|
33
|
-
[
|
|
34
|
-
[
|
|
35
|
-
[
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
40
|
-
[
|
|
41
|
-
[
|
|
42
|
-
[
|
|
43
|
-
[
|
|
29
|
+
[36006]: null,
|
|
30
|
+
[36007]: null,
|
|
31
|
+
[34229]: null,
|
|
32
|
+
[34964]: null,
|
|
33
|
+
[2886]: 2305,
|
|
34
|
+
[33170]: 4352,
|
|
35
|
+
[2849]: 1,
|
|
36
|
+
[32823]: false,
|
|
37
|
+
[32824]: 0,
|
|
38
|
+
[10752]: 0,
|
|
39
|
+
[32926]: false,
|
|
40
|
+
[32928]: false,
|
|
41
|
+
[32938]: 1.0,
|
|
42
|
+
[32939]: false,
|
|
43
|
+
[3089]: false,
|
|
44
44
|
// Note: Dynamic value. If scissor test enabled we expect users to set correct scissor box
|
|
45
|
-
[
|
|
46
|
-
[
|
|
47
|
-
[
|
|
48
|
-
[
|
|
49
|
-
[
|
|
50
|
-
[
|
|
51
|
-
[
|
|
52
|
-
[
|
|
53
|
-
[
|
|
54
|
-
[
|
|
55
|
-
[
|
|
56
|
-
[
|
|
57
|
-
[
|
|
58
|
-
[
|
|
59
|
-
[
|
|
60
|
-
[
|
|
61
|
-
[
|
|
45
|
+
[3088]: new Int32Array([0, 0, 1024, 1024]),
|
|
46
|
+
[2960]: false,
|
|
47
|
+
[2961]: 0,
|
|
48
|
+
[2968]: 0xffffffff,
|
|
49
|
+
[36005]: 0xffffffff,
|
|
50
|
+
[2962]: 519,
|
|
51
|
+
[2967]: 0,
|
|
52
|
+
[2963]: 0xffffffff,
|
|
53
|
+
[34816]: 519,
|
|
54
|
+
[36003]: 0,
|
|
55
|
+
[36004]: 0xffffffff,
|
|
56
|
+
[2964]: 7680,
|
|
57
|
+
[2965]: 7680,
|
|
58
|
+
[2966]: 7680,
|
|
59
|
+
[34817]: 7680,
|
|
60
|
+
[34818]: 7680,
|
|
61
|
+
[34819]: 7680,
|
|
62
62
|
// Dynamic value: We use [0, 0, 1024, 1024] as default, but usually this is updated in each frame.
|
|
63
|
-
[
|
|
64
|
-
[
|
|
65
|
-
[
|
|
66
|
-
[
|
|
67
|
-
[
|
|
68
|
-
[
|
|
69
|
-
[
|
|
70
|
-
[
|
|
71
|
-
[
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[
|
|
75
|
-
[
|
|
76
|
-
[
|
|
77
|
-
[
|
|
78
|
-
[
|
|
79
|
-
[
|
|
80
|
-
[
|
|
81
|
-
[
|
|
82
|
-
[
|
|
83
|
-
[
|
|
84
|
-
[
|
|
63
|
+
[2978]: [0, 0, 1024, 1024],
|
|
64
|
+
[36389]: null,
|
|
65
|
+
[36662]: null,
|
|
66
|
+
[36663]: null,
|
|
67
|
+
[35053]: null,
|
|
68
|
+
[35055]: null,
|
|
69
|
+
[35723]: 4352,
|
|
70
|
+
[36010]: null,
|
|
71
|
+
[35977]: false,
|
|
72
|
+
[3333]: 4,
|
|
73
|
+
[3317]: 4,
|
|
74
|
+
[37440]: false,
|
|
75
|
+
[37441]: false,
|
|
76
|
+
[37443]: 37444,
|
|
77
|
+
[3330]: 0,
|
|
78
|
+
[3332]: 0,
|
|
79
|
+
[3331]: 0,
|
|
80
|
+
[3314]: 0,
|
|
81
|
+
[32878]: 0,
|
|
82
|
+
[3316]: 0,
|
|
83
|
+
[3315]: 0,
|
|
84
|
+
[32877]: 0
|
|
85
85
|
};
|
|
86
86
|
// SETTER TABLES - ENABLES SETTING ANY PARAMETER WITH A COMMON API
|
|
87
87
|
const enable = (gl, value, key) => value ? gl.enable(key) : gl.disable(key);
|
|
88
88
|
const hint = (gl, value, key) => gl.hint(key, value);
|
|
89
89
|
const pixelStorei = (gl, value, key) => gl.pixelStorei(key, value);
|
|
90
90
|
const bindFramebuffer = (gl, value, key) => {
|
|
91
|
-
const target = key ===
|
|
91
|
+
const target = key === 36006 ? 36009 : 36008;
|
|
92
92
|
return gl.bindFramebuffer(target, value);
|
|
93
93
|
};
|
|
94
94
|
const bindBuffer = (gl, value, key) => {
|
|
95
95
|
const bindingMap = {
|
|
96
|
-
[
|
|
97
|
-
[
|
|
98
|
-
[
|
|
99
|
-
[
|
|
100
|
-
[
|
|
96
|
+
[34964]: 34962,
|
|
97
|
+
[36662]: 36662,
|
|
98
|
+
[36663]: 36663,
|
|
99
|
+
[35053]: 35051,
|
|
100
|
+
[35055]: 35052
|
|
101
101
|
};
|
|
102
102
|
const glTarget = bindingMap[key];
|
|
103
103
|
gl.bindBuffer(glTarget, value);
|
|
@@ -110,107 +110,107 @@ function isArray(array) {
|
|
|
110
110
|
// WegGL constants are read by parameter names, but set by function names
|
|
111
111
|
// NOTE: When value type is a string, it will be handled by 'GL_COMPOSITE_PARAMETER_SETTERS'
|
|
112
112
|
export const GL_PARAMETER_SETTERS = {
|
|
113
|
-
[
|
|
114
|
-
[
|
|
115
|
-
[
|
|
116
|
-
[
|
|
117
|
-
[
|
|
118
|
-
[
|
|
119
|
-
[
|
|
120
|
-
[
|
|
121
|
-
[
|
|
122
|
-
[
|
|
123
|
-
[
|
|
124
|
-
[
|
|
125
|
-
[
|
|
126
|
-
[
|
|
127
|
-
[
|
|
128
|
-
[
|
|
129
|
-
[
|
|
130
|
-
[
|
|
131
|
-
[
|
|
132
|
-
[
|
|
133
|
-
[
|
|
134
|
-
[
|
|
135
|
-
[
|
|
113
|
+
[3042]: enable,
|
|
114
|
+
[32773]: (gl, value) => gl.blendColor(...value),
|
|
115
|
+
[32777]: 'blendEquation',
|
|
116
|
+
[34877]: 'blendEquation',
|
|
117
|
+
[32969]: 'blendFunc',
|
|
118
|
+
[32968]: 'blendFunc',
|
|
119
|
+
[32971]: 'blendFunc',
|
|
120
|
+
[32970]: 'blendFunc',
|
|
121
|
+
[3106]: (gl, value) => gl.clearColor(...value),
|
|
122
|
+
[3107]: (gl, value) => gl.colorMask(...value),
|
|
123
|
+
[2884]: enable,
|
|
124
|
+
[2885]: (gl, value) => gl.cullFace(value),
|
|
125
|
+
[2929]: enable,
|
|
126
|
+
[2931]: (gl, value) => gl.clearDepth(value),
|
|
127
|
+
[2932]: (gl, value) => gl.depthFunc(value),
|
|
128
|
+
[2928]: (gl, value) => gl.depthRange(...value),
|
|
129
|
+
[2930]: (gl, value) => gl.depthMask(value),
|
|
130
|
+
[3024]: enable,
|
|
131
|
+
[35723]: hint,
|
|
132
|
+
[35725]: (gl, value) => gl.useProgram(value),
|
|
133
|
+
[36007]: (gl, value) => gl.bindRenderbuffer(36161, value),
|
|
134
|
+
[36389]: (gl, value) => gl.bindTransformFeedback?.(36386, value),
|
|
135
|
+
[34229]: (gl, value) => gl.bindVertexArray(value),
|
|
136
136
|
// NOTE: FRAMEBUFFER_BINDING and DRAW_FRAMEBUFFER_BINDING(WebGL2) refer same state.
|
|
137
|
-
[
|
|
138
|
-
[
|
|
137
|
+
[36006]: bindFramebuffer,
|
|
138
|
+
[36010]: bindFramebuffer,
|
|
139
139
|
// Buffers
|
|
140
|
-
[
|
|
141
|
-
[
|
|
142
|
-
[
|
|
143
|
-
[
|
|
144
|
-
[
|
|
145
|
-
[
|
|
146
|
-
[
|
|
147
|
-
[
|
|
148
|
-
[
|
|
149
|
-
[
|
|
150
|
-
[
|
|
151
|
-
[
|
|
152
|
-
[
|
|
153
|
-
[
|
|
154
|
-
[
|
|
155
|
-
[
|
|
156
|
-
[
|
|
157
|
-
[
|
|
158
|
-
[
|
|
159
|
-
[
|
|
160
|
-
[
|
|
161
|
-
[
|
|
162
|
-
[
|
|
163
|
-
[
|
|
164
|
-
[
|
|
165
|
-
[
|
|
166
|
-
[
|
|
167
|
-
[
|
|
168
|
-
[
|
|
169
|
-
[
|
|
170
|
-
[
|
|
171
|
-
[
|
|
172
|
-
[
|
|
173
|
-
[
|
|
174
|
-
[
|
|
140
|
+
[34964]: bindBuffer,
|
|
141
|
+
[36662]: bindBuffer,
|
|
142
|
+
[36663]: bindBuffer,
|
|
143
|
+
[35053]: bindBuffer,
|
|
144
|
+
[35055]: bindBuffer,
|
|
145
|
+
[2886]: (gl, value) => gl.frontFace(value),
|
|
146
|
+
[33170]: hint,
|
|
147
|
+
[2849]: (gl, value) => gl.lineWidth(value),
|
|
148
|
+
[32823]: enable,
|
|
149
|
+
[32824]: 'polygonOffset',
|
|
150
|
+
[10752]: 'polygonOffset',
|
|
151
|
+
[35977]: enable,
|
|
152
|
+
[32926]: enable,
|
|
153
|
+
[32928]: enable,
|
|
154
|
+
[32938]: 'sampleCoverage',
|
|
155
|
+
[32939]: 'sampleCoverage',
|
|
156
|
+
[3089]: enable,
|
|
157
|
+
[3088]: (gl, value) => gl.scissor(...value),
|
|
158
|
+
[2960]: enable,
|
|
159
|
+
[2961]: (gl, value) => gl.clearStencil(value),
|
|
160
|
+
[2968]: (gl, value) => gl.stencilMaskSeparate(1028, value),
|
|
161
|
+
[36005]: (gl, value) => gl.stencilMaskSeparate(1029, value),
|
|
162
|
+
[2962]: 'stencilFuncFront',
|
|
163
|
+
[2967]: 'stencilFuncFront',
|
|
164
|
+
[2963]: 'stencilFuncFront',
|
|
165
|
+
[34816]: 'stencilFuncBack',
|
|
166
|
+
[36003]: 'stencilFuncBack',
|
|
167
|
+
[36004]: 'stencilFuncBack',
|
|
168
|
+
[2964]: 'stencilOpFront',
|
|
169
|
+
[2965]: 'stencilOpFront',
|
|
170
|
+
[2966]: 'stencilOpFront',
|
|
171
|
+
[34817]: 'stencilOpBack',
|
|
172
|
+
[34818]: 'stencilOpBack',
|
|
173
|
+
[34819]: 'stencilOpBack',
|
|
174
|
+
[2978]: (gl, value) => gl.viewport(...value),
|
|
175
175
|
// WEBGL2 EXTENSIONS
|
|
176
176
|
// EXT_depth_clamp https://registry.khronos.org/webgl/extensions/EXT_depth_clamp/
|
|
177
|
-
[
|
|
177
|
+
[34383]: enable,
|
|
178
178
|
// WEBGL_provoking_vertex https://registry.khronos.org/webgl/extensions/WEBGL_provoking_vertex/
|
|
179
179
|
// [GL.PROVOKING_VERTEX_WEBL]: TODO - extension function needed
|
|
180
180
|
// WEBGL_polygon_mode https://registry.khronos.org/webgl/extensions/WEBGL_polygon_mode/
|
|
181
181
|
// POLYGON_MODE_WEBGL TODO - extension function needed
|
|
182
|
-
[
|
|
182
|
+
[10754]: enable,
|
|
183
183
|
// WEBGL_clip_cull_distance https://registry.khronos.org/webgl/extensions/WEBGL_clip_cull_distance/
|
|
184
|
-
[
|
|
185
|
-
[
|
|
186
|
-
[
|
|
187
|
-
[
|
|
188
|
-
[
|
|
189
|
-
[
|
|
190
|
-
[
|
|
191
|
-
[
|
|
184
|
+
[12288]: enable,
|
|
185
|
+
[12289]: enable,
|
|
186
|
+
[12290]: enable,
|
|
187
|
+
[12291]: enable,
|
|
188
|
+
[12292]: enable,
|
|
189
|
+
[12293]: enable,
|
|
190
|
+
[12294]: enable,
|
|
191
|
+
[12295]: enable,
|
|
192
192
|
// PIXEL PACK/UNPACK MODES
|
|
193
|
-
[
|
|
194
|
-
[
|
|
195
|
-
[
|
|
196
|
-
[
|
|
197
|
-
[
|
|
198
|
-
[
|
|
199
|
-
[
|
|
200
|
-
[
|
|
201
|
-
[
|
|
202
|
-
[
|
|
203
|
-
[
|
|
204
|
-
[
|
|
205
|
-
[
|
|
193
|
+
[3333]: pixelStorei,
|
|
194
|
+
[3317]: pixelStorei,
|
|
195
|
+
[37440]: pixelStorei,
|
|
196
|
+
[37441]: pixelStorei,
|
|
197
|
+
[37443]: pixelStorei,
|
|
198
|
+
[3330]: pixelStorei,
|
|
199
|
+
[3332]: pixelStorei,
|
|
200
|
+
[3331]: pixelStorei,
|
|
201
|
+
[3314]: pixelStorei,
|
|
202
|
+
[32878]: pixelStorei,
|
|
203
|
+
[3316]: pixelStorei,
|
|
204
|
+
[3315]: pixelStorei,
|
|
205
|
+
[32877]: pixelStorei,
|
|
206
206
|
// Function-style setters
|
|
207
207
|
framebuffer: (gl, framebuffer) => {
|
|
208
208
|
// accepts 1) a WebGLFramebuffer 2) null (default framebuffer), or 3) luma.gl Framebuffer class
|
|
209
209
|
// framebuffer is null when restoring to default framebuffer, otherwise use the WebGL handle.
|
|
210
210
|
const handle = framebuffer && 'handle' in framebuffer ? framebuffer.handle : framebuffer;
|
|
211
|
-
return gl.bindFramebuffer(
|
|
211
|
+
return gl.bindFramebuffer(36160, handle);
|
|
212
212
|
},
|
|
213
|
-
blend: (gl, value) => value ? gl.enable(
|
|
213
|
+
blend: (gl, value) => value ? gl.enable(3042) : gl.disable(3042),
|
|
214
214
|
blendColor: (gl, value) => gl.blendColor(...value),
|
|
215
215
|
blendEquation: (gl, args) => {
|
|
216
216
|
const separateModes = typeof args === 'number' ? [args, args] : args;
|
|
@@ -224,43 +224,43 @@ export const GL_PARAMETER_SETTERS = {
|
|
|
224
224
|
clearDepth: (gl, value) => gl.clearDepth(value),
|
|
225
225
|
clearStencil: (gl, value) => gl.clearStencil(value),
|
|
226
226
|
colorMask: (gl, value) => gl.colorMask(...value),
|
|
227
|
-
cull: (gl, value) => value ? gl.enable(
|
|
227
|
+
cull: (gl, value) => value ? gl.enable(2884) : gl.disable(2884),
|
|
228
228
|
cullFace: (gl, value) => gl.cullFace(value),
|
|
229
|
-
depthTest: (gl, value) => value ? gl.enable(
|
|
229
|
+
depthTest: (gl, value) => value ? gl.enable(2929) : gl.disable(2929),
|
|
230
230
|
depthFunc: (gl, value) => gl.depthFunc(value),
|
|
231
231
|
depthMask: (gl, value) => gl.depthMask(value),
|
|
232
232
|
depthRange: (gl, value) => gl.depthRange(...value),
|
|
233
|
-
dither: (gl, value) => value ? gl.enable(
|
|
233
|
+
dither: (gl, value) => value ? gl.enable(3024) : gl.disable(3024),
|
|
234
234
|
derivativeHint: (gl, value) => {
|
|
235
235
|
// gl1: 'OES_standard_derivatives'
|
|
236
|
-
gl.hint(
|
|
236
|
+
gl.hint(35723, value);
|
|
237
237
|
},
|
|
238
238
|
frontFace: (gl, value) => gl.frontFace(value),
|
|
239
|
-
mipmapHint: (gl, value) => gl.hint(
|
|
239
|
+
mipmapHint: (gl, value) => gl.hint(33170, value),
|
|
240
240
|
lineWidth: (gl, value) => gl.lineWidth(value),
|
|
241
|
-
polygonOffsetFill: (gl, value) => value ? gl.enable(
|
|
241
|
+
polygonOffsetFill: (gl, value) => value ? gl.enable(32823) : gl.disable(32823),
|
|
242
242
|
polygonOffset: (gl, value) => gl.polygonOffset(...value),
|
|
243
243
|
sampleCoverage: (gl, value) => gl.sampleCoverage(...value),
|
|
244
|
-
scissorTest: (gl, value) => value ? gl.enable(
|
|
244
|
+
scissorTest: (gl, value) => value ? gl.enable(3089) : gl.disable(3089),
|
|
245
245
|
scissor: (gl, value) => gl.scissor(...value),
|
|
246
|
-
stencilTest: (gl, value) => value ? gl.enable(
|
|
246
|
+
stencilTest: (gl, value) => value ? gl.enable(2960) : gl.disable(2960),
|
|
247
247
|
stencilMask: (gl, value) => {
|
|
248
248
|
value = isArray(value) ? value : [value, value];
|
|
249
249
|
const [mask, backMask] = value;
|
|
250
|
-
gl.stencilMaskSeparate(
|
|
251
|
-
gl.stencilMaskSeparate(
|
|
250
|
+
gl.stencilMaskSeparate(1028, mask);
|
|
251
|
+
gl.stencilMaskSeparate(1029, backMask);
|
|
252
252
|
},
|
|
253
253
|
stencilFunc: (gl, args) => {
|
|
254
254
|
args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
|
|
255
255
|
const [func, ref, mask, backFunc, backRef, backMask] = args;
|
|
256
|
-
gl.stencilFuncSeparate(
|
|
257
|
-
gl.stencilFuncSeparate(
|
|
256
|
+
gl.stencilFuncSeparate(1028, func, ref, mask);
|
|
257
|
+
gl.stencilFuncSeparate(1029, backFunc, backRef, backMask);
|
|
258
258
|
},
|
|
259
259
|
stencilOp: (gl, args) => {
|
|
260
260
|
args = isArray(args) && args.length === 3 ? [...args, ...args] : args;
|
|
261
261
|
const [sfail, dpfail, dppass, backSfail, backDpfail, backDppass] = args;
|
|
262
|
-
gl.stencilOpSeparate(
|
|
263
|
-
gl.stencilOpSeparate(
|
|
262
|
+
gl.stencilOpSeparate(1028, sfail, dpfail, dppass);
|
|
263
|
+
gl.stencilOpSeparate(1029, backSfail, backDpfail, backDppass);
|
|
264
264
|
},
|
|
265
265
|
viewport: (gl, value) => gl.viewport(...value)
|
|
266
266
|
};
|
|
@@ -269,14 +269,14 @@ function getValue(glEnum, values, cache) {
|
|
|
269
269
|
}
|
|
270
270
|
// COMPOSITE_WEBGL_PARAMETER_
|
|
271
271
|
export const GL_COMPOSITE_PARAMETER_SETTERS = {
|
|
272
|
-
blendEquation: (gl, values, cache) => gl.blendEquationSeparate(getValue(
|
|
273
|
-
blendFunc: (gl, values, cache) => gl.blendFuncSeparate(getValue(
|
|
274
|
-
polygonOffset: (gl, values, cache) => gl.polygonOffset(getValue(
|
|
275
|
-
sampleCoverage: (gl, values, cache) => gl.sampleCoverage(getValue(
|
|
276
|
-
stencilFuncFront: (gl, values, cache) => gl.stencilFuncSeparate(
|
|
277
|
-
stencilFuncBack: (gl, values, cache) => gl.stencilFuncSeparate(
|
|
278
|
-
stencilOpFront: (gl, values, cache) => gl.stencilOpSeparate(
|
|
279
|
-
stencilOpBack: (gl, values, cache) => gl.stencilOpSeparate(
|
|
272
|
+
blendEquation: (gl, values, cache) => gl.blendEquationSeparate(getValue(32777, values, cache), getValue(34877, values, cache)),
|
|
273
|
+
blendFunc: (gl, values, cache) => gl.blendFuncSeparate(getValue(32969, values, cache), getValue(32968, values, cache), getValue(32971, values, cache), getValue(32970, values, cache)),
|
|
274
|
+
polygonOffset: (gl, values, cache) => gl.polygonOffset(getValue(32824, values, cache), getValue(10752, values, cache)),
|
|
275
|
+
sampleCoverage: (gl, values, cache) => gl.sampleCoverage(getValue(32938, values, cache), getValue(32939, values, cache)),
|
|
276
|
+
stencilFuncFront: (gl, values, cache) => gl.stencilFuncSeparate(1028, getValue(2962, values, cache), getValue(2967, values, cache), getValue(2963, values, cache)),
|
|
277
|
+
stencilFuncBack: (gl, values, cache) => gl.stencilFuncSeparate(1029, getValue(34816, values, cache), getValue(36003, values, cache), getValue(36004, values, cache)),
|
|
278
|
+
stencilOpFront: (gl, values, cache) => gl.stencilOpSeparate(1028, getValue(2964, values, cache), getValue(2965, values, cache), getValue(2966, values, cache)),
|
|
279
|
+
stencilOpBack: (gl, values, cache) => gl.stencilOpSeparate(1029, getValue(34817, values, cache), getValue(34818, values, cache), getValue(34819, values, cache))
|
|
280
280
|
};
|
|
281
281
|
// Setter functions intercepted for cache updates
|
|
282
282
|
export const GL_HOOKED_SETTERS = {
|
|
@@ -295,39 +295,39 @@ export const GL_HOOKED_SETTERS = {
|
|
|
295
295
|
}),
|
|
296
296
|
// SPECIFIC SETTERS
|
|
297
297
|
useProgram: (update, value) => update({
|
|
298
|
-
[
|
|
298
|
+
[35725]: value
|
|
299
299
|
}),
|
|
300
300
|
bindRenderbuffer: (update, target, value) => update({
|
|
301
|
-
[
|
|
301
|
+
[36007]: value
|
|
302
302
|
}),
|
|
303
303
|
bindTransformFeedback: (update, target, value) => update({
|
|
304
|
-
[
|
|
304
|
+
[36389]: value
|
|
305
305
|
}),
|
|
306
306
|
bindVertexArray: (update, value) => update({
|
|
307
|
-
[
|
|
307
|
+
[34229]: value
|
|
308
308
|
}),
|
|
309
309
|
bindFramebuffer: (update, target, framebuffer) => {
|
|
310
310
|
switch (target) {
|
|
311
|
-
case
|
|
311
|
+
case 36160:
|
|
312
312
|
return update({
|
|
313
|
-
[
|
|
314
|
-
[
|
|
313
|
+
[36006]: framebuffer,
|
|
314
|
+
[36010]: framebuffer
|
|
315
315
|
});
|
|
316
|
-
case
|
|
317
|
-
return update({ [
|
|
318
|
-
case
|
|
319
|
-
return update({ [
|
|
316
|
+
case 36009:
|
|
317
|
+
return update({ [36006]: framebuffer });
|
|
318
|
+
case 36008:
|
|
319
|
+
return update({ [36010]: framebuffer });
|
|
320
320
|
default:
|
|
321
321
|
return null;
|
|
322
322
|
}
|
|
323
323
|
},
|
|
324
324
|
bindBuffer: (update, target, buffer) => {
|
|
325
325
|
const pname = {
|
|
326
|
-
[
|
|
327
|
-
[
|
|
328
|
-
[
|
|
329
|
-
[
|
|
330
|
-
[
|
|
326
|
+
[34962]: [34964],
|
|
327
|
+
[36662]: [36662],
|
|
328
|
+
[36663]: [36663],
|
|
329
|
+
[35051]: [35053],
|
|
330
|
+
[35052]: [35055]
|
|
331
331
|
}[target];
|
|
332
332
|
if (pname) {
|
|
333
333
|
return update({ [pname]: buffer });
|
|
@@ -336,156 +336,150 @@ export const GL_HOOKED_SETTERS = {
|
|
|
336
336
|
return { valueChanged: true };
|
|
337
337
|
},
|
|
338
338
|
blendColor: (update, r, g, b, a) => update({
|
|
339
|
-
[
|
|
339
|
+
[32773]: new Float32Array([r, g, b, a])
|
|
340
340
|
}),
|
|
341
341
|
blendEquation: (update, mode) => update({
|
|
342
|
-
[
|
|
343
|
-
[
|
|
342
|
+
[32777]: mode,
|
|
343
|
+
[34877]: mode
|
|
344
344
|
}),
|
|
345
345
|
blendEquationSeparate: (update, modeRGB, modeAlpha) => update({
|
|
346
|
-
[
|
|
347
|
-
[
|
|
346
|
+
[32777]: modeRGB,
|
|
347
|
+
[34877]: modeAlpha
|
|
348
348
|
}),
|
|
349
349
|
blendFunc: (update, src, dst) => update({
|
|
350
|
-
[
|
|
351
|
-
[
|
|
352
|
-
[
|
|
353
|
-
[
|
|
350
|
+
[32969]: src,
|
|
351
|
+
[32968]: dst,
|
|
352
|
+
[32971]: src,
|
|
353
|
+
[32970]: dst
|
|
354
354
|
}),
|
|
355
355
|
blendFuncSeparate: (update, srcRGB, dstRGB, srcAlpha, dstAlpha) => update({
|
|
356
|
-
[
|
|
357
|
-
[
|
|
358
|
-
[
|
|
359
|
-
[
|
|
356
|
+
[32969]: srcRGB,
|
|
357
|
+
[32968]: dstRGB,
|
|
358
|
+
[32971]: srcAlpha,
|
|
359
|
+
[32970]: dstAlpha
|
|
360
360
|
}),
|
|
361
361
|
clearColor: (update, r, g, b, a) => update({
|
|
362
|
-
[
|
|
362
|
+
[3106]: new Float32Array([r, g, b, a])
|
|
363
363
|
}),
|
|
364
364
|
clearDepth: (update, depth) => update({
|
|
365
|
-
[
|
|
365
|
+
[2931]: depth
|
|
366
366
|
}),
|
|
367
367
|
clearStencil: (update, s) => update({
|
|
368
|
-
[
|
|
368
|
+
[2961]: s
|
|
369
369
|
}),
|
|
370
370
|
colorMask: (update, r, g, b, a) => update({
|
|
371
|
-
[
|
|
371
|
+
[3107]: [r, g, b, a]
|
|
372
372
|
}),
|
|
373
373
|
cullFace: (update, mode) => update({
|
|
374
|
-
[
|
|
374
|
+
[2885]: mode
|
|
375
375
|
}),
|
|
376
376
|
depthFunc: (update, func) => update({
|
|
377
|
-
[
|
|
377
|
+
[2932]: func
|
|
378
378
|
}),
|
|
379
379
|
depthRange: (update, zNear, zFar) => update({
|
|
380
|
-
[
|
|
380
|
+
[2928]: new Float32Array([zNear, zFar])
|
|
381
381
|
}),
|
|
382
382
|
depthMask: (update, mask) => update({
|
|
383
|
-
[
|
|
383
|
+
[2930]: mask
|
|
384
384
|
}),
|
|
385
385
|
frontFace: (update, face) => update({
|
|
386
|
-
[
|
|
386
|
+
[2886]: face
|
|
387
387
|
}),
|
|
388
388
|
lineWidth: (update, width) => update({
|
|
389
|
-
[
|
|
389
|
+
[2849]: width
|
|
390
390
|
}),
|
|
391
391
|
polygonOffset: (update, factor, units) => update({
|
|
392
|
-
[
|
|
393
|
-
[
|
|
392
|
+
[32824]: factor,
|
|
393
|
+
[10752]: units
|
|
394
394
|
}),
|
|
395
395
|
sampleCoverage: (update, value, invert) => update({
|
|
396
|
-
[
|
|
397
|
-
[
|
|
396
|
+
[32938]: value,
|
|
397
|
+
[32939]: invert
|
|
398
398
|
}),
|
|
399
399
|
scissor: (update, x, y, width, height) => update({
|
|
400
|
-
[
|
|
400
|
+
[3088]: new Int32Array([x, y, width, height])
|
|
401
401
|
}),
|
|
402
402
|
stencilMask: (update, mask) => update({
|
|
403
|
-
[
|
|
404
|
-
[
|
|
403
|
+
[2968]: mask,
|
|
404
|
+
[36005]: mask
|
|
405
405
|
}),
|
|
406
406
|
stencilMaskSeparate: (update, face, mask) => update({
|
|
407
|
-
[face ===
|
|
407
|
+
[face === 1028 ? 2968 : 36005]: mask
|
|
408
408
|
}),
|
|
409
409
|
stencilFunc: (update, func, ref, mask) => update({
|
|
410
|
-
[
|
|
411
|
-
[
|
|
412
|
-
[
|
|
413
|
-
[
|
|
414
|
-
[
|
|
415
|
-
[
|
|
410
|
+
[2962]: func,
|
|
411
|
+
[2967]: ref,
|
|
412
|
+
[2963]: mask,
|
|
413
|
+
[34816]: func,
|
|
414
|
+
[36003]: ref,
|
|
415
|
+
[36004]: mask
|
|
416
416
|
}),
|
|
417
417
|
stencilFuncSeparate: (update, face, func, ref, mask) => update({
|
|
418
|
-
[face ===
|
|
419
|
-
[face ===
|
|
420
|
-
[face ===
|
|
418
|
+
[face === 1028 ? 2962 : 34816]: func,
|
|
419
|
+
[face === 1028 ? 2967 : 36003]: ref,
|
|
420
|
+
[face === 1028 ? 2963 : 36004]: mask
|
|
421
421
|
}),
|
|
422
422
|
stencilOp: (update, fail, zfail, zpass) => update({
|
|
423
|
-
[
|
|
424
|
-
[
|
|
425
|
-
[
|
|
426
|
-
[
|
|
427
|
-
[
|
|
428
|
-
[
|
|
423
|
+
[2964]: fail,
|
|
424
|
+
[2965]: zfail,
|
|
425
|
+
[2966]: zpass,
|
|
426
|
+
[34817]: fail,
|
|
427
|
+
[34818]: zfail,
|
|
428
|
+
[34819]: zpass
|
|
429
429
|
}),
|
|
430
430
|
stencilOpSeparate: (update, face, fail, zfail, zpass) => update({
|
|
431
|
-
[face ===
|
|
432
|
-
[face ===
|
|
433
|
-
[face ===
|
|
431
|
+
[face === 1028 ? 2964 : 34817]: fail,
|
|
432
|
+
[face === 1028 ? 2965 : 34818]: zfail,
|
|
433
|
+
[face === 1028 ? 2966 : 34819]: zpass
|
|
434
434
|
}),
|
|
435
435
|
viewport: (update, x, y, width, height) => update({
|
|
436
|
-
[
|
|
436
|
+
[2978]: [x, y, width, height]
|
|
437
437
|
})
|
|
438
438
|
};
|
|
439
439
|
// GETTER TABLE - FOR READING OUT AN ENTIRE CONTEXT
|
|
440
440
|
const isEnabled = (gl, key) => gl.isEnabled(key);
|
|
441
441
|
// Exceptions for any keys that cannot be queried by gl.getParameters
|
|
442
442
|
export const GL_PARAMETER_GETTERS = {
|
|
443
|
-
[
|
|
444
|
-
[
|
|
445
|
-
[
|
|
446
|
-
[
|
|
447
|
-
[
|
|
448
|
-
[
|
|
449
|
-
[
|
|
450
|
-
[
|
|
451
|
-
[
|
|
452
|
-
[
|
|
443
|
+
[3042]: isEnabled,
|
|
444
|
+
[2884]: isEnabled,
|
|
445
|
+
[2929]: isEnabled,
|
|
446
|
+
[3024]: isEnabled,
|
|
447
|
+
[32823]: isEnabled,
|
|
448
|
+
[32926]: isEnabled,
|
|
449
|
+
[32928]: isEnabled,
|
|
450
|
+
[3089]: isEnabled,
|
|
451
|
+
[2960]: isEnabled,
|
|
452
|
+
[35977]: isEnabled
|
|
453
453
|
};
|
|
454
454
|
export const NON_CACHE_PARAMETERS = new Set([
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
// states depending on ACTIVE_TEXTURE
|
|
486
|
-
GL.SAMPLER_BINDING,
|
|
487
|
-
GL.TEXTURE_BINDING_2D,
|
|
488
|
-
GL.TEXTURE_BINDING_2D_ARRAY,
|
|
489
|
-
GL.TEXTURE_BINDING_3D,
|
|
490
|
-
GL.TEXTURE_BINDING_CUBE_MAP
|
|
455
|
+
34016,
|
|
456
|
+
36388,
|
|
457
|
+
36387,
|
|
458
|
+
35983,
|
|
459
|
+
35368,
|
|
460
|
+
34965,
|
|
461
|
+
35739,
|
|
462
|
+
35738,
|
|
463
|
+
3074,
|
|
464
|
+
34853,
|
|
465
|
+
34854,
|
|
466
|
+
34855,
|
|
467
|
+
34856,
|
|
468
|
+
34857,
|
|
469
|
+
34858,
|
|
470
|
+
34859,
|
|
471
|
+
34860,
|
|
472
|
+
34861,
|
|
473
|
+
34862,
|
|
474
|
+
34863,
|
|
475
|
+
34864,
|
|
476
|
+
34865,
|
|
477
|
+
34866,
|
|
478
|
+
34867,
|
|
479
|
+
34868,
|
|
480
|
+
35097,
|
|
481
|
+
32873,
|
|
482
|
+
35869,
|
|
483
|
+
32874,
|
|
484
|
+
34068
|
|
491
485
|
]);
|