@luma.gl/webgl 9.0.0-beta.4 → 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 +297 -155
- 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 +13 -19
- package/dist/adapter/converters/texture-formats.d.ts.map +1 -1
- package/dist/adapter/converters/texture-formats.js +474 -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/device-features.d.ts +2 -5
- package/dist/adapter/device-helpers/device-features.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-features.js +56 -87
- package/dist/adapter/device-helpers/device-limits.d.ts +2 -4
- package/dist/adapter/device-helpers/device-limits.d.ts.map +1 -1
- package/dist/adapter/device-helpers/device-limits.js +88 -83
- package/dist/adapter/device-helpers/get-device-info.d.ts +1 -1
- package/dist/adapter/device-helpers/get-device-info.d.ts.map +1 -1
- package/dist/adapter/device-helpers/get-device-info.js +79 -63
- package/dist/adapter/device-helpers/webgl-device-features.d.ts +19 -0
- package/dist/adapter/device-helpers/webgl-device-features.d.ts.map +1 -0
- package/dist/adapter/device-helpers/webgl-device-features.js +86 -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 -146
- 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 +161 -119
- 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 -10
- package/dist/adapter/resources/webgl-framebuffer.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-framebuffer.js +167 -137
- 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 +356 -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 +6 -9
- package/dist/adapter/resources/webgl-texture.d.ts.map +1 -1
- package/dist/adapter/resources/webgl-texture.js +615 -695
- 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 +34 -40
- package/dist/adapter/webgl-device.d.ts.map +1 -1
- package/dist/adapter/webgl-device.js +418 -363
- 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 +175 -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/context/context-data.d.ts +14 -0
- package/dist/context/context/context-data.d.ts.map +1 -0
- package/dist/context/context/context-data.js +33 -0
- package/dist/context/context/create-browser-context.d.ts +1 -6
- package/dist/context/context/create-browser-context.d.ts.map +1 -1
- package/dist/context/context/create-browser-context.js +62 -49
- 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/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/{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 -3
- package/dist/context/parameters/unified-parameter-api.d.ts.map +1 -1
- package/dist/context/parameters/unified-parameter-api.js +94 -44
- package/dist/context/parameters/webgl-parameter-tables.d.ts +120 -99
- package/dist/context/parameters/webgl-parameter-tables.d.ts.map +1 -1
- package/dist/context/parameters/webgl-parameter-tables.js +469 -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 -2
- package/dist/context/state-tracker/with-parameters.d.ts.map +1 -1
- package/dist/context/state-tracker/with-parameters.js +43 -26
- package/dist/dist.dev.js +3135 -4142
- package/dist/index.cjs +1766 -2717
- package/dist/index.cjs.map +7 -0
- package/dist/index.d.ts +25 -28
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +16 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +3 -1
- package/dist.min.js +9 -42
- package/package.json +11 -15
- package/src/adapter/converters/device-parameters.ts +105 -17
- 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 +138 -185
- package/src/adapter/converters/vertex-formats.ts +3 -3
- package/src/adapter/device-helpers/webgl-device-features.ts +101 -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 +7 -140
- 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 +5 -5
- package/src/adapter/resources/webgl-framebuffer.ts +38 -34
- package/src/adapter/resources/webgl-query-set.ts +171 -0
- package/src/adapter/resources/webgl-render-pass.ts +24 -15
- package/src/adapter/resources/webgl-render-pipeline.ts +138 -70
- 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 +38 -105
- 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 +106 -151
- 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 +5 -4
- 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 +7 -2
- package/src/index.ts +4 -18
- 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.js.map +0 -1
- package/dist/adapter/device-helpers/device-limits.js.map +0 -1
- 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.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,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
|
-
gl:
|
|
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
|
/**
|
|
@@ -30,7 +28,7 @@ export declare class WEBGLFramebuffer extends Framebuffer {
|
|
|
30
28
|
* @param attachment
|
|
31
29
|
* @param texture
|
|
32
30
|
* @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
33
|
-
* @param level
|
|
31
|
+
* @param level = 0 - mipmapLevel
|
|
34
32
|
*/
|
|
35
33
|
protected _attachTexture(attachment: GL, texture: WEBGLTexture, layer: number, level: number): void;
|
|
36
34
|
}
|
|
@@ -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,155 +1,185 @@
|
|
|
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";
|
|
7
|
+
import { WEBGLTextureView } from "./webgl-texture-view.js";
|
|
3
8
|
import { WEBGLRenderbuffer } from "../objects/webgl-renderbuffer.js";
|
|
4
9
|
import { getDepthStencilAttachmentWebGL } from "../converters/texture-formats.js";
|
|
10
|
+
/** luma.gl Framebuffer, WebGL implementation */
|
|
5
11
|
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);
|
|
12
|
+
device;
|
|
13
|
+
gl;
|
|
14
|
+
handle;
|
|
15
|
+
get texture() {
|
|
16
|
+
return this.colorAttachments[0];
|
|
45
17
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
18
|
+
constructor(device, props) {
|
|
19
|
+
super(device, props);
|
|
20
|
+
// WebGL default framebuffer handle is null
|
|
21
|
+
const isDefaultFramebuffer = props.handle === null;
|
|
22
|
+
this.device = device;
|
|
23
|
+
this.gl = device.gl;
|
|
24
|
+
this.handle =
|
|
25
|
+
this.props.handle || isDefaultFramebuffer ? this.props.handle : this.gl.createFramebuffer();
|
|
26
|
+
if (!isDefaultFramebuffer) {
|
|
27
|
+
// default framebuffer handle is null, so we can't set spector metadata...
|
|
28
|
+
device.setSpectorMetadata(this.handle, { id: this.props.id, props: this.props });
|
|
29
|
+
// Auto create textures for attachments if needed
|
|
30
|
+
this.autoCreateAttachmentTextures();
|
|
31
|
+
/** Attach from a map of attachments */
|
|
32
|
+
this.gl.bindFramebuffer(GL.FRAMEBUFFER, this.handle);
|
|
33
|
+
// Walk the attachments
|
|
34
|
+
for (let i = 0; i < this.colorAttachments.length; ++i) {
|
|
35
|
+
const attachment = this.colorAttachments[i];
|
|
36
|
+
const attachmentPoint = GL.COLOR_ATTACHMENT0 + i;
|
|
37
|
+
if (attachment) {
|
|
38
|
+
this._attachOne(attachmentPoint, attachment);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
if (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
|
+
}
|
|
51
|
+
}
|
|
52
|
+
this.gl.bindFramebuffer(GL.FRAMEBUFFER, null);
|
|
53
|
+
}
|
|
71
54
|
}
|
|
72
|
-
|
|
73
|
-
|
|
55
|
+
/** destroys any auto created resources etc. */
|
|
56
|
+
destroy() {
|
|
57
|
+
super.destroy(); // destroys owned resources etc.
|
|
58
|
+
if (!this.destroyed && this.handle !== null) {
|
|
59
|
+
this.gl.deleteFramebuffer(this.handle);
|
|
60
|
+
// this.handle = null;
|
|
61
|
+
}
|
|
74
62
|
}
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
// PRIVATE
|
|
64
|
+
/** In WebGL we must use renderbuffers for depth/stencil attachments (unless we have extensions) */
|
|
65
|
+
createDepthStencilTexture(format) {
|
|
66
|
+
return new WEBGLRenderbuffer(this.device, {
|
|
67
|
+
id: `${this.id}-depth-stencil`, // TODO misleading if not depth and stencil?
|
|
68
|
+
format,
|
|
69
|
+
// dataFormat: GL.DEPTH_STENCIL,
|
|
70
|
+
// type: GL.UNSIGNED_INT_24_8,
|
|
71
|
+
width: this.width,
|
|
72
|
+
height: this.height
|
|
73
|
+
});
|
|
77
74
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
75
|
+
/**
|
|
76
|
+
* Attachment resize is expected to be a noop if size is same
|
|
77
|
+
*/
|
|
78
|
+
resizeAttachments(width, height) {
|
|
79
|
+
// for default framebuffer, just update the stored size
|
|
80
|
+
if (this.handle === null) {
|
|
81
|
+
// assert(width === undefined && height === undefined);
|
|
82
|
+
this.width = this.gl.drawingBufferWidth;
|
|
83
|
+
this.height = this.gl.drawingBufferHeight;
|
|
84
|
+
return this;
|
|
85
|
+
}
|
|
86
|
+
if (width === undefined) {
|
|
87
|
+
width = this.gl.drawingBufferWidth;
|
|
88
|
+
}
|
|
89
|
+
if (height === undefined) {
|
|
90
|
+
height = this.gl.drawingBufferHeight;
|
|
91
|
+
}
|
|
92
|
+
// TODO Not clear that this is better than default destroy/create implementation
|
|
93
|
+
for (const colorAttachment of this.colorAttachments) {
|
|
94
|
+
colorAttachment.texture.resize({ width, height });
|
|
95
|
+
}
|
|
96
|
+
if (this.depthStencilAttachment) {
|
|
97
|
+
this.depthStencilAttachment.texture.resize({ width, height });
|
|
98
|
+
}
|
|
99
|
+
return this;
|
|
83
100
|
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
101
|
+
/** Attach one attachment */
|
|
102
|
+
_attachOne(attachmentPoint, attachment) {
|
|
103
|
+
if (attachment instanceof WEBGLRenderbuffer) {
|
|
104
|
+
this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
|
|
105
|
+
return attachment;
|
|
106
|
+
}
|
|
107
|
+
else if (Array.isArray(attachment)) {
|
|
108
|
+
const [texture, layer = 0, level = 0] = attachment;
|
|
109
|
+
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
110
|
+
return texture;
|
|
111
|
+
}
|
|
112
|
+
else if (attachment instanceof WEBGLTexture) {
|
|
113
|
+
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
114
|
+
return attachment;
|
|
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
|
+
throw new Error('attach');
|
|
89
122
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
_attachOne(attachmentPoint, attachment) {
|
|
93
|
-
if (attachment instanceof WEBGLRenderbuffer) {
|
|
94
|
-
this._attachWEBGLRenderbuffer(attachmentPoint, attachment);
|
|
95
|
-
return attachment;
|
|
96
|
-
} else if (Array.isArray(attachment)) {
|
|
97
|
-
const [texture, layer = 0, level = 0] = attachment;
|
|
98
|
-
this._attachTexture(attachmentPoint, texture, layer, level);
|
|
99
|
-
return texture;
|
|
100
|
-
} else if (attachment instanceof WEBGLTexture) {
|
|
101
|
-
this._attachTexture(attachmentPoint, attachment, 0, 0);
|
|
102
|
-
return attachment;
|
|
123
|
+
_attachWEBGLRenderbuffer(attachment, renderbuffer) {
|
|
124
|
+
this.gl.framebufferRenderbuffer(GL.FRAMEBUFFER, attachment, GL.RENDERBUFFER, renderbuffer.handle);
|
|
103
125
|
}
|
|
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
|
-
|
|
126
|
+
/**
|
|
127
|
+
* @param attachment
|
|
128
|
+
* @param texture
|
|
129
|
+
* @param layer = 0 - index into WEBGLTextureArray and Texture3D or face for `TextureCubeMap`
|
|
130
|
+
* @param level = 0 - mipmapLevel
|
|
131
|
+
*/
|
|
132
|
+
_attachTexture(attachment, texture, layer, level) {
|
|
133
|
+
const { gl } = this.device;
|
|
134
|
+
gl.bindTexture(texture.target, texture.handle);
|
|
135
|
+
switch (texture.target) {
|
|
136
|
+
case GL.TEXTURE_2D_ARRAY:
|
|
137
|
+
case GL.TEXTURE_3D:
|
|
138
|
+
gl.framebufferTextureLayer(GL.FRAMEBUFFER, attachment, texture.target, level, layer);
|
|
139
|
+
break;
|
|
140
|
+
case GL.TEXTURE_CUBE_MAP:
|
|
141
|
+
// layer must be a cubemap face (or if index, converted to cube map face)
|
|
142
|
+
const face = mapIndexToCubeMapFace(layer);
|
|
143
|
+
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, face, texture.handle, level);
|
|
144
|
+
break;
|
|
145
|
+
case GL.TEXTURE_2D:
|
|
146
|
+
gl.framebufferTexture2D(GL.FRAMEBUFFER, attachment, GL.TEXTURE_2D, texture.handle, level);
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
assert(false, 'Illegal texture type');
|
|
150
|
+
}
|
|
151
|
+
gl.bindTexture(texture.target, null);
|
|
130
152
|
}
|
|
131
|
-
gl.bindTexture(texture.target, null);
|
|
132
|
-
}
|
|
133
153
|
}
|
|
154
|
+
// Helper functions
|
|
155
|
+
// Map an index to a cube map face constant
|
|
134
156
|
function mapIndexToCubeMapFace(layer) {
|
|
135
|
-
|
|
157
|
+
// TEXTURE_CUBE_MAP_POSITIVE_X is a big value (0x8515)
|
|
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
|
|
160
|
+
? layer + GL.TEXTURE_CUBE_MAP_POSITIVE_X
|
|
161
|
+
: layer;
|
|
136
162
|
}
|
|
163
|
+
// Helper METHODS
|
|
164
|
+
// Get a string describing the framebuffer error if installed
|
|
137
165
|
function _getFrameBufferStatus(status) {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
166
|
+
switch (status) {
|
|
167
|
+
case GL.FRAMEBUFFER_COMPLETE:
|
|
168
|
+
return 'success';
|
|
169
|
+
case GL.FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
|
|
170
|
+
return 'Mismatched attachments';
|
|
171
|
+
case GL.FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT:
|
|
172
|
+
return 'No attachments';
|
|
173
|
+
case GL.FRAMEBUFFER_INCOMPLETE_DIMENSIONS:
|
|
174
|
+
return 'Height/width mismatch';
|
|
175
|
+
case GL.FRAMEBUFFER_UNSUPPORTED:
|
|
176
|
+
return 'Unsupported or split attachments';
|
|
177
|
+
// WebGL2
|
|
178
|
+
case GL.FRAMEBUFFER_INCOMPLETE_MULTISAMPLE:
|
|
179
|
+
return 'Samples mismatch';
|
|
180
|
+
// OVR_multiview2 extension
|
|
181
|
+
// case GL.FRAMEBUFFER_INCOMPLETE_VIEW_TARGETS_OVR: return 'baseViewIndex mismatch';
|
|
182
|
+
default:
|
|
183
|
+
return `${status}`;
|
|
184
|
+
}
|
|
154
185
|
}
|
|
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(GL.TIME_ELAPSED_EXT);
|
|
37
|
+
}
|
|
38
|
+
endTimestampQuery() {
|
|
39
|
+
this._end();
|
|
40
|
+
}
|
|
41
|
+
// Shortcut for occlusion queries
|
|
42
|
+
beginOcclusionQuery(options) {
|
|
43
|
+
return this._begin(options?.conservative ? GL.ANY_SAMPLES_PASSED_CONSERVATIVE : GL.ANY_SAMPLES_PASSED);
|
|
44
|
+
}
|
|
45
|
+
endOcclusionQuery() {
|
|
46
|
+
this._end();
|
|
47
|
+
}
|
|
48
|
+
// Shortcut for transformFeedbackQuery
|
|
49
|
+
beginTransformFeedbackQuery() {
|
|
50
|
+
return this._begin(GL.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN);
|
|
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, GL.QUERY_RESULT_AVAILABLE);
|
|
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(GL.GPU_DISJOINT_EXT);
|
|
103
|
+
}
|
|
104
|
+
// Returns query result.
|
|
105
|
+
getResult() {
|
|
106
|
+
return this.device.gl.getQueryParameter(this.handle, GL.QUERY_RESULT);
|
|
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"}
|