@itwin/webgl-compatibility 4.0.0-dev.52 → 4.0.0-dev.55

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.
@@ -1,119 +1,119 @@
1
- "use strict";
2
- /*---------------------------------------------------------------------------------------------
3
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
- * See LICENSE.md in the project root for license terms and full copyright notice.
5
- *--------------------------------------------------------------------------------------------*/
6
- /** @packageDocumentation
7
- * @module Compatibility
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.queryRenderCompatibility = exports.WebGLRenderCompatibilityStatus = exports.WebGLFeature = void 0;
11
- const Capabilities_1 = require("./Capabilities");
12
- /** Enumerates the required and optional WebGL features used by the [RenderSystem]($frontend).
13
- * @public
14
- */
15
- var WebGLFeature;
16
- (function (WebGLFeature) {
17
- /** This feature allows transparent geometry to be rendered more efficiently, using 1 pass instead of 2. */
18
- WebGLFeature["MrtTransparency"] = "mrt transparency";
19
- /** This feature allows picking to occur more efficiently, using 1 pass instead of 3. */
20
- WebGLFeature["MrtPick"] = "mrt pick";
21
- /** This feature ensures large meshes (with more than 21,845 triangles) can be rendered. */
22
- WebGLFeature["UintElementIndex"] = "uint element index";
23
- /** This feature allows transparency to achieve the optimal quality. Without this feature, overlapping transparent geometry will "wash out" more easily. */
24
- WebGLFeature["FloatRendering"] = "float rendering";
25
- /** This feature allows for the display of non-3D classification data and solar shadows. */
26
- WebGLFeature["DepthTexture"] = "depth texture";
27
- /** This feature allows instancing of repeated geometry, which can reduce memory consumption. */
28
- WebGLFeature["Instancing"] = "instancing";
29
- /** This feature indicates that the system has enough texture units available for the shaders to run properly. */
30
- WebGLFeature["MinimalTextureUnits"] = "minimal texture units";
31
- /** Indicates that shadow maps are supported. Without this feature, shadows cannot be displayed. */
32
- WebGLFeature["ShadowMaps"] = "shadow maps";
33
- /** This feature allows a logarithmic depth buffer to be used. Without this feature, z-fighting will be much more likely to occur. */
34
- WebGLFeature["FragDepth"] = "fragment depth";
35
- /** This feature allows the renderer to achieve accurate contour lines for isoline and stepped delimiter modes of thematic display. */
36
- WebGLFeature["StandardDerivatives"] = "standard derivatives";
37
- /** This feature allows the renderer to smooth curved lines. */
38
- WebGLFeature["AntiAliasing"] = "anti-aliasing";
39
- })(WebGLFeature = exports.WebGLFeature || (exports.WebGLFeature = {}));
40
- /** An enumeration that describes a general "compatibility rating" based on the contents of a [[WebGLRenderCompatibilityInfo]].
41
- * @public
42
- */
43
- var WebGLRenderCompatibilityStatus;
44
- (function (WebGLRenderCompatibilityStatus) {
45
- /**
46
- * Signifies that everything is ideal: context created successfully, all required and optional features are available,
47
- * and browser did not signal a major performance caveat.
48
- */
49
- WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["AllOkay"] = 0] = "AllOkay";
50
- /**
51
- * Signifies that the base requirements of compatibility are met but at least some optional features are missing.
52
- * Consult the contents of [[WebGLRenderCompatibilityInfo.missingOptionalFeatures]].
53
- */
54
- WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["MissingOptionalFeatures"] = 1] = "MissingOptionalFeatures";
55
- /**
56
- * Signifies that the base requirements of compatibility are met but WebGL reported a major performance caveat. The browser
57
- * has likely fallen back to software rendering due to lack of a usable GPU.
58
- * Consult [[WebGLRenderCompatibilityInfo.contextErrorMessage]] for a possible description of what went wrong.
59
- * There could also be some missing optional features; consult the contents of [[WebGLRenderCompatibilityInfo.missingOptionalFeatures]].
60
- */
61
- WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["MajorPerformanceCaveat"] = 2] = "MajorPerformanceCaveat";
62
- /**
63
- * Signifies that the base requirements of compatibility are not met; rendering cannot occur.
64
- * Consult the contents of [[WebGLRenderCompatibilityInfo.missingRequiredFeatures]].
65
- */
66
- WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["MissingRequiredFeatures"] = 3] = "MissingRequiredFeatures";
67
- /**
68
- * Signifies an inability to create either a canvas or a WebGL rendering context; rendering cannot occur. Consult
69
- * [[WebGLRenderCompatibilityInfo.contextErrorMessage]] for a possible description of what went wrong.
70
- */
71
- WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["CannotCreateContext"] = 4] = "CannotCreateContext";
72
- })(WebGLRenderCompatibilityStatus = exports.WebGLRenderCompatibilityStatus || (exports.WebGLRenderCompatibilityStatus = {}));
73
- function createDefaultContext(canvas, useWebGL2 = true, attributes) {
74
- let context = useWebGL2 ? canvas.getContext("webgl2", attributes) : canvas.getContext("webgl", attributes);
75
- if (context === null && useWebGL2)
76
- context = canvas.getContext("webgl", attributes);
77
- return context ?? undefined;
78
- }
79
- /** This function returns information about the client system's level of compatibility with the iTwin.js rendering system, describing the client system's support for both optional and required features. It will also report if there is a major issue with the client system such as the browser falling back to software rendering or an inability to create a either a canvas or a WebGL rendering context.
80
- * @param useWebGL2 A boolean which will be passed to the createContext function in order to create the desired type of context; set this to `true` to use WebGL2, `false` to use WebGL1.
81
- * @param createContext A function of type [[ContextCreator]] that returns a WebGLContext. If not specified, this by default uses `canvas.getContext()` to create the WebGLContext.
82
- * @returns A [[WebGLRenderCompatibilityInfo]] object which contains a compatibility summary.
83
- * @see [[WebGLRenderCompatibilityInfo]]
84
- * @public
85
- */
86
- function queryRenderCompatibility(useWebGL2, createContext) {
87
- const canvas = document.createElement("canvas");
88
- if (null === canvas)
89
- return { status: WebGLRenderCompatibilityStatus.CannotCreateContext, missingOptionalFeatures: [], missingRequiredFeatures: [], userAgent: navigator.userAgent, driverBugs: {} };
90
- let errorMessage;
91
- canvas.addEventListener("webglcontextcreationerror", (event) => {
92
- errorMessage = event.statusMessage || "webglcontextcreationerror was triggered with no error provided";
93
- }, false);
94
- if (undefined === createContext)
95
- createContext = createDefaultContext;
96
- let hasMajorPerformanceCaveat = false;
97
- let context = createContext(canvas, useWebGL2, { failIfMajorPerformanceCaveat: true });
98
- if (undefined === context) {
99
- hasMajorPerformanceCaveat = true;
100
- context = createContext(canvas, useWebGL2); // try to create context without black-listed GPU
101
- if (undefined === context)
102
- return {
103
- status: WebGLRenderCompatibilityStatus.CannotCreateContext,
104
- missingOptionalFeatures: [],
105
- missingRequiredFeatures: [],
106
- userAgent: navigator.userAgent,
107
- contextErrorMessage: errorMessage,
108
- driverBugs: {},
109
- };
110
- }
111
- const capabilities = new Capabilities_1.Capabilities();
112
- const compatibility = capabilities.init(context, undefined);
113
- compatibility.contextErrorMessage = errorMessage;
114
- if (hasMajorPerformanceCaveat && compatibility.status !== WebGLRenderCompatibilityStatus.MissingRequiredFeatures)
115
- compatibility.status = WebGLRenderCompatibilityStatus.MajorPerformanceCaveat;
116
- return compatibility;
117
- }
118
- exports.queryRenderCompatibility = queryRenderCompatibility;
1
+ "use strict";
2
+ /*---------------------------------------------------------------------------------------------
3
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
4
+ * See LICENSE.md in the project root for license terms and full copyright notice.
5
+ *--------------------------------------------------------------------------------------------*/
6
+ /** @packageDocumentation
7
+ * @module Compatibility
8
+ */
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.queryRenderCompatibility = exports.WebGLRenderCompatibilityStatus = exports.WebGLFeature = void 0;
11
+ const Capabilities_1 = require("./Capabilities");
12
+ /** Enumerates the required and optional WebGL features used by the [RenderSystem]($frontend).
13
+ * @public
14
+ */
15
+ var WebGLFeature;
16
+ (function (WebGLFeature) {
17
+ /** This feature allows transparent geometry to be rendered more efficiently, using 1 pass instead of 2. */
18
+ WebGLFeature["MrtTransparency"] = "mrt transparency";
19
+ /** This feature allows picking to occur more efficiently, using 1 pass instead of 3. */
20
+ WebGLFeature["MrtPick"] = "mrt pick";
21
+ /** This feature ensures large meshes (with more than 21,845 triangles) can be rendered. */
22
+ WebGLFeature["UintElementIndex"] = "uint element index";
23
+ /** This feature allows transparency to achieve the optimal quality. Without this feature, overlapping transparent geometry will "wash out" more easily. */
24
+ WebGLFeature["FloatRendering"] = "float rendering";
25
+ /** This feature allows for the display of non-3D classification data and solar shadows. */
26
+ WebGLFeature["DepthTexture"] = "depth texture";
27
+ /** This feature allows instancing of repeated geometry, which can reduce memory consumption. */
28
+ WebGLFeature["Instancing"] = "instancing";
29
+ /** This feature indicates that the system has enough texture units available for the shaders to run properly. */
30
+ WebGLFeature["MinimalTextureUnits"] = "minimal texture units";
31
+ /** Indicates that shadow maps are supported. Without this feature, shadows cannot be displayed. */
32
+ WebGLFeature["ShadowMaps"] = "shadow maps";
33
+ /** This feature allows a logarithmic depth buffer to be used. Without this feature, z-fighting will be much more likely to occur. */
34
+ WebGLFeature["FragDepth"] = "fragment depth";
35
+ /** This feature allows the renderer to achieve accurate contour lines for isoline and stepped delimiter modes of thematic display. */
36
+ WebGLFeature["StandardDerivatives"] = "standard derivatives";
37
+ /** This feature allows the renderer to smooth curved lines. */
38
+ WebGLFeature["AntiAliasing"] = "anti-aliasing";
39
+ })(WebGLFeature = exports.WebGLFeature || (exports.WebGLFeature = {}));
40
+ /** An enumeration that describes a general "compatibility rating" based on the contents of a [[WebGLRenderCompatibilityInfo]].
41
+ * @public
42
+ */
43
+ var WebGLRenderCompatibilityStatus;
44
+ (function (WebGLRenderCompatibilityStatus) {
45
+ /**
46
+ * Signifies that everything is ideal: context created successfully, all required and optional features are available,
47
+ * and browser did not signal a major performance caveat.
48
+ */
49
+ WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["AllOkay"] = 0] = "AllOkay";
50
+ /**
51
+ * Signifies that the base requirements of compatibility are met but at least some optional features are missing.
52
+ * Consult the contents of [[WebGLRenderCompatibilityInfo.missingOptionalFeatures]].
53
+ */
54
+ WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["MissingOptionalFeatures"] = 1] = "MissingOptionalFeatures";
55
+ /**
56
+ * Signifies that the base requirements of compatibility are met but WebGL reported a major performance caveat. The browser
57
+ * has likely fallen back to software rendering due to lack of a usable GPU.
58
+ * Consult [[WebGLRenderCompatibilityInfo.contextErrorMessage]] for a possible description of what went wrong.
59
+ * There could also be some missing optional features; consult the contents of [[WebGLRenderCompatibilityInfo.missingOptionalFeatures]].
60
+ */
61
+ WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["MajorPerformanceCaveat"] = 2] = "MajorPerformanceCaveat";
62
+ /**
63
+ * Signifies that the base requirements of compatibility are not met; rendering cannot occur.
64
+ * Consult the contents of [[WebGLRenderCompatibilityInfo.missingRequiredFeatures]].
65
+ */
66
+ WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["MissingRequiredFeatures"] = 3] = "MissingRequiredFeatures";
67
+ /**
68
+ * Signifies an inability to create either a canvas or a WebGL rendering context; rendering cannot occur. Consult
69
+ * [[WebGLRenderCompatibilityInfo.contextErrorMessage]] for a possible description of what went wrong.
70
+ */
71
+ WebGLRenderCompatibilityStatus[WebGLRenderCompatibilityStatus["CannotCreateContext"] = 4] = "CannotCreateContext";
72
+ })(WebGLRenderCompatibilityStatus = exports.WebGLRenderCompatibilityStatus || (exports.WebGLRenderCompatibilityStatus = {}));
73
+ function createDefaultContext(canvas, useWebGL2 = true, attributes) {
74
+ let context = useWebGL2 ? canvas.getContext("webgl2", attributes) : canvas.getContext("webgl", attributes);
75
+ if (context === null && useWebGL2)
76
+ context = canvas.getContext("webgl", attributes);
77
+ return context ?? undefined;
78
+ }
79
+ /** This function returns information about the client system's level of compatibility with the iTwin.js rendering system, describing the client system's support for both optional and required features. It will also report if there is a major issue with the client system such as the browser falling back to software rendering or an inability to create a either a canvas or a WebGL rendering context.
80
+ * @param useWebGL2 A boolean which will be passed to the createContext function in order to create the desired type of context; set this to `true` to use WebGL2, `false` to use WebGL1.
81
+ * @param createContext A function of type [[ContextCreator]] that returns a WebGLContext. If not specified, this by default uses `canvas.getContext()` to create the WebGLContext.
82
+ * @returns A [[WebGLRenderCompatibilityInfo]] object which contains a compatibility summary.
83
+ * @see [[WebGLRenderCompatibilityInfo]]
84
+ * @public
85
+ */
86
+ function queryRenderCompatibility(useWebGL2, createContext) {
87
+ const canvas = document.createElement("canvas");
88
+ if (null === canvas)
89
+ return { status: WebGLRenderCompatibilityStatus.CannotCreateContext, missingOptionalFeatures: [], missingRequiredFeatures: [], userAgent: navigator.userAgent, driverBugs: {} };
90
+ let errorMessage;
91
+ canvas.addEventListener("webglcontextcreationerror", (event) => {
92
+ errorMessage = event.statusMessage || "webglcontextcreationerror was triggered with no error provided";
93
+ }, false);
94
+ if (undefined === createContext)
95
+ createContext = createDefaultContext;
96
+ let hasMajorPerformanceCaveat = false;
97
+ let context = createContext(canvas, useWebGL2, { failIfMajorPerformanceCaveat: true });
98
+ if (undefined === context) {
99
+ hasMajorPerformanceCaveat = true;
100
+ context = createContext(canvas, useWebGL2); // try to create context without black-listed GPU
101
+ if (undefined === context)
102
+ return {
103
+ status: WebGLRenderCompatibilityStatus.CannotCreateContext,
104
+ missingOptionalFeatures: [],
105
+ missingRequiredFeatures: [],
106
+ userAgent: navigator.userAgent,
107
+ contextErrorMessage: errorMessage,
108
+ driverBugs: {},
109
+ };
110
+ }
111
+ const capabilities = new Capabilities_1.Capabilities();
112
+ const compatibility = capabilities.init(context, undefined);
113
+ compatibility.contextErrorMessage = errorMessage;
114
+ if (hasMajorPerformanceCaveat && compatibility.status !== WebGLRenderCompatibilityStatus.MissingRequiredFeatures)
115
+ compatibility.status = WebGLRenderCompatibilityStatus.MajorPerformanceCaveat;
116
+ return compatibility;
117
+ }
118
+ exports.queryRenderCompatibility = queryRenderCompatibility;
119
119
  //# sourceMappingURL=RenderCompatibility.js.map
