@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,10 +1,11 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { assert } from '@luma.gl/core';
|
|
4
5
|
import { GL } from '@luma.gl/constants';
|
|
5
|
-
import { WebGLResource } from
|
|
6
|
-
import { isRenderbufferFormatSupported } from
|
|
7
|
-
import { convertTextureFormatToGL, getTextureFormatBytesPerPixel } from
|
|
6
|
+
import { WebGLResource } from "./webgl-resource.js";
|
|
7
|
+
import { isRenderbufferFormatSupported } from "../converters/texture-formats.js";
|
|
8
|
+
import { convertTextureFormatToGL, getTextureFormatBytesPerPixel } from "../converters/texture-formats.js";
|
|
8
9
|
/**
|
|
9
10
|
* Renderbuffers are GPU objects that contain images.
|
|
10
11
|
* In contrast to Textures they are optimized for use as render targets, with Framebuffers.
|
|
@@ -25,16 +26,28 @@ export class WEBGLRenderbuffer extends WebGLResource {
|
|
|
25
26
|
height: 1,
|
|
26
27
|
samples: 0
|
|
27
28
|
};
|
|
28
|
-
get [Symbol.toStringTag]() {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
get
|
|
32
|
-
|
|
33
|
-
|
|
29
|
+
get [Symbol.toStringTag]() {
|
|
30
|
+
return 'Renderbuffer';
|
|
31
|
+
}
|
|
32
|
+
get width() {
|
|
33
|
+
return this.props.width;
|
|
34
|
+
}
|
|
35
|
+
get height() {
|
|
36
|
+
return this.props.height;
|
|
37
|
+
}
|
|
38
|
+
get format() {
|
|
39
|
+
return this.props.format;
|
|
40
|
+
}
|
|
41
|
+
get samples() {
|
|
42
|
+
return this.props.samples;
|
|
43
|
+
}
|
|
44
|
+
get attachment() {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
34
47
|
/** WebGL format constant */
|
|
35
48
|
glFormat;
|
|
36
49
|
static isTextureFormatSupported(device, format) {
|
|
37
|
-
return isRenderbufferFormatSupported(device.gl, format);
|
|
50
|
+
return isRenderbufferFormatSupported(device.gl, format, device._extensions);
|
|
38
51
|
}
|
|
39
52
|
constructor(device, props) {
|
|
40
53
|
// TODO - remove temporary sanity check
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { Resource } from '@luma.gl/core';
|
|
2
1
|
import type { Device, ResourceProps } from '@luma.gl/core';
|
|
2
|
+
import { Resource } from '@luma.gl/core';
|
|
3
3
|
import { GL } from '@luma.gl/constants';
|
|
4
|
-
import { WebGLDevice } from
|
|
4
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
5
5
|
/**
|
|
6
6
|
* Base class for WebGL object wrappers
|
|
7
7
|
*/
|
|
@@ -20,28 +20,6 @@ export declare abstract class WebGLResource<Props extends ResourceProps> extends
|
|
|
20
20
|
}): this;
|
|
21
21
|
bind(funcOrHandle?: any): any;
|
|
22
22
|
unbind(): void;
|
|
23
|
-
/**
|
|
24
|
-
* Query a Resource parameter
|
|
25
|
-
*
|
|
26
|
-
* @param name
|
|
27
|
-
* @return param
|
|
28
|
-
*/
|
|
29
|
-
getParameter(pname: number, props?: any): any;
|
|
30
|
-
getParameters(options?: {
|
|
31
|
-
parameters?: any;
|
|
32
|
-
keys?: any;
|
|
33
|
-
}): Record<string, any>;
|
|
34
|
-
/**
|
|
35
|
-
* Update a Resource setting
|
|
36
|
-
*
|
|
37
|
-
* @todo - cache parameter to avoid issuing WebGL calls?
|
|
38
|
-
*
|
|
39
|
-
* @param pname - parameter (GL constant, value or key)
|
|
40
|
-
* @param value {GLint|GLfloat|GLenum}
|
|
41
|
-
* @return returns self to enable chaining
|
|
42
|
-
*/
|
|
43
|
-
setParameter(pname: GL | string, value: any): this;
|
|
44
|
-
setParameters(parameters: Record<GL, any>): this;
|
|
45
23
|
stubRemovedMethods(className: string, version: string, methodNames: string[]): void;
|
|
46
24
|
initialize(props: ResourceProps): void;
|
|
47
25
|
_createHandle(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-resource.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-resource.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-resource.d.ts","sourceRoot":"","sources":["../../../src/adapter/objects/webgl-resource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACzD,OAAO,EAAC,QAAQ,EAA0B,MAAM,eAAe,CAAC;AAChE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAI5C;;GAEG;AACH,8BAAsB,aAAa,CAAC,KAAK,SAAS,aAAa,CAAE,SAAQ,QAAQ,CAAC,KAAK,CAAC;IACtF,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,sBAAsB,CAAC;IACpC,QAAQ,CAAC,GAAG,EAAE,sBAAsB,CAAC;IACrC,OAAO,CAAC,OAAO,CAAM;IAErB,OAAO,CAAC,MAAM,CAAS;IAEvB,UAAU,SAAK;gBAEH,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC;IA2B9D,QAAQ,IAAI,MAAM;IAI3B,IAAI,MAAM,QAWT;IAEQ,MAAM,CAAC,EAAC,cAAsB,EAAC;;KAAK;IAmB7C,IAAI,CAAC,YAAY,MAAc;IAuB/B,MAAM;IAKN,kBAAkB,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE;IAK5E,UAAU,CAAC,KAAK,EAAE,aAAa;IAG/B,aAAa;IAIb,aAAa;IAIb,WAAW,CAAC,MAAM,EAAE,GAAG;IAIvB,kBAAkB;IAIlB,aAAa,CAAC,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM;IAI5D,aAAa,CAAC,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,GAAG;CAuC7C"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
|
-
import { Resource,
|
|
4
|
-
import { WebGLDevice } from
|
|
5
|
-
// Requires full GL enum to be bundled... Make these bindings dependent on dynamic import (debug)?
|
|
6
|
-
import { getKeyValue } from './constants-to-keys';
|
|
4
|
+
import { Resource, uid, stubRemovedMethods } from '@luma.gl/core';
|
|
5
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
7
6
|
const ERR_RESOURCE_METHOD_UNDEFINED = 'Resource subclass must define virtual methods';
|
|
8
7
|
/**
|
|
9
8
|
* Base class for WebGL object wrappers
|
|
@@ -20,7 +19,7 @@ export class WebGLResource extends Resource {
|
|
|
20
19
|
super(device, props, defaultProps);
|
|
21
20
|
this.device = WebGLDevice.attach(device);
|
|
22
21
|
const gl = this.device.gl;
|
|
23
|
-
// extends
|
|
22
|
+
// extends
|
|
24
23
|
const { id } = props || {};
|
|
25
24
|
this.gl = gl;
|
|
26
25
|
this.gl2 = gl;
|
|
@@ -63,7 +62,7 @@ export class WebGLResource extends Resource {
|
|
|
63
62
|
// @ts-expect-error
|
|
64
63
|
if (children && deleteChildren) {
|
|
65
64
|
// @ts-expect-error
|
|
66
|
-
children.filter(Boolean).forEach(
|
|
65
|
+
children.filter(Boolean).forEach(child => child.destroy());
|
|
67
66
|
}
|
|
68
67
|
return this;
|
|
69
68
|
}
|
|
@@ -88,99 +87,6 @@ export class WebGLResource extends Resource {
|
|
|
88
87
|
unbind() {
|
|
89
88
|
this.bind(null);
|
|
90
89
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Query a Resource parameter
|
|
93
|
-
*
|
|
94
|
-
* @param name
|
|
95
|
-
* @return param
|
|
96
|
-
*/
|
|
97
|
-
getParameter(pname, props = {}) {
|
|
98
|
-
pname = getKeyValue(this.gl, pname);
|
|
99
|
-
assert(pname);
|
|
100
|
-
// @ts-expect-error
|
|
101
|
-
const parameters = this.constructor.PARAMETERS || {};
|
|
102
|
-
// Use parameter definitions to handle unsupported parameters
|
|
103
|
-
const parameter = parameters[pname];
|
|
104
|
-
if (parameter) {
|
|
105
|
-
// Check if we can query for this parameter
|
|
106
|
-
const parameterAvailable = (!('extension' in parameter) || this.gl.getExtension(parameter.extension));
|
|
107
|
-
if (!parameterAvailable) {
|
|
108
|
-
return parameter.webgl2;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
// If unknown parameter - Could be a valid parameter not covered by PARAMS
|
|
112
|
-
// Attempt to query for it and let WebGL report errors
|
|
113
|
-
return this._getParameter(pname, props);
|
|
114
|
-
}
|
|
115
|
-
// Many resources support a getParameter call -
|
|
116
|
-
// getParameters will get all parameters - slow but useful for debugging
|
|
117
|
-
// eslint-disable-next-line complexity
|
|
118
|
-
getParameters(options = {}) {
|
|
119
|
-
const { parameters, keys } = options;
|
|
120
|
-
// Get parameter definitions for this Resource
|
|
121
|
-
// @ts-expect-error
|
|
122
|
-
const PARAMETERS = this.constructor.PARAMETERS || {};
|
|
123
|
-
const values = {};
|
|
124
|
-
// Query all parameters if no list provided
|
|
125
|
-
const parameterKeys = parameters || Object.keys(PARAMETERS);
|
|
126
|
-
// WEBGL limits
|
|
127
|
-
for (const pname of parameterKeys) {
|
|
128
|
-
const parameter = PARAMETERS[pname];
|
|
129
|
-
// Check if this parameter is available on this platform
|
|
130
|
-
const parameterAvailable = parameter &&
|
|
131
|
-
(!('extension' in parameter) || this.gl.getExtension(parameter.extension));
|
|
132
|
-
if (parameterAvailable) {
|
|
133
|
-
const key = keys ? this.device.getGLKey(pname) : pname;
|
|
134
|
-
values[key] = this.getParameter(pname, options);
|
|
135
|
-
if (keys && parameter.type === 'GLenum') {
|
|
136
|
-
values[key] = this.device.getGLKey(values[key]);
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
return values;
|
|
141
|
-
}
|
|
142
|
-
/**
|
|
143
|
-
* Update a Resource setting
|
|
144
|
-
*
|
|
145
|
-
* @todo - cache parameter to avoid issuing WebGL calls?
|
|
146
|
-
*
|
|
147
|
-
* @param pname - parameter (GL constant, value or key)
|
|
148
|
-
* @param value {GLint|GLfloat|GLenum}
|
|
149
|
-
* @return returns self to enable chaining
|
|
150
|
-
*/
|
|
151
|
-
setParameter(pname, value) {
|
|
152
|
-
pname = getKeyValue(this.gl, pname);
|
|
153
|
-
assert(pname);
|
|
154
|
-
// @ts-expect-error
|
|
155
|
-
const parameters = this.constructor.PARAMETERS || {};
|
|
156
|
-
const parameter = parameters[pname];
|
|
157
|
-
if (parameter) {
|
|
158
|
-
// Check if this parameter is available on this platform
|
|
159
|
-
const parameterAvailable = (!('extension' in parameter) || this.gl.getExtension(parameter.extension));
|
|
160
|
-
if (!parameterAvailable) {
|
|
161
|
-
throw new Error('Parameter not available on this platform');
|
|
162
|
-
}
|
|
163
|
-
// Handle string keys
|
|
164
|
-
if (parameter.type === 'GLenum') {
|
|
165
|
-
// @ts-expect-error
|
|
166
|
-
value = getKeyValue(value);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
// If unknown parameter - Could be a valid parameter not covered by PARAMS
|
|
170
|
-
// attempt to set it and let WebGL report errors
|
|
171
|
-
this._setParameter(pname, value);
|
|
172
|
-
return this;
|
|
173
|
-
}
|
|
174
|
-
/*
|
|
175
|
-
* Batch update resource parameters
|
|
176
|
-
* Assumes the subclass supports a setParameter call
|
|
177
|
-
*/
|
|
178
|
-
setParameters(parameters) {
|
|
179
|
-
for (const pname in parameters) {
|
|
180
|
-
this.setParameter(pname, parameters[pname]);
|
|
181
|
-
}
|
|
182
|
-
return this;
|
|
183
|
-
}
|
|
184
90
|
// Install stubs for removed methods
|
|
185
91
|
stubRemovedMethods(className, version, methodNames) {
|
|
186
92
|
return stubRemovedMethods(this, className, version, methodNames);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { BufferProps } from '@luma.gl/core';
|
|
2
2
|
import { Buffer } from '@luma.gl/core';
|
|
3
3
|
import { GL } from '@luma.gl/constants';
|
|
4
|
-
import { WebGLDevice } from
|
|
4
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
5
5
|
/** WebGL Buffer interface */
|
|
6
6
|
export declare class WEBGLBuffer extends Buffer {
|
|
7
7
|
readonly device: WebGLDevice;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-buffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-buffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,MAAM,EAAS,MAAM,eAAe,CAAC;AAC7C,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,6BAA6B;AAC7B,qBAAa,WAAY,SAAQ,MAAM;IACrC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAC7B,QAAQ,CAAC,EAAE,EAAE,sBAAsB,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,kDAAkD;IAClD,QAAQ,CAAC,QAAQ,EAAE,EAAE,CAAC,YAAY,GAAG,EAAE,CAAC,oBAAoB,GAAG,EAAE,CAAC,cAAc,CAAC;IACjF,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,GAAG,EAAE,CAAC,YAAY,CAAC;IACnD,yEAAyE;IACzE,QAAQ,CAAC,WAAW,EAAE,EAAE,CAAC,cAAc,GAAG,EAAE,CAAC,YAAY,CAAqB;IAE9E,2DAA2D;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,2BAA2B;IAC3B,SAAS,EAAE,MAAM,CAAC;gBAEN,MAAM,EAAE,WAAW,EAAE,KAAK,GAAE,WAAgB;IA2BxD,sEAAsE;IACtE,aAAa,CACX,IAAI,EAAE,WAAW,GAAG,eAAe,EACnC,UAAU,GAAE,MAAU,EACtB,UAAU,GAAE,MAAqC,GAChD,IAAI;IAgBP,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IA2BpC,OAAO,IAAI,IAAI;IAWf,KAAK,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,GAAE,MAAU,GAAG,IAAI;IAmBnE,+CAA+C;IAChC,SAAS,CAAC,UAAU,SAAI,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIlF,2DAA2D;IAClD,aAAa,CAAC,UAAU,SAAI,EAAE,UAAU,CAAC,EAAE,MAAM,GAAG,UAAU;CAexE"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/core';
|
|
2
2
|
import { CommandBuffer } from '@luma.gl/core';
|
|
3
3
|
import { GL } from '@luma.gl/constants';
|
|
4
|
-
import { WebGLDevice } from
|
|
4
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
5
5
|
type CopyBufferToBufferCommand = {
|
|
6
6
|
name: 'copy-buffer-to-buffer';
|
|
7
7
|
options: CopyBufferToBufferOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-command-buffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-buffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC5B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAC,aAAa,EAAuB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AAEtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAU5C,KAAK,yBAAyB,GAAG;IAC/B,IAAI,EAAE,uBAAuB,CAAC;IAC9B,OAAO,EAAE,yBAAyB,CAAC;CACpC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,KAAK,0BAA0B,GAAG;IAChC,IAAI,EAAE,wBAAwB,CAAC;IAC/B,OAAO,EAAE,0BAA0B,CAAC;CACrC,CAAC;AAEF,KAAK,2BAA2B,GAAG;IACjC,IAAI,EAAE,yBAAyB,CAAC;IAChC,OAAO,EAAE,2BAA2B,CAAC;CACtC,CAAC;AAEF,KAAK,OAAO,GACR,yBAAyB,GACzB,0BAA0B,GAC1B,0BAA0B,GAC1B,2BAA2B,CAAC;AAEhC,qBAAa,kBAAmB,SAAQ,aAAa;IACnD,MAAM,EAAE,WAAW,CAAC;IACpB,QAAQ,EAAE,OAAO,EAAE,CAAM;gBAEb,MAAM,EAAE,WAAW;IAK/B,cAAc,CAAC,QAAQ,GAAE,OAAO,EAAkB;CAkBnD;AA6PD,wBAAgB,oBAAoB,CAAC,MAAM,KAAA,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAmB1D;AAGD,wBAAgB,aAAa,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,CAcjD"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { CommandBuffer, Texture } from '@luma.gl/core';
|
|
4
5
|
import { GL } from '@luma.gl/constants';
|
|
5
|
-
import { WEBGLTexture } from
|
|
6
|
-
import { getWebGLTextureParameters } from
|
|
6
|
+
import { WEBGLTexture } from "./webgl-texture.js";
|
|
7
|
+
import { getWebGLTextureParameters } from "../converters/texture-formats.js";
|
|
7
8
|
function cast(value) {
|
|
8
9
|
return value;
|
|
9
10
|
}
|
|
@@ -98,7 +99,7 @@ function _copyTextureToBuffer(device, options) {
|
|
|
98
99
|
const webglBuffer = destination;
|
|
99
100
|
const sourceWidth = width || framebuffer.width;
|
|
100
101
|
const sourceHeight = height || framebuffer.height;
|
|
101
|
-
const sourceParams = getWebGLTextureParameters(framebuffer.texture.format);
|
|
102
|
+
const sourceParams = getWebGLTextureParameters(framebuffer.texture.props.format);
|
|
102
103
|
const sourceFormat = sourceParams.dataFormat;
|
|
103
104
|
const sourceType = sourceParams.type;
|
|
104
105
|
// if (!target) {
|
|
@@ -153,7 +154,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
153
154
|
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
|
|
154
155
|
origin = [0, 0],
|
|
155
156
|
/** Texture to copy to/from. */
|
|
156
|
-
destination
|
|
157
|
+
destination
|
|
157
158
|
/** Mip-map level of the texture to copy to/from. (Default 0) */
|
|
158
159
|
// destinationMipLevel = options.mipLevel,
|
|
159
160
|
/** Defines the origin of the copy - the minimum corner of the texture sub-region to copy to/from. */
|
|
@@ -161,7 +162,7 @@ function _copyTextureToTexture(device, options) {
|
|
|
161
162
|
/** Defines which aspects of the texture to copy to/from. */
|
|
162
163
|
// destinationAspect = options.aspect,
|
|
163
164
|
} = options;
|
|
164
|
-
let { width = options.destination.width, height = options.destination.width
|
|
165
|
+
let { width = options.destination.width, height = options.destination.width
|
|
165
166
|
// depthOrArrayLayers = 0
|
|
166
167
|
} = options;
|
|
167
168
|
const destinationMipmaplevel = 0;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandEncoder, CommandEncoderProps } from '@luma.gl/core';
|
|
2
|
-
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions } from '@luma.gl/core';
|
|
3
|
-
import { WEBGLCommandBuffer } from
|
|
4
|
-
import { WebGLDevice } from
|
|
2
|
+
import type { CopyBufferToBufferOptions, CopyBufferToTextureOptions, CopyTextureToBufferOptions, CopyTextureToTextureOptions, QuerySet, Buffer } from '@luma.gl/core';
|
|
3
|
+
import { WEBGLCommandBuffer } from "./webgl-command-buffer.js";
|
|
4
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
5
5
|
export declare class WEBGLCommandEncoder extends CommandEncoder {
|
|
6
6
|
readonly device: WebGLDevice;
|
|
7
7
|
readonly commandBuffer: WEBGLCommandBuffer;
|
|
@@ -15,5 +15,10 @@ export declare class WEBGLCommandEncoder extends CommandEncoder {
|
|
|
15
15
|
pushDebugGroup(groupLabel: string): void;
|
|
16
16
|
popDebugGroup(): void;
|
|
17
17
|
insertDebugMarker(markerLabel: string): void;
|
|
18
|
+
resolveQuerySet(querySet: QuerySet, destination: Buffer, options?: {
|
|
19
|
+
firstQuery?: number;
|
|
20
|
+
queryCount?: number;
|
|
21
|
+
destinationOffset?: number;
|
|
22
|
+
}): void;
|
|
18
23
|
}
|
|
19
24
|
//# sourceMappingURL=webgl-command-encoder.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-command-encoder.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-command-encoder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,cAAc,EAAE,mBAAmB,EAAC,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EACV,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,QAAQ,EACR,MAAM,EACP,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAC,kBAAkB,EAAC,kCAA+B;AAC1D,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C,qBAAa,mBAAoB,SAAQ,cAAc;IACrD,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,QAAQ,CAAC,aAAa,EAAE,kBAAkB,CAAC;gBAE/B,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,mBAAmB;IAMlD,OAAO,IAAI,IAAI;IAEf,MAAM,IAAI,IAAI;IAQvB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,IAAI;IAI5D,mBAAmB,CAAC,OAAO,EAAE,0BAA0B;IAIvD,mBAAmB,CAAC,OAAO,EAAE,0BAA0B,GAAG,IAAI;IAI9D,oBAAoB,CAAC,OAAO,EAAE,2BAA2B,GAAG,IAAI;IAIvD,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa;IAEb,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAE5C,eAAe,CACtB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;QACR,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,iBAAiB,CAAC,EAAE,MAAM,CAAC;KAC5B,GACA,IAAI;CACR"}
|
|
@@ -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 { CommandEncoder } from '@luma.gl/core';
|
|
4
|
-
import { WEBGLCommandBuffer } from
|
|
5
|
+
import { WEBGLCommandBuffer } from "./webgl-command-buffer.js";
|
|
5
6
|
export class WEBGLCommandEncoder extends CommandEncoder {
|
|
6
7
|
device;
|
|
7
8
|
commandBuffer;
|
|
@@ -32,4 +33,5 @@ export class WEBGLCommandEncoder extends CommandEncoder {
|
|
|
32
33
|
pushDebugGroup(groupLabel) { }
|
|
33
34
|
popDebugGroup() { }
|
|
34
35
|
insertDebugMarker(markerLabel) { }
|
|
36
|
+
resolveQuerySet(querySet, destination, options) { }
|
|
35
37
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
/*
|
|
4
5
|
export class WEBGLExternalTexture extends WEBGLTexture {
|
|
@@ -90,4 +91,4 @@ export class WEBGLExternalTexture extends WEBGLTexture {
|
|
|
90
91
|
}
|
|
91
92
|
|
|
92
93
|
|
|
93
|
-
*/
|
|
94
|
+
*/
|
|
@@ -1,22 +1,20 @@
|
|
|
1
1
|
import type { FramebufferProps, TextureFormat } from '@luma.gl/core';
|
|
2
2
|
import { Framebuffer, Texture } from '@luma.gl/core';
|
|
3
3
|
import { GL } from '@luma.gl/constants';
|
|
4
|
-
import { WebGLDevice } from
|
|
5
|
-
import { WEBGLTexture } from
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
export type Attachment =
|
|
4
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
5
|
+
import { WEBGLTexture } from "./webgl-texture.js";
|
|
6
|
+
import { WEBGLTextureView } from "./webgl-texture-view.js";
|
|
7
|
+
import { WEBGLRenderbuffer } from "../objects/webgl-renderbuffer.js";
|
|
8
|
+
export type Attachment = WEBGLTextureView | WEBGLTexture | WEBGLRenderbuffer;
|
|
9
9
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
10
10
|
export declare class WEBGLFramebuffer extends Framebuffer {
|
|
11
11
|
device: WebGLDevice;
|
|
12
12
|
gl: WebGL2RenderingContext;
|
|
13
13
|
handle: WebGLFramebuffer;
|
|
14
|
-
get texture():
|
|
14
|
+
get texture(): import("@luma.gl/core").TextureView;
|
|
15
15
|
constructor(device: WebGLDevice, props: FramebufferProps);
|
|
16
16
|
/** destroys any auto created resources etc. */
|
|
17
17
|
destroy(): void;
|
|
18
|
-
/** Check the status */
|
|
19
|
-
protected _checkStatus(): void;
|
|
20
18
|
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
21
19
|
protected createDepthStencilTexture(format: TextureFormat): Texture;
|
|
22
20
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-framebuffer.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-framebuffer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAC,gBAAgB,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AACnE,OAAO,EAAC,WAAW,EAAE,OAAO,EAAS,MAAM,eAAe,CAAC;AAC3D,OAAO,EAAC,EAAE,EAAC,MAAM,oBAAoB,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAC,YAAY,EAAC,2BAAwB;AAC7C,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AACtD,OAAO,EAAC,iBAAiB,EAAC,yCAAsC;AAGhE,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,YAAY,GAAG,iBAAiB,CAAC;AAE7E,iDAAiD;AACjD,qBAAa,gBAAiB,SAAQ,WAAW;IAC/C,MAAM,EAAE,WAAW,CAAC;IACpB,EAAE,EAAE,sBAAsB,CAAC;IAC3B,MAAM,EAAE,gBAAgB,CAAC;IAEzB,IAAI,OAAO,wCAEV;gBAEW,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,gBAAgB;IAkDxD,+CAA+C;IACtC,OAAO,IAAI,IAAI;IAUxB,mGAAmG;cAChF,yBAAyB,CAAC,MAAM,EAAE,aAAa,GAAG,OAAO;IAW5E;;OAEG;cACgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IA2BzE,4BAA4B;IAC5B,SAAS,CAAC,UAAU,CAClB,eAAe,EAAE,EAAE,EACnB,UAAU,EAAE,UAAU,GACrB,YAAY,GAAG,iBAAiB;IAwBnC,SAAS,CAAC,wBAAwB,CAAC,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,iBAAiB,GAAG,IAAI;IASzF;;;;;OAKG;IACH,SAAS,CAAC,cAAc,CACtB,UAAU,EAAE,EAAE,EACd,OAAO,EAAE,YAAY,EACrB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,GACZ,IAAI;CA2BR"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
-
// luma.gl
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
2
3
|
// Copyright (c) vis.gl contributors
|
|
3
4
|
import { Framebuffer, assert } from '@luma.gl/core';
|
|
4
5
|
import { GL } from '@luma.gl/constants';
|
|
5
|
-
import { WEBGLTexture } from
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { WEBGLTexture } from "./webgl-texture.js";
|
|
7
|
+
import { WEBGLTextureView } from "./webgl-texture-view.js";
|
|
8
|
+
import { WEBGLRenderbuffer } from "../objects/webgl-renderbuffer.js";
|
|
9
|
+
import { getDepthStencilAttachmentWebGL } from "../converters/texture-formats.js";
|
|
8
10
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
9
11
|
export class WEBGLFramebuffer extends Framebuffer {
|
|
10
12
|
device;
|
|
@@ -37,14 +39,18 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
if (this.depthStencilAttachment) {
|
|
40
|
-
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.format), this.depthStencilAttachment);
|
|
42
|
+
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format), this.depthStencilAttachment);
|
|
43
|
+
}
|
|
44
|
+
/** Check the status */
|
|
45
|
+
// @ts-expect-error
|
|
46
|
+
if (props.check !== false) {
|
|
47
|
+
const status = this.gl.checkFramebufferStatus(GL.FRAMEBUFFER);
|
|
48
|
+
if (status !== GL.FRAMEBUFFER_COMPLETE) {
|
|
49
|
+
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
50
|
+
}
|
|
41
51
|
}
|
|
42
52
|
this.gl.bindFramebuffer(GL.FRAMEBUFFER, null);
|
|
43
53
|
}
|
|
44
|
-
// @ts-expect-error
|
|
45
|
-
if (props.check !== false) {
|
|
46
|
-
this._checkStatus();
|
|
47
|
-
}
|
|
48
54
|
}
|
|
49
55
|
/** destroys any auto created resources etc. */
|
|
50
56
|
destroy() {
|
|
@@ -55,17 +61,6 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
55
61
|
}
|
|
56
62
|
}
|
|
57
63
|
// PRIVATE
|
|
58
|
-
/** Check the status */
|
|
59
|
-
_checkStatus() {
|
|
60
|
-
const { gl } = this;
|
|
61
|
-
// TODO - should we really rely on this trick?
|
|
62
|
-
const prevHandle = gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
|
|
63
|
-
const status = gl.checkFramebufferStatus(GL.FRAMEBUFFER);
|
|
64
|
-
gl.bindFramebuffer(GL.FRAMEBUFFER, prevHandle || null);
|
|
65
|
-
if (status !== gl.FRAMEBUFFER_COMPLETE) {
|
|
66
|
-
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
64
|
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
70
65
|
createDepthStencilTexture(format) {
|
|
71
66
|
return new WEBGLRenderbuffer(this.device, {
|
|
@@ -96,10 +91,10 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
96
91
|
}
|
|
97
92
|
// TODO Not clear that this is better than default destroy/create implementation
|
|
98
93
|
for (const colorAttachment of this.colorAttachments) {
|
|
99
|
-
colorAttachment.resize({ width, height });
|
|
94
|
+
colorAttachment.texture.resize({ width, height });
|
|
100
95
|
}
|
|
101
96
|
if (this.depthStencilAttachment) {
|
|
102
|
-
this.depthStencilAttachment.resize({ width, height });
|
|
97
|
+
this.depthStencilAttachment.texture.resize({ width, height });
|
|
103
98
|
}
|
|
104
99
|
return this;
|
|
105
100
|
}
|
|
@@ -118,6 +113,11 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
118
113
|
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
119
114
|
return attachment;
|
|
120
115
|
}
|
|
116
|
+
else if (attachment instanceof WEBGLTextureView) {
|
|
117
|
+
const textureView = attachment;
|
|
118
|
+
this._attachTexture(attachmentPoint, textureView.texture, textureView.props.baseMipLevel, textureView.props.baseArrayLayer);
|
|
119
|
+
return attachment.texture;
|
|
120
|
+
}
|
|
121
121
|
throw new Error('attach');
|
|
122
122
|
}
|
|
123
123
|
_attachWEBGLRenderbuffer(attachment, renderbuffer) {
|
|
@@ -156,7 +156,9 @@ export class WEBGLFramebuffer extends Framebuffer {
|
|
|
156
156
|
function mapIndexToCubeMapFace(layer) {
|
|
157
157
|
// TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515)
|
|
158
158
|
// if smaller assume layer is index, otherwise assume it is already a cube map face constant
|
|
159
|
-
return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X
|
|
159
|
+
return layer < GL.TEXTURE_CUBE_MAP_POSITIVE_X
|
|
160
|
+
? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X
|
|
161
|
+
: layer;
|
|
160
162
|
}
|
|
161
163
|
// Helper METHODS
|
|
162
164
|
// Get a string describing the framebuffer error if installed
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { QuerySet, QuerySetProps } from '@luma.gl/core';
|
|
2
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
3
|
+
/**
|
|
4
|
+
* Asynchronous queries for different kinds of information
|
|
5
|
+
*/
|
|
6
|
+
export declare class WEBGLQuerySet extends QuerySet {
|
|
7
|
+
device: WebGLDevice;
|
|
8
|
+
handle: WebGLQuery;
|
|
9
|
+
target: number | null;
|
|
10
|
+
_queryPending: boolean;
|
|
11
|
+
_pollingPromise: Promise<any> | null;
|
|
12
|
+
get [Symbol.toStringTag](): string;
|
|
13
|
+
constructor(device: WebGLDevice, props: QuerySetProps);
|
|
14
|
+
destroy(): void;
|
|
15
|
+
/**
|
|
16
|
+
* Shortcut for timer query (dependent on extension in both WebGL1 and 2)
|
|
17
|
+
* Measures GPU time delta between this call and a matching `end` call in the
|
|
18
|
+
* GPU instruction stream.
|
|
19
|
+
*/
|
|
20
|
+
beginTimestampQuery(): void;
|
|
21
|
+
endTimestampQuery(): void;
|
|
22
|
+
beginOcclusionQuery(options?: {
|
|
23
|
+
conservative?: boolean;
|
|
24
|
+
}): void;
|
|
25
|
+
endOcclusionQuery(): void;
|
|
26
|
+
beginTransformFeedbackQuery(): void;
|
|
27
|
+
endTransformFeedbackQuery(): void;
|
|
28
|
+
resolveQuery(): Promise<bigint[]>;
|
|
29
|
+
/**
|
|
30
|
+
* Due to OpenGL API limitations, after calling `begin()` on one Query
|
|
31
|
+
* instance, `end()` must be called on that same instance before
|
|
32
|
+
* calling `begin()` on another query. While there can be multiple
|
|
33
|
+
* outstanding queries representing disjoint `begin()`/`end()` intervals.
|
|
34
|
+
* It is not possible to interleave or overlap `begin` and `end` calls.
|
|
35
|
+
*/
|
|
36
|
+
protected _begin(target: number): void;
|
|
37
|
+
protected _end(): void;
|
|
38
|
+
isResultAvailable(): boolean;
|
|
39
|
+
isTimerDisjoint(): boolean;
|
|
40
|
+
getResult(): any;
|
|
41
|
+
getTimerMilliseconds(): number;
|
|
42
|
+
pollQuery(limit?: number): Promise<any>;
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=webgl-query-set.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webgl-query-set.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-query-set.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAEtD,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAE5C;;GAEG;AACH,qBAAa,aAAc,SAAQ,QAAQ;IACzC,MAAM,EAAE,WAAW,CAAC;IACpB,MAAM,EAAE,UAAU,CAAC;IAEnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAQ;IAC7B,aAAa,UAAS;IACtB,eAAe,EAAE,OAAO,CAAC,GAAG,CAAC,GAAG,IAAI,CAAQ;IAE5C,IAAa,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAE1C;gBAGW,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,aAAa;IAY5C,OAAO;IAMhB;;;;OAIG;IACH,mBAAmB,IAAI,IAAI;IAI3B,iBAAiB,IAAI,IAAI;IAKzB,mBAAmB,CAAC,OAAO,CAAC,EAAE;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAC,GAAG,IAAI;IAM7D,iBAAiB;IAKjB,2BAA2B,IAAI,IAAI;IAInC,yBAAyB,IAAI,IAAI;IAI3B,YAAY,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAOvC;;;;;;OAMG;IACH,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAatC,SAAS,CAAC,IAAI,IAAI,IAAI;IAetB,iBAAiB,IAAI,OAAO;IAgB5B,eAAe,IAAI,OAAO;IAK1B,SAAS,IAAI,GAAG;IAKhB,oBAAoB;IAKpB,SAAS,CAAC,KAAK,GAAE,MAAiC,GAAG,OAAO,CAAC,GAAG,CAAC;CAyBlE"}
|