@luma.gl/webgl 9.0.0-beta.5 → 9.0.0-beta.6
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 +71 -11
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +3 -2
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
- package/dist/adapter/converters/shader-formats.js +40 -20
- package/dist/adapter/converters/texture-formats.d.ts +10 -7
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +76 -64
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +2 -1
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +18 -5
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-features.js +77 -43
- package/dist/adapter/device-helpers/webgl-device-info.d.ts +2 -1
- package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-info.js +17 -14
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts +33 -48
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/webgl-device-limits.js +42 -87
- package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -1
- package/dist/adapter/helpers/decode-webgl-types.js +2 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +6 -5
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +3 -2
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +2 -1
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.js +2 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +2 -1
- package/dist/adapter/objects/webgl-renderbuffer.d.ts +2 -2
- package/dist/adapter/objects/webgl-renderbuffer.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-renderbuffer.js +24 -11
- package/dist/adapter/objects/webgl-resource.d.ts +2 -24
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +6 -100
- package/dist/adapter/resources/webgl-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +2 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts +1 -1
- package/dist/adapter/resources/webgl-command-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-buffer.js +7 -6
- package/dist/adapter/resources/webgl-command-encoder.d.ts +8 -3
- package/dist/adapter/resources/webgl-command-encoder.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-command-encoder.js +4 -2
- package/dist/adapter/resources/webgl-external-texture.js +3 -2
- package/dist/adapter/resources/webgl-framebuffer.d.ts +6 -8
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +25 -23
- package/dist/adapter/resources/webgl-query-set.d.ts +44 -0
- package/dist/adapter/resources/webgl-query-set.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-query-set.js +136 -0
- package/dist/adapter/resources/webgl-render-pass.d.ts +3 -1
- package/dist/adapter/resources/webgl-render-pass.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pass.js +15 -7
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +4 -5
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +34 -49
- package/dist/adapter/resources/webgl-sampler.d.ts +1 -1
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +3 -2
- package/dist/adapter/resources/webgl-shader.d.ts +3 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +12 -6
- package/dist/adapter/resources/webgl-texture-view.d.ts +14 -0
- package/dist/adapter/resources/webgl-texture-view.d.ts.map +1 -0
- package/dist/adapter/resources/webgl-texture-view.js +18 -0
- package/dist/adapter/resources/webgl-texture.d.ts +4 -3
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +12 -7
- package/dist/adapter/resources/webgl-transform-feedback.d.ts +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +2 -2
- package/dist/adapter/resources/webgl-vertex-array.d.ts +3 -3
- package/dist/adapter/resources/webgl-vertex-array.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-vertex-array.js +5 -4
- package/dist/adapter/webgl-canvas-context.d.ts +2 -2
- package/dist/adapter/webgl-canvas-context.d.ts.map +1 -1
- package/dist/adapter/webgl-canvas-context.js +3 -2
- package/dist/adapter/webgl-device.d.ts +29 -27
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +90 -94
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +4 -3
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +3 -2
- package/dist/classic/copy-and-blit.d.ts +1 -1
- package/dist/classic/copy-and-blit.d.ts.map +1 -1
- package/dist/classic/copy-and-blit.js +5 -4
- package/dist/classic/format-utils.d.ts +2 -2
- package/dist/classic/format-utils.d.ts.map +1 -1
- package/dist/classic/format-utils.js +2 -1
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +2 -1
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +2 -1
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +7 -6
- package/dist/context/helpers/create-browser-context.d.ts +35 -0
- package/dist/context/helpers/create-browser-context.d.ts.map +1 -0
- package/dist/context/helpers/create-browser-context.js +67 -0
- package/dist/context/helpers/webgl-context-data.d.ts +13 -0
- package/dist/context/helpers/webgl-context-data.d.ts.map +1 -0
- package/dist/context/helpers/webgl-context-data.js +21 -0
- package/dist/context/helpers/webgl-extensions.d.ts +4 -0
- package/dist/context/helpers/webgl-extensions.d.ts.map +1 -0
- package/dist/context/helpers/webgl-extensions.js +10 -0
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +4 -3
- package/dist/context/parameters/webgl-parameter-tables.d.ts +10 -0
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +29 -16
- package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +2 -1
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +5 -4
- package/dist/context/state-tracker/with-parameters.d.ts +1 -1
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +5 -4
- package/dist/dist.dev.js +941 -730
- package/dist/index.cjs +732 -565
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +25 -25
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -23
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +2 -1
- package/dist.min.js +5 -5
- package/package.json +4 -4
- package/src/adapter/converters/device-parameters.ts +105 -16
- package/src/adapter/converters/sampler-parameters.ts +12 -3
- package/src/adapter/converters/shader-formats.ts +47 -22
- package/src/adapter/converters/texture-formats.ts +87 -66
- package/src/adapter/converters/vertex-formats.ts +3 -3
- package/src/adapter/device-helpers/webgl-device-features.ts +83 -51
- package/src/adapter/device-helpers/webgl-device-info.ts +28 -19
- package/src/adapter/device-helpers/webgl-device-limits.ts +46 -150
- package/src/adapter/helpers/decode-webgl-types.ts +13 -7
- package/src/adapter/helpers/get-shader-layout.ts +4 -3
- package/src/adapter/helpers/parse-shader-compiler-log.ts +10 -6
- package/src/adapter/helpers/set-uniform.ts +2 -1
- package/src/adapter/helpers/webgl-topology-utils.ts +10 -3
- package/src/adapter/objects/constants-to-keys.ts +2 -1
- package/src/adapter/objects/webgl-renderbuffer.ts +35 -13
- package/src/adapter/objects/webgl-resource.ts +6 -124
- package/src/adapter/resources/webgl-buffer.ts +4 -3
- package/src/adapter/resources/webgl-command-buffer.ts +5 -5
- package/src/adapter/resources/webgl-command-encoder.ts +14 -11
- package/src/adapter/resources/webgl-external-texture.ts +3 -2
- package/src/adapter/resources/webgl-framebuffer.ts +34 -29
- package/src/adapter/resources/webgl-query-set.ts +171 -0
- package/src/adapter/resources/webgl-render-pass.ts +17 -8
- package/src/adapter/resources/webgl-render-pipeline.ts +41 -48
- package/src/adapter/resources/webgl-sampler.ts +2 -1
- package/src/adapter/resources/webgl-shader.ts +12 -5
- package/src/adapter/resources/webgl-texture-view.ts +28 -0
- package/src/adapter/resources/webgl-texture.ts +9 -2
- package/src/adapter/resources/webgl-transform-feedback.ts +2 -7
- package/src/adapter/resources/webgl-vertex-array.ts +4 -3
- package/src/adapter/webgl-canvas-context.ts +6 -4
- package/src/adapter/webgl-device.ts +94 -90
- package/src/classic/accessor.ts +5 -4
- package/src/classic/clear.ts +12 -6
- package/src/classic/copy-and-blit.ts +11 -4
- package/src/classic/format-utils.ts +2 -1
- package/src/classic/typed-array-utils.ts +3 -7
- package/src/context/debug/spector.ts +9 -6
- package/src/context/debug/webgl-developer-tools.ts +27 -14
- package/src/context/{context → helpers}/create-browser-context.ts +3 -2
- package/src/context/helpers/webgl-context-data.ts +31 -0
- package/src/context/helpers/webgl-extensions.ts +17 -0
- package/src/context/parameters/unified-parameter-api.ts +2 -1
- package/src/context/parameters/webgl-parameter-tables.ts +69 -32
- package/src/context/state-tracker/deep-array-equal.ts +2 -1
- package/src/context/state-tracker/track-context-state.ts +11 -6
- package/src/context/state-tracker/with-parameters.ts +7 -2
- package/src/index.ts +3 -2
- package/src/types.ts +2 -1
- package/src/context/context/context-data.ts +0 -44
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/device-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"device-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/device-parameters.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,MAAM,EACN,UAAU,EACV,eAAe,EAMhB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,KAAK,EAAmC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAOvF;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,CAAC,GAAG,OAAO,EACnD,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,YAAY,EAAE,YAAY,EAC1B,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAiBH;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,GAAG,OAAO,EAC1C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,YAAY,EACxB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,GAAG,OAAO,EAC9C,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,MAAM,KAAK,CAAC,GAC3B,CAAC,CAgBH;AAED,kCAAkC;AAClC,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,UAAU,QAkMzE;AAyBD,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,GAAG,EAAE,CAWpF;AAED,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,eAAe,CAWtF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { log, isObjectEmpty } from '@luma.gl/core';
|
|
4
5
|
import { GL } from '@luma.gl/constants';
|
|
5
|
-
import { pushContextState, popContextState } from
|
|
6
|
-
import { setGLParameters } from
|
|
7
|
-
import { WebGLDevice } from
|
|
6
|
+
import { pushContextState, popContextState } from "../../context/state-tracker/track-context-state.js";
|
|
7
|
+
import { setGLParameters } from "../../context/parameters/unified-parameter-api.js";
|
|
8
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
8
9
|
/* eslint-disable no-unused-expressions */ // For expression ? gl.enable() : gl.disable()
|
|
9
10
|
/**
|
|
10
11
|
* Execute a function with a set of temporary WebGL parameter overrides
|
|
@@ -109,12 +110,71 @@ export function setDeviceParameters(device, parameters) {
|
|
|
109
110
|
cw: GL.CW
|
|
110
111
|
}));
|
|
111
112
|
}
|
|
113
|
+
if (parameters.unclippedDepth) {
|
|
114
|
+
if (device.features.has('depth-clip-control')) {
|
|
115
|
+
// EXT_depth_clamp
|
|
116
|
+
gl.enable(GL.DEPTH_CLAMP_EXT);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
112
119
|
if (parameters.depthBias !== undefined) {
|
|
113
120
|
gl.polygonOffset(parameters.depthBias, parameters.depthBiasSlopeScale || 0);
|
|
114
121
|
}
|
|
115
122
|
// depthBiasSlopeScale: {
|
|
116
123
|
// // Handled by depthBias
|
|
117
124
|
// },
|
|
125
|
+
// WEBGL EXTENSIONS
|
|
126
|
+
if (device.features.has('provoking-vertex-webgl')) {
|
|
127
|
+
const extensions = webglDevice.getExtension('WEBGL_provoking_vertex');
|
|
128
|
+
const ext = extensions.WEBGL_provoking_vertex;
|
|
129
|
+
if (parameters.provokingVertex) {
|
|
130
|
+
const vertex = map('provokingVertex', parameters.provokingVertex, {
|
|
131
|
+
first: GL.FIRST_VERTEX_CONVENTION_WEBGL,
|
|
132
|
+
last: GL.LAST_VERTEX_CONVENTION_WEBGL
|
|
133
|
+
});
|
|
134
|
+
ext?.provokingVertexWEBGL(vertex);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
if (device.features.has('polygon-mode-webgl')) {
|
|
138
|
+
const extensions = webglDevice.getExtension('WEBGL_polygon_mode');
|
|
139
|
+
const ext = extensions.WEBGL_polygon_mode;
|
|
140
|
+
if (parameters.polygonMode) {
|
|
141
|
+
const mode = map('polygonMode', parameters.provokingVertex, {
|
|
142
|
+
fill: GL.FILL_WEBGL,
|
|
143
|
+
lint: GL.LINE_WEBGL
|
|
144
|
+
});
|
|
145
|
+
ext?.polygonModeWEBGL(GL.FRONT, mode);
|
|
146
|
+
ext?.polygonModeWEBGL(GL.BACK, mode);
|
|
147
|
+
}
|
|
148
|
+
if (parameters.polygonOffsetLine) {
|
|
149
|
+
gl.enable(GL.POLYGON_OFFSET_LINE_WEBGL);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (device.features.has('shader-clip-cull-distance-webgl')) {
|
|
153
|
+
if (parameters.clipDistance0) {
|
|
154
|
+
gl.enable(GL.CLIP_DISTANCE0_WEBGL);
|
|
155
|
+
}
|
|
156
|
+
if (parameters.clipDistance1) {
|
|
157
|
+
gl.enable(GL.CLIP_DISTANCE1_WEBGL);
|
|
158
|
+
}
|
|
159
|
+
if (parameters.clipDistance2) {
|
|
160
|
+
gl.enable(GL.CLIP_DISTANCE2_WEBGL);
|
|
161
|
+
}
|
|
162
|
+
if (parameters.clipDistance3) {
|
|
163
|
+
gl.enable(GL.CLIP_DISTANCE3_WEBGL);
|
|
164
|
+
}
|
|
165
|
+
if (parameters.clipDistance4) {
|
|
166
|
+
gl.enable(GL.CLIP_DISTANCE4_WEBGL);
|
|
167
|
+
}
|
|
168
|
+
if (parameters.clipDistance5) {
|
|
169
|
+
gl.enable(GL.CLIP_DISTANCE5_WEBGL);
|
|
170
|
+
}
|
|
171
|
+
if (parameters.clipDistance6) {
|
|
172
|
+
gl.enable(GL.CLIP_DISTANCE6_WEBGL);
|
|
173
|
+
}
|
|
174
|
+
if (parameters.clipDistance7) {
|
|
175
|
+
gl.enable(GL.CLIP_DISTANCE7_WEBGL);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
118
178
|
// DEPTH STENCIL
|
|
119
179
|
if (parameters.depthWriteEnabled !== undefined) {
|
|
120
180
|
gl.depthMask(mapBoolean('depthWriteEnabled', parameters.depthWriteEnabled));
|
|
@@ -230,17 +290,17 @@ function convertStencilOperation(parameter, value) {
|
|
|
230
290
|
}
|
|
231
291
|
function convertBlendOperationToEquation(parameter, value) {
|
|
232
292
|
return map(parameter, value, {
|
|
233
|
-
|
|
234
|
-
|
|
293
|
+
add: GL.FUNC_ADD,
|
|
294
|
+
subtract: GL.FUNC_SUBTRACT,
|
|
235
295
|
'reverse-subtract': GL.FUNC_REVERSE_SUBTRACT,
|
|
236
|
-
|
|
237
|
-
|
|
296
|
+
min: GL.MIN,
|
|
297
|
+
max: GL.MAX
|
|
238
298
|
});
|
|
239
299
|
}
|
|
240
300
|
function convertBlendFactorToFunction(parameter, value) {
|
|
241
301
|
return map(parameter, value, {
|
|
242
|
-
|
|
243
|
-
|
|
302
|
+
one: GL.ONE,
|
|
303
|
+
zero: GL.ZERO,
|
|
244
304
|
'src-color': GL.SRC_COLOR,
|
|
245
305
|
'one-minus-src-color': GL.ONE_MINUS_SRC_COLOR,
|
|
246
306
|
'dst-color': GL.DST_COLOR,
|
|
@@ -248,7 +308,7 @@ function convertBlendFactorToFunction(parameter, value) {
|
|
|
248
308
|
'src-alpha': GL.SRC_ALPHA,
|
|
249
309
|
'one-minus-src-alpha': GL.ONE_MINUS_SRC_ALPHA,
|
|
250
310
|
'dst-alpha': GL.DST_ALPHA,
|
|
251
|
-
'one-minus-dst-alpha': GL.ONE_MINUS_DST_ALPHA
|
|
311
|
+
'one-minus-dst-alpha': GL.ONE_MINUS_DST_ALPHA
|
|
252
312
|
});
|
|
253
313
|
}
|
|
254
314
|
function message(parameter, value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sampler-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/sampler-parameters.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sampler-parameters.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/sampler-parameters.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAK,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAG3D;;;;GAIG;AACH,wBAAgB,+BAA+B,CAAC,KAAK,EAAE,YAAY,GAAG,mBAAmB,CAuCxF"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { GL } from '@luma.gl/constants';
|
|
4
|
-
import { convertCompareFunction } from
|
|
5
|
+
import { convertCompareFunction } from "./device-parameters.js";
|
|
5
6
|
/**
|
|
6
7
|
* Convert WebGPU-style sampler props to WebGL
|
|
7
8
|
* @param props
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shader-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/shader-formats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shader-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/shader-formats.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,mBAAmB,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAElE,kDAAkD;AAClD,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,EAAE,EACR,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GACxB,mBAAmB,CAcrB;AAED,6CAA6C;AAC7C,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,EAAE,GAAG,cAAc,CAqBhE;AAED,2CAA2C;AAC3C,wBAAgB,uBAAuB,CACrC,IAAI,EAAE,cAAc,GACnB,EAAE,CAAC,GAAG,GAAG,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,KAAK,GAAG,EAAE,CAAC,UAAU,CAcrD"}
|
|
@@ -1,39 +1,59 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { GL } from '@luma.gl/constants';
|
|
4
5
|
/** Get shader attribute type from GL constants */
|
|
5
6
|
export function getShaderAttributeTypeFromGL(type, components) {
|
|
6
7
|
const dataType = getShaderDataTypeFromGL(type);
|
|
7
8
|
switch (components) {
|
|
8
|
-
case 1:
|
|
9
|
-
|
|
10
|
-
case
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
case 1:
|
|
10
|
+
return dataType;
|
|
11
|
+
case 2:
|
|
12
|
+
return `vec2<${dataType}>`;
|
|
13
|
+
case 3:
|
|
14
|
+
return `vec2<${dataType}>`;
|
|
15
|
+
case 4:
|
|
16
|
+
return `vec2<${dataType}>`;
|
|
17
|
+
default:
|
|
18
|
+
throw new Error(String(components));
|
|
13
19
|
}
|
|
14
20
|
}
|
|
15
21
|
/** Get shader data type from GL constants */
|
|
16
22
|
export function getShaderDataTypeFromGL(type) {
|
|
17
23
|
switch (type) {
|
|
18
|
-
case GL.INT:
|
|
19
|
-
|
|
20
|
-
case GL.
|
|
21
|
-
|
|
22
|
-
case GL.
|
|
23
|
-
|
|
24
|
-
case GL.
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
case GL.INT:
|
|
25
|
+
return 'i32';
|
|
26
|
+
case GL.UNSIGNED_INT:
|
|
27
|
+
return 'u32';
|
|
28
|
+
case GL.SHORT:
|
|
29
|
+
return 'i32';
|
|
30
|
+
case GL.UNSIGNED_SHORT:
|
|
31
|
+
return 'u32';
|
|
32
|
+
case GL.BYTE:
|
|
33
|
+
return 'i32';
|
|
34
|
+
case GL.UNSIGNED_BYTE:
|
|
35
|
+
return 'u32';
|
|
36
|
+
case GL.FLOAT:
|
|
37
|
+
return 'f32';
|
|
38
|
+
case GL.HALF_FLOAT:
|
|
39
|
+
return 'f16';
|
|
40
|
+
default:
|
|
41
|
+
throw new Error(String(type));
|
|
27
42
|
}
|
|
28
43
|
}
|
|
29
44
|
/** GetGL constant from shader data type */
|
|
30
45
|
export function getGLFromShaderDataType(type) {
|
|
31
46
|
switch (type) {
|
|
32
47
|
// TODO
|
|
33
|
-
case 'i32':
|
|
34
|
-
|
|
35
|
-
case '
|
|
36
|
-
|
|
37
|
-
|
|
48
|
+
case 'i32':
|
|
49
|
+
return GL.INT;
|
|
50
|
+
case 'u32':
|
|
51
|
+
return GL.UNSIGNED_INT;
|
|
52
|
+
case 'f32':
|
|
53
|
+
return GL.FLOAT;
|
|
54
|
+
case 'f16':
|
|
55
|
+
return GL.HALF_FLOAT;
|
|
56
|
+
default:
|
|
57
|
+
throw new Error(String(type));
|
|
38
58
|
}
|
|
39
59
|
}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { TextureFormat, DeviceFeature } from '@luma.gl/core';
|
|
2
|
-
import { GL } from '@luma.gl/constants';
|
|
2
|
+
import { GL, GLExtensions } from '@luma.gl/constants';
|
|
3
|
+
export declare const TEXTURE_FEATURES: Partial<Record<DeviceFeature, string[]>>;
|
|
3
4
|
/** Return a list of texture feature strings (for Device.features). Mainly compressed texture support */
|
|
4
|
-
export declare function
|
|
5
|
+
export declare function isTextureFeature(feature: DeviceFeature): boolean;
|
|
6
|
+
/** Checks a texture feature (for Device.features). Mainly compressed texture support */
|
|
7
|
+
export declare function checkTextureFeature(gl: WebGL2RenderingContext, feature: DeviceFeature, extensions: GLExtensions): boolean;
|
|
5
8
|
/** Map a format to webgl and constants */
|
|
6
9
|
type Format = {
|
|
7
10
|
gl?: GL;
|
|
@@ -38,8 +41,8 @@ type Format = {
|
|
|
38
41
|
*/
|
|
39
42
|
export declare const TEXTURE_FORMATS: Record<TextureFormat, Format>;
|
|
40
43
|
/** Checks if a texture format is supported */
|
|
41
|
-
export declare function isTextureFormatSupported(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL): boolean;
|
|
42
|
-
export declare function isRenderbufferFormatSupported(gl: WebGL2RenderingContext, format: TextureFormat): boolean;
|
|
44
|
+
export declare function isTextureFormatSupported(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL, extensions: GLExtensions): boolean;
|
|
45
|
+
export declare function isRenderbufferFormatSupported(gl: WebGL2RenderingContext, format: TextureFormat, extensions: GLExtensions): boolean;
|
|
43
46
|
/**
|
|
44
47
|
* Map WebGL texture formats (GL constants) to WebGPU-style TextureFormat strings
|
|
45
48
|
*/
|
|
@@ -49,7 +52,7 @@ export declare function convertGLToTextureFormat(format: GL | TextureFormat): Te
|
|
|
49
52
|
*/
|
|
50
53
|
export declare function convertTextureFormatToGL(format: TextureFormat): GL | undefined;
|
|
51
54
|
/** Checks if a texture format is supported */
|
|
52
|
-
export declare function getTextureFormatSupport(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL): {
|
|
55
|
+
export declare function getTextureFormatSupport(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL, extensions: GLExtensions): {
|
|
53
56
|
supported: boolean;
|
|
54
57
|
filterable?: boolean;
|
|
55
58
|
renderable?: boolean;
|
|
@@ -57,8 +60,8 @@ export declare function getTextureFormatSupport(gl: WebGL2RenderingContext, form
|
|
|
57
60
|
storable?: boolean;
|
|
58
61
|
};
|
|
59
62
|
/** Checks whether linear filtering (interpolated sampling) is available for floating point textures */
|
|
60
|
-
export declare function isTextureFormatFilterable(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL): boolean;
|
|
61
|
-
export declare function isTextureFormatRenderable(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL): boolean;
|
|
63
|
+
export declare function isTextureFormatFilterable(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL, extensions: GLExtensions): boolean;
|
|
64
|
+
export declare function isTextureFormatRenderable(gl: WebGL2RenderingContext, formatOrGL: TextureFormat | GL, extensions: GLExtensions): boolean;
|
|
62
65
|
export declare function getWebGLTextureParameters(formatOrGL: TextureFormat | GL): {
|
|
63
66
|
format: GL;
|
|
64
67
|
dataFormat: GL;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/texture-formats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"texture-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/texture-formats.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { decodeTextureFormat } from '@luma.gl/core';
|
|
4
5
|
import { GL } from '@luma.gl/constants';
|
|
5
|
-
import {
|
|
6
|
+
import { getWebGLExtension } from "../../context/helpers/webgl-extensions.js";
|
|
7
|
+
import { getGLFromVertexType } from "./vertex-formats.js";
|
|
6
8
|
/* eslint-disable camelcase */
|
|
7
9
|
// TEXTURE FEATURES
|
|
8
10
|
// Define local device feature strings to optimize minification
|
|
@@ -12,8 +14,14 @@ const texture_compression_etc2 = 'texture-compression-etc2';
|
|
|
12
14
|
const texture_compression_etc1_webgl = 'texture-compression-etc1-webgl';
|
|
13
15
|
const texture_compression_pvrtc_webgl = 'texture-compression-pvrtc-webgl';
|
|
14
16
|
const texture_compression_atc_webgl = 'texture-compression-atc-webgl';
|
|
15
|
-
|
|
16
|
-
|
|
17
|
+
const float32_renderable = 'float32-renderable-webgl';
|
|
18
|
+
const float16_renderable = 'float16-renderable-webgl';
|
|
19
|
+
const rgb9e5ufloat_renderable = 'rgb9e5ufloat_renderable-webgl';
|
|
20
|
+
const snorm8_renderable = 'snorm8-renderable-webgl';
|
|
21
|
+
const norm16_renderable = 'norm16-renderable-webgl';
|
|
22
|
+
const snorm16_renderable = 'snorm16-renderable-webgl';
|
|
23
|
+
const float32_filterable = 'float32-filterable';
|
|
24
|
+
const float16_filterable = 'float16-filterable-webgl';
|
|
17
25
|
// Define local webgl extension strings to optimize minification
|
|
18
26
|
const X_S3TC = 'WEBGL_compressed_texture_s3tc'; // BC1, BC2, BC3
|
|
19
27
|
const X_S3TC_SRGB = 'WEBGL_compressed_texture_s3tc_srgb'; // BC1, BC2, BC3
|
|
@@ -25,19 +33,19 @@ const X_ETC1 = 'WEBGL_compressed_texture_etc1';
|
|
|
25
33
|
const X_PVRTC = 'WEBGL_compressed_texture_pvrtc';
|
|
26
34
|
const X_ATC = 'WEBGL_compressed_texture_atc';
|
|
27
35
|
// Define local webgl extension strings to optimize minification
|
|
28
|
-
const
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
// const DEPTH = 'WEBGL_depth_texture';
|
|
32
|
-
// WebGL1-only extensions
|
|
33
|
-
// const EXT_SRGB = 'EXT_sRGB'; // https://developer.mozilla.org/en-US/docs/Web/API/EXT_sRGB
|
|
36
|
+
const EXT_texture_norm16 = 'EXT_texture_norm16';
|
|
37
|
+
const EXT_render_snorm = 'EXT_render_snorm';
|
|
38
|
+
const EXT_color_buffer_float = 'EXT_color_buffer_float';
|
|
34
39
|
// prettier-ignore
|
|
35
|
-
const
|
|
36
|
-
'float32-renderable-webgl': ['EXT_color_buffer_float'],
|
|
40
|
+
export const TEXTURE_FEATURES = {
|
|
41
|
+
'float32-renderable-webgl': ['EXT_color_buffer_float'],
|
|
37
42
|
'float16-renderable-webgl': ['EXT_color_buffer_half_float'],
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
43
|
+
'rgb9e5ufloat_renderable-webgl': ['WEBGL_render_shared_exponent'],
|
|
44
|
+
'snorm8-renderable-webgl': [EXT_render_snorm],
|
|
45
|
+
'norm16-renderable-webgl': [EXT_texture_norm16],
|
|
46
|
+
'snorm16-renderable-webgl': [EXT_texture_norm16, EXT_render_snorm],
|
|
47
|
+
'float32-filterable': ['OES_texture_float_linear'],
|
|
48
|
+
'float16-filterable-webgl': ['OES_texture_half_float_linear'],
|
|
41
49
|
'texture-filterable-anisotropic-webgl': ['EXT_texture_filter_anisotropic'],
|
|
42
50
|
'texture-blend-float-webgl': ['EXT_float_blend'],
|
|
43
51
|
'texture-compression-bc': [X_S3TC, X_S3TC_SRGB, X_RGTC, X_BPTC],
|
|
@@ -51,17 +59,21 @@ const TEXTURE_FEATURE_CHECKS = {
|
|
|
51
59
|
'texture-compression-pvrtc-webgl': [X_PVRTC],
|
|
52
60
|
'texture-compression-atc-webgl': [X_ATC]
|
|
53
61
|
};
|
|
54
|
-
function checkTextureFeature(gl, feature) {
|
|
55
|
-
const extensions = TEXTURE_FEATURE_CHECKS[feature] || [];
|
|
56
|
-
return extensions.every(extension => gl.getExtension(extension));
|
|
57
|
-
}
|
|
58
|
-
function checkTextureFeatures(gl, features) {
|
|
59
|
-
return features.every(feature => checkTextureFeature(gl, feature));
|
|
60
|
-
}
|
|
61
62
|
/** Return a list of texture feature strings (for Device.features). Mainly compressed texture support */
|
|
62
|
-
export function getTextureFeatures(
|
|
63
|
-
|
|
64
|
-
|
|
63
|
+
// export function getTextureFeatures(
|
|
64
|
+
// gl: WebGL2RenderingContext,
|
|
65
|
+
// extensions: GLExtensions
|
|
66
|
+
// ): DeviceFeature[] {
|
|
67
|
+
// const textureFeatures = Object.keys(TEXTURE_FEATURES) as DeviceFeature[];
|
|
68
|
+
// return textureFeatures.filter(feature => checkTextureFeature(gl, feature, extensions));
|
|
69
|
+
// }
|
|
70
|
+
export function isTextureFeature(feature) {
|
|
71
|
+
return feature in TEXTURE_FEATURES;
|
|
72
|
+
}
|
|
73
|
+
/** Checks a texture feature (for Device.features). Mainly compressed texture support */
|
|
74
|
+
export function checkTextureFeature(gl, feature, extensions) {
|
|
75
|
+
const textureExtensions = TEXTURE_FEATURES[feature] || [];
|
|
76
|
+
return textureExtensions.every(extension => getWebGLExtension(gl, extension, extensions));
|
|
65
77
|
}
|
|
66
78
|
// TABLES
|
|
67
79
|
/**
|
|
@@ -81,19 +93,19 @@ export const TEXTURE_FORMATS = {
|
|
|
81
93
|
// 'rgba8unorm-srgb-unsized': {gl: GL.SRGB_ALPHA_EXT, b: 4, c: 2, bpp: 4, gl1Ext: SRGB},
|
|
82
94
|
// 8-bit formats
|
|
83
95
|
'r8unorm': { gl: GL.R8, b: 1, c: 1, renderbuffer: true },
|
|
84
|
-
'r8snorm': { gl: GL.R8_SNORM, b: 1, c: 1 },
|
|
96
|
+
'r8snorm': { gl: GL.R8_SNORM, b: 1, c: 1, render: snorm8_renderable },
|
|
85
97
|
'r8uint': { gl: GL.R8UI, b: 1, c: 1, renderbuffer: true },
|
|
86
98
|
'r8sint': { gl: GL.R8I, b: 1, c: 1, renderbuffer: true },
|
|
87
99
|
// 16-bit formats
|
|
88
100
|
'rg8unorm': { gl: GL.RG8, b: 2, c: 2, renderbuffer: true },
|
|
89
|
-
'rg8snorm': { gl: GL.RG8_SNORM, b: 2, c: 2 },
|
|
101
|
+
'rg8snorm': { gl: GL.RG8_SNORM, b: 2, c: 2, render: snorm8_renderable },
|
|
90
102
|
'rg8uint': { gl: GL.RG8UI, b: 2, c: 2, renderbuffer: true },
|
|
91
103
|
'rg8sint': { gl: GL.RG8I, b: 2, c: 2, renderbuffer: true },
|
|
92
104
|
'r16uint': { gl: GL.R16UI, b: 2, c: 1, renderbuffer: true },
|
|
93
105
|
'r16sint': { gl: GL.R16I, b: 2, c: 1, renderbuffer: true },
|
|
94
|
-
'r16float': { gl: GL.R16F, b: 2, c: 1, render:
|
|
95
|
-
'r16unorm-webgl': { gl: GL.R16_EXT, b: 2, c: 1, f:
|
|
96
|
-
'r16snorm-webgl': { gl: GL.R16_SNORM_EXT, b: 2, c: 1, f:
|
|
106
|
+
'r16float': { gl: GL.R16F, b: 2, c: 1, render: float16_renderable, filter: 'float16-filterable-webgl', renderbuffer: true },
|
|
107
|
+
'r16unorm-webgl': { gl: GL.R16_EXT, b: 2, c: 1, f: norm16_renderable, renderbuffer: true },
|
|
108
|
+
'r16snorm-webgl': { gl: GL.R16_SNORM_EXT, b: 2, c: 1, f: snorm16_renderable },
|
|
97
109
|
// Packed 16-bit formats
|
|
98
110
|
'rgba4unorm-webgl': { gl: GL.RGBA4, b: 2, c: 4, wgpu: false, renderbuffer: true },
|
|
99
111
|
'rgb565unorm-webgl': { gl: GL.RGB565, b: 2, c: 4, wgpu: false, renderbuffer: true },
|
|
@@ -104,7 +116,7 @@ export const TEXTURE_FORMATS = {
|
|
|
104
116
|
// 32-bit formats
|
|
105
117
|
'rgba8unorm': { gl: GL.RGBA8, b: 4, c: 2, bpp: 4 },
|
|
106
118
|
'rgba8unorm-srgb': { gl: GL.SRGB8_ALPHA8, b: 4, c: 4, bpp: 4 },
|
|
107
|
-
'rgba8snorm': { gl: GL.RGBA8_SNORM, b: 4, c: 4 },
|
|
119
|
+
'rgba8snorm': { gl: GL.RGBA8_SNORM, b: 4, c: 4, render: snorm8_renderable },
|
|
108
120
|
'rgba8uint': { gl: GL.RGBA8UI, b: 4, c: 4, bpp: 4 },
|
|
109
121
|
'rgba8sint': { gl: GL.RGBA8I, b: 4, c: 4, bpp: 4 },
|
|
110
122
|
// reverse colors, webgpu only
|
|
@@ -113,36 +125,36 @@ export const TEXTURE_FORMATS = {
|
|
|
113
125
|
'rg16uint': { gl: GL.RG16UI, b: 4, c: 1, bpp: 4 },
|
|
114
126
|
'rg16sint': { gl: GL.RG16I, b: 4, c: 2, bpp: 4 },
|
|
115
127
|
// When using a WebGL 2 context and the EXT_color_buffer_float WebGL2 extension
|
|
116
|
-
'rg16float': { gl: GL.RG16F, bpp: 4, b: 4, c: 2, render:
|
|
117
|
-
'rg16unorm-webgl': { gl: GL.RG16_EXT, b: 2, c: 2,
|
|
118
|
-
'rg16snorm-webgl': { gl: GL.RG16_SNORM_EXT, b: 2, c: 2,
|
|
128
|
+
'rg16float': { gl: GL.RG16F, bpp: 4, b: 4, c: 2, render: float16_renderable, filter: float16_filterable, renderbuffer: true },
|
|
129
|
+
'rg16unorm-webgl': { gl: GL.RG16_EXT, b: 2, c: 2, render: norm16_renderable },
|
|
130
|
+
'rg16snorm-webgl': { gl: GL.RG16_SNORM_EXT, b: 2, c: 2, render: snorm16_renderable },
|
|
119
131
|
'r32uint': { gl: GL.R32UI, b: 4, c: 1, bpp: 4, renderbuffer: true },
|
|
120
132
|
'r32sint': { gl: GL.R32I, b: 4, c: 1, bpp: 4, renderbuffer: true },
|
|
121
|
-
'r32float': { gl: GL.R32F, bpp: 4, b: 4, c: 1, render:
|
|
133
|
+
'r32float': { gl: GL.R32F, bpp: 4, b: 4, c: 1, render: float32_renderable, filter: float32_filterable },
|
|
122
134
|
// Packed 32-bit formats
|
|
123
|
-
'rgb9e5ufloat': { gl: GL.RGB9_E5, b: 4, c: 3, p: 1, render:
|
|
124
|
-
'rg11b10ufloat': { gl: GL.R11F_G11F_B10F, b: 4, c: 3, p: 1, render:
|
|
135
|
+
'rgb9e5ufloat': { gl: GL.RGB9_E5, b: 4, c: 3, p: 1, render: rgb9e5ufloat_renderable }, // , filter: true},
|
|
136
|
+
'rg11b10ufloat': { gl: GL.R11F_G11F_B10F, b: 4, c: 3, p: 1, render: float32_renderable, renderbuffer: true },
|
|
125
137
|
'rgb10a2unorm': { gl: GL.RGB10_A2, b: 4, c: 4, p: 1, renderbuffer: true },
|
|
126
|
-
'
|
|
138
|
+
'rgb10a2uint-webgl': { b: 4, c: 4, gl: GL.RGB10_A2UI, p: 1, wgpu: false, bpp: 4, renderbuffer: true },
|
|
127
139
|
// 48-bit formats
|
|
128
|
-
'rgb16unorm-webgl': { gl: GL.RGB16_EXT, b: 2, c: 3, f:
|
|
129
|
-
'rgb16snorm-webgl': { gl: GL.RGB16_SNORM_EXT, b: 2, c: 3, f:
|
|
140
|
+
'rgb16unorm-webgl': { gl: GL.RGB16_EXT, b: 2, c: 3, f: norm16_renderable }, // rgb not renderable
|
|
141
|
+
'rgb16snorm-webgl': { gl: GL.RGB16_SNORM_EXT, b: 2, c: 3, f: norm16_renderable }, // rgb not renderable
|
|
130
142
|
// 64-bit formats
|
|
131
143
|
'rg32uint': { gl: GL.RG32UI, b: 8, c: 2, renderbuffer: true },
|
|
132
144
|
'rg32sint': { gl: GL.RG32I, b: 8, c: 2, renderbuffer: true },
|
|
133
|
-
'rg32float': { gl: GL.RG32F, b: 8, c: 2, render:
|
|
145
|
+
'rg32float': { gl: GL.RG32F, b: 8, c: 2, render: float32_renderable, filter: float32_filterable, renderbuffer: true },
|
|
134
146
|
'rgba16uint': { gl: GL.RGBA16UI, b: 8, c: 4, renderbuffer: true },
|
|
135
147
|
'rgba16sint': { gl: GL.RGBA16I, b: 8, c: 4, renderbuffer: true },
|
|
136
|
-
'rgba16float': { gl: GL.RGBA16F, b: 8, c: 4, render:
|
|
137
|
-
'rgba16unorm-webgl': { gl: GL.RGBA16_EXT, b: 2, c: 4,
|
|
138
|
-
'rgba16snorm-webgl': { gl: GL.RGBA16_SNORM_EXT, b: 2, c: 4,
|
|
148
|
+
'rgba16float': { gl: GL.RGBA16F, b: 8, c: 4, render: float16_renderable, filter: float16_filterable },
|
|
149
|
+
'rgba16unorm-webgl': { gl: GL.RGBA16_EXT, b: 2, c: 4, render: norm16_renderable, renderbuffer: true },
|
|
150
|
+
'rgba16snorm-webgl': { gl: GL.RGBA16_SNORM_EXT, b: 2, c: 4, render: snorm16_renderable },
|
|
139
151
|
// 96-bit formats (deprecated!)
|
|
140
|
-
'rgb32float-webgl': { gl: GL.RGB32F, render:
|
|
141
|
-
gl2ext:
|
|
152
|
+
'rgb32float-webgl': { gl: GL.RGB32F, render: float32_renderable, filter: float32_filterable,
|
|
153
|
+
gl2ext: EXT_color_buffer_float, dataFormat: GL.RGB, types: [GL.FLOAT] },
|
|
142
154
|
// 128-bit formats
|
|
143
155
|
'rgba32uint': { gl: GL.RGBA32UI, b: 16, c: 4, renderbuffer: true },
|
|
144
156
|
'rgba32sint': { gl: GL.RGBA32I, b: 16, c: 4, renderbuffer: true },
|
|
145
|
-
'rgba32float': { gl: GL.RGBA32F, b: 16, c: 4, render:
|
|
157
|
+
'rgba32float': { gl: GL.RGBA32F, b: 16, c: 4, render: float32_renderable, filter: float32_filterable, renderbuffer: true },
|
|
146
158
|
// Depth and stencil formats
|
|
147
159
|
'stencil8': { gl: GL.STENCIL_INDEX8, b: 1, c: 1, attachment: GL.STENCIL_ATTACHMENT, renderbuffer: true }, // 8 stencil bits
|
|
148
160
|
'depth16unorm': { gl: GL.DEPTH_COMPONENT16, b: 2, c: 1, attachment: GL.DEPTH_ATTACHMENT, renderbuffer: true }, // 16 depth bits
|
|
@@ -312,7 +324,7 @@ export const RENDERBUFFER_FORMATS: Record<string, RenderbufferFormat> = {
|
|
|
312
324
|
[GL.RG32F]: {ext: EXT_FLOAT_WEBGL2, bpp: 8},
|
|
313
325
|
// TODO - can't get WEBGL_color_buffer_float to work on renderbuffers
|
|
314
326
|
[GL.RGBA32F]: {ext: EXT_FLOAT_WEBGL2, bpp: 16},
|
|
315
|
-
// [GL.RGBA32F]: {ext: EXT_FLOAT_WEBGL2
|
|
327
|
+
// [GL.RGBA32F]: {ext: EXT_FLOAT_WEBGL2},
|
|
316
328
|
[GL.R11F_G11F_B10F]: {ext: EXT_FLOAT_WEBGL2, bpp: 4}
|
|
317
329
|
};
|
|
318
330
|
*/
|
|
@@ -345,7 +357,7 @@ const TYPE_SIZES = {
|
|
|
345
357
|
};
|
|
346
358
|
// FUNCTIONS
|
|
347
359
|
/** Checks if a texture format is supported */
|
|
348
|
-
export function isTextureFormatSupported(gl, formatOrGL) {
|
|
360
|
+
export function isTextureFormatSupported(gl, formatOrGL, extensions) {
|
|
349
361
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
350
362
|
const info = TEXTURE_FORMATS[format];
|
|
351
363
|
if (!info) {
|
|
@@ -358,13 +370,13 @@ export function isTextureFormatSupported(gl, formatOrGL) {
|
|
|
358
370
|
// Check extensions
|
|
359
371
|
const extension = info.x || info.gl2ext;
|
|
360
372
|
if (extension) {
|
|
361
|
-
return Boolean(gl
|
|
373
|
+
return Boolean(getWebGLExtension(gl, extension, extensions));
|
|
362
374
|
}
|
|
363
375
|
return true;
|
|
364
376
|
}
|
|
365
|
-
export function isRenderbufferFormatSupported(gl, format) {
|
|
377
|
+
export function isRenderbufferFormatSupported(gl, format, extensions) {
|
|
366
378
|
// Note: Order is important since the function call initializes extensions.
|
|
367
|
-
return isTextureFormatSupported(gl, format) && TEXTURE_FORMATS[format]?.renderbuffer;
|
|
379
|
+
return isTextureFormatSupported(gl, format, extensions) && TEXTURE_FORMATS[format]?.renderbuffer;
|
|
368
380
|
}
|
|
369
381
|
/**
|
|
370
382
|
* Map WebGL texture formats (GL constants) to WebGPU-style TextureFormat strings
|
|
@@ -391,7 +403,7 @@ export function convertTextureFormatToGL(format) {
|
|
|
391
403
|
return webglFormat;
|
|
392
404
|
}
|
|
393
405
|
/** Checks if a texture format is supported */
|
|
394
|
-
export function getTextureFormatSupport(gl, formatOrGL) {
|
|
406
|
+
export function getTextureFormatSupport(gl, formatOrGL, extensions) {
|
|
395
407
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
396
408
|
const info = TEXTURE_FORMATS[format];
|
|
397
409
|
if (!info) {
|
|
@@ -403,26 +415,26 @@ export function getTextureFormatSupport(gl, formatOrGL) {
|
|
|
403
415
|
// } catch {}
|
|
404
416
|
// Support Check that we have a GL constant
|
|
405
417
|
let supported = info.gl === undefined;
|
|
406
|
-
supported = supported &&
|
|
418
|
+
supported = supported && checkTextureFeature(gl, info.f, extensions);
|
|
407
419
|
// Filtering
|
|
408
420
|
// const filterable = info.filter
|
|
409
|
-
// ?
|
|
421
|
+
// ? checkTextureFeature(gl, infofilter])
|
|
410
422
|
// : decoded && !decoded.signed;
|
|
411
423
|
// const renderable = info.filter
|
|
412
|
-
// ?
|
|
424
|
+
// ? checkTextureFeature(gl, inforender])
|
|
413
425
|
// : decoded && !decoded.signed;
|
|
414
426
|
return {
|
|
415
427
|
supported,
|
|
416
|
-
renderable: supported &&
|
|
417
|
-
filterable: supported &&
|
|
428
|
+
renderable: supported && checkTextureFeature(gl, info.render, extensions),
|
|
429
|
+
filterable: supported && checkTextureFeature(gl, info.filter, extensions),
|
|
418
430
|
blendable: false, // tod,
|
|
419
431
|
storable: false
|
|
420
432
|
};
|
|
421
433
|
}
|
|
422
434
|
/** Checks whether linear filtering (interpolated sampling) is available for floating point textures */
|
|
423
|
-
export function isTextureFormatFilterable(gl, formatOrGL) {
|
|
435
|
+
export function isTextureFormatFilterable(gl, formatOrGL, extensions) {
|
|
424
436
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
425
|
-
if (!isTextureFormatSupported(gl, format)) {
|
|
437
|
+
if (!isTextureFormatSupported(gl, format, extensions)) {
|
|
426
438
|
return false;
|
|
427
439
|
}
|
|
428
440
|
try {
|
|
@@ -435,16 +447,16 @@ export function isTextureFormatFilterable(gl, formatOrGL) {
|
|
|
435
447
|
return false;
|
|
436
448
|
}
|
|
437
449
|
if (format.endsWith('32float')) {
|
|
438
|
-
return Boolean(gl
|
|
450
|
+
return Boolean(getWebGLExtension(gl, 'OES_texture_float_linear, extensions', extensions));
|
|
439
451
|
}
|
|
440
452
|
if (format.endsWith('16float')) {
|
|
441
|
-
return Boolean(gl
|
|
453
|
+
return Boolean(getWebGLExtension(gl, 'OES_texture_half_float_linear, extensions', extensions));
|
|
442
454
|
}
|
|
443
455
|
return true;
|
|
444
456
|
}
|
|
445
|
-
export function isTextureFormatRenderable(gl, formatOrGL) {
|
|
457
|
+
export function isTextureFormatRenderable(gl, formatOrGL, extensions) {
|
|
446
458
|
const format = convertGLToTextureFormat(formatOrGL);
|
|
447
|
-
if (!isTextureFormatSupported(gl, format)) {
|
|
459
|
+
if (!isTextureFormatSupported(gl, format, extensions)) {
|
|
448
460
|
return false;
|
|
449
461
|
}
|
|
450
462
|
if (typeof format === 'number') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vertex-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/vertex-formats.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vertex-formats.d.ts","sourceRoot":"","sources":["../../../src/adapter/converters/vertex-formats.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,YAAY,EAAE,UAAU,EAAC,MAAM,eAAe,CAAC;AAEvD,KAAK,UAAU,GACX,EAAE,CAAC,aAAa,GAChB,EAAE,CAAC,IAAI,GACP,EAAE,CAAC,cAAc,GACjB,EAAE,CAAC,KAAK,GACR,EAAE,CAAC,YAAY,GACf,EAAE,CAAC,GAAG,GACN,EAAE,CAAC,UAAU,GACb,EAAE,CAAC,KAAK,CAAC;AAEb,0CAA0C;AAC1C,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,YAAY,CAa/F;AAED,sCAAsC;AACtC,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,UAAU,EAAE,UAAU,UAAQ,GAAG,UAAU,CAepF;AAED,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,UAAU,GAElB,EAAE,CAAC,aAAa,GAChB,EAAE,CAAC,IAAI,GACP,EAAE,CAAC,cAAc,GACjB,EAAE,CAAC,KAAK,GACR,EAAE,CAAC,YAAY,GACf,EAAE,CAAC,GAAG,GACN,EAAE,CAAC,UAAU,GACb,EAAE,CAAC,KAAK,CAqBX"}
|
|
@@ -1,6 +1,19 @@
|
|
|
1
|
-
import { DeviceFeature } from '@luma.gl/core';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { DeviceFeature, DeviceFeatures } from '@luma.gl/core';
|
|
2
|
+
import { GLExtensions } from '@luma.gl/constants';
|
|
3
|
+
/**
|
|
4
|
+
* WebGL extensions exposed as luma.gl features
|
|
5
|
+
* To minimize GL log noise and improve performance, this class ensures that
|
|
6
|
+
* - WebGL extensions are not queried until the corresponding feature is checked.
|
|
7
|
+
* - WebGL extensions are only queried once.
|
|
8
|
+
*/
|
|
9
|
+
export declare class WebGLDeviceFeatures extends DeviceFeatures {
|
|
10
|
+
protected gl: WebGL2RenderingContext;
|
|
11
|
+
protected extensions: GLExtensions;
|
|
12
|
+
protected testedFeatures: Set<DeviceFeature>;
|
|
13
|
+
constructor(gl: WebGL2RenderingContext, extensions: GLExtensions);
|
|
14
|
+
[Symbol.iterator](): IterableIterator<DeviceFeature>;
|
|
15
|
+
has(feature: DeviceFeature): boolean;
|
|
16
|
+
/** Extract all WebGL features */
|
|
17
|
+
protected getWebGLFeature(feature: DeviceFeature): boolean;
|
|
18
|
+
}
|
|
6
19
|
//# sourceMappingURL=webgl-device-features.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-device-features.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/webgl-device-features.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-device-features.d.ts","sourceRoot":"","sources":["../../../src/adapter/device-helpers/webgl-device-features.ts"],"names":[],"mappings":"AAOA,OAAO,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AA8BhD;;;;;GAKG;AACH,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,SAAS,CAAC,EAAE,EAAE,sBAAsB,CAAC;IACrC,SAAS,CAAC,UAAU,EAAE,YAAY,CAAC;IACnC,SAAS,CAAC,cAAc,qBAA4B;gBAExC,EAAE,EAAE,sBAAsB,EAAE,UAAU,EAAE,YAAY;IAS/D,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,gBAAgB,CAAC,aAAa,CAAC;IAc5C,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;IAiB7C,iCAAiC;IACjC,SAAS,CAAC,eAAe,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO;CAU3D"}
|