@@ -1,10 +1,10 @@
1
- export * from "./Capabilities";
2
- export * from "./RenderCompatibility";
3
- /** @docs-package-description
4
- * The webgl-compatibility package provides APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.
5
- */
6
- /**
7
- * @docs-group-description Compatibility
8
- * APIs for evaluating compatibility with the iTwin.js rendering system.
9
- */
1
+ export * from "./Capabilities";
2
+ export * from "./RenderCompatibility";
3
+ /** @docs-package-description
4
+ * The webgl-compatibility package provides APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.
5
+ */
6
+ /**
7
+ * @docs-group-description Compatibility
8
+ * APIs for evaluating compatibility with the iTwin.js rendering system.
9
+ */
10
10
  //# sourceMappingURL=webgl-compatibility.d.ts.map
@@ -1,26 +1,30 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
5
- }) : (function(o, m, k, k2) {
6
- if (k2 === undefined) k2 = k;
7
- o[k2] = m[k];
8
- }));
9
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- /*---------------------------------------------------------------------------------------------
14
- * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
15
- * See LICENSE.md in the project root for license terms and full copyright notice.
16
- *--------------------------------------------------------------------------------------------*/
17
- __exportStar(require("./Capabilities"), exports);
18
- __exportStar(require("./RenderCompatibility"), exports);
19
- /** @docs-package-description
20
- * The webgl-compatibility package provides APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.
21
- */
22
- /**
23
- * @docs-group-description Compatibility
24
- * APIs for evaluating compatibility with the iTwin.js rendering system.
25
- */
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ /*---------------------------------------------------------------------------------------------
18
+ * Copyright (c) Bentley Systems, Incorporated. All rights reserved.
19
+ * See LICENSE.md in the project root for license terms and full copyright notice.
20
+ *--------------------------------------------------------------------------------------------*/
21
+ __exportStar(require("./Capabilities"), exports);
22
+ __exportStar(require("./RenderCompatibility"), exports);
23
+ /** @docs-package-description
24
+ * The webgl-compatibility package provides APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.
25
+ */
26
+ /**
27
+ * @docs-group-description Compatibility
28
+ * APIs for evaluating compatibility with the iTwin.js rendering system.
29
+ */
26
30
  //# sourceMappingURL=webgl-compatibility.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"webgl-compatibility.js","sourceRoot":"","sources":["../../src/webgl-compatibility.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,iDAA+B;AAC/B,wDAAsC;AAEtC;;GAEG;AAEH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./Capabilities\";\r\nexport * from \"./RenderCompatibility\";\r\n\r\n/** @docs-package-description\r\n * The webgl-compatibility package provides APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.\r\n */\r\n\r\n/**\r\n * @docs-group-description Compatibility\r\n * APIs for evaluating compatibility with the iTwin.js rendering system.\r\n */\r\n"]}
