@luma.gl/webgl 8.6.0-alpha.2 → 8.6.0-alpha.3
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/LICENSE +8 -1
- package/dist/adapter/converters/set-device-parameters.d.ts +5 -0
- package/dist/adapter/converters/set-device-parameters.d.ts.map +1 -0
- package/dist/adapter/converters/set-device-parameters.js +124 -0
- package/dist/adapter/converters/set-device-parameters.js.map +1 -0
- package/dist/adapter/converters/webgpu-texture-formats.d.ts +281 -0
- package/dist/adapter/converters/webgpu-texture-formats.d.ts.map +1 -0
- package/dist/adapter/converters/webgpu-texture-formats.js +285 -0
- package/dist/adapter/converters/webgpu-texture-formats.js.map +1 -0
- package/dist/{device → adapter/device-helpers}/device-features.d.ts +0 -0
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -0
- package/dist/{esm/device → adapter/device-helpers}/device-features.js +2 -2
- package/dist/adapter/device-helpers/device-features.js.map +1 -0
- package/dist/{device → adapter/device-helpers}/device-limits.d.ts +0 -0
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -0
- package/dist/{esm/device → adapter/device-helpers}/device-limits.js +1 -1
- package/dist/adapter/device-helpers/device-limits.js.map +1 -0
- package/dist/{device → adapter/device-helpers}/get-device-info.d.ts +0 -0
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -0
- package/dist/{device → adapter/device-helpers}/get-device-info.js +1 -1
- package/dist/adapter/device-helpers/get-device-info.js.map +1 -0
- package/dist/{webgl-utils → adapter/device-helpers}/is-old-ie.d.ts +0 -0
- package/dist/adapter/device-helpers/is-old-ie.d.ts.map +1 -0
- package/dist/{esm/webgl-utils → adapter/device-helpers}/is-old-ie.js +0 -0
- package/dist/adapter/device-helpers/is-old-ie.js.map +1 -0
- package/dist/{device → adapter}/webgl-device.d.ts +3 -3
- package/dist/adapter/webgl-device.d.ts.map +1 -0
- package/dist/{esm/device → adapter}/webgl-device.js +6 -6
- package/dist/adapter/webgl-device.js.map +1 -0
- package/dist/adapter/webgl-shader.d.ts +18 -0
- package/dist/adapter/webgl-shader.d.ts.map +1 -0
- package/dist/adapter/webgl-shader.js +82 -0
- package/dist/adapter/webgl-shader.js.map +1 -0
- package/dist/classes/framebuffer.js +1 -1
- package/dist/classes/framebuffer.js.map +1 -1
- package/dist/classes/program-configuration.d.ts +14 -17
- package/dist/classes/program-configuration.d.ts.map +1 -1
- package/dist/classes/program-configuration.js +10 -97
- package/dist/classes/program-configuration.js.map +1 -1
- package/dist/classes/program.d.ts +20 -15
- package/dist/classes/program.d.ts.map +1 -1
- package/dist/classes/program.js +31 -22
- package/dist/classes/program.js.map +1 -1
- package/dist/classes/query.js +1 -1
- package/dist/classes/query.js.map +1 -1
- package/dist/classes/renderbuffer.js +1 -1
- package/dist/classes/renderbuffer.js.map +1 -1
- package/dist/classes/{webgl-shader.d.ts → shader.d.ts} +4 -15
- package/dist/classes/shader.d.ts.map +1 -0
- package/dist/{esm/classes/webgl-shader.js → classes/shader.js} +6 -81
- package/dist/classes/shader.js.map +1 -0
- package/dist/classes/texture-3d.js +1 -1
- package/dist/classes/texture-3d.js.map +1 -1
- package/dist/classes/texture-cube.js.map +1 -1
- package/dist/classes/texture.d.ts +1 -1
- package/dist/classes/texture.d.ts.map +1 -1
- package/dist/classes/texture.js +1 -1
- package/dist/classes/texture.js.map +1 -1
- package/dist/classes/transform-feedback.js +1 -1
- package/dist/classes/transform-feedback.js.map +1 -1
- package/dist/classes/vertex-array-object.d.ts +6 -5
- package/dist/classes/vertex-array-object.d.ts.map +1 -1
- package/dist/classes/vertex-array-object.js +5 -5
- package/dist/classes/vertex-array-object.js.map +1 -1
- package/dist/classes/vertex-array.d.ts +13 -13
- package/dist/classes/vertex-array.d.ts.map +1 -1
- package/dist/classes/vertex-array.js +2 -2
- package/dist/classes/vertex-array.js.map +1 -1
- package/dist/classes/webgl-buffer.d.ts +1 -1
- package/dist/classes/webgl-buffer.d.ts.map +1 -1
- package/dist/classes/webgl-buffer.js +1 -1
- package/dist/classes/webgl-buffer.js.map +1 -1
- package/dist/classes/webgl-resource.d.ts +1 -1
- package/dist/classes/webgl-resource.d.ts.map +1 -1
- package/dist/classes/webgl-resource.js +1 -1
- package/dist/classes/webgl-resource.js.map +1 -1
- package/dist/context/parameters/unified-parameter-api.d.ts +2 -1
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/context/parameters/webgl-parameters.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameters.js.map +1 -1
- package/dist/es5/adapter/converters/set-device-parameters.js +138 -0
- package/dist/es5/adapter/converters/set-device-parameters.js.map +1 -0
- package/dist/es5/adapter/converters/webgpu-texture-formats.js +296 -0
- package/dist/es5/adapter/converters/webgpu-texture-formats.js.map +1 -0
- package/dist/es5/{device → adapter/device-helpers}/device-features.js +2 -2
- package/dist/es5/adapter/device-helpers/device-features.js.map +1 -0
- package/dist/es5/{device → adapter/device-helpers}/device-limits.js +1 -1
- package/dist/es5/adapter/device-helpers/device-limits.js.map +1 -0
- package/dist/es5/{device → adapter/device-helpers}/get-device-info.js +1 -1
- package/dist/es5/adapter/device-helpers/get-device-info.js.map +1 -0
- package/dist/es5/{webgl-utils → adapter/device-helpers}/is-old-ie.js +0 -0
- package/dist/es5/adapter/device-helpers/is-old-ie.js.map +1 -0
- package/dist/es5/{device → adapter}/webgl-device.js +6 -6
- package/dist/es5/adapter/webgl-device.js.map +1 -0
- package/dist/es5/adapter/webgl-shader.js +155 -0
- package/dist/es5/adapter/webgl-shader.js.map +1 -0
- package/dist/es5/classes/framebuffer.js +1 -1
- package/dist/es5/classes/framebuffer.js.map +1 -1
- package/dist/es5/classes/program-configuration.js +34 -101
- package/dist/es5/classes/program-configuration.js.map +1 -1
- package/dist/es5/classes/program.js +38 -27
- package/dist/es5/classes/program.js.map +1 -1
- package/dist/es5/classes/query.js +1 -1
- package/dist/es5/classes/query.js.map +1 -1
- package/dist/es5/classes/renderbuffer.js +1 -1
- package/dist/es5/classes/renderbuffer.js.map +1 -1
- package/dist/es5/classes/{webgl-shader.js → shader.js} +18 -132
- package/dist/es5/classes/shader.js.map +1 -0
- package/dist/es5/classes/texture-3d.js +1 -1
- package/dist/es5/classes/texture-3d.js.map +1 -1
- package/dist/es5/classes/texture-cube.js.map +1 -1
- package/dist/es5/classes/texture.js +1 -1
- package/dist/es5/classes/texture.js.map +1 -1
- package/dist/es5/classes/transform-feedback.js +1 -1
- package/dist/es5/classes/transform-feedback.js.map +1 -1
- package/dist/es5/classes/vertex-array-object.js +5 -5
- package/dist/es5/classes/vertex-array-object.js.map +1 -1
- package/dist/es5/classes/vertex-array.js +5 -5
- package/dist/es5/classes/vertex-array.js.map +1 -1
- package/dist/es5/classes/webgl-buffer.js +1 -1
- package/dist/es5/classes/webgl-buffer.js.map +1 -1
- package/dist/es5/classes/webgl-resource.js +1 -1
- package/dist/es5/classes/webgl-resource.js.map +1 -1
- package/dist/es5/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/es5/context/parameters/webgl-parameters.js.map +1 -1
- package/dist/es5/helpers/get-program-bindings.js +274 -0
- package/dist/es5/helpers/get-program-bindings.js.map +1 -0
- package/dist/es5/helpers/program-bindings.js +2 -0
- package/dist/es5/helpers/program-bindings.js.map +1 -0
- package/dist/es5/index.js +31 -15
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/init.js +1 -1
- package/dist/es5/init.js.map +1 -1
- package/dist/es5/types/accessor.d.ts +29 -0
- package/dist/esm/adapter/converters/set-device-parameters.js +124 -0
- package/dist/esm/adapter/converters/set-device-parameters.js.map +1 -0
- package/dist/esm/adapter/converters/webgpu-texture-formats.js +285 -0
- package/dist/esm/adapter/converters/webgpu-texture-formats.js.map +1 -0
- package/dist/{device → esm/adapter/device-helpers}/device-features.js +2 -2
- package/dist/esm/adapter/device-helpers/device-features.js.map +1 -0
- package/dist/{device → esm/adapter/device-helpers}/device-limits.js +1 -1
- package/dist/esm/adapter/device-helpers/device-limits.js.map +1 -0
- package/dist/esm/{device → adapter/device-helpers}/get-device-info.js +1 -1
- package/dist/esm/adapter/device-helpers/get-device-info.js.map +1 -0
- package/dist/{webgl-utils → esm/adapter/device-helpers}/is-old-ie.js +0 -0
- package/dist/esm/adapter/device-helpers/is-old-ie.js.map +1 -0
- package/dist/{device → esm/adapter}/webgl-device.js +6 -6
- package/dist/esm/adapter/webgl-device.js.map +1 -0
- package/dist/esm/adapter/webgl-shader.js +82 -0
- package/dist/esm/adapter/webgl-shader.js.map +1 -0
- package/dist/esm/classes/framebuffer.js +1 -1
- package/dist/esm/classes/framebuffer.js.map +1 -1
- package/dist/esm/classes/program-configuration.js +10 -97
- package/dist/esm/classes/program-configuration.js.map +1 -1
- package/dist/esm/classes/program.js +31 -22
- package/dist/esm/classes/program.js.map +1 -1
- package/dist/esm/classes/query.js +1 -1
- package/dist/esm/classes/query.js.map +1 -1
- package/dist/esm/classes/renderbuffer.js +1 -1
- package/dist/esm/classes/renderbuffer.js.map +1 -1
- package/dist/{classes/webgl-shader.js → esm/classes/shader.js} +6 -81
- package/dist/esm/classes/shader.js.map +1 -0
- package/dist/esm/classes/texture-3d.js +1 -1
- package/dist/esm/classes/texture-3d.js.map +1 -1
- package/dist/esm/classes/texture-cube.js.map +1 -1
- package/dist/esm/classes/texture.js +1 -1
- package/dist/esm/classes/texture.js.map +1 -1
- package/dist/esm/classes/transform-feedback.js +1 -1
- package/dist/esm/classes/transform-feedback.js.map +1 -1
- package/dist/esm/classes/vertex-array-object.js +5 -5
- package/dist/esm/classes/vertex-array-object.js.map +1 -1
- package/dist/esm/classes/vertex-array.js +2 -2
- package/dist/esm/classes/vertex-array.js.map +1 -1
- package/dist/esm/classes/webgl-buffer.js +1 -1
- package/dist/esm/classes/webgl-buffer.js.map +1 -1
- package/dist/esm/classes/webgl-resource.js +1 -1
- package/dist/esm/classes/webgl-resource.js.map +1 -1
- package/dist/esm/context/parameters/unified-parameter-api.js.map +1 -1
- package/dist/esm/context/parameters/webgl-parameters.js.map +1 -1
- package/dist/esm/helpers/get-program-bindings.js +228 -0
- package/dist/esm/helpers/get-program-bindings.js.map +1 -0
- package/dist/esm/helpers/program-bindings.js +2 -0
- package/dist/esm/helpers/program-bindings.js.map +1 -0
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/init.js +1 -1
- package/dist/esm/init.js.map +1 -1
- package/dist/esm/types/accessor.d.ts +29 -0
- package/dist/helpers/get-program-bindings.d.ts +8 -0
- package/dist/helpers/get-program-bindings.d.ts.map +1 -0
- package/dist/helpers/get-program-bindings.js +228 -0
- package/dist/helpers/get-program-bindings.js.map +1 -0
- package/dist/helpers/program-bindings.d.ts +41 -0
- package/dist/helpers/program-bindings.d.ts.map +1 -0
- package/dist/helpers/program-bindings.js +2 -0
- package/dist/helpers/program-bindings.js.map +1 -0
- package/dist/index.d.ts +6 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -2
- package/dist/index.js.map +1 -1
- package/dist/init.js +1 -1
- package/dist/init.js.map +1 -1
- package/dist/types/accessor.d.ts +29 -0
- package/package.json +5 -5
- package/src/adapter/converters/set-device-parameters.ts +182 -0
- package/src/adapter/converters/webgpu-texture-formats.ts +167 -0
- package/src/{device → adapter/device-helpers}/device-features.ts +4 -4
- package/src/{device → adapter/device-helpers}/device-limits.ts +1 -1
- package/src/{device → adapter/device-helpers}/get-device-info.ts +2 -2
- package/src/{webgl-utils → adapter/device-helpers}/is-old-ie.ts +0 -0
- package/src/{device → adapter}/webgl-device.ts +9 -9
- package/src/adapter/webgl-shader.ts +84 -0
- package/src/classes/framebuffer.ts +1 -1
- package/src/classes/program-configuration.ts +28 -81
- package/src/classes/program.ts +70 -62
- package/src/classes/query.ts +1 -1
- package/src/classes/renderbuffer.ts +1 -1
- package/src/classes/{webgl-shader.ts → shader.ts} +6 -79
- package/src/classes/texture-3d.ts +1 -1
- package/src/classes/texture-cube.ts +1 -1
- package/src/classes/texture.ts +1 -1
- package/src/classes/transform-feedback.ts +1 -1
- package/src/classes/vertex-array-object.ts +9 -8
- package/src/classes/vertex-array.ts +14 -8
- package/src/classes/webgl-buffer.ts +1 -1
- package/src/classes/webgl-resource.ts +1 -1
- package/src/context/parameters/unified-parameter-api.ts +3 -2
- package/src/context/parameters/webgl-parameters.ts +115 -115
- package/src/helpers/get-program-bindings.ts +244 -0
- package/src/helpers/program-bindings.ts +46 -0
- package/src/index.ts +12 -6
- package/src/init.ts +1 -1
- package/src/types/accessor.d.ts +29 -0
- package/dist/api/device2.d.ts +0 -52
- package/dist/api/device2.d.ts.map +0 -1
- package/dist/api/device2.js +0 -23
- package/dist/api/device2.js.map +0 -1
- package/dist/classes/webgl-shader.d.ts.map +0 -1
- package/dist/classes/webgl-shader.js.map +0 -1
- package/dist/device/check-glsl-extension.d.ts +0 -4
- package/dist/device/check-glsl-extension.d.ts.map +0 -1
- package/dist/device/check-glsl-extension.js +0 -22
- package/dist/device/check-glsl-extension.js.map +0 -1
- package/dist/device/device-features.d.ts.map +0 -1
- package/dist/device/device-features.js.map +0 -1
- package/dist/device/device-limits.d.ts.map +0 -1
- package/dist/device/device-limits.js.map +0 -1
- package/dist/device/get-device-info.d.ts.map +0 -1
- package/dist/device/get-device-info.js.map +0 -1
- package/dist/device/webgl-device.d.ts.map +0 -1
- package/dist/device/webgl-device.js.map +0 -1
- package/dist/es5/api/device2.js +0 -42
- package/dist/es5/api/device2.js.map +0 -1
- package/dist/es5/classes/webgl-shader.js.map +0 -1
- package/dist/es5/device/check-glsl-extension.js +0 -33
- package/dist/es5/device/check-glsl-extension.js.map +0 -1
- package/dist/es5/device/device-features.js.map +0 -1
- package/dist/es5/device/device-limits.js.map +0 -1
- package/dist/es5/device/get-device-info.js.map +0 -1
- package/dist/es5/device/webgl-device.js.map +0 -1
- package/dist/es5/webgl-utils/is-old-ie.js.map +0 -1
- package/dist/es5/webgl-utils/webgl-info.ts.disabled +0 -135
- package/dist/esm/api/device2.js +0 -23
- package/dist/esm/api/device2.js.map +0 -1
- package/dist/esm/classes/webgl-shader.js.map +0 -1
- package/dist/esm/device/check-glsl-extension.js +0 -22
- package/dist/esm/device/check-glsl-extension.js.map +0 -1
- package/dist/esm/device/device-features.js.map +0 -1
- package/dist/esm/device/device-limits.js.map +0 -1
- package/dist/esm/device/get-device-info.js.map +0 -1
- package/dist/esm/device/webgl-device.js.map +0 -1
- package/dist/esm/webgl-utils/is-old-ie.js.map +0 -1
- package/dist/esm/webgl-utils/webgl-info.ts.disabled +0 -135
- package/dist/webgl-utils/is-old-ie.d.ts.map +0 -1
- package/dist/webgl-utils/is-old-ie.js.map +0 -1
- package/dist/webgl-utils/webgl-info.ts.disabled +0 -135
- package/src/api/device2.ts +0 -71
- package/src/device/check-glsl-extension.ts +0 -44
- package/src/webgl-utils/webgl-info.ts.disabled +0 -135
package/src/classes/program.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {log, assert, uid} from '@luma.gl/api';
|
|
1
|
+
import {log, assert, uid, cast, Shader} from '@luma.gl/api';
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
|
-
import WebGLDevice from '../
|
|
3
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
4
4
|
import WebGLResource, {ResourceProps} from './webgl-resource';
|
|
5
5
|
import Texture from './texture';
|
|
6
6
|
import Framebuffer from './framebuffer';
|
|
7
7
|
import {parseUniformName, getUniformSetter} from './uniforms';
|
|
8
|
-
import {
|
|
8
|
+
import {WEBGLShader} from '../adapter/webgl-shader';
|
|
9
9
|
import ProgramConfiguration from './program-configuration';
|
|
10
10
|
import {copyUniform, checkUniformValues} from './uniforms';
|
|
11
11
|
|
|
@@ -19,38 +19,38 @@ const LOG_PROGRAM_PERF_PRIORITY = 4;
|
|
|
19
19
|
const GL_SEPARATE_ATTRIBS = 0x8c8d;
|
|
20
20
|
|
|
21
21
|
export type ProgramProps = ResourceProps & {
|
|
22
|
-
hash
|
|
23
|
-
vs
|
|
24
|
-
fs
|
|
25
|
-
varyings
|
|
22
|
+
hash?: string;
|
|
23
|
+
vs?: string | Shader;
|
|
24
|
+
fs?: string | Shader;
|
|
25
|
+
varyings?: string[];
|
|
26
26
|
bufferMode?: number;
|
|
27
|
-
}
|
|
27
|
+
};
|
|
28
28
|
|
|
29
29
|
export type ProgramDrawOptions = {
|
|
30
|
-
logPriority?:
|
|
31
|
-
drawMode?:
|
|
30
|
+
logPriority?: number;
|
|
31
|
+
drawMode?: number;
|
|
32
32
|
vertexCount: any;
|
|
33
33
|
offset?: number;
|
|
34
|
-
start?:
|
|
35
|
-
end?:
|
|
34
|
+
start?: number;
|
|
35
|
+
end?: number;
|
|
36
36
|
isIndexed?: boolean;
|
|
37
37
|
indexType?: any;
|
|
38
38
|
instanceCount?: number;
|
|
39
39
|
isInstanced?: boolean;
|
|
40
40
|
vertexArray?: any;
|
|
41
|
-
transformFeedback?: any;
|
|
42
|
-
framebuffer?:
|
|
41
|
+
transformFeedback?: any; // TransformFeedback;
|
|
42
|
+
framebuffer?: Framebuffer;
|
|
43
43
|
parameters?: {};
|
|
44
|
-
uniforms?: any
|
|
44
|
+
uniforms?: Record<string, any>;
|
|
45
45
|
samplers?: any;
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
export default class Program extends WebGLResource<ProgramProps> {
|
|
49
49
|
configuration: ProgramConfiguration;
|
|
50
50
|
// Experimental flag to avoid deleting Program object while it is cached
|
|
51
|
-
hash: string
|
|
52
|
-
vs;
|
|
53
|
-
fs;
|
|
51
|
+
hash: string; // Used by ProgramManager
|
|
52
|
+
vs: WEBGLShader;
|
|
53
|
+
fs: WEBGLShader;
|
|
54
54
|
uniforms: Record<string, any>;
|
|
55
55
|
varyings: Record<string, any>;
|
|
56
56
|
_textureUniforms: Record<string, any>;
|
|
@@ -58,18 +58,30 @@ export default class Program extends WebGLResource<ProgramProps> {
|
|
|
58
58
|
_textureIndexCounter: number = 0;
|
|
59
59
|
_uniformCount: number = 0;
|
|
60
60
|
_uniformSetters: Record<string, Function>;
|
|
61
|
-
|
|
62
|
-
constructor(gl: WebGLRenderingContext, props: ProgramProps = {}) {
|
|
63
|
-
super(WebGLDevice.attach(gl), props, {} as any);
|
|
64
|
-
|
|
65
61
|
|
|
62
|
+
constructor(device: WebGLDevice | WebGLRenderingContext, props: ProgramProps = {}) {
|
|
63
|
+
super(WebGLDevice.attach(device), props, {} as any);
|
|
66
64
|
this.initialize(props);
|
|
67
|
-
|
|
68
65
|
Object.seal(this);
|
|
69
|
-
|
|
70
66
|
this._setId(props.id);
|
|
71
67
|
}
|
|
72
68
|
|
|
69
|
+
destroy(options = {}) {
|
|
70
|
+
if (this._isCached) {
|
|
71
|
+
// This object is cached, do not delete
|
|
72
|
+
return this;
|
|
73
|
+
}
|
|
74
|
+
return super.delete(options);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
delete(options = {}) {
|
|
78
|
+
if (this._isCached) {
|
|
79
|
+
// This object is cached, do not delete
|
|
80
|
+
return this;
|
|
81
|
+
}
|
|
82
|
+
return super.delete(options);
|
|
83
|
+
}
|
|
84
|
+
|
|
73
85
|
initialize(props: ProgramProps = {}) {
|
|
74
86
|
const {hash, vs, fs, varyings, bufferMode = GL_SEPARATE_ATTRIBS} = props;
|
|
75
87
|
|
|
@@ -77,15 +89,18 @@ export default class Program extends WebGLResource<ProgramProps> {
|
|
|
77
89
|
|
|
78
90
|
// Create shaders if needed
|
|
79
91
|
this.vs =
|
|
80
|
-
typeof vs === 'string'
|
|
92
|
+
typeof vs === 'string'
|
|
93
|
+
? this.device.createShader({id: `${props.id}-vs`, source: vs, stage: 'vertex'})
|
|
94
|
+
: cast<WEBGLShader>(vs);
|
|
81
95
|
this.fs =
|
|
82
|
-
typeof fs === 'string'
|
|
83
|
-
|
|
84
|
-
|
|
96
|
+
typeof fs === 'string'
|
|
97
|
+
? this.device.createShader({id: `${props.id}-fs`, source: fs, stage: 'fragment'})
|
|
98
|
+
: cast<WEBGLShader>(fs);
|
|
99
|
+
assert(this.vs.stage === 'vertex');
|
|
100
|
+
assert(this.fs.stage === 'fragment');
|
|
85
101
|
|
|
86
102
|
// uniforms
|
|
87
103
|
this.uniforms = {};
|
|
88
|
-
|
|
89
104
|
this._textureUniforms = {};
|
|
90
105
|
|
|
91
106
|
// Setup varyings if supplied
|
|
@@ -102,14 +117,6 @@ export default class Program extends WebGLResource<ProgramProps> {
|
|
|
102
117
|
return this.setProps(props);
|
|
103
118
|
}
|
|
104
119
|
|
|
105
|
-
delete(options = {}) {
|
|
106
|
-
if (this._isCached) {
|
|
107
|
-
// This object is cached, do not delete
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
return super.delete(options);
|
|
111
|
-
}
|
|
112
|
-
|
|
113
120
|
setProps(props) {
|
|
114
121
|
if ('uniforms' in props) {
|
|
115
122
|
this.setUniforms(props.uniforms);
|
|
@@ -121,30 +128,30 @@ export default class Program extends WebGLResource<ProgramProps> {
|
|
|
121
128
|
// This function unifies those ways into a single call using common parameters with sane defaults
|
|
122
129
|
draw(options: ProgramDrawOptions): boolean {
|
|
123
130
|
const {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
131
|
+
logPriority, // Probe log priority, enables Model to do more integrated logging
|
|
132
|
+
|
|
133
|
+
drawMode = GL.TRIANGLES,
|
|
134
|
+
vertexCount,
|
|
135
|
+
offset = 0,
|
|
136
|
+
start,
|
|
137
|
+
end,
|
|
138
|
+
isIndexed = false,
|
|
139
|
+
indexType = GL.UNSIGNED_SHORT,
|
|
140
|
+
instanceCount = 0,
|
|
141
|
+
isInstanced = instanceCount > 0,
|
|
142
|
+
|
|
143
|
+
vertexArray = null,
|
|
144
|
+
transformFeedback,
|
|
145
|
+
framebuffer,
|
|
146
|
+
|
|
147
|
+
// Deprecated
|
|
148
|
+
uniforms,
|
|
149
|
+
samplers
|
|
150
|
+
} = options;
|
|
151
|
+
|
|
152
|
+
let {parameters = {}} = options;
|
|
153
|
+
|
|
154
|
+
if (uniforms || samplers) {
|
|
148
155
|
// DEPRECATED: v7.0 (deprecated earlier but warning not properly implemented)
|
|
149
156
|
log.deprecated('Program.draw({uniforms})', 'Program.setUniforms(uniforms)')();
|
|
150
157
|
this.setUniforms(uniforms || {});
|
|
@@ -342,7 +349,8 @@ export default class Program extends WebGLResource<ProgramProps> {
|
|
|
342
349
|
|
|
343
350
|
// Generate a default name for the program based on names of the shaders
|
|
344
351
|
_getName() {
|
|
345
|
-
let programName = this.vs.getName() || this.fs.getName();
|
|
352
|
+
// let programName = this.vs.getName() || this.fs.getName();
|
|
353
|
+
let programName = this.vs.id || this.fs.id;
|
|
346
354
|
programName = programName.replace(/shader/i, '');
|
|
347
355
|
programName = programName ? `${programName}-program` : 'program';
|
|
348
356
|
return programName;
|
package/src/classes/query.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// WebGL2 Query (also handles disjoint timer extensions)
|
|
2
2
|
import {assert} from '@luma.gl/api';
|
|
3
|
-
import WebGLDevice from '../
|
|
3
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
4
4
|
import {isWebGL2} from '../context/context/webgl-checks';
|
|
5
5
|
import WebGLResource, {ResourceProps} from './webgl-resource';
|
|
6
6
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* eslint-disable no-inline-comments */
|
|
2
2
|
import {assert} from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import WebGLDevice from '../
|
|
4
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
5
5
|
import WebGLResource, {ResourceProps} from './webgl-resource';
|
|
6
6
|
import {isRenderbufferFormatSupported, getRenderbufferFormatBytesPerPixel} from './renderbuffer-formats';
|
|
7
7
|
import {isWebGL2} from '../context/context/webgl-checks';
|
|
@@ -1,82 +1,18 @@
|
|
|
1
1
|
// luma.gl, MIT license
|
|
2
|
-
import {
|
|
2
|
+
import {assert, uid, ShaderProps} from '@luma.gl/api';
|
|
3
3
|
import GL from '@luma.gl/constants';
|
|
4
|
-
import {getShaderInfo
|
|
4
|
+
import {getShaderInfo} from '@luma.gl/shadertools';
|
|
5
5
|
import {assertWebGLContext} from '../context/context/webgl-checks';
|
|
6
|
-
import {
|
|
7
|
-
import WebGLDevice from '../
|
|
6
|
+
import {WEBGLShader} from '../adapter/webgl-shader'
|
|
7
|
+
import WebGLDevice from '../adapter/webgl-device'
|
|
8
8
|
|
|
9
9
|
const ERR_SOURCE = 'Shader: GLSL source code must be a JavaScript string';
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
export type {ShaderProps};
|
|
13
12
|
|
|
14
|
-
export class WEBGLShader extends ShaderAPI {
|
|
15
|
-
readonly device: WebGLDevice;
|
|
16
|
-
readonly gl: WebGLRenderingContext;
|
|
17
|
-
readonly handle: WebGLShader;
|
|
18
|
-
|
|
19
|
-
readonly stage: 'vertex' | 'fragment';
|
|
20
|
-
|
|
21
|
-
constructor(gl: WebGLRenderingContext, props: ShaderProps) {
|
|
22
|
-
super(WebGLDevice.attach(gl), {id: getShaderIdFromProps(props), ...props});
|
|
23
|
-
this.device = WebGLDevice.attach(gl);
|
|
24
|
-
this.gl = gl;
|
|
25
|
-
switch (this.props.stage) {
|
|
26
|
-
case 'vertex':
|
|
27
|
-
this.handle = this.props.handle || this.gl.createShader(GL.VERTEX_SHADER);
|
|
28
|
-
break;
|
|
29
|
-
case 'fragment':
|
|
30
|
-
this.handle = this.props.handle || this.gl.createShader(GL.FRAGMENT_SHADER);
|
|
31
|
-
break;
|
|
32
|
-
default:
|
|
33
|
-
throw new Error(this.props.stage);
|
|
34
|
-
}
|
|
35
|
-
this.stage = this.props.stage;
|
|
36
|
-
this._compile(props.source);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
destroy(): void {
|
|
40
|
-
if (this.handle) {
|
|
41
|
-
this.removeStats();
|
|
42
|
-
this.gl.deleteShader(this.handle);
|
|
43
|
-
// @ts-expect-error
|
|
44
|
-
this.handle = null;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async compilationInfo(): Promise<readonly CompilerMessage[]> {
|
|
49
|
-
const log = this.gl.getShaderInfoLog(this.handle);
|
|
50
|
-
return parseShaderCompilerLog(log);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// PRIVATE METHODS
|
|
54
|
-
_compile(source) {
|
|
55
|
-
if (!source.startsWith('#version ')) {
|
|
56
|
-
source = `#version 100\n${source}`;
|
|
57
|
-
}
|
|
58
|
-
this.gl.shaderSource(this.handle, source);
|
|
59
|
-
this.gl.compileShader(this.handle);
|
|
60
|
-
|
|
61
|
-
// TODO - For performance reasons, avoid checking shader compilation errors on production?
|
|
62
|
-
// TODO - Load log even when no error reported, to catch warnings?
|
|
63
|
-
// https://gamedev.stackexchange.com/questions/30429/how-to-detect-glsl-warnings
|
|
64
|
-
const compileStatus = this.gl.getShaderParameter(this.handle, GL.COMPILE_STATUS);
|
|
65
|
-
if (!compileStatus) {
|
|
66
|
-
const shaderLog = this.gl.getShaderInfoLog(this.handle);
|
|
67
|
-
const messages = parseShaderCompilerLog(shaderLog).filter(message => message.type === 'error');
|
|
68
|
-
const formattedLog = formatCompilerLog(messages, source);
|
|
69
|
-
const shaderName: string = getShaderInfo(source).name;
|
|
70
|
-
const shaderDescription = `${this.stage} shader ${shaderName}`;
|
|
71
|
-
log.error(`GLSL compilation errors in ${shaderName}\n${formattedLog}`)();
|
|
72
|
-
throw new Error(`GLSL compilation errors in ${shaderName}`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
13
|
/**
|
|
78
14
|
* Encapsulates the compiled or linked Shaders that execute portions of the WebGL Pipeline
|
|
79
|
-
*
|
|
15
|
+
* This is an internal class, use FragmentShader or VertexShader
|
|
80
16
|
*/
|
|
81
17
|
export class Shader extends WEBGLShader {
|
|
82
18
|
shaderType: GL.FRAGMENT_SHADER | GL.VERTEX_SHADER;
|
|
@@ -97,9 +33,7 @@ export class Shader extends WEBGLShader {
|
|
|
97
33
|
constructor(gl: WebGLRenderingContext, props: Omit<ShaderProps, 'stage'>) {
|
|
98
34
|
assertWebGLContext(gl);
|
|
99
35
|
assert(typeof props.source === 'string', ERR_SOURCE);
|
|
100
|
-
|
|
101
|
-
// @ts-expect-error
|
|
102
|
-
super(gl, {...props, id: getShaderIdFromProps(props), stage: props.shaderType === GL.VERTEX_SHADER ? 'vertex' : 'fragment'});
|
|
36
|
+
super(WebGLDevice.attach(gl), {...props, stage: props.shaderType === GL.VERTEX_SHADER ? 'vertex' : 'fragment'});
|
|
103
37
|
|
|
104
38
|
this.shaderType = props.shaderType;
|
|
105
39
|
this.source = props.source;
|
|
@@ -193,10 +127,3 @@ function getShaderProps(props: Omit<ShaderProps, 'stage'> | string, shaderType:
|
|
|
193
127
|
}
|
|
194
128
|
return {...props, shaderType};
|
|
195
129
|
}
|
|
196
|
-
|
|
197
|
-
/** Deduce an id, from shader source, or supplied id, or shader type */
|
|
198
|
-
function getShaderIdFromProps(props: ShaderProps): string {
|
|
199
|
-
return getShaderInfo(props.source).name ||
|
|
200
|
-
props.id ||
|
|
201
|
-
uid(`unnamed ${props.stage || Shader.getTypeName(props.shaderType)}`);
|
|
202
|
-
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Device} from '@luma.gl/api';
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
|
-
import WebGLDevice from '../
|
|
3
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
4
4
|
import {assertWebGL2Context} from '../context/context/webgl-checks';
|
|
5
5
|
import {withParameters} from '../context/state-tracker/with-parameters';
|
|
6
6
|
import Texture, {TextureProps} from './texture';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {Device, log} from '@luma.gl/api';
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
|
-
import WebGLDevice from '../
|
|
3
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
4
4
|
import {assertWebGLContext} from '../context/context/webgl-checks';
|
|
5
5
|
import Texture, {TextureProps} from './texture';
|
|
6
6
|
|
package/src/classes/texture.ts
CHANGED
|
@@ -4,7 +4,7 @@ import GL from '@luma.gl/constants';
|
|
|
4
4
|
import {isWebGL2, assertWebGL2Context} from '../context/context/webgl-checks';
|
|
5
5
|
import {withParameters} from '../context/state-tracker/with-parameters';
|
|
6
6
|
import {getKey, getKeyValue} from '../webgl-utils/constants-to-keys';
|
|
7
|
-
import WebGLDevice from '../
|
|
7
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
8
8
|
import Buffer from './webgl-buffer';
|
|
9
9
|
import {
|
|
10
10
|
TEXTURE_FORMATS,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {log, isObjectEmpty} from '@luma.gl/api';
|
|
2
2
|
import GL from '@luma.gl/constants';
|
|
3
|
-
import WebGLDevice from '../
|
|
3
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
4
4
|
import {isWebGL2, assertWebGL2Context} from '../context/context/webgl-checks';
|
|
5
5
|
import WebGLResource, {ResourceProps} from './webgl-resource';
|
|
6
6
|
import Buffer from './webgl-buffer';
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import type {NumberArray} from '@luma.gl/api';
|
|
1
2
|
import {assert, getScratchArray, fillArray} from '@luma.gl/api';
|
|
2
3
|
import GL from '@luma.gl/constants';
|
|
3
4
|
import {getBrowser} from '@probe.gl/env';
|
|
4
|
-
import WebGLDevice from '../
|
|
5
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
5
6
|
import {assertWebGL2Context, isWebGL2} from '../context/context/webgl-checks';
|
|
6
7
|
import Program from './program';
|
|
7
8
|
import WebGLResource, {ResourceProps} from './webgl-resource';
|
|
@@ -83,13 +84,13 @@ export default class VertexArrayObject extends WebGLResource<VertexArrayObjectPr
|
|
|
83
84
|
private isDefaultArray: boolean = false;
|
|
84
85
|
|
|
85
86
|
// Create a VertexArray
|
|
86
|
-
constructor(gl: WebGLRenderingContext,
|
|
87
|
+
constructor(gl: WebGLRenderingContext, props?: VertexArrayObjectProps) {
|
|
87
88
|
// Use program's id if program but no id is supplied
|
|
88
|
-
super(WebGLDevice.attach(gl), {...
|
|
89
|
+
super(WebGLDevice.attach(gl), {...props, id: props?.id || (props?.program && props?.program.id)}, {} as any);
|
|
89
90
|
|
|
90
91
|
this.buffer = null;
|
|
91
92
|
this.bufferValue = null;
|
|
92
|
-
this.isDefaultArray =
|
|
93
|
+
this.isDefaultArray = props?.isDefaultArray || false;
|
|
93
94
|
|
|
94
95
|
Object.seal(this);
|
|
95
96
|
}
|
|
@@ -108,7 +109,7 @@ export default class VertexArrayObject extends WebGLResource<VertexArrayObjectPr
|
|
|
108
109
|
|
|
109
110
|
// Set (bind) an elements buffer, for indexed rendering.
|
|
110
111
|
// Must be a Buffer bound to GL.ELEMENT_ARRAY_BUFFER. Constants not supported
|
|
111
|
-
setElementBuffer(elementBuffer = null, opts = {}) {
|
|
112
|
+
setElementBuffer(elementBuffer: Buffer = null, opts = {}) {
|
|
112
113
|
assert(!elementBuffer || elementBuffer.target === GL.ELEMENT_ARRAY_BUFFER, ERR_ELEMENTS);
|
|
113
114
|
|
|
114
115
|
// The GL.ELEMENT_ARRAY_BUFFER_BINDING is stored on the VertexArrayObject...
|
|
@@ -120,7 +121,7 @@ export default class VertexArrayObject extends WebGLResource<VertexArrayObjectPr
|
|
|
120
121
|
}
|
|
121
122
|
|
|
122
123
|
/** Set a location in vertex attributes array to a buffer, enables the location, sets divisor */
|
|
123
|
-
setBuffer(location, buffer, accessor): this {
|
|
124
|
+
setBuffer(location: number, buffer: Buffer, accessor: any): this {
|
|
124
125
|
// Check target
|
|
125
126
|
if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {
|
|
126
127
|
return this.setElementBuffer(buffer, accessor);
|
|
@@ -158,7 +159,7 @@ export default class VertexArrayObject extends WebGLResource<VertexArrayObjectPr
|
|
|
158
159
|
* TODO - handle single values for size 1 attributes?
|
|
159
160
|
* TODO - convert classic arrays based on known type?
|
|
160
161
|
*/
|
|
161
|
-
enable(location, enable = true): this {
|
|
162
|
+
enable(location: number, enable = true): this {
|
|
162
163
|
// Attribute 0 cannot be disabled in most desktop OpenGL based browsers
|
|
163
164
|
const disablingAttributeZero =
|
|
164
165
|
!enable &&
|
|
@@ -227,7 +228,7 @@ export default class VertexArrayObject extends WebGLResource<VertexArrayObjectPr
|
|
|
227
228
|
|
|
228
229
|
// TODO - convert Arrays based on known type? (read type from accessor, don't assume Float32Array)
|
|
229
230
|
// TODO - handle single values for size 1 attributes?
|
|
230
|
-
_normalizeConstantArrayValue(arrayValue) {
|
|
231
|
+
_normalizeConstantArrayValue(arrayValue: NumberArray) {
|
|
231
232
|
if (Array.isArray(arrayValue)) {
|
|
232
233
|
return new Float32Array(arrayValue);
|
|
233
234
|
}
|
|
@@ -3,6 +3,7 @@ import GL from '@luma.gl/constants';
|
|
|
3
3
|
import Accessor from './accessor';
|
|
4
4
|
import Buffer from './webgl-buffer';
|
|
5
5
|
import Program from './program';
|
|
6
|
+
import type {AttributeBinding} from '../helpers/program-bindings'
|
|
6
7
|
import ProgramConfiguration from './program-configuration';
|
|
7
8
|
import VertexArrayObject, {VertexArrayObjectProps} from './vertex-array-object';
|
|
8
9
|
|
|
@@ -165,7 +166,7 @@ export default class VertexArray {
|
|
|
165
166
|
}
|
|
166
167
|
|
|
167
168
|
// Set a location in vertex attributes array to a buffer
|
|
168
|
-
setBuffer(locationOrName, buffer: Buffer, appAccessor = {}): this {
|
|
169
|
+
setBuffer(locationOrName: number | string, buffer: Buffer, appAccessor = {}): this {
|
|
169
170
|
// Check target
|
|
170
171
|
if (buffer.target === GL.ELEMENT_ARRAY_BUFFER) {
|
|
171
172
|
this.setElementBuffer(buffer, appAccessor);
|
|
@@ -317,18 +318,18 @@ export default class VertexArray {
|
|
|
317
318
|
return {location, accessor};
|
|
318
319
|
}
|
|
319
320
|
|
|
320
|
-
_getAttributeInfo(attributeName) {
|
|
321
|
+
_getAttributeInfo(attributeName: string | number): AttributeBinding {
|
|
321
322
|
return this.configuration && this.configuration.getAttributeInfo(attributeName);
|
|
322
323
|
}
|
|
323
324
|
|
|
324
|
-
_getAttributeIndex(locationOrName) {
|
|
325
|
+
_getAttributeIndex(locationOrName: number | string): {location: number, name?: string} {
|
|
325
326
|
const location = Number(locationOrName);
|
|
326
327
|
if (Number.isFinite(location)) {
|
|
327
328
|
return {location};
|
|
328
329
|
}
|
|
329
330
|
|
|
330
|
-
const multiLocation = MULTI_LOCATION_ATTRIBUTE_REGEXP.exec(locationOrName);
|
|
331
|
-
const name = multiLocation ? multiLocation[1] : locationOrName;
|
|
331
|
+
const multiLocation = MULTI_LOCATION_ATTRIBUTE_REGEXP.exec(String(locationOrName));
|
|
332
|
+
const name = multiLocation ? multiLocation[1] : String(locationOrName);
|
|
332
333
|
const locationOffset = multiLocation ? Number(multiLocation[2]) : 0;
|
|
333
334
|
|
|
334
335
|
if (this.configuration) {
|
|
@@ -341,7 +342,12 @@ export default class VertexArray {
|
|
|
341
342
|
return {location: -1};
|
|
342
343
|
}
|
|
343
344
|
|
|
344
|
-
_setAttribute(locationOrName, value): void
|
|
345
|
+
_setAttribute(locationOrName: number | string, value: Buffer): void;
|
|
346
|
+
_setAttribute(locationOrName: number | string, value: [Buffer, any]): void;
|
|
347
|
+
_setAttribute(locationOrName: number | string, value: ArrayBuffer | any[]): void;
|
|
348
|
+
_setAttribute(locationOrName: number | string, value: {value: Buffer}): void;
|
|
349
|
+
|
|
350
|
+
_setAttribute(locationOrName: number | string, value): void {
|
|
345
351
|
if (value instanceof Buffer) {
|
|
346
352
|
// Signature: {attributeName: Buffer}
|
|
347
353
|
this.setBuffer(locationOrName, value);
|
|
@@ -368,7 +374,7 @@ export default class VertexArray {
|
|
|
368
374
|
// Updates all constant attribute values (constants are used when vertex attributes are disabled).
|
|
369
375
|
// This needs to be done repeatedly since in contrast to buffer bindings,
|
|
370
376
|
// constants are stored on the WebGL context, not the VAO
|
|
371
|
-
_setConstantAttributes(vertexCount, instanceCount): void {
|
|
377
|
+
_setConstantAttributes(vertexCount: number, instanceCount: number): void {
|
|
372
378
|
// TODO - use accessor to determine what length to use
|
|
373
379
|
const elementCount = Math.max(vertexCount | 0, instanceCount | 0);
|
|
374
380
|
let constant = this.values[0];
|
|
@@ -397,7 +403,7 @@ export default class VertexArray {
|
|
|
397
403
|
this.vertexArrayObject.setBuffer(0, buffer, this.accessors[0]);
|
|
398
404
|
}
|
|
399
405
|
|
|
400
|
-
_setConstantAttribute(location, constant): void {
|
|
406
|
+
_setConstantAttribute(location: number | string, constant): void {
|
|
401
407
|
VertexArrayObject.setConstant(this.gl, location, constant);
|
|
402
408
|
}
|
|
403
409
|
|
|
@@ -5,7 +5,7 @@ import {getWebGL2Context, assertWebGL2Context} from '../context/context/webgl-ch
|
|
|
5
5
|
import {AccessorObject} from '../types';
|
|
6
6
|
import Accessor from './accessor';
|
|
7
7
|
import {getGLTypeFromTypedArray, getTypedArrayFromGLType} from '../webgl-utils/typed-array-utils';
|
|
8
|
-
import WebGLDevice from '../
|
|
8
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
9
9
|
|
|
10
10
|
const DEBUG_DATA_LENGTH = 10;
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ import type {Device} from '@luma.gl/api';
|
|
|
4
4
|
export type {ResourceProps} from '@luma.gl/api';
|
|
5
5
|
import {isWebGL2, assertWebGLContext} from '../context/context/webgl-checks';
|
|
6
6
|
import {getKey, getKeyValue} from '../webgl-utils/constants-to-keys';
|
|
7
|
-
import WebGLDevice from '../
|
|
7
|
+
import WebGLDevice from '../adapter/webgl-device';
|
|
8
8
|
|
|
9
9
|
const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual methods';
|
|
10
10
|
|
|
@@ -81,8 +81,9 @@ export function setParameters(gl: WebGLRenderingContext, parameters: GLParameter
|
|
|
81
81
|
* considered a very slow operation, to be used only if/when a context already manipulated
|
|
82
82
|
* by external code needs to be synchronized for the first time
|
|
83
83
|
*/
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
export function getParameters(gl: WebGLRenderingContext, parameters?: Record<keyof GLParameters, any>): GLParameters;
|
|
85
|
+
export function getParameters(gl: WebGLRenderingContext, parameters?: (keyof GLParameters)[]): GLParameters;
|
|
86
|
+
export function getParameters(gl: WebGLRenderingContext, parameters: keyof GLParameters): GLParameters;
|
|
86
87
|
|
|
87
88
|
export function getParameters(gl, parameters) {
|
|
88
89
|
// default to querying all parameters
|