@luma.gl/webgl 9.0.0-beta.1 → 9.0.0-beta.10
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 +295 -156
- package/dist/adapter/converters/sampler-parameters.d.ts +0 -4
- package/dist/adapter/converters/sampler-parameters.d.ts.map +1 -1
- package/dist/adapter/converters/sampler-parameters.js +73 -67
- package/dist/adapter/converters/shader-formats.d.ts.map +1 -1
- package/dist/adapter/converters/shader-formats.js +53 -46
- package/dist/adapter/converters/texture-formats.d.ts +17 -21
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +481 -879
- package/dist/adapter/converters/vertex-formats.d.ts.map +1 -1
- package/dist/adapter/converters/vertex-formats.js +53 -61
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +20 -0
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -0
- package/dist/adapter/device-helpers/webgl-device-features.js +98 -0
- package/dist/adapter/device-helpers/webgl-device-info.d.ts +5 -0
- package/dist/adapter/device-helpers/webgl-device-info.d.ts.map +1 -0
- package/dist/adapter/device-helpers/webgl-device-info.js +90 -0
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts +35 -0
- package/dist/adapter/device-helpers/webgl-device-limits.d.ts.map +1 -0
- package/dist/adapter/device-helpers/webgl-device-limits.js +47 -0
- package/dist/adapter/helpers/decode-webgl-types.d.ts.map +1 -1
- package/dist/adapter/helpers/decode-webgl-types.js +88 -76
- package/dist/adapter/helpers/get-shader-layout.d.ts +1 -1
- package/dist/adapter/helpers/get-shader-layout.d.ts.map +1 -1
- package/dist/adapter/helpers/get-shader-layout.js +261 -225
- package/dist/adapter/helpers/parse-shader-compiler-log.d.ts.map +1 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js +47 -37
- package/dist/adapter/helpers/set-uniform.d.ts +1 -1
- package/dist/adapter/helpers/set-uniform.d.ts.map +1 -1
- package/dist/adapter/helpers/set-uniform.js +68 -82
- package/dist/adapter/helpers/webgl-topology-utils.d.ts.map +1 -1
- package/dist/adapter/helpers/webgl-topology-utils.js +78 -93
- package/dist/adapter/objects/constants-to-keys.d.ts +1 -1
- package/dist/adapter/objects/constants-to-keys.d.ts.map +1 -1
- package/dist/adapter/objects/constants-to-keys.js +19 -12
- 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 +86 -77
- package/dist/adapter/objects/webgl-resource.d.ts +3 -25
- package/dist/adapter/objects/webgl-resource.d.ts.map +1 -1
- package/dist/adapter/objects/webgl-resource.js +102 -147
- package/dist/adapter/resources/webgl-buffer.d.ts +3 -4
- package/dist/adapter/resources/webgl-buffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-buffer.js +159 -117
- 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 +266 -168
- 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 +33 -39
- package/dist/adapter/resources/webgl-external-texture.js +93 -1
- package/dist/adapter/resources/webgl-framebuffer.d.ts +8 -12
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +174 -139
- 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 +124 -90
- package/dist/adapter/resources/webgl-render-pipeline.d.ts +15 -6
- package/dist/adapter/resources/webgl-render-pipeline.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-render-pipeline.js +362 -221
- package/dist/adapter/resources/webgl-sampler.d.ts +1 -3
- package/dist/adapter/resources/webgl-sampler.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-sampler.js +43 -33
- package/dist/adapter/resources/webgl-shader.d.ts +12 -2
- package/dist/adapter/resources/webgl-shader.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-shader.js +114 -47
- 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 +8 -10
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +616 -694
- package/dist/adapter/resources/webgl-transform-feedback.d.ts +2 -2
- package/dist/adapter/resources/webgl-transform-feedback.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-transform-feedback.js +141 -143
- 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 +229 -157
- 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 +58 -36
- package/dist/adapter/webgl-device.d.ts +50 -44
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +427 -352
- package/dist/classic/accessor.d.ts.map +1 -1
- package/dist/classic/accessor.js +132 -101
- package/dist/classic/clear.d.ts +2 -2
- package/dist/classic/clear.d.ts.map +1 -1
- package/dist/classic/clear.js +73 -72
- 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 +174 -175
- 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 +39 -32
- package/dist/classic/typed-array-utils.d.ts.map +1 -1
- package/dist/classic/typed-array-utils.js +96 -81
- package/dist/context/debug/spector.d.ts.map +1 -1
- package/dist/context/debug/spector.js +55 -50
- package/dist/context/debug/webgl-developer-tools.d.ts +1 -2
- package/dist/context/debug/webgl-developer-tools.d.ts.map +1 -1
- package/dist/context/debug/webgl-developer-tools.js +104 -77
- package/dist/context/{context → helpers}/create-browser-context.d.ts +1 -6
- 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/{polyfill/context-data.d.ts → helpers/webgl-context-data.d.ts} +2 -2
- 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 +3 -4
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +92 -47
- package/dist/context/parameters/webgl-parameter-tables.d.ts +109 -99
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +463 -404
- package/dist/context/state-tracker/deep-array-equal.d.ts.map +1 -1
- package/dist/context/state-tracker/deep-array-equal.js +19 -14
- package/dist/context/state-tracker/track-context-state.d.ts +4 -4
- package/dist/context/state-tracker/track-context-state.d.ts.map +1 -1
- package/dist/context/state-tracker/track-context-state.js +188 -123
- package/dist/context/state-tracker/with-parameters.d.ts +2 -3
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +42 -28
- package/dist/dist.dev.js +4465 -7235
- package/dist/dist.min.js +10 -0
- package/dist/index.cjs +2146 -3116
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +25 -31
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -10
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/dist.min.js +9 -42
- package/package.json +10 -15
- package/src/adapter/converters/device-parameters.ts +114 -28
- package/src/adapter/converters/sampler-parameters.ts +12 -20
- package/src/adapter/converters/shader-formats.ts +47 -22
- package/src/adapter/converters/texture-formats.ts +183 -227
- package/src/adapter/converters/vertex-formats.ts +3 -3
- package/src/adapter/device-helpers/webgl-device-features.ts +121 -0
- package/src/adapter/device-helpers/{get-device-info.ts → webgl-device-info.ts} +30 -22
- package/src/adapter/device-helpers/webgl-device-limits.ts +53 -0
- package/src/adapter/helpers/decode-webgl-types.ts +13 -7
- package/src/adapter/helpers/get-shader-layout.ts +21 -31
- package/src/adapter/helpers/parse-shader-compiler-log.ts +10 -6
- package/src/adapter/helpers/set-uniform.ts +3 -4
- package/src/adapter/helpers/webgl-topology-utils.ts +10 -3
- package/src/adapter/objects/constants-to-keys.ts +3 -2
- package/src/adapter/objects/webgl-renderbuffer.ts +38 -16
- package/src/adapter/objects/webgl-resource.ts +8 -141
- package/src/adapter/resources/webgl-buffer.ts +10 -14
- package/src/adapter/resources/webgl-command-buffer.ts +24 -34
- package/src/adapter/resources/webgl-command-encoder.ts +14 -11
- package/src/adapter/resources/webgl-external-texture.ts +7 -7
- package/src/adapter/resources/webgl-framebuffer.ts +65 -58
- package/src/adapter/resources/webgl-query-set.ts +171 -0
- package/src/adapter/resources/webgl-render-pass.ts +27 -18
- package/src/adapter/resources/webgl-render-pipeline.ts +148 -73
- package/src/adapter/resources/webgl-sampler.ts +7 -10
- package/src/adapter/resources/webgl-shader.ts +65 -11
- package/src/adapter/resources/webgl-texture-view.ts +28 -0
- package/src/adapter/resources/webgl-texture.ts +43 -106
- package/src/adapter/resources/webgl-transform-feedback.ts +16 -22
- package/src/adapter/resources/webgl-vertex-array.ts +20 -21
- package/src/adapter/webgl-canvas-context.ts +7 -11
- package/src/adapter/webgl-device.ts +142 -162
- package/src/classic/accessor.ts +5 -4
- package/src/classic/clear.ts +25 -20
- package/src/classic/copy-and-blit.ts +12 -6
- 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 +31 -20
- package/src/context/{context → helpers}/create-browser-context.ts +9 -33
- package/src/context/{polyfill/context-data.ts → helpers/webgl-context-data.ts} +3 -2
- package/src/context/helpers/webgl-extensions.ts +17 -0
- package/src/context/parameters/unified-parameter-api.ts +6 -17
- package/src/context/parameters/webgl-parameter-tables.ts +118 -90
- package/src/context/state-tracker/deep-array-equal.ts +2 -1
- package/src/context/state-tracker/track-context-state.ts +29 -23
- package/src/context/state-tracker/with-parameters.ts +8 -8
- package/src/index.ts +16 -56
- package/src/types.ts +2 -1
- package/dist/adapter/converters/device-parameters.js.map +0 -1
- package/dist/adapter/converters/sampler-parameters.js.map +0 -1
- package/dist/adapter/converters/shader-formats.js.map +0 -1
- package/dist/adapter/converters/texture-formats.js.map +0 -1
- package/dist/adapter/converters/vertex-formats.js.map +0 -1
- package/dist/adapter/device-helpers/device-features.d.ts +0 -9
- package/dist/adapter/device-helpers/device-features.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-features.js +0 -96
- package/dist/adapter/device-helpers/device-features.js.map +0 -1
- package/dist/adapter/device-helpers/device-limits.d.ts +0 -52
- package/dist/adapter/device-helpers/device-limits.d.ts.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js +0 -87
- package/dist/adapter/device-helpers/device-limits.js.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts +0 -4
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +0 -1
- package/dist/adapter/device-helpers/get-device-info.js +0 -71
- package/dist/adapter/device-helpers/get-device-info.js.map +0 -1
- package/dist/adapter/device-helpers/is-old-ie.d.ts +0 -2
- package/dist/adapter/device-helpers/is-old-ie.d.ts.map +0 -1
- package/dist/adapter/device-helpers/is-old-ie.js +0 -9
- package/dist/adapter/device-helpers/is-old-ie.js.map +0 -1
- package/dist/adapter/helpers/decode-webgl-types.js.map +0 -1
- package/dist/adapter/helpers/get-shader-layout.js.map +0 -1
- package/dist/adapter/helpers/parse-shader-compiler-log.js.map +0 -1
- package/dist/adapter/helpers/set-uniform.js.map +0 -1
- package/dist/adapter/helpers/webgl-topology-utils.js.map +0 -1
- package/dist/adapter/objects/constants-to-keys.js.map +0 -1
- package/dist/adapter/objects/webgl-renderbuffer.js.map +0 -1
- package/dist/adapter/objects/webgl-resource.js.map +0 -1
- package/dist/adapter/resources/webgl-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-buffer.js.map +0 -1
- package/dist/adapter/resources/webgl-command-encoder.js.map +0 -1
- package/dist/adapter/resources/webgl-external-texture.js.map +0 -1
- package/dist/adapter/resources/webgl-framebuffer.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pass.js.map +0 -1
- package/dist/adapter/resources/webgl-render-pipeline.js.map +0 -1
- package/dist/adapter/resources/webgl-sampler.js.map +0 -1
- package/dist/adapter/resources/webgl-shader.js.map +0 -1
- package/dist/adapter/resources/webgl-texture.js.map +0 -1
- package/dist/adapter/resources/webgl-transform-feedback.js.map +0 -1
- package/dist/adapter/resources/webgl-vertex-array.js.map +0 -1
- package/dist/adapter/webgl-canvas-context.js.map +0 -1
- package/dist/adapter/webgl-device.js.map +0 -1
- package/dist/classic/accessor.js.map +0 -1
- package/dist/classic/clear.js.map +0 -1
- package/dist/classic/copy-and-blit.js.map +0 -1
- package/dist/classic/format-utils.js.map +0 -1
- package/dist/classic/typed-array-utils.js.map +0 -1
- package/dist/context/context/create-browser-context.d.ts.map +0 -1
- package/dist/context/context/create-browser-context.js +0 -53
- package/dist/context/context/create-browser-context.js.map +0 -1
- package/dist/context/context/create-headless-context.d.ts +0 -9
- package/dist/context/context/create-headless-context.d.ts.map +0 -1
- package/dist/context/context/create-headless-context.js +0 -42
- package/dist/context/context/create-headless-context.js.map +0 -1
- package/dist/context/context/webgl-checks.d.ts +0 -13
- package/dist/context/context/webgl-checks.d.ts.map +0 -1
- package/dist/context/context/webgl-checks.js +0 -31
- package/dist/context/context/webgl-checks.js.map +0 -1
- package/dist/context/debug/spector.js.map +0 -1
- package/dist/context/debug/webgl-developer-tools.js.map +0 -1
- package/dist/context/parameters/unified-parameter-api.js.map +0 -1
- package/dist/context/parameters/webgl-parameter-tables.js.map +0 -1
- package/dist/context/polyfill/context-data.d.ts.map +0 -1
- package/dist/context/polyfill/context-data.js +0 -12
- package/dist/context/polyfill/context-data.js.map +0 -1
- package/dist/context/polyfill/get-parameter-polyfill.d.ts +0 -2
- package/dist/context/polyfill/get-parameter-polyfill.d.ts.map +0 -1
- package/dist/context/polyfill/get-parameter-polyfill.js +0 -85
- package/dist/context/polyfill/get-parameter-polyfill.js.map +0 -1
- package/dist/context/polyfill/polyfill-context.d.ts +0 -5
- package/dist/context/polyfill/polyfill-context.d.ts.map +0 -1
- package/dist/context/polyfill/polyfill-context.js +0 -87
- package/dist/context/polyfill/polyfill-context.js.map +0 -1
- package/dist/context/polyfill/polyfill-table.d.ts +0 -48
- package/dist/context/polyfill/polyfill-table.d.ts.map +0 -1
- package/dist/context/polyfill/polyfill-table.js +0 -137
- package/dist/context/polyfill/polyfill-table.js.map +0 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts +0 -2
- package/dist/context/polyfill/polyfill-vertex-array-object.d.ts.map +0 -1
- package/dist/context/polyfill/polyfill-vertex-array-object.js +0 -265
- package/dist/context/polyfill/polyfill-vertex-array-object.js.map +0 -1
- package/dist/context/state-tracker/deep-array-equal.js.map +0 -1
- package/dist/context/state-tracker/track-context-state.js.map +0 -1
- package/dist/context/state-tracker/with-parameters.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/types.js.map +0 -1
- package/src/adapter/device-helpers/device-features.ts +0 -161
- package/src/adapter/device-helpers/device-limits.ts +0 -155
- package/src/adapter/device-helpers/is-old-ie.ts +0 -14
- package/src/context/context/create-headless-context.ts +0 -51
- package/src/context/context/webgl-checks.ts +0 -51
- package/src/context/polyfill/get-parameter-polyfill.ts +0 -122
- package/src/context/polyfill/polyfill-context.ts +0 -104
- package/src/context/polyfill/polyfill-table.ts +0 -167
- package/src/context/polyfill/polyfill-vertex-array-object.ts +0 -365
|
@@ -1,22 +1,19 @@
|
|
|
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
|
-
export type
|
|
8
|
-
export type Attachment = WEBGLTexture | WEBGLRenderbuffer | TextureAttachment;
|
|
4
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
5
|
+
import { WEBGLTexture } from "./webgl-texture.js";
|
|
6
|
+
import { WEBGLTextureView } from "./webgl-texture-view.js";
|
|
7
|
+
export type Attachment = WEBGLTextureView | WEBGLTexture;
|
|
9
8
|
/** luma.gl Framebuffer, WebGL implementation */
|
|
10
9
|
export declare class WEBGLFramebuffer extends Framebuffer {
|
|
11
10
|
device: WebGLDevice;
|
|
12
|
-
gl:
|
|
11
|
+
gl: WebGL2RenderingContext;
|
|
13
12
|
handle: WebGLFramebuffer;
|
|
14
|
-
get texture():
|
|
13
|
+
get texture(): import("@luma.gl/core").TextureView;
|
|
15
14
|
constructor(device: WebGLDevice, props: FramebufferProps);
|
|
16
15
|
/** destroys any auto created resources etc. */
|
|
17
16
|
destroy(): void;
|
|
18
|
-
/** Check the status */
|
|
19
|
-
protected _checkStatus(): void;
|
|
20
17
|
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
21
18
|
protected createDepthStencilTexture(format: TextureFormat): Texture;
|
|
22
19
|
/**
|
|
@@ -24,13 +21,12 @@ export declare class WEBGLFramebuffer extends Framebuffer {
|
|
|
24
21
|
*/
|
|
25
22
|
protected resizeAttachments(width: number, height: number): this;
|
|
26
23
|
/** Attach one attachment */
|
|
27
|
-
protected _attachOne(attachmentPoint: GL, attachment: Attachment): WEBGLTexture
|
|
28
|
-
protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void;
|
|
24
|
+
protected _attachOne(attachmentPoint: GL, attachment: Attachment): WEBGLTexture;
|
|
29
25
|
/**
|
|
30
26
|
* @param attachment
|
|
31
27
|
* @param texture
|
|
32
28
|
* @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
33
|
-
* @param level
|
|
29
|
+
* @param level = 0 - mipmapLevel
|
|
34
30
|
*/
|
|
35
31
|
protected _attachTexture(attachment: GL, texture: WEBGLTexture, layer: number, level: number): void;
|
|
36
32
|
}
|
|
@@ -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;AAMtD,MAAM,MAAM,UAAU,GAAG,gBAAgB,GAAG,YAAY,CAAC;AAEzD,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,CAAC,eAAe,EAAE,EAAE,EAAE,UAAU,EAAE,UAAU,GAAG,YAAY;IAqC/E;;;;;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,155 +1,190 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// Copyright (c) vis.gl contributors
|
|
1
4
|
import { Framebuffer, assert } from '@luma.gl/core';
|
|
5
|
+
import { GL } from '@luma.gl/constants';
|
|
2
6
|
import { WEBGLTexture } from "./webgl-texture.js";
|
|
3
|
-
import {
|
|
7
|
+
import { WEBGLTextureView } from "./webgl-texture-view.js";
|
|
4
8
|
import { getDepthStencilAttachmentWebGL } from "../converters/texture-formats.js";
|
|
9
|
+
/** luma.gl Framebuffer, WebGL implementation */
|
|
5
10
|
export class WEBGLFramebuffer extends Framebuffer {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this.device = void 0;
|
|
12
|
-
this.gl = void 0;
|
|
13
|
-
this.handle = void 0;
|
|
14
|
-
const isDefaultFramebuffer = props.handle === null;
|
|
15
|
-
this.device = device;
|
|
16
|
-
this.gl = device.gl;
|
|
17
|
-
this.handle = this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();
|
|
18
|
-
if (!isDefaultFramebuffer) {
|
|
19
|
-
device.setSpectorMetadata(this.handle, {
|
|
20
|
-
id: this.props.id,
|
|
21
|
-
props: this.props
|
|
22
|
-
});
|
|
23
|
-
this.autoCreateAttachmentTextures();
|
|
24
|
-
this.gl.bindFramebuffer(36160, this.handle);
|
|
25
|
-
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
26
|
-
const attachment = this.colorAttachments[i];
|
|
27
|
-
const attachmentPoint = 36064 + i;
|
|
28
|
-
if (attachment) {
|
|
29
|
-
this._attachOne(attachmentPoint, attachment);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (this.depthStencilAttachment) {
|
|
33
|
-
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.format), this.depthStencilAttachment);
|
|
34
|
-
}
|
|
35
|
-
this.gl.bindFramebuffer(36160, null);
|
|
36
|
-
}
|
|
37
|
-
if (props.check !== false) {
|
|
38
|
-
this._checkStatus();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
destroy() {
|
|
42
|
-
super.destroy();
|
|
43
|
-
if (!this.destroyed && this.handle !== null) {
|
|
44
|
-
this.gl.deleteFramebuffer(this.handle);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
_checkStatus() {
|
|
48
|
-
const {
|
|
49
|
-
gl
|
|
50
|
-
} = this;
|
|
51
|
-
const prevHandle = gl.bindFramebuffer(36160, this.handle);
|
|
52
|
-
const status = gl.checkFramebufferStatus(36160);
|
|
53
|
-
gl.bindFramebuffer(36160, prevHandle || null);
|
|
54
|
-
if (status !== 36053) {
|
|
55
|
-
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
createDepthStencilTexture(format) {
|
|
59
|
-
return new WEBGLRenderbuffer(this.device, {
|
|
60
|
-
id: `${this.id}-depth-stencil`,
|
|
61
|
-
format,
|
|
62
|
-
width: this.width,
|
|
63
|
-
height: this.height
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
resizeAttachments(width, height) {
|
|
67
|
-
if (this.handle === null) {
|
|
68
|
-
this.width = this.gl.drawingBufferWidth;
|
|
69
|
-
this.height = this.gl.drawingBufferHeight;
|
|
70
|
-
return this;
|
|
11
|
+
device;
|
|
12
|
+
gl;
|
|
13
|
+
handle;
|
|
14
|
+
get texture() {
|
|
15
|
+
return this.colorAttachments[0];
|
|
71
16
|
}
|
|
72
|
-
|
|
73
|
-
|
|
17
|
+
constructor(device, props) {
|
|
18
|
+
super(device, props);
|
|
19
|
+
// WebGL default framebuffer handle is null
|
|
20
|
+
const isDefaultFramebuffer = props.handle === null;
|
|
21
|
+
this.device = device;
|
|
22
|
+
this.gl = device.gl;
|
|
23
|
+
this.handle =
|
|
24
|
+
this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();
|
|
25
|
+
if (!isDefaultFramebuffer) {
|
|
26
|
+
// default framebuffer handle is null, so we can't set spector metadata...
|
|
27
|
+
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
28
|
+
// Auto create textures for attachments if needed
|
|
29
|
+
this.autoCreateAttachmentTextures();
|
|
30
|
+
/** Attach from a map of attachments */
|
|
31
|
+
this.gl.bindFramebuffer(36160, this.handle);
|
|
32
|
+
// Walk the attachments
|
|
33
|
+
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
34
|
+
const attachment = this.colorAttachments[i];
|
|
35
|
+
const attachmentPoint = 36064 + i;
|
|
36
|
+
if (attachment) {
|
|
37
|
+
this._attachOne(attachmentPoint, attachment);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (this.depthStencilAttachment) {
|
|
41
|
+
this._attachOne(getDepthStencilAttachmentWebGL(this.depthStencilAttachment.props.format), this.depthStencilAttachment);
|
|
42
|
+
}
|
|
43
|
+
/** Check the status */
|
|
44
|
+
// @ts-expect-error
|
|
45
|
+
if (props.check !== false) {
|
|
46
|
+
const status = this.gl.checkFramebufferStatus(36160);
|
|
47
|
+
if (status !== 36053) {
|
|
48
|
+
throw new Error(`Framebuffer ${_getFrameBufferStatus(status)}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
this.gl.bindFramebuffer(36160, null);
|
|
52
|
+
}
|
|
74
53
|
}
|
|
75
|
-
|
|
76
|
-
|
|
54
|
+
/** destroys any auto created resources etc. */
|
|
55
|
+
destroy() {
|
|
56
|
+
super.destroy(); // destroys owned resources etc.
|
|
57
|
+
if (!this.destroyed && this.handle !== null) {
|
|
58
|
+
this.gl.deleteFramebuffer(this.handle);
|
|
59
|
+
// this.handle = null;
|
|
60
|
+
}
|
|
77
61
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
62
|
+
// PRIVATE
|
|
63
|
+
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
64
|
+
createDepthStencilTexture(format) {
|
|
65
|
+
// return new WEBGLRenderbuffer(this.device, {
|
|
66
|
+
return new WEBGLTexture(this.device, {
|
|
67
|
+
id: `${this.id}-depth-stencil`,
|
|
68
|
+
format,
|
|
69
|
+
width: this.width,
|
|
70
|
+
height: this.height,
|
|
71
|
+
mipmaps: false
|
|
72
|
+
});
|
|
83
73
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
74
|
+
/**
|
|
75
|
+
* Attachment resize is expected to be a noop if size is same
|
|
76
|
+
*/
|
|
77
|
+
resizeAttachments(width, height) {
|
|
78
|
+
// for default framebuffer, just update the stored size
|
|
79
|
+
if (this.handle === null) {
|
|
80
|
+
// assert(width === undefined && height === undefined);
|
|
81
|
+
this.width = this.gl.drawingBufferWidth;
|
|
82
|
+
this.height = this.gl.drawingBufferHeight;
|
|
83
|
+
return this;
|
|
84
|
+
}
|
|
85
|
+
if (width === undefined) {
|
|
86
|
+
width = this.gl.drawingBufferWidth;
|
|
87
|
+
}
|
|
88
|
+
if (height === undefined) {
|
|
89
|
+
height = this.gl.drawingBufferHeight;
|
|
90
|
+
}
|
|
91
|
+
// TODO Not clear that this is better than default destroy/create implementation
|
|
92
|
+
for (const colorAttachment of this.colorAttachments) {
|
|
93
|
+
colorAttachment.texture.resize({ width, height });
|
|
94
|
+
}
|
|
95
|
+
if (this.depthStencilAttachment) {
|
|
96
|
+
this.depthStencilAttachment.texture.resize({ width, height });
|
|
97
|
+
}
|
|
98
|
+
return this;
|
|
89
99
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
/** Attach one attachment */
|
|
101
|
+
_attachOne(attachmentPoint, attachment) {
|
|
102
|
+
// if (attachment instanceof WEBGLRenderbuffer) {
|
|
103
|
+
// this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
|
|
104
|
+
// return attachment;
|
|
105
|
+
// }
|
|
106
|
+
if (Array.isArray(attachment)) {
|
|
107
|
+
const [texture, layer = 0, level = 0] = attachment;
|
|
108
|
+
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
109
|
+
return texture;
|
|
110
|
+
}
|
|
111
|
+
if (attachment instanceof WEBGLTexture) {
|
|
112
|
+
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
113
|
+
return attachment;
|
|
114
|
+
}
|
|
115
|
+
if (attachment instanceof WEBGLTextureView) {
|
|
116
|
+
const textureView = attachment;
|
|
117
|
+
this._attachTexture(attachmentPoint, textureView.texture, textureView.props.baseMipLevel, textureView.props.baseArrayLayer);
|
|
118
|
+
return attachment.texture;
|
|
119
|
+
}
|
|
120
|
+
throw new Error('attach');
|
|
103
121
|
}
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
122
|
+
// TODO - we do not seem to need render buffers in WebGL 2
|
|
123
|
+
// protected _attachWEBGLRenderbuffer(attachment: GL, renderbuffer: WEBGLRenderbuffer): void {
|
|
124
|
+
// this.gl.framebufferRenderbuffer(
|
|
125
|
+
// GL.FRAMEBUFFER,
|
|
126
|
+
// attachment,
|
|
127
|
+
// GL.RENDERBUFFER,
|
|
128
|
+
// renderbuffer.handle
|
|
129
|
+
// );
|
|
130
|
+
// }
|
|
131
|
+
/**
|
|
132
|
+
* @param attachment
|
|
133
|
+
* @param texture
|
|
134
|
+
* @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
135
|
+
* @param level = 0 - mipmapLevel
|
|
136
|
+
*/
|
|
137
|
+
_attachTexture(attachment, texture, layer, level) {
|
|
138
|
+
const { gl } = this.device;
|
|
139
|
+
gl.bindTexture(texture.target, texture.handle);
|
|
140
|
+
switch (texture.target) {
|
|
141
|
+
case 35866:
|
|
142
|
+
case 32879:
|
|
143
|
+
gl.framebufferTextureLayer(36160, attachment, texture.target, level, layer);
|
|
144
|
+
break;
|
|
145
|
+
case 34067:
|
|
146
|
+
// layer must be a cubemap face (or if index, converted to cube map face)
|
|
147
|
+
const face = mapIndexToCubeMapFace(layer);
|
|
148
|
+
gl.framebufferTexture2D(36160, attachment, face, texture.handle, level);
|
|
149
|
+
break;
|
|
150
|
+
case 3553:
|
|
151
|
+
gl.framebufferTexture2D(36160, attachment, 3553, texture.handle, level);
|
|
152
|
+
break;
|
|
153
|
+
default:
|
|
154
|
+
assert(false, 'Illegal texture type');
|
|
155
|
+
}
|
|
156
|
+
gl.bindTexture(texture.target, null);
|
|
130
157
|
}
|
|
131
|
-
gl.bindTexture(texture.target, null);
|
|
132
|
-
}
|
|
133
158
|
}
|
|
159
|
+
// Helper functions
|
|
160
|
+
// Map an index to a cube map face constant
|
|
134
161
|
function mapIndexToCubeMapFace(layer) {
|
|
135
|
-
|
|
162
|
+
// TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515)
|
|
163
|
+
// if smaller assume layer is index, otherwise assume it is already a cube map face constant
|
|
164
|
+
return layer < 34069
|
|
165
|
+
? layer + 34069
|
|
166
|
+
: layer;
|
|
136
167
|
}
|
|
168
|
+
// Helper METHODS
|
|
169
|
+
// Get a string describing the framebuffer error if installed
|
|
137
170
|
function _getFrameBufferStatus(status) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
171
|
+
switch (status) {
|
|
172
|
+
case 36053:
|
|
173
|
+
return 'success';
|
|
174
|
+
case 36054:
|
|
175
|
+
return 'Mismatched attachments';
|
|
176
|
+
case 36055:
|
|
177
|
+
return 'No attachments';
|
|
178
|
+
case 36057:
|
|
179
|
+
return 'Height/width mismatch';
|
|
180
|
+
case 36061:
|
|
181
|
+
return 'Unsupported or split attachments';
|
|
182
|
+
// WebGL2
|
|
183
|
+
case 36182:
|
|
184
|
+
return 'Samples mismatch';
|
|
185
|
+
// OVR_multiview2 extension
|
|
186
|
+
// case GL.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR: return 'baseViewIndex mismatch';
|
|
187
|
+
default:
|
|
188
|
+
return `${status}`;
|
|
189
|
+
}
|
|
154
190
|
}
|
|
155
|
-
//# sourceMappingURL=webgl-framebuffer.js.map
|
|
@@ -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"}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// WebGL2 Query (also handles disjoint timer extensions)
|
|
2
|
+
import { QuerySet } from '@luma.gl/core';
|
|
3
|
+
import { GL } from '@luma.gl/constants';
|
|
4
|
+
/**
|
|
5
|
+
* Asynchronous queries for different kinds of information
|
|
6
|
+
*/
|
|
7
|
+
export class WEBGLQuerySet extends QuerySet {
|
|
8
|
+
device;
|
|
9
|
+
handle;
|
|
10
|
+
target = null;
|
|
11
|
+
_queryPending = false;
|
|
12
|
+
_pollingPromise = null;
|
|
13
|
+
get [Symbol.toStringTag]() {
|
|
14
|
+
return 'Query';
|
|
15
|
+
}
|
|
16
|
+
// Create a query class
|
|
17
|
+
constructor(device, props) {
|
|
18
|
+
super(device, props);
|
|
19
|
+
this.device = device;
|
|
20
|
+
if (props.count > 1) {
|
|
21
|
+
throw new Error('WebGL QuerySet can only have one value');
|
|
22
|
+
}
|
|
23
|
+
this.handle = this.device.gl.createQuery();
|
|
24
|
+
Object.seal(this);
|
|
25
|
+
}
|
|
26
|
+
destroy() {
|
|
27
|
+
this.device.gl.deleteQuery(this.handle);
|
|
28
|
+
}
|
|
29
|
+
// FOR RENDER PASS AND COMMAND ENCODER
|
|
30
|
+
/**
|
|
31
|
+
* Shortcut for timer query (dependent on extension in both WebGL1 and 2)
|
|
32
|
+
* Measures GPU time delta between this call and a matching `end` call in the
|
|
33
|
+
* GPU instruction stream.
|
|
34
|
+
*/
|
|
35
|
+
beginTimestampQuery() {
|
|
36
|
+
return this._begin(35007);
|
|
37
|
+
}
|
|
38
|
+
endTimestampQuery() {
|
|
39
|
+
this._end();
|
|
40
|
+
}
|
|
41
|
+
// Shortcut for occlusion queries
|
|
42
|
+
beginOcclusionQuery(options) {
|
|
43
|
+
return this._begin(options?.conservative ? 36202 : 35887);
|
|
44
|
+
}
|
|
45
|
+
endOcclusionQuery() {
|
|
46
|
+
this._end();
|
|
47
|
+
}
|
|
48
|
+
// Shortcut for transformFeedbackQuery
|
|
49
|
+
beginTransformFeedbackQuery() {
|
|
50
|
+
return this._begin(35976);
|
|
51
|
+
}
|
|
52
|
+
endTransformFeedbackQuery() {
|
|
53
|
+
this._end();
|
|
54
|
+
}
|
|
55
|
+
async resolveQuery() {
|
|
56
|
+
const value = await this.pollQuery();
|
|
57
|
+
return [value];
|
|
58
|
+
}
|
|
59
|
+
// PRIVATE METHODS
|
|
60
|
+
/**
|
|
61
|
+
* Due to OpenGL API limitations, after calling `begin()` on one Query
|
|
62
|
+
* instance, `end()` must be called on that same instance before
|
|
63
|
+
* calling `begin()` on another query. While there can be multiple
|
|
64
|
+
* outstanding queries representing disjoint `begin()`/`end()` intervals.
|
|
65
|
+
* It is not possible to interleave or overlap `begin` and `end` calls.
|
|
66
|
+
*/
|
|
67
|
+
_begin(target) {
|
|
68
|
+
// Don't start a new query if one is already active.
|
|
69
|
+
if (this._queryPending) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
this.target = target;
|
|
73
|
+
this.device.gl.beginQuery(this.target, this.handle);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
// ends the current query
|
|
77
|
+
_end() {
|
|
78
|
+
// Can't end a new query if the last one hasn't been resolved.
|
|
79
|
+
if (this._queryPending) {
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
82
|
+
if (this.target) {
|
|
83
|
+
this.device.gl.endQuery(this.target);
|
|
84
|
+
this.target = null;
|
|
85
|
+
this._queryPending = true;
|
|
86
|
+
}
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// Returns true if the query result is available
|
|
90
|
+
isResultAvailable() {
|
|
91
|
+
if (!this._queryPending) {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
const resultAvailable = this.device.gl.getQueryParameter(this.handle, 34919);
|
|
95
|
+
if (resultAvailable) {
|
|
96
|
+
this._queryPending = false;
|
|
97
|
+
}
|
|
98
|
+
return resultAvailable;
|
|
99
|
+
}
|
|
100
|
+
// Timing query is disjoint, i.e. results are invalid
|
|
101
|
+
isTimerDisjoint() {
|
|
102
|
+
return this.device.gl.getParameter(36795);
|
|
103
|
+
}
|
|
104
|
+
// Returns query result.
|
|
105
|
+
getResult() {
|
|
106
|
+
return this.device.gl.getQueryParameter(this.handle, 34918);
|
|
107
|
+
}
|
|
108
|
+
// Returns the query result, converted to milliseconds to match JavaScript conventions.
|
|
109
|
+
getTimerMilliseconds() {
|
|
110
|
+
return this.getResult() / 1e6;
|
|
111
|
+
}
|
|
112
|
+
// Polls the query
|
|
113
|
+
pollQuery(limit = Number.POSITIVE_INFINITY) {
|
|
114
|
+
if (this._pollingPromise) {
|
|
115
|
+
return this._pollingPromise;
|
|
116
|
+
}
|
|
117
|
+
let counter = 0;
|
|
118
|
+
this._pollingPromise = new Promise((resolve, reject) => {
|
|
119
|
+
const poll = () => {
|
|
120
|
+
if (this.isResultAvailable()) {
|
|
121
|
+
resolve(this.getResult());
|
|
122
|
+
this._pollingPromise = null;
|
|
123
|
+
}
|
|
124
|
+
else if (counter++ > limit) {
|
|
125
|
+
reject('Timed out');
|
|
126
|
+
this._pollingPromise = null;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
requestAnimationFrame(poll);
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
requestAnimationFrame(poll);
|
|
133
|
+
});
|
|
134
|
+
return this._pollingPromise;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RenderPass, RenderPassProps, NumberArray, RenderPassParameters } from '@luma.gl/core';
|
|
2
|
-
import { WebGLDevice } from
|
|
2
|
+
import { WebGLDevice } from "../webgl-device.js";
|
|
3
3
|
import { GLParameters } from '@luma.gl/constants';
|
|
4
4
|
export declare class WEBGLRenderPass extends RenderPass {
|
|
5
5
|
readonly device: WebGLDevice;
|
|
@@ -14,6 +14,8 @@ export declare class WEBGLRenderPass extends RenderPass {
|
|
|
14
14
|
* Maps RenderPass parameters to GL parameters
|
|
15
15
|
*/
|
|
16
16
|
setParameters(parameters?: RenderPassParameters): void;
|
|
17
|
+
beginOcclusionQuery(queryIndex: number): void;
|
|
18
|
+
endOcclusionQuery(): void;
|
|
17
19
|
/**
|
|
18
20
|
* Optionally clears depth, color and stencil buffers based on parameters
|
|
19
21
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webgl-render-pass.d.ts","sourceRoot":"","sources":["../../../src/adapter/resources/webgl-render-pass.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAC,MAAM,eAAe,CAAC;AAC7F,OAAO,EAAC,WAAW,EAAC,2BAAwB;AAC5C,OAAO,EAAK,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAapD,qBAAa,eAAgB,SAAQ,UAAU;IAC7C,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC;IAE7B,8DAA8D;IAC9D,YAAY,EAAE,YAAY,CAAC;gBAEf,MAAM,EAAE,WAAW,EAAE,KAAK,EAAE,eAAe;IAYvD,GAAG,IAAI,IAAI;IAQX,cAAc,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IACxC,aAAa,IAAI,IAAI;IACrB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI;IAO5C;;OAEG;IACH,aAAa,CAAC,UAAU,GAAE,oBAAyB,GAAG,IAAI;IA+C1D,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKpC,iBAAiB,IAAI,IAAI;IAOlC;;OAEG;IACH,SAAS,CAAC,KAAK,IAAI,IAAI;IA+BvB;;OAEG;IACH,SAAS,CAAC,gBAAgB,CAAC,UAAU,GAAE,MAAU,EAAE,KAAK,GAAE,WAA0B;CAwCrF"}
|