1
+ {"version":3,"file":"webgl-compatibility.js","sourceRoot":"","sources":["../../src/webgl-compatibility.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;+FAG+F;AAC/F,iDAA+B;AAC/B,wDAAsC;AAEtC;;GAEG;AAEH;;;GAGG","sourcesContent":["/*---------------------------------------------------------------------------------------------\r\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\r\n* See LICENSE.md in the project root for license terms and full copyright notice.\r\n*--------------------------------------------------------------------------------------------*/\r\nexport * from \"./Capabilities\";\r\nexport * from \"./RenderCompatibility\";\r\n\r\n/** @docs-package-description\r\n * The webgl-compatibility package provides APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.\r\n */\r\n\r\n/**\r\n * @docs-group-description Compatibility\r\n * APIs for evaluating compatibility with the iTwin.js rendering system.\r\n */\r\n"]}
@@ -1,104 +1,104 @@
1
- /** @packageDocumentation
2
- * @module Compatibility
3
- */
4
- import { GraphicsDriverBugs, WebGLContext, WebGLFeature, WebGLRenderCompatibilityInfo } from "./RenderCompatibility";
5
- /** @internal */
6
- export declare type WebGLExtensionName = "WEBGL_draw_buffers" | "OES_element_index_uint" | "OES_texture_float" | "OES_texture_float_linear" | "OES_texture_half_float" | "OES_texture_half_float_linear" | "EXT_texture_filter_anisotropic" | "WEBGL_depth_texture" | "EXT_color_buffer_float" | "EXT_shader_texture_lod" | "ANGLE_instanced_arrays" | "OES_vertex_array_object" | "WEBGL_lose_context" | "EXT_frag_depth" | "EXT_disjoint_timer_query" | "EXT_disjoint_timer_query_webgl2" | "OES_standard_derivatives" | "EXT_float_blend";
7
- /** Describes the type of a render target. Used by Capabilities to represent maximum precision render target available on host system.
8
- * @internal
9
- */
10
- export declare enum RenderType {
11
- TextureUnsignedByte = 0,
12
- TextureHalfFloat = 1,
13
- TextureFloat = 2
14
- }
15
- /**
16
- * Describes the type of a depth buffer. Used by Capabilities to represent maximum depth buffer precision available on host system.
17
- * Note: the commented-out values are unimplemented but left in place for reference, in case desired for future implementation.
18
- * @internal
19
- */
20
- export declare enum DepthType {
21
- RenderBufferUnsignedShort16 = 0,
22
- TextureUnsignedInt24Stencil8 = 1,
23
- TextureUnsignedInt32 = 2
24
- }
25
- /** Describes the rendering capabilities of the host system.
26
- * @internal
27
- */
28
- export declare class Capabilities {
29
- private _maxRenderType;
30
- private _maxDepthType;
31
- private _maxTextureSize;
32
- private _maxColorAttachments;
33
- private _maxDrawBuffers;
34
- private _maxFragTextureUnits;
35
- private _maxVertTextureUnits;
36
- private _maxVertAttribs;
37
- private _maxVertUniformVectors;
38
- private _maxVaryingVectors;
39
- private _maxFragUniformVectors;
40
- private _maxAnisotropy?;
41
- private _maxAntialiasSamples;
42
- private _supportsCreateImageBitmap;
43
- private _maxTexSizeAllow;
44
- private _extensionMap;
45
- private _presentFeatures;
46
- private _isWebGL2;
47
- private _isMobile;
48
- private _driverBugs;
49
- get maxRenderType(): RenderType;
50
- get maxDepthType(): DepthType;
51
- get maxTextureSize(): number;
52
- get maxTexSizeAllow(): number;
53
- get supportsCreateImageBitmap(): boolean;
54
- get maxColorAttachments(): number;
55
- get maxDrawBuffers(): number;
56
- get maxFragTextureUnits(): number;
57
- get maxVertTextureUnits(): number;
58
- get maxVertAttribs(): number;
59
- get maxVertUniformVectors(): number;
60
- get maxVaryingVectors(): number;
61
- get maxFragUniformVectors(): number;
62
- get maxAntialiasSamples(): number;
63
- get isWebGL2(): boolean;
64
- get driverBugs(): GraphicsDriverBugs;
65
- /** These getters check for existence of extension objects to determine availability of features. In WebGL2, could just return true for some. */
66
- get supportsNonPowerOf2Textures(): boolean;
67
- get supportsDrawBuffers(): boolean;
68
- get supportsInstancing(): boolean;
69
- get supports32BitElementIndex(): boolean;
70
- get supportsTextureFloat(): boolean;
71
- get supportsTextureFloatLinear(): boolean;
72
- get supportsTextureHalfFloat(): boolean;
73
- get supportsTextureHalfFloatLinear(): boolean;
74
- get supportsTextureFilterAnisotropic(): boolean;
75
- get supportsShaderTextureLOD(): boolean;
76
- get supportsVertexArrayObjects(): boolean;
77
- get supportsFragDepth(): boolean;
78
- get supportsDisjointTimerQuery(): boolean;
79
- get supportsStandardDerivatives(): boolean;
80
- get supportsMRTTransparency(): boolean;
81
- get supportsMRTPickShaders(): boolean;
82
- get supportsShadowMaps(): boolean;
83
- get supportsAntiAliasing(): boolean;
84
- get isMobile(): boolean;
85
- private findExtension;
86
- /** Queries an extension object if available. This is necessary for other parts of the system to access some constants within extensions. */
87
- queryExtensionObject<T>(ext: WebGLExtensionName): T | undefined;
88
- static readonly optionalFeatures: WebGLFeature[];
89
- static readonly requiredFeatures: WebGLFeature[];
90
- private get _hasRequiredTextureUnits();
91
- /** Return an array containing any features not supported by the system as compared to the input array. */
92
- private _findMissingFeatures;
93
- /** Populate and return an array containing features that this system supports. */
94
- private _gatherFeatures;
95
- /** Retrieve compatibility status based on presence of various features. */
96
- private _getCompatibilityStatus;
97
- /** Initializes the capabilities based on a GL context. Must be called first. */
98
- init(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): WebGLRenderCompatibilityInfo;
99
- static create(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): Capabilities | undefined;
100
- /** Determines if a particular texture type is color-renderable on the host system. */
101
- private isTextureRenderable;
102
- setMaxAnisotropy(desiredMax: number | undefined, gl: WebGLContext): void;
103
- }
1
+ /** @packageDocumentation
2
+ * @module Compatibility
3
+ */
4
+ import { GraphicsDriverBugs, WebGLContext, WebGLFeature, WebGLRenderCompatibilityInfo } from "./RenderCompatibility";
5
+ /** @internal */
6
+ export type WebGLExtensionName = "WEBGL_draw_buffers" | "OES_element_index_uint" | "OES_texture_float" | "OES_texture_float_linear" | "OES_texture_half_float" | "OES_texture_half_float_linear" | "EXT_texture_filter_anisotropic" | "WEBGL_depth_texture" | "EXT_color_buffer_float" | "EXT_shader_texture_lod" | "ANGLE_instanced_arrays" | "OES_vertex_array_object" | "WEBGL_lose_context" | "EXT_frag_depth" | "EXT_disjoint_timer_query" | "EXT_disjoint_timer_query_webgl2" | "OES_standard_derivatives" | "EXT_float_blend";
7
+ /** Describes the type of a render target. Used by Capabilities to represent maximum precision render target available on host system.
8
+ * @internal
9
+ */
10
+ export declare enum RenderType {
11
+ TextureUnsignedByte = 0,
12
+ TextureHalfFloat = 1,
13
+ TextureFloat = 2
14
+ }
15
+ /**
16
+ * Describes the type of a depth buffer. Used by Capabilities to represent maximum depth buffer precision available on host system.
17
+ * Note: the commented-out values are unimplemented but left in place for reference, in case desired for future implementation.
18
+ * @internal
19
+ */
20
+ export declare enum DepthType {
21
+ RenderBufferUnsignedShort16 = 0,
22
+ TextureUnsignedInt24Stencil8 = 1,
23
+ TextureUnsignedInt32 = 2
24
+ }
25
+ /** Describes the rendering capabilities of the host system.
26
+ * @internal
27
+ */
28
+ export declare class Capabilities {
29
+ private _maxRenderType;
30
+ private _maxDepthType;
31
+ private _maxTextureSize;
32
+ private _maxColorAttachments;
33
+ private _maxDrawBuffers;
34
+ private _maxFragTextureUnits;
35
+ private _maxVertTextureUnits;
36
+ private _maxVertAttribs;
37
+ private _maxVertUniformVectors;
38
+ private _maxVaryingVectors;
39
+ private _maxFragUniformVectors;
40
+ private _maxAnisotropy?;
41
+ private _maxAntialiasSamples;
42
+ private _supportsCreateImageBitmap;
43
+ private _maxTexSizeAllow;
44
+ private _extensionMap;
45
+ private _presentFeatures;
46
+ private _isWebGL2;
47
+ private _isMobile;
48
+ private _driverBugs;
49
+ get maxRenderType(): RenderType;
50
+ get maxDepthType(): DepthType;
51
+ get maxTextureSize(): number;
52
+ get maxTexSizeAllow(): number;
53
+ get supportsCreateImageBitmap(): boolean;
54
+ get maxColorAttachments(): number;
55
+ get maxDrawBuffers(): number;
56
+ get maxFragTextureUnits(): number;
57
+ get maxVertTextureUnits(): number;
58
+ get maxVertAttribs(): number;
59
+ get maxVertUniformVectors(): number;
60
+ get maxVaryingVectors(): number;
61
+ get maxFragUniformVectors(): number;
62
+ get maxAntialiasSamples(): number;
63
+ get isWebGL2(): boolean;
64
+ get driverBugs(): GraphicsDriverBugs;
65
+ /** These getters check for existence of extension objects to determine availability of features. In WebGL2, could just return true for some. */
66
+ get supportsNonPowerOf2Textures(): boolean;
67
+ get supportsDrawBuffers(): boolean;
68
+ get supportsInstancing(): boolean;
69
+ get supports32BitElementIndex(): boolean;
70
+ get supportsTextureFloat(): boolean;
71
+ get supportsTextureFloatLinear(): boolean;
72
+ get supportsTextureHalfFloat(): boolean;
73
+ get supportsTextureHalfFloatLinear(): boolean;
74
+ get supportsTextureFilterAnisotropic(): boolean;
75
+ get supportsShaderTextureLOD(): boolean;
76
+ get supportsVertexArrayObjects(): boolean;
77
+ get supportsFragDepth(): boolean;
78
+ get supportsDisjointTimerQuery(): boolean;
79
+ get supportsStandardDerivatives(): boolean;
80
+ get supportsMRTTransparency(): boolean;
81
+ get supportsMRTPickShaders(): boolean;
82
+ get supportsShadowMaps(): boolean;
83
+ get supportsAntiAliasing(): boolean;
84
+ get isMobile(): boolean;
85
+ private findExtension;
86
+ /** Queries an extension object if available. This is necessary for other parts of the system to access some constants within extensions. */
87
+ queryExtensionObject<T>(ext: WebGLExtensionName): T | undefined;
88
+ static readonly optionalFeatures: WebGLFeature[];
89
+ static readonly requiredFeatures: WebGLFeature[];
90
+ private get _hasRequiredTextureUnits();
91
+ /** Return an array containing any features not supported by the system as compared to the input array. */
92
+ private _findMissingFeatures;
93
+ /** Populate and return an array containing features that this system supports. */
94
+ private _gatherFeatures;
95
+ /** Retrieve compatibility status based on presence of various features. */
96
+ private _getCompatibilityStatus;
97
+ /** Initializes the capabilities based on a GL context. Must be called first. */
98
+ init(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): WebGLRenderCompatibilityInfo;
99
+ static create(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): Capabilities | undefined;
100
+ /** Determines if a particular texture type is color-renderable on the host system. */
101
+ private isTextureRenderable;
102
+ setMaxAnisotropy(desiredMax: number | undefined, gl: WebGLContext): void;
103
+ }
104
104
  //# sourceMappingURL=Capabilities.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Capabilities.d.ts","sourceRoot":"","sources":["../../src/Capabilities.ts"],"names":[],"mappings":"AAIA;;GAEG;AAGH,OAAO,EACL,kBAAkB,EAAE,YAAY,EAAE,YAAY,EAAE,4BAA4B,EAC7E,MAAM,uBAAuB,CAAC;A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