@itwin/webgl-compatibility 5.0.0-dev.8 → 5.0.0-dev.82
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/CHANGELOG.md +46 -1
- package/lib/cjs/Capabilities.js +35 -36
- package/lib/cjs/Capabilities.js.map +1 -1
- package/lib/esm/Capabilities.js +35 -36
- package/lib/esm/Capabilities.js.map +1 -1
- package/package.json +11 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,51 @@
|
|
|
1
1
|
# Change Log - @itwin/webgl-compatibility
|
|
2
2
|
|
|
3
|
-
This log was last generated on
|
|
3
|
+
This log was last generated on Tue, 11 Mar 2025 15:27:53 GMT and should not be manually modified.
|
|
4
|
+
|
|
5
|
+
## 4.10.10
|
|
6
|
+
Tue, 11 Mar 2025 15:25:11 GMT
|
|
7
|
+
|
|
8
|
+
_Version update only_
|
|
9
|
+
|
|
10
|
+
## 4.10.9
|
|
11
|
+
Tue, 11 Mar 2025 05:17:33 GMT
|
|
12
|
+
|
|
13
|
+
_Version update only_
|
|
14
|
+
|
|
15
|
+
## 4.10.8
|
|
16
|
+
Thu, 06 Mar 2025 14:13:37 GMT
|
|
17
|
+
|
|
18
|
+
_Version update only_
|
|
19
|
+
|
|
20
|
+
## 4.10.7
|
|
21
|
+
Tue, 18 Feb 2025 17:27:03 GMT
|
|
22
|
+
|
|
23
|
+
_Version update only_
|
|
24
|
+
|
|
25
|
+
## 4.10.6
|
|
26
|
+
Fri, 24 Jan 2025 08:02:40 GMT
|
|
27
|
+
|
|
28
|
+
_Version update only_
|
|
29
|
+
|
|
30
|
+
## 4.10.5
|
|
31
|
+
Tue, 21 Jan 2025 21:56:45 GMT
|
|
32
|
+
|
|
33
|
+
_Version update only_
|
|
34
|
+
|
|
35
|
+
## 4.10.4
|
|
36
|
+
Mon, 13 Jan 2025 14:06:43 GMT
|
|
37
|
+
|
|
38
|
+
_Version update only_
|
|
39
|
+
|
|
40
|
+
## 4.10.3
|
|
41
|
+
Mon, 06 Jan 2025 14:00:13 GMT
|
|
42
|
+
|
|
43
|
+
_Version update only_
|
|
44
|
+
|
|
45
|
+
## 4.10.2
|
|
46
|
+
Thu, 21 Nov 2024 15:22:20 GMT
|
|
47
|
+
|
|
48
|
+
_Version update only_
|
|
4
49
|
|
|
5
50
|
## 4.10.1
|
|
6
51
|
Thu, 14 Nov 2024 18:11:00 GMT
|
package/lib/cjs/Capabilities.js
CHANGED
|
@@ -85,27 +85,26 @@ function isIntegratedGraphics(args) {
|
|
|
85
85
|
* @internal
|
|
86
86
|
*/
|
|
87
87
|
class Capabilities {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}
|
|
88
|
+
_maxRenderType = RenderType.TextureUnsignedByte;
|
|
89
|
+
_maxDepthType = DepthType.RenderBufferUnsignedShort16;
|
|
90
|
+
_maxTextureSize = 0;
|
|
91
|
+
_maxColorAttachments = 0;
|
|
92
|
+
_maxDrawBuffers = 0;
|
|
93
|
+
_maxFragTextureUnits = 0;
|
|
94
|
+
_maxVertTextureUnits = 0;
|
|
95
|
+
_maxVertAttribs = 0;
|
|
96
|
+
_maxVertUniformVectors = 0;
|
|
97
|
+
_maxVaryingVectors = 0;
|
|
98
|
+
_maxFragUniformVectors = 0;
|
|
99
|
+
_maxAnisotropy;
|
|
100
|
+
_maxAntialiasSamples = 1;
|
|
101
|
+
_supportsCreateImageBitmap = false;
|
|
102
|
+
_maxTexSizeAllow = maxTexSizeAllowed;
|
|
103
|
+
_extensionMap = {}; // Use this map to store actual extension objects retrieved from GL.
|
|
104
|
+
_presentFeatures = []; // List of features the system can support (not necessarily dependent on extensions)
|
|
105
|
+
_isWebGL2 = false;
|
|
106
|
+
_isMobile = false;
|
|
107
|
+
_driverBugs = {};
|
|
109
108
|
get maxRenderType() { return this._maxRenderType; }
|
|
110
109
|
get maxDepthType() { return this._maxDepthType; }
|
|
111
110
|
get maxTextureSize() { return this._maxTextureSize; }
|
|
@@ -152,6 +151,21 @@ class Capabilities {
|
|
|
152
151
|
queryExtensionObject(ext) {
|
|
153
152
|
return this.findExtension(ext);
|
|
154
153
|
}
|
|
154
|
+
static optionalFeatures = [
|
|
155
|
+
RenderCompatibility_1.WebGLFeature.MrtTransparency,
|
|
156
|
+
RenderCompatibility_1.WebGLFeature.MrtPick,
|
|
157
|
+
RenderCompatibility_1.WebGLFeature.DepthTexture,
|
|
158
|
+
RenderCompatibility_1.WebGLFeature.FloatRendering,
|
|
159
|
+
RenderCompatibility_1.WebGLFeature.Instancing,
|
|
160
|
+
RenderCompatibility_1.WebGLFeature.ShadowMaps,
|
|
161
|
+
RenderCompatibility_1.WebGLFeature.FragDepth,
|
|
162
|
+
RenderCompatibility_1.WebGLFeature.StandardDerivatives,
|
|
163
|
+
RenderCompatibility_1.WebGLFeature.AntiAliasing,
|
|
164
|
+
];
|
|
165
|
+
static requiredFeatures = [
|
|
166
|
+
RenderCompatibility_1.WebGLFeature.UintElementIndex,
|
|
167
|
+
RenderCompatibility_1.WebGLFeature.MinimalTextureUnits,
|
|
168
|
+
];
|
|
155
169
|
get _hasRequiredTextureUnits() { return this.maxFragTextureUnits >= 4 && this.maxVertTextureUnits >= 5; }
|
|
156
170
|
/** Return an array containing any features not supported by the system as compared to the input array. */
|
|
157
171
|
_findMissingFeatures(featuresToSeek) {
|
|
@@ -324,19 +338,4 @@ class Capabilities {
|
|
|
324
338
|
}
|
|
325
339
|
}
|
|
326
340
|
exports.Capabilities = Capabilities;
|
|
327
|
-
Capabilities.optionalFeatures = [
|
|
328
|
-
RenderCompatibility_1.WebGLFeature.MrtTransparency,
|
|
329
|
-
RenderCompatibility_1.WebGLFeature.MrtPick,
|
|
330
|
-
RenderCompatibility_1.WebGLFeature.DepthTexture,
|
|
331
|
-
RenderCompatibility_1.WebGLFeature.FloatRendering,
|
|
332
|
-
RenderCompatibility_1.WebGLFeature.Instancing,
|
|
333
|
-
RenderCompatibility_1.WebGLFeature.ShadowMaps,
|
|
334
|
-
RenderCompatibility_1.WebGLFeature.FragDepth,
|
|
335
|
-
RenderCompatibility_1.WebGLFeature.StandardDerivatives,
|
|
336
|
-
RenderCompatibility_1.WebGLFeature.AntiAliasing,
|
|
337
|
-
];
|
|
338
|
-
Capabilities.requiredFeatures = [
|
|
339
|
-
RenderCompatibility_1.WebGLFeature.UintElementIndex,
|
|
340
|
-
RenderCompatibility_1.WebGLFeature.MinimalTextureUnits,
|
|
341
|
-
];
|
|
342
341
|
//# sourceMappingURL=Capabilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Capabilities.js","sourceRoot":"","sources":["../../src/Capabilities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,+DAE+B;AAS/B,MAAM,eAAe,GAAyB;IAC5C,oBAAoB;IACpB,wBAAwB;IACxB,mBAAmB;IACnB,0BAA0B;IAC1B,wBAAwB;IACxB,+BAA+B;IAC/B,gCAAgC;IAChC,qBAAqB;IACrB,wBAAwB;IACxB,wBAAwB;IACxB,gBAAgB;IAChB,wBAAwB;IACxB,yBAAyB;IACzB,oBAAoB;IACpB,0BAA0B;IAC1B,iCAAiC;IACjC,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,yEAAmB,CAAA;IACnB,mEAAgB,CAAA;IAChB,2DAAY,CAAA;AACd,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED;;;;GAIG;AACH,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,uFAA2B,CAAA;IAC3B,+FAA+F;IAC/F,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,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;QACzG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;IACvE,CAAC;;AAnSH,oCAoSC;AAtNwB,6BAAgB,GAAmB;IACxD,kCAAY,CAAC,eAAe;IAC5B,kCAAY,CAAC,OAAO;IACpB,kCAAY,CAAC,YAAY;IACzB,kCAAY,CAAC,cAAc;IAC3B,kCAAY,CAAC,UAAU;IACvB,kCAAY,CAAC,UAAU;IACvB,kCAAY,CAAC,SAAS;IACtB,kCAAY,CAAC,mBAAmB;IAChC,kCAAY,CAAC,YAAY;CAC1B,AAVsC,CAUrC;AACqB,6BAAgB,GAAmB;IACxD,kCAAY,CAAC,gBAAgB;IAC7B,kCAAY,CAAC,mBAAmB;CACjC,AAHsC,CAGrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Compatibility\n */\n\nimport { ProcessDetector } from \"@itwin/core-bentley\";\nimport {\n GraphicsDriverBugs, WebGLContext, WebGLFeature, WebGLRenderCompatibilityInfo, WebGLRenderCompatibilityStatus,\n} from \"./RenderCompatibility\";\n\n/** @internal */\nexport type WebGLExtensionName =\n \"WEBGL_draw_buffers\" | \"OES_element_index_uint\" | \"OES_texture_float\" | \"OES_texture_float_linear\" |\n \"OES_texture_half_float\" | \"OES_texture_half_float_linear\" | \"EXT_texture_filter_anisotropic\" | \"WEBGL_depth_texture\" |\n \"EXT_color_buffer_float\" | \"EXT_shader_texture_lod\" | \"ANGLE_instanced_arrays\" | \"OES_vertex_array_object\" | \"WEBGL_lose_context\" |\n \"EXT_frag_depth\" | \"EXT_disjoint_timer_query\" | \"EXT_disjoint_timer_query_webgl2\" | \"OES_standard_derivatives\" | \"EXT_float_blend\";\n\nconst knownExtensions: WebGLExtensionName[] = [\n \"WEBGL_draw_buffers\",\n \"OES_element_index_uint\",\n \"OES_texture_float\",\n \"OES_texture_float_linear\",\n \"OES_texture_half_float\",\n \"OES_texture_half_float_linear\",\n \"EXT_texture_filter_anisotropic\",\n \"WEBGL_depth_texture\",\n \"EXT_color_buffer_float\",\n \"EXT_shader_texture_lod\",\n \"EXT_frag_depth\",\n \"ANGLE_instanced_arrays\",\n \"OES_vertex_array_object\",\n \"WEBGL_lose_context\",\n \"EXT_disjoint_timer_query\",\n \"EXT_disjoint_timer_query_webgl2\",\n \"OES_standard_derivatives\",\n \"EXT_float_blend\",\n];\n\n/** Describes the type of a render target. Used by Capabilities to represent maximum precision render target available on host system.\n * @internal\n */\nexport enum RenderType {\n TextureUnsignedByte,\n TextureHalfFloat,\n TextureFloat,\n}\n\n/**\n * Describes the type of a depth buffer. Used by Capabilities to represent maximum depth buffer precision available on host system.\n * Note: the commented-out values are unimplemented but left in place for reference, in case desired for future implementation.\n * @internal\n */\nexport enum DepthType {\n RenderBufferUnsignedShort16, // core to WebGL1\n // TextureUnsignedShort16, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureUnsignedInt24, // core to WebGL2\n TextureUnsignedInt24Stencil8, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n TextureUnsignedInt32, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureFloat32, // core to WebGL2\n // TextureFloat32Stencil8, // core to WeBGL2\n}\n\nconst maxTexSizeAllowed = 4096; // many devices and browsers have issues with source textures larger than this\n\n// Regexes to match Intel UHD/HD 620/630 integrated GPUS that suffer from GraphicsDriverBugs.fragDepthDoesNotDisableEarlyZ.\nconst buggyIntelMatchers = [\n // Original unmasked renderer string when workaround we implemented.\n /ANGLE \\(Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n // New unmasked renderer string circa October 2021.\n /ANGLE \\(Intel, Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n];\n\n// Regexes to match Mali GPUs known to suffer from GraphicsDriverBugs.msaaWillHang.\nconst buggyMaliMatchers = [\n /Mali-G71/,\n /Mali-G72/,\n /Mali-G76/,\n];\n\n// Regexes to match as many Intel integrated GPUs as possible.\n// https://en.wikipedia.org/wiki/List_of_Intel_graphics_processing_units\nconst integratedIntelGpuMatchers = [\n /(U)?HD Graphics/,\n /Iris/,\n];\n\nfunction isIntegratedGraphics(args: {unmaskedVendor?: string, unmaskedRenderer?: string}): boolean {\n if (args.unmaskedRenderer && args.unmaskedRenderer.includes(\"Intel\") && integratedIntelGpuMatchers.some((x) => x.test(args.unmaskedRenderer!)))\n return true;\n\n // NB: For now, we do not attempt to detect AMD integrated graphics.\n // It appears that AMD integrated graphics are not usually paired with a graphics card so detecting integrated usage there is less important than Intel.\n\n return false;\n}\n\n/** Describes the rendering capabilities of the host system.\n * @internal\n */\nexport class Capabilities {\n private _maxRenderType: RenderType = RenderType.TextureUnsignedByte;\n private _maxDepthType: DepthType = DepthType.RenderBufferUnsignedShort16;\n private _maxTextureSize: number = 0;\n private _maxColorAttachments: number = 0;\n private _maxDrawBuffers: number = 0;\n private _maxFragTextureUnits: number = 0;\n private _maxVertTextureUnits: number = 0;\n private _maxVertAttribs: number = 0;\n private _maxVertUniformVectors: number = 0;\n private _maxVaryingVectors: number = 0;\n private _maxFragUniformVectors: number = 0;\n private _maxAnisotropy?: number;\n private _maxAntialiasSamples: number = 1;\n private _supportsCreateImageBitmap: boolean = false;\n private _maxTexSizeAllow: number = maxTexSizeAllowed;\n\n private _extensionMap: { [key: string]: any } = {}; // Use this map to store actual extension objects retrieved from GL.\n private _presentFeatures: WebGLFeature[] = []; // List of features the system can support (not necessarily dependent on extensions)\n\n private _isWebGL2: boolean = false;\n private _isMobile: boolean = false;\n private _driverBugs: GraphicsDriverBugs = {};\n\n public get maxRenderType(): RenderType { return this._maxRenderType; }\n public get maxDepthType(): DepthType { return this._maxDepthType; }\n public get maxTextureSize(): number { return this._maxTextureSize; }\n public get maxTexSizeAllow(): number { return this._maxTexSizeAllow; }\n public get supportsCreateImageBitmap(): boolean { return this._supportsCreateImageBitmap; }\n public get maxColorAttachments(): number { return this._maxColorAttachments; }\n public get maxDrawBuffers(): number { return this._maxDrawBuffers; }\n public get maxFragTextureUnits(): number { return this._maxFragTextureUnits; }\n public get maxVertTextureUnits(): number { return this._maxVertTextureUnits; }\n public get maxVertAttribs(): number { return this._maxVertAttribs; }\n public get maxVertUniformVectors(): number { return this._maxVertUniformVectors; }\n public get maxVaryingVectors(): number { return this._maxVaryingVectors; }\n public get maxFragUniformVectors(): number { return this._maxFragUniformVectors; }\n public get maxAntialiasSamples(): number { return this._maxAntialiasSamples; }\n public get isWebGL2(): boolean { return this._isWebGL2; }\n public get driverBugs(): GraphicsDriverBugs { return this._driverBugs; }\n\n /** These getters check for existence of extension objects to determine availability of features. In WebGL2, could just return true for some. */\n public get supportsNonPowerOf2Textures(): boolean { return false; }\n public get supportsDrawBuffers(): boolean { return this._isWebGL2 || this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\") !== undefined; }\n public get supportsInstancing(): boolean { return this._isWebGL2 || this.queryExtensionObject<ANGLE_instanced_arrays>(\"ANGLE_instanced_arrays\") !== undefined; }\n public get supports32BitElementIndex(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_element_index_uint>(\"OES_element_index_uint\") !== undefined; }\n public get supportsTextureFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float>(\"OES_texture_float\") !== undefined; }\n public get supportsTextureFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float_linear>(\"OES_texture_float_linear\") !== undefined; }\n public get supportsTextureHalfFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\") !== undefined; }\n public get supportsTextureHalfFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float_linear>(\"OES_texture_half_float_linear\") !== undefined; }\n public get supportsTextureFilterAnisotropic(): boolean { return this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\") !== undefined; }\n public get supportsShaderTextureLOD(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_shader_texture_lod>(\"EXT_shader_texture_lod\") !== undefined; }\n public get supportsVertexArrayObjects(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_vertex_array_object>(\"OES_vertex_array_object\") !== undefined; }\n public get supportsFragDepth(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_frag_depth>(\"EXT_frag_depth\") !== undefined; }\n public get supportsDisjointTimerQuery(): boolean { return (this._isWebGL2 && this.queryExtensionObject<any>(\"EXT_disjoint_timer_query_webgl2\") !== undefined) || this.queryExtensionObject<any>(\"EXT_disjoint_timer_query\") !== undefined; }\n public get supportsStandardDerivatives(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_standard_derivatives>(\"OES_standard_derivatives\") !== undefined; }\n\n public get supportsMRTTransparency(): boolean { return this.maxColorAttachments >= 2; }\n public get supportsMRTPickShaders(): boolean { return this.maxColorAttachments >= 3; }\n\n public get supportsShadowMaps(): boolean {\n return this.supportsTextureFloat || this.supportsTextureHalfFloat;\n }\n\n public get supportsAntiAliasing(): boolean { return this._isWebGL2 && this.maxAntialiasSamples > 1; }\n\n public get isMobile(): boolean { return this._isMobile; }\n\n private findExtension(name: WebGLExtensionName): any {\n const ext = this._extensionMap[name];\n return null !== ext ? ext : undefined;\n }\n\n /** Queries an extension object if available. This is necessary for other parts of the system to access some constants within extensions. */\n public queryExtensionObject<T>(ext: WebGLExtensionName): T | undefined {\n return this.findExtension(ext) as T;\n }\n\n public static readonly optionalFeatures: WebGLFeature[] = [\n WebGLFeature.MrtTransparency,\n WebGLFeature.MrtPick,\n WebGLFeature.DepthTexture,\n WebGLFeature.FloatRendering,\n WebGLFeature.Instancing,\n WebGLFeature.ShadowMaps,\n WebGLFeature.FragDepth,\n WebGLFeature.StandardDerivatives,\n WebGLFeature.AntiAliasing,\n ];\n public static readonly requiredFeatures: WebGLFeature[] = [\n WebGLFeature.UintElementIndex,\n WebGLFeature.MinimalTextureUnits,\n ];\n\n private get _hasRequiredTextureUnits(): boolean { return this.maxFragTextureUnits >= 4 && this.maxVertTextureUnits >= 5; }\n\n /** Return an array containing any features not supported by the system as compared to the input array. */\n private _findMissingFeatures(featuresToSeek: WebGLFeature[]): WebGLFeature[] {\n const missingFeatures: WebGLFeature[] = [];\n for (const featureName of featuresToSeek) {\n if (-1 === this._presentFeatures.indexOf(featureName))\n missingFeatures.push(featureName);\n }\n return missingFeatures;\n }\n\n /** Populate and return an array containing features that this system supports. */\n private _gatherFeatures(): WebGLFeature[] {\n const features: WebGLFeature[] = [];\n\n // simply check for presence of various extensions if that gives enough information\n if (this._isWebGL2 || this._extensionMap[\"OES_element_index_uint\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.UintElementIndex);\n if (this._isWebGL2 || this._extensionMap[\"ANGLE_instanced_arrays\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.Instancing);\n\n if (this.supportsMRTTransparency)\n features.push(WebGLFeature.MrtTransparency);\n if (this.supportsMRTPickShaders)\n features.push(WebGLFeature.MrtPick);\n if (this.supportsShadowMaps)\n features.push(WebGLFeature.ShadowMaps);\n if (this._hasRequiredTextureUnits)\n features.push(WebGLFeature.MinimalTextureUnits);\n if (this.supportsFragDepth)\n features.push(WebGLFeature.FragDepth);\n if (this.supportsStandardDerivatives)\n features.push(WebGLFeature.StandardDerivatives);\n if (this.supportsAntiAliasing)\n features.push(WebGLFeature.AntiAliasing);\n\n if (DepthType.TextureUnsignedInt24Stencil8 === this._maxDepthType)\n features.push(WebGLFeature.DepthTexture);\n\n // check if at least half-float rendering is available based on maximum discovered renderable target\n if (RenderType.TextureUnsignedByte !== this._maxRenderType)\n features.push(WebGLFeature.FloatRendering);\n\n return features;\n }\n\n /** Retrieve compatibility status based on presence of various features. */\n private _getCompatibilityStatus(missingRequiredFeatures: WebGLFeature[], missingOptionalFeatures: WebGLFeature[]): WebGLRenderCompatibilityStatus {\n let status: WebGLRenderCompatibilityStatus = WebGLRenderCompatibilityStatus.AllOkay;\n if (missingOptionalFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingOptionalFeatures;\n if (missingRequiredFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingRequiredFeatures;\n return status;\n }\n\n /** Initializes the capabilities based on a GL context. Must be called first. */\n public init(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): WebGLRenderCompatibilityInfo {\n const gl2 = !(gl instanceof WebGLRenderingContext) ? gl : undefined;\n this._isWebGL2 = undefined !== gl2;\n\n this._isMobile = ProcessDetector.isMobileBrowser;\n\n const debugInfo = gl.getExtension(\"WEBGL_debug_renderer_info\");\n const unmaskedRenderer = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) : undefined;\n const unmaskedVendor = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) : undefined;\n\n this._driverBugs = {};\n if (unmaskedRenderer && buggyIntelMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.fragDepthDoesNotDisableEarlyZ = true;\n\n if (unmaskedRenderer && buggyMaliMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.msaaWillHang = true;\n\n this._maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n this._supportsCreateImageBitmap = typeof createImageBitmap === \"function\" && ProcessDetector.isChromium && !ProcessDetector.isIOSBrowser;\n this._maxTexSizeAllow = Math.min(this._maxTextureSize, maxTexSizeAllowed);\n this._maxFragTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n this._maxVertTextureUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\n this._maxVertAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n this._maxVertUniformVectors = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);\n this._maxVaryingVectors = gl.getParameter(gl.MAX_VARYING_VECTORS);\n this._maxFragUniformVectors = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);\n this._maxAntialiasSamples = this._driverBugs.msaaWillHang ? 1 : (this._isWebGL2 && undefined !== gl2 ? gl.getParameter(gl2.MAX_SAMPLES) : 1);\n\n const extensions = gl.getSupportedExtensions(); // This just retrieves a list of available extensions (not necessarily enabled).\n if (extensions) {\n for (const extStr of extensions) {\n const ext = extStr as WebGLExtensionName;\n if (-1 === knownExtensions.indexOf(ext))\n continue;\n else if (undefined !== disabledExtensions && -1 !== disabledExtensions.indexOf(ext))\n continue;\n\n const extObj: any = gl.getExtension(ext); // This call enables the extension and returns a WebGLObject containing extension instance.\n if (null !== extObj)\n this._extensionMap[ext] = extObj;\n }\n }\n\n if (this._isWebGL2 && undefined !== gl2) {\n this._maxColorAttachments = gl.getParameter(gl2.MAX_COLOR_ATTACHMENTS);\n this._maxDrawBuffers = gl.getParameter(gl2.MAX_DRAW_BUFFERS);\n } else {\n const dbExt: WEBGL_draw_buffers | undefined = this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\");\n this._maxColorAttachments = dbExt !== undefined ? gl.getParameter(dbExt.MAX_COLOR_ATTACHMENTS_WEBGL) : 1;\n this._maxDrawBuffers = dbExt !== undefined ? gl.getParameter(dbExt.MAX_DRAW_BUFFERS_WEBGL) : 1;\n }\n\n // Determine the maximum color-renderable attachment type.\n const allowFloatRender =\n (undefined === disabledExtensions || -1 === disabledExtensions.indexOf(\"OES_texture_float\"))\n // iOS>=15 allows full-float rendering. However, it does not actually work on non-M1 devices.\n // Because of this, for now we disallow full float rendering on iOS devices.\n // ###TODO: Re-assess this after future iOS updates.\n && !ProcessDetector.isIOSBrowser\n // Samsung Galaxy Note 8 exhibits same issue as described above for iOS >= 15.\n // It uses specifically Mali-G71 MP20 but reports its renderer as follows.\n // Samsung Galaxy A50 and S9 exhibits same issue; they use Mali-G72.\n // HUAWEI P30 exhibits same issue; it uses Mali-G76.\n && unmaskedRenderer !== \"Mali-G71\" && unmaskedRenderer !== \"Mali-G72\" && unmaskedRenderer !== \"Mali-G76\";\n\n if (allowFloatRender && undefined !== this.queryExtensionObject(\"EXT_float_blend\") && this.isTextureRenderable(gl, gl.FLOAT)) {\n this._maxRenderType = RenderType.TextureFloat;\n } else if (this.isWebGL2) {\n this._maxRenderType = (this.isTextureRenderable(gl, (gl as WebGL2RenderingContext).HALF_FLOAT)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n } else {\n const hfExt: OES_texture_half_float | undefined = this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\");\n this._maxRenderType = (hfExt !== undefined && this.isTextureRenderable(gl, hfExt.HALF_FLOAT_OES)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n }\n\n // Determine the maximum depth attachment type.\n // this._maxDepthType = this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt32 : DepthType.RenderBufferUnsignedShort16;\n this._maxDepthType = this._isWebGL2 || this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt24Stencil8 : DepthType.RenderBufferUnsignedShort16;\n\n this._presentFeatures = this._gatherFeatures();\n const missingRequiredFeatures = this._findMissingFeatures(Capabilities.requiredFeatures);\n const missingOptionalFeatures = this._findMissingFeatures(Capabilities.optionalFeatures);\n\n return {\n status: this._getCompatibilityStatus(missingRequiredFeatures, missingOptionalFeatures),\n missingRequiredFeatures,\n missingOptionalFeatures,\n unmaskedRenderer,\n unmaskedVendor,\n usingIntegratedGraphics: isIntegratedGraphics({unmaskedVendor, unmaskedRenderer}),\n driverBugs: { ...this._driverBugs },\n userAgent: navigator.userAgent,\n createdContext: gl,\n };\n }\n\n public static create(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): Capabilities | undefined {\n const caps = new Capabilities();\n const compatibility = caps.init(gl, disabledExtensions);\n if (WebGLRenderCompatibilityStatus.CannotCreateContext === compatibility.status || WebGLRenderCompatibilityStatus.MissingRequiredFeatures === compatibility.status)\n return undefined;\n return caps;\n }\n\n /** Determines if a particular texture type is color-renderable on the host system. */\n private isTextureRenderable(gl: WebGLContext, texType: number): boolean {\n const tex: WebGLTexture | null = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, tex);\n if (this.isWebGL2) {\n if (gl.FLOAT === texType)\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA32F, 1, 1, 0, gl.RGBA, texType, null);\n else\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA16F, 1, 1, 0, gl.RGBA, texType, null);\n } else\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, texType, null);\n\n const fb: WebGLFramebuffer | null = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);\n\n const fbStatus: number = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteFramebuffer(fb);\n gl.deleteTexture(tex);\n\n gl.getError(); // clear any errors\n\n return fbStatus === gl.FRAMEBUFFER_COMPLETE;\n }\n\n public setMaxAnisotropy(desiredMax: number | undefined, gl: WebGLContext): void {\n const ext = this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\");\n if (undefined === ext)\n return;\n\n if (undefined === this._maxAnisotropy)\n this._maxAnisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) as number;\n\n const max = (undefined !== desiredMax) ? Math.min(desiredMax, this._maxAnisotropy) : this._maxAnisotropy;\n gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Capabilities.js","sourceRoot":"","sources":["../../src/Capabilities.ts"],"names":[],"mappings":";AAAA;;;+FAG+F;AAC/F;;GAEG;;;AAEH,sDAAsD;AACtD,+DAE+B;AAS/B,MAAM,eAAe,GAAyB;IAC5C,oBAAoB;IACpB,wBAAwB;IACxB,mBAAmB;IACnB,0BAA0B;IAC1B,wBAAwB;IACxB,+BAA+B;IAC/B,gCAAgC;IAChC,qBAAqB;IACrB,wBAAwB;IACxB,wBAAwB;IACxB,gBAAgB;IAChB,wBAAwB;IACxB,yBAAyB;IACzB,oBAAoB;IACpB,0BAA0B;IAC1B,iCAAiC;IACjC,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,yEAAmB,CAAA;IACnB,mEAAgB,CAAA;IAChB,2DAAY,CAAA;AACd,CAAC,EAJW,UAAU,0BAAV,UAAU,QAIrB;AAED;;;;GAIG;AACH,IAAY,SAQX;AARD,WAAY,SAAS;IACnB,uFAA2B,CAAA;IAC3B,+FAA+F;IAC/F,kDAAkD;IAClD,yFAA4B,CAAA;IAC5B,yEAAoB,CAAA;IACpB,kDAAkD;IAClD,kDAAkD;AACpD,CAAC,EARW,SAAS,yBAAT,SAAS,QAQpB;AAED,MAAM,iBAAiB,GAAG,IAAI,CAAC,CAAC,8EAA8E;AAE9G,2HAA2H;AAC3H,MAAM,kBAAkB,GAAG;IACzB,oEAAoE;IACpE,uDAAuD;IACvD,mDAAmD;IACnD,8DAA8D;CAC/D,CAAC;AAEF,mFAAmF;AACnF,MAAM,iBAAiB,GAAG;IACxB,UAAU;IACV,UAAU;IACV,UAAU;CACX,CAAC;AAEF,8DAA8D;AAC9D,wEAAwE;AACxE,MAAM,0BAA0B,GAAG;IACjC,iBAAiB;IACjB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CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;QACzG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;IACvE,CAAC;;AAnSH,oCAoSC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Compatibility\n */\n\nimport { ProcessDetector } from \"@itwin/core-bentley\";\nimport {\n GraphicsDriverBugs, WebGLContext, WebGLFeature, WebGLRenderCompatibilityInfo, WebGLRenderCompatibilityStatus,\n} from \"./RenderCompatibility\";\n\n/** @internal */\nexport type WebGLExtensionName =\n \"WEBGL_draw_buffers\" | \"OES_element_index_uint\" | \"OES_texture_float\" | \"OES_texture_float_linear\" |\n \"OES_texture_half_float\" | \"OES_texture_half_float_linear\" | \"EXT_texture_filter_anisotropic\" | \"WEBGL_depth_texture\" |\n \"EXT_color_buffer_float\" | \"EXT_shader_texture_lod\" | \"ANGLE_instanced_arrays\" | \"OES_vertex_array_object\" | \"WEBGL_lose_context\" |\n \"EXT_frag_depth\" | \"EXT_disjoint_timer_query\" | \"EXT_disjoint_timer_query_webgl2\" | \"OES_standard_derivatives\" | \"EXT_float_blend\";\n\nconst knownExtensions: WebGLExtensionName[] = [\n \"WEBGL_draw_buffers\",\n \"OES_element_index_uint\",\n \"OES_texture_float\",\n \"OES_texture_float_linear\",\n \"OES_texture_half_float\",\n \"OES_texture_half_float_linear\",\n \"EXT_texture_filter_anisotropic\",\n \"WEBGL_depth_texture\",\n \"EXT_color_buffer_float\",\n \"EXT_shader_texture_lod\",\n \"EXT_frag_depth\",\n \"ANGLE_instanced_arrays\",\n \"OES_vertex_array_object\",\n \"WEBGL_lose_context\",\n \"EXT_disjoint_timer_query\",\n \"EXT_disjoint_timer_query_webgl2\",\n \"OES_standard_derivatives\",\n \"EXT_float_blend\",\n];\n\n/** Describes the type of a render target. Used by Capabilities to represent maximum precision render target available on host system.\n * @internal\n */\nexport enum RenderType {\n TextureUnsignedByte,\n TextureHalfFloat,\n TextureFloat,\n}\n\n/**\n * Describes the type of a depth buffer. Used by Capabilities to represent maximum depth buffer precision available on host system.\n * Note: the commented-out values are unimplemented but left in place for reference, in case desired for future implementation.\n * @internal\n */\nexport enum DepthType {\n RenderBufferUnsignedShort16, // core to WebGL1\n // TextureUnsignedShort16, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureUnsignedInt24, // core to WebGL2\n TextureUnsignedInt24Stencil8, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n TextureUnsignedInt32, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureFloat32, // core to WebGL2\n // TextureFloat32Stencil8, // core to WeBGL2\n}\n\nconst maxTexSizeAllowed = 4096; // many devices and browsers have issues with source textures larger than this\n\n// Regexes to match Intel UHD/HD 620/630 integrated GPUS that suffer from GraphicsDriverBugs.fragDepthDoesNotDisableEarlyZ.\nconst buggyIntelMatchers = [\n // Original unmasked renderer string when workaround we implemented.\n /ANGLE \\(Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n // New unmasked renderer string circa October 2021.\n /ANGLE \\(Intel, Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n];\n\n// Regexes to match Mali GPUs known to suffer from GraphicsDriverBugs.msaaWillHang.\nconst buggyMaliMatchers = [\n /Mali-G71/,\n /Mali-G72/,\n /Mali-G76/,\n];\n\n// Regexes to match as many Intel integrated GPUs as possible.\n// https://en.wikipedia.org/wiki/List_of_Intel_graphics_processing_units\nconst integratedIntelGpuMatchers = [\n /(U)?HD Graphics/,\n /Iris/,\n];\n\nfunction isIntegratedGraphics(args: {unmaskedVendor?: string, unmaskedRenderer?: string}): boolean {\n if (args.unmaskedRenderer && args.unmaskedRenderer.includes(\"Intel\") && integratedIntelGpuMatchers.some((x) => x.test(args.unmaskedRenderer!)))\n return true;\n\n // NB: For now, we do not attempt to detect AMD integrated graphics.\n // It appears that AMD integrated graphics are not usually paired with a graphics card so detecting integrated usage there is less important than Intel.\n\n return false;\n}\n\n/** Describes the rendering capabilities of the host system.\n * @internal\n */\nexport class Capabilities {\n private _maxRenderType: RenderType = RenderType.TextureUnsignedByte;\n private _maxDepthType: DepthType = DepthType.RenderBufferUnsignedShort16;\n private _maxTextureSize: number = 0;\n private _maxColorAttachments: number = 0;\n private _maxDrawBuffers: number = 0;\n private _maxFragTextureUnits: number = 0;\n private _maxVertTextureUnits: number = 0;\n private _maxVertAttribs: number = 0;\n private _maxVertUniformVectors: number = 0;\n private _maxVaryingVectors: number = 0;\n private _maxFragUniformVectors: number = 0;\n private _maxAnisotropy?: number;\n private _maxAntialiasSamples: number = 1;\n private _supportsCreateImageBitmap: boolean = false;\n private _maxTexSizeAllow: number = maxTexSizeAllowed;\n\n private _extensionMap: { [key: string]: any } = {}; // Use this map to store actual extension objects retrieved from GL.\n private _presentFeatures: WebGLFeature[] = []; // List of features the system can support (not necessarily dependent on extensions)\n\n private _isWebGL2: boolean = false;\n private _isMobile: boolean = false;\n private _driverBugs: GraphicsDriverBugs = {};\n\n public get maxRenderType(): RenderType { return this._maxRenderType; }\n public get maxDepthType(): DepthType { return this._maxDepthType; }\n public get maxTextureSize(): number { return this._maxTextureSize; }\n public get maxTexSizeAllow(): number { return this._maxTexSizeAllow; }\n public get supportsCreateImageBitmap(): boolean { return this._supportsCreateImageBitmap; }\n public get maxColorAttachments(): number { return this._maxColorAttachments; }\n public get maxDrawBuffers(): number { return this._maxDrawBuffers; }\n public get maxFragTextureUnits(): number { return this._maxFragTextureUnits; }\n public get maxVertTextureUnits(): number { return this._maxVertTextureUnits; }\n public get maxVertAttribs(): number { return this._maxVertAttribs; }\n public get maxVertUniformVectors(): number { return this._maxVertUniformVectors; }\n public get maxVaryingVectors(): number { return this._maxVaryingVectors; }\n public get maxFragUniformVectors(): number { return this._maxFragUniformVectors; }\n public get maxAntialiasSamples(): number { return this._maxAntialiasSamples; }\n public get isWebGL2(): boolean { return this._isWebGL2; }\n public get driverBugs(): GraphicsDriverBugs { return this._driverBugs; }\n\n /** These getters check for existence of extension objects to determine availability of features. In WebGL2, could just return true for some. */\n public get supportsNonPowerOf2Textures(): boolean { return false; }\n public get supportsDrawBuffers(): boolean { return this._isWebGL2 || this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\") !== undefined; }\n public get supportsInstancing(): boolean { return this._isWebGL2 || this.queryExtensionObject<ANGLE_instanced_arrays>(\"ANGLE_instanced_arrays\") !== undefined; }\n public get supports32BitElementIndex(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_element_index_uint>(\"OES_element_index_uint\") !== undefined; }\n public get supportsTextureFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float>(\"OES_texture_float\") !== undefined; }\n public get supportsTextureFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float_linear>(\"OES_texture_float_linear\") !== undefined; }\n public get supportsTextureHalfFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\") !== undefined; }\n public get supportsTextureHalfFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float_linear>(\"OES_texture_half_float_linear\") !== undefined; }\n public get supportsTextureFilterAnisotropic(): boolean { return this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\") !== undefined; }\n public get supportsShaderTextureLOD(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_shader_texture_lod>(\"EXT_shader_texture_lod\") !== undefined; }\n public get supportsVertexArrayObjects(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_vertex_array_object>(\"OES_vertex_array_object\") !== undefined; }\n public get supportsFragDepth(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_frag_depth>(\"EXT_frag_depth\") !== undefined; }\n public get supportsDisjointTimerQuery(): boolean { return (this._isWebGL2 && this.queryExtensionObject<any>(\"EXT_disjoint_timer_query_webgl2\") !== undefined) || this.queryExtensionObject<any>(\"EXT_disjoint_timer_query\") !== undefined; }\n public get supportsStandardDerivatives(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_standard_derivatives>(\"OES_standard_derivatives\") !== undefined; }\n\n public get supportsMRTTransparency(): boolean { return this.maxColorAttachments >= 2; }\n public get supportsMRTPickShaders(): boolean { return this.maxColorAttachments >= 3; }\n\n public get supportsShadowMaps(): boolean {\n return this.supportsTextureFloat || this.supportsTextureHalfFloat;\n }\n\n public get supportsAntiAliasing(): boolean { return this._isWebGL2 && this.maxAntialiasSamples > 1; }\n\n public get isMobile(): boolean { return this._isMobile; }\n\n private findExtension(name: WebGLExtensionName): any {\n const ext = this._extensionMap[name];\n return null !== ext ? ext : undefined;\n }\n\n /** Queries an extension object if available. This is necessary for other parts of the system to access some constants within extensions. */\n public queryExtensionObject<T>(ext: WebGLExtensionName): T | undefined {\n return this.findExtension(ext) as T;\n }\n\n public static readonly optionalFeatures: WebGLFeature[] = [\n WebGLFeature.MrtTransparency,\n WebGLFeature.MrtPick,\n WebGLFeature.DepthTexture,\n WebGLFeature.FloatRendering,\n WebGLFeature.Instancing,\n WebGLFeature.ShadowMaps,\n WebGLFeature.FragDepth,\n WebGLFeature.StandardDerivatives,\n WebGLFeature.AntiAliasing,\n ];\n public static readonly requiredFeatures: WebGLFeature[] = [\n WebGLFeature.UintElementIndex,\n WebGLFeature.MinimalTextureUnits,\n ];\n\n private get _hasRequiredTextureUnits(): boolean { return this.maxFragTextureUnits >= 4 && this.maxVertTextureUnits >= 5; }\n\n /** Return an array containing any features not supported by the system as compared to the input array. */\n private _findMissingFeatures(featuresToSeek: WebGLFeature[]): WebGLFeature[] {\n const missingFeatures: WebGLFeature[] = [];\n for (const featureName of featuresToSeek) {\n if (-1 === this._presentFeatures.indexOf(featureName))\n missingFeatures.push(featureName);\n }\n return missingFeatures;\n }\n\n /** Populate and return an array containing features that this system supports. */\n private _gatherFeatures(): WebGLFeature[] {\n const features: WebGLFeature[] = [];\n\n // simply check for presence of various extensions if that gives enough information\n if (this._isWebGL2 || this._extensionMap[\"OES_element_index_uint\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.UintElementIndex);\n if (this._isWebGL2 || this._extensionMap[\"ANGLE_instanced_arrays\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.Instancing);\n\n if (this.supportsMRTTransparency)\n features.push(WebGLFeature.MrtTransparency);\n if (this.supportsMRTPickShaders)\n features.push(WebGLFeature.MrtPick);\n if (this.supportsShadowMaps)\n features.push(WebGLFeature.ShadowMaps);\n if (this._hasRequiredTextureUnits)\n features.push(WebGLFeature.MinimalTextureUnits);\n if (this.supportsFragDepth)\n features.push(WebGLFeature.FragDepth);\n if (this.supportsStandardDerivatives)\n features.push(WebGLFeature.StandardDerivatives);\n if (this.supportsAntiAliasing)\n features.push(WebGLFeature.AntiAliasing);\n\n if (DepthType.TextureUnsignedInt24Stencil8 === this._maxDepthType)\n features.push(WebGLFeature.DepthTexture);\n\n // check if at least half-float rendering is available based on maximum discovered renderable target\n if (RenderType.TextureUnsignedByte !== this._maxRenderType)\n features.push(WebGLFeature.FloatRendering);\n\n return features;\n }\n\n /** Retrieve compatibility status based on presence of various features. */\n private _getCompatibilityStatus(missingRequiredFeatures: WebGLFeature[], missingOptionalFeatures: WebGLFeature[]): WebGLRenderCompatibilityStatus {\n let status: WebGLRenderCompatibilityStatus = WebGLRenderCompatibilityStatus.AllOkay;\n if (missingOptionalFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingOptionalFeatures;\n if (missingRequiredFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingRequiredFeatures;\n return status;\n }\n\n /** Initializes the capabilities based on a GL context. Must be called first. */\n public init(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): WebGLRenderCompatibilityInfo {\n const gl2 = !(gl instanceof WebGLRenderingContext) ? gl : undefined;\n this._isWebGL2 = undefined !== gl2;\n\n this._isMobile = ProcessDetector.isMobileBrowser;\n\n const debugInfo = gl.getExtension(\"WEBGL_debug_renderer_info\");\n const unmaskedRenderer = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) : undefined;\n const unmaskedVendor = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) : undefined;\n\n this._driverBugs = {};\n if (unmaskedRenderer && buggyIntelMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.fragDepthDoesNotDisableEarlyZ = true;\n\n if (unmaskedRenderer && buggyMaliMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.msaaWillHang = true;\n\n this._maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n this._supportsCreateImageBitmap = typeof createImageBitmap === \"function\" && ProcessDetector.isChromium && !ProcessDetector.isIOSBrowser;\n this._maxTexSizeAllow = Math.min(this._maxTextureSize, maxTexSizeAllowed);\n this._maxFragTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n this._maxVertTextureUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\n this._maxVertAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n this._maxVertUniformVectors = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);\n this._maxVaryingVectors = gl.getParameter(gl.MAX_VARYING_VECTORS);\n this._maxFragUniformVectors = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);\n this._maxAntialiasSamples = this._driverBugs.msaaWillHang ? 1 : (this._isWebGL2 && undefined !== gl2 ? gl.getParameter(gl2.MAX_SAMPLES) : 1);\n\n const extensions = gl.getSupportedExtensions(); // This just retrieves a list of available extensions (not necessarily enabled).\n if (extensions) {\n for (const extStr of extensions) {\n const ext = extStr as WebGLExtensionName;\n if (-1 === knownExtensions.indexOf(ext))\n continue;\n else if (undefined !== disabledExtensions && -1 !== disabledExtensions.indexOf(ext))\n continue;\n\n const extObj: any = gl.getExtension(ext); // This call enables the extension and returns a WebGLObject containing extension instance.\n if (null !== extObj)\n this._extensionMap[ext] = extObj;\n }\n }\n\n if (this._isWebGL2 && undefined !== gl2) {\n this._maxColorAttachments = gl.getParameter(gl2.MAX_COLOR_ATTACHMENTS);\n this._maxDrawBuffers = gl.getParameter(gl2.MAX_DRAW_BUFFERS);\n } else {\n const dbExt: WEBGL_draw_buffers | undefined = this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\");\n this._maxColorAttachments = dbExt !== undefined ? gl.getParameter(dbExt.MAX_COLOR_ATTACHMENTS_WEBGL) : 1;\n this._maxDrawBuffers = dbExt !== undefined ? gl.getParameter(dbExt.MAX_DRAW_BUFFERS_WEBGL) : 1;\n }\n\n // Determine the maximum color-renderable attachment type.\n const allowFloatRender =\n (undefined === disabledExtensions || -1 === disabledExtensions.indexOf(\"OES_texture_float\"))\n // iOS>=15 allows full-float rendering. However, it does not actually work on non-M1 devices.\n // Because of this, for now we disallow full float rendering on iOS devices.\n // ###TODO: Re-assess this after future iOS updates.\n && !ProcessDetector.isIOSBrowser\n // Samsung Galaxy Note 8 exhibits same issue as described above for iOS >= 15.\n // It uses specifically Mali-G71 MP20 but reports its renderer as follows.\n // Samsung Galaxy A50 and S9 exhibits same issue; they use Mali-G72.\n // HUAWEI P30 exhibits same issue; it uses Mali-G76.\n && unmaskedRenderer !== \"Mali-G71\" && unmaskedRenderer !== \"Mali-G72\" && unmaskedRenderer !== \"Mali-G76\";\n\n if (allowFloatRender && undefined !== this.queryExtensionObject(\"EXT_float_blend\") && this.isTextureRenderable(gl, gl.FLOAT)) {\n this._maxRenderType = RenderType.TextureFloat;\n } else if (this.isWebGL2) {\n this._maxRenderType = (this.isTextureRenderable(gl, (gl as WebGL2RenderingContext).HALF_FLOAT)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n } else {\n const hfExt: OES_texture_half_float | undefined = this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\");\n this._maxRenderType = (hfExt !== undefined && this.isTextureRenderable(gl, hfExt.HALF_FLOAT_OES)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n }\n\n // Determine the maximum depth attachment type.\n // this._maxDepthType = this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt32 : DepthType.RenderBufferUnsignedShort16;\n this._maxDepthType = this._isWebGL2 || this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt24Stencil8 : DepthType.RenderBufferUnsignedShort16;\n\n this._presentFeatures = this._gatherFeatures();\n const missingRequiredFeatures = this._findMissingFeatures(Capabilities.requiredFeatures);\n const missingOptionalFeatures = this._findMissingFeatures(Capabilities.optionalFeatures);\n\n return {\n status: this._getCompatibilityStatus(missingRequiredFeatures, missingOptionalFeatures),\n missingRequiredFeatures,\n missingOptionalFeatures,\n unmaskedRenderer,\n unmaskedVendor,\n usingIntegratedGraphics: isIntegratedGraphics({unmaskedVendor, unmaskedRenderer}),\n driverBugs: { ...this._driverBugs },\n userAgent: navigator.userAgent,\n createdContext: gl,\n };\n }\n\n public static create(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): Capabilities | undefined {\n const caps = new Capabilities();\n const compatibility = caps.init(gl, disabledExtensions);\n if (WebGLRenderCompatibilityStatus.CannotCreateContext === compatibility.status || WebGLRenderCompatibilityStatus.MissingRequiredFeatures === compatibility.status)\n return undefined;\n return caps;\n }\n\n /** Determines if a particular texture type is color-renderable on the host system. */\n private isTextureRenderable(gl: WebGLContext, texType: number): boolean {\n const tex: WebGLTexture | null = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, tex);\n if (this.isWebGL2) {\n if (gl.FLOAT === texType)\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA32F, 1, 1, 0, gl.RGBA, texType, null);\n else\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA16F, 1, 1, 0, gl.RGBA, texType, null);\n } else\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, texType, null);\n\n const fb: WebGLFramebuffer | null = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);\n\n const fbStatus: number = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteFramebuffer(fb);\n gl.deleteTexture(tex);\n\n gl.getError(); // clear any errors\n\n return fbStatus === gl.FRAMEBUFFER_COMPLETE;\n }\n\n public setMaxAnisotropy(desiredMax: number | undefined, gl: WebGLContext): void {\n const ext = this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\");\n if (undefined === ext)\n return;\n\n if (undefined === this._maxAnisotropy)\n this._maxAnisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) as number;\n\n const max = (undefined !== desiredMax) ? Math.min(desiredMax, this._maxAnisotropy) : this._maxAnisotropy;\n gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max);\n }\n}\n"]}
|
package/lib/esm/Capabilities.js
CHANGED
|
@@ -82,27 +82,26 @@ function isIntegratedGraphics(args) {
|
|
|
82
82
|
* @internal
|
|
83
83
|
*/
|
|
84
84
|
export class Capabilities {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
}
|
|
85
|
+
_maxRenderType = RenderType.TextureUnsignedByte;
|
|
86
|
+
_maxDepthType = DepthType.RenderBufferUnsignedShort16;
|
|
87
|
+
_maxTextureSize = 0;
|
|
88
|
+
_maxColorAttachments = 0;
|
|
89
|
+
_maxDrawBuffers = 0;
|
|
90
|
+
_maxFragTextureUnits = 0;
|
|
91
|
+
_maxVertTextureUnits = 0;
|
|
92
|
+
_maxVertAttribs = 0;
|
|
93
|
+
_maxVertUniformVectors = 0;
|
|
94
|
+
_maxVaryingVectors = 0;
|
|
95
|
+
_maxFragUniformVectors = 0;
|
|
96
|
+
_maxAnisotropy;
|
|
97
|
+
_maxAntialiasSamples = 1;
|
|
98
|
+
_supportsCreateImageBitmap = false;
|
|
99
|
+
_maxTexSizeAllow = maxTexSizeAllowed;
|
|
100
|
+
_extensionMap = {}; // Use this map to store actual extension objects retrieved from GL.
|
|
101
|
+
_presentFeatures = []; // List of features the system can support (not necessarily dependent on extensions)
|
|
102
|
+
_isWebGL2 = false;
|
|
103
|
+
_isMobile = false;
|
|
104
|
+
_driverBugs = {};
|
|
106
105
|
get maxRenderType() { return this._maxRenderType; }
|
|
107
106
|
get maxDepthType() { return this._maxDepthType; }
|
|
108
107
|
get maxTextureSize() { return this._maxTextureSize; }
|
|
@@ -149,6 +148,21 @@ export class Capabilities {
|
|
|
149
148
|
queryExtensionObject(ext) {
|
|
150
149
|
return this.findExtension(ext);
|
|
151
150
|
}
|
|
151
|
+
static optionalFeatures = [
|
|
152
|
+
WebGLFeature.MrtTransparency,
|
|
153
|
+
WebGLFeature.MrtPick,
|
|
154
|
+
WebGLFeature.DepthTexture,
|
|
155
|
+
WebGLFeature.FloatRendering,
|
|
156
|
+
WebGLFeature.Instancing,
|
|
157
|
+
WebGLFeature.ShadowMaps,
|
|
158
|
+
WebGLFeature.FragDepth,
|
|
159
|
+
WebGLFeature.StandardDerivatives,
|
|
160
|
+
WebGLFeature.AntiAliasing,
|
|
161
|
+
];
|
|
162
|
+
static requiredFeatures = [
|
|
163
|
+
WebGLFeature.UintElementIndex,
|
|
164
|
+
WebGLFeature.MinimalTextureUnits,
|
|
165
|
+
];
|
|
152
166
|
get _hasRequiredTextureUnits() { return this.maxFragTextureUnits >= 4 && this.maxVertTextureUnits >= 5; }
|
|
153
167
|
/** Return an array containing any features not supported by the system as compared to the input array. */
|
|
154
168
|
_findMissingFeatures(featuresToSeek) {
|
|
@@ -320,19 +334,4 @@ export class Capabilities {
|
|
|
320
334
|
gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max);
|
|
321
335
|
}
|
|
322
336
|
}
|
|
323
|
-
Capabilities.optionalFeatures = [
|
|
324
|
-
WebGLFeature.MrtTransparency,
|
|
325
|
-
WebGLFeature.MrtPick,
|
|
326
|
-
WebGLFeature.DepthTexture,
|
|
327
|
-
WebGLFeature.FloatRendering,
|
|
328
|
-
WebGLFeature.Instancing,
|
|
329
|
-
WebGLFeature.ShadowMaps,
|
|
330
|
-
WebGLFeature.FragDepth,
|
|
331
|
-
WebGLFeature.StandardDerivatives,
|
|
332
|
-
WebGLFeature.AntiAliasing,
|
|
333
|
-
];
|
|
334
|
-
Capabilities.requiredFeatures = [
|
|
335
|
-
WebGLFeature.UintElementIndex,
|
|
336
|
-
WebGLFeature.MinimalTextureUnits,
|
|
337
|
-
];
|
|
338
337
|
//# sourceMappingURL=Capabilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Capabilities.js","sourceRoot":"","sources":["../../src/Capabilities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAC6B,YAAY,EAAgC,8BAA8B,GAC7G,MAAM,uBAAuB,CAAC;AAS/B,MAAM,eAAe,GAAyB;IAC5C,oBAAoB;IACpB,wBAAwB;IACxB,mBAAmB;IACnB,0BAA0B;IAC1B,wBAAwB;I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QAEtB,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,mBAAmB;QAElC,OAAO,QAAQ,KAAK,EAAE,CAAC,oBAAoB,CAAC;IAC9C,CAAC;IAEM,gBAAgB,CAAC,UAA8B,EAAE,EAAgB;QACtE,MAAM,GAAG,GAAG,IAAI,CAAC,oBAAoB,CAAiC,gCAAgC,CAAC,CAAC;QACxG,IAAI,SAAS,KAAK,GAAG;YACnB,OAAO;QAET,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc;YACnC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,8BAA8B,CAAW,CAAC;QAEtF,MAAM,GAAG,GAAG,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;QACzG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;IACvE,CAAC;;AArNsB,6BAAgB,GAAmB;IACxD,YAAY,CAAC,eAAe;IAC5B,YAAY,CAAC,OAAO;IACpB,YAAY,CAAC,YAAY;IACzB,YAAY,CAAC,cAAc;IAC3B,YAAY,CAAC,UAAU;IACvB,YAAY,CAAC,UAAU;IACvB,YAAY,CAAC,SAAS;IACtB,YAAY,CAAC,mBAAmB;IAChC,YAAY,CAAC,YAAY;CAC1B,AAVsC,CAUrC;AACqB,6BAAgB,GAAmB;IACxD,YAAY,CAAC,gBAAgB;IAC7B,YAAY,CAAC,mBAAmB;CACjC,AAHsC,CAGrC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Compatibility\n */\n\nimport { ProcessDetector } from \"@itwin/core-bentley\";\nimport {\n GraphicsDriverBugs, WebGLContext, WebGLFeature, WebGLRenderCompatibilityInfo, WebGLRenderCompatibilityStatus,\n} from \"./RenderCompatibility\";\n\n/** @internal */\nexport type WebGLExtensionName =\n \"WEBGL_draw_buffers\" | \"OES_element_index_uint\" | \"OES_texture_float\" | \"OES_texture_float_linear\" |\n \"OES_texture_half_float\" | \"OES_texture_half_float_linear\" | \"EXT_texture_filter_anisotropic\" | \"WEBGL_depth_texture\" |\n \"EXT_color_buffer_float\" | \"EXT_shader_texture_lod\" | \"ANGLE_instanced_arrays\" | \"OES_vertex_array_object\" | \"WEBGL_lose_context\" |\n \"EXT_frag_depth\" | \"EXT_disjoint_timer_query\" | \"EXT_disjoint_timer_query_webgl2\" | \"OES_standard_derivatives\" | \"EXT_float_blend\";\n\nconst knownExtensions: WebGLExtensionName[] = [\n \"WEBGL_draw_buffers\",\n \"OES_element_index_uint\",\n \"OES_texture_float\",\n \"OES_texture_float_linear\",\n \"OES_texture_half_float\",\n \"OES_texture_half_float_linear\",\n \"EXT_texture_filter_anisotropic\",\n \"WEBGL_depth_texture\",\n \"EXT_color_buffer_float\",\n \"EXT_shader_texture_lod\",\n \"EXT_frag_depth\",\n \"ANGLE_instanced_arrays\",\n \"OES_vertex_array_object\",\n \"WEBGL_lose_context\",\n \"EXT_disjoint_timer_query\",\n \"EXT_disjoint_timer_query_webgl2\",\n \"OES_standard_derivatives\",\n \"EXT_float_blend\",\n];\n\n/** Describes the type of a render target. Used by Capabilities to represent maximum precision render target available on host system.\n * @internal\n */\nexport enum RenderType {\n TextureUnsignedByte,\n TextureHalfFloat,\n TextureFloat,\n}\n\n/**\n * Describes the type of a depth buffer. Used by Capabilities to represent maximum depth buffer precision available on host system.\n * Note: the commented-out values are unimplemented but left in place for reference, in case desired for future implementation.\n * @internal\n */\nexport enum DepthType {\n RenderBufferUnsignedShort16, // core to WebGL1\n // TextureUnsignedShort16, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureUnsignedInt24, // core to WebGL2\n TextureUnsignedInt24Stencil8, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n TextureUnsignedInt32, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureFloat32, // core to WebGL2\n // TextureFloat32Stencil8, // core to WeBGL2\n}\n\nconst maxTexSizeAllowed = 4096; // many devices and browsers have issues with source textures larger than this\n\n// Regexes to match Intel UHD/HD 620/630 integrated GPUS that suffer from GraphicsDriverBugs.fragDepthDoesNotDisableEarlyZ.\nconst buggyIntelMatchers = [\n // Original unmasked renderer string when workaround we implemented.\n /ANGLE \\(Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n // New unmasked renderer string circa October 2021.\n /ANGLE \\(Intel, Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n];\n\n// Regexes to match Mali GPUs known to suffer from GraphicsDriverBugs.msaaWillHang.\nconst buggyMaliMatchers = [\n /Mali-G71/,\n /Mali-G72/,\n /Mali-G76/,\n];\n\n// Regexes to match as many Intel integrated GPUs as possible.\n// https://en.wikipedia.org/wiki/List_of_Intel_graphics_processing_units\nconst integratedIntelGpuMatchers = [\n /(U)?HD Graphics/,\n /Iris/,\n];\n\nfunction isIntegratedGraphics(args: {unmaskedVendor?: string, unmaskedRenderer?: string}): boolean {\n if (args.unmaskedRenderer && args.unmaskedRenderer.includes(\"Intel\") && integratedIntelGpuMatchers.some((x) => x.test(args.unmaskedRenderer!)))\n return true;\n\n // NB: For now, we do not attempt to detect AMD integrated graphics.\n // It appears that AMD integrated graphics are not usually paired with a graphics card so detecting integrated usage there is less important than Intel.\n\n return false;\n}\n\n/** Describes the rendering capabilities of the host system.\n * @internal\n */\nexport class Capabilities {\n private _maxRenderType: RenderType = RenderType.TextureUnsignedByte;\n private _maxDepthType: DepthType = DepthType.RenderBufferUnsignedShort16;\n private _maxTextureSize: number = 0;\n private _maxColorAttachments: number = 0;\n private _maxDrawBuffers: number = 0;\n private _maxFragTextureUnits: number = 0;\n private _maxVertTextureUnits: number = 0;\n private _maxVertAttribs: number = 0;\n private _maxVertUniformVectors: number = 0;\n private _maxVaryingVectors: number = 0;\n private _maxFragUniformVectors: number = 0;\n private _maxAnisotropy?: number;\n private _maxAntialiasSamples: number = 1;\n private _supportsCreateImageBitmap: boolean = false;\n private _maxTexSizeAllow: number = maxTexSizeAllowed;\n\n private _extensionMap: { [key: string]: any } = {}; // Use this map to store actual extension objects retrieved from GL.\n private _presentFeatures: WebGLFeature[] = []; // List of features the system can support (not necessarily dependent on extensions)\n\n private _isWebGL2: boolean = false;\n private _isMobile: boolean = false;\n private _driverBugs: GraphicsDriverBugs = {};\n\n public get maxRenderType(): RenderType { return this._maxRenderType; }\n public get maxDepthType(): DepthType { return this._maxDepthType; }\n public get maxTextureSize(): number { return this._maxTextureSize; }\n public get maxTexSizeAllow(): number { return this._maxTexSizeAllow; }\n public get supportsCreateImageBitmap(): boolean { return this._supportsCreateImageBitmap; }\n public get maxColorAttachments(): number { return this._maxColorAttachments; }\n public get maxDrawBuffers(): number { return this._maxDrawBuffers; }\n public get maxFragTextureUnits(): number { return this._maxFragTextureUnits; }\n public get maxVertTextureUnits(): number { return this._maxVertTextureUnits; }\n public get maxVertAttribs(): number { return this._maxVertAttribs; }\n public get maxVertUniformVectors(): number { return this._maxVertUniformVectors; }\n public get maxVaryingVectors(): number { return this._maxVaryingVectors; }\n public get maxFragUniformVectors(): number { return this._maxFragUniformVectors; }\n public get maxAntialiasSamples(): number { return this._maxAntialiasSamples; }\n public get isWebGL2(): boolean { return this._isWebGL2; }\n public get driverBugs(): GraphicsDriverBugs { return this._driverBugs; }\n\n /** These getters check for existence of extension objects to determine availability of features. In WebGL2, could just return true for some. */\n public get supportsNonPowerOf2Textures(): boolean { return false; }\n public get supportsDrawBuffers(): boolean { return this._isWebGL2 || this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\") !== undefined; }\n public get supportsInstancing(): boolean { return this._isWebGL2 || this.queryExtensionObject<ANGLE_instanced_arrays>(\"ANGLE_instanced_arrays\") !== undefined; }\n public get supports32BitElementIndex(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_element_index_uint>(\"OES_element_index_uint\") !== undefined; }\n public get supportsTextureFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float>(\"OES_texture_float\") !== undefined; }\n public get supportsTextureFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float_linear>(\"OES_texture_float_linear\") !== undefined; }\n public get supportsTextureHalfFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\") !== undefined; }\n public get supportsTextureHalfFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float_linear>(\"OES_texture_half_float_linear\") !== undefined; }\n public get supportsTextureFilterAnisotropic(): boolean { return this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\") !== undefined; }\n public get supportsShaderTextureLOD(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_shader_texture_lod>(\"EXT_shader_texture_lod\") !== undefined; }\n public get supportsVertexArrayObjects(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_vertex_array_object>(\"OES_vertex_array_object\") !== undefined; }\n public get supportsFragDepth(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_frag_depth>(\"EXT_frag_depth\") !== undefined; }\n public get supportsDisjointTimerQuery(): boolean { return (this._isWebGL2 && this.queryExtensionObject<any>(\"EXT_disjoint_timer_query_webgl2\") !== undefined) || this.queryExtensionObject<any>(\"EXT_disjoint_timer_query\") !== undefined; }\n public get supportsStandardDerivatives(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_standard_derivatives>(\"OES_standard_derivatives\") !== undefined; }\n\n public get supportsMRTTransparency(): boolean { return this.maxColorAttachments >= 2; }\n public get supportsMRTPickShaders(): boolean { return this.maxColorAttachments >= 3; }\n\n public get supportsShadowMaps(): boolean {\n return this.supportsTextureFloat || this.supportsTextureHalfFloat;\n }\n\n public get supportsAntiAliasing(): boolean { return this._isWebGL2 && this.maxAntialiasSamples > 1; }\n\n public get isMobile(): boolean { return this._isMobile; }\n\n private findExtension(name: WebGLExtensionName): any {\n const ext = this._extensionMap[name];\n return null !== ext ? ext : undefined;\n }\n\n /** Queries an extension object if available. This is necessary for other parts of the system to access some constants within extensions. */\n public queryExtensionObject<T>(ext: WebGLExtensionName): T | undefined {\n return this.findExtension(ext) as T;\n }\n\n public static readonly optionalFeatures: WebGLFeature[] = [\n WebGLFeature.MrtTransparency,\n WebGLFeature.MrtPick,\n WebGLFeature.DepthTexture,\n WebGLFeature.FloatRendering,\n WebGLFeature.Instancing,\n WebGLFeature.ShadowMaps,\n WebGLFeature.FragDepth,\n WebGLFeature.StandardDerivatives,\n WebGLFeature.AntiAliasing,\n ];\n public static readonly requiredFeatures: WebGLFeature[] = [\n WebGLFeature.UintElementIndex,\n WebGLFeature.MinimalTextureUnits,\n ];\n\n private get _hasRequiredTextureUnits(): boolean { return this.maxFragTextureUnits >= 4 && this.maxVertTextureUnits >= 5; }\n\n /** Return an array containing any features not supported by the system as compared to the input array. */\n private _findMissingFeatures(featuresToSeek: WebGLFeature[]): WebGLFeature[] {\n const missingFeatures: WebGLFeature[] = [];\n for (const featureName of featuresToSeek) {\n if (-1 === this._presentFeatures.indexOf(featureName))\n missingFeatures.push(featureName);\n }\n return missingFeatures;\n }\n\n /** Populate and return an array containing features that this system supports. */\n private _gatherFeatures(): WebGLFeature[] {\n const features: WebGLFeature[] = [];\n\n // simply check for presence of various extensions if that gives enough information\n if (this._isWebGL2 || this._extensionMap[\"OES_element_index_uint\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.UintElementIndex);\n if (this._isWebGL2 || this._extensionMap[\"ANGLE_instanced_arrays\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.Instancing);\n\n if (this.supportsMRTTransparency)\n features.push(WebGLFeature.MrtTransparency);\n if (this.supportsMRTPickShaders)\n features.push(WebGLFeature.MrtPick);\n if (this.supportsShadowMaps)\n features.push(WebGLFeature.ShadowMaps);\n if (this._hasRequiredTextureUnits)\n features.push(WebGLFeature.MinimalTextureUnits);\n if (this.supportsFragDepth)\n features.push(WebGLFeature.FragDepth);\n if (this.supportsStandardDerivatives)\n features.push(WebGLFeature.StandardDerivatives);\n if (this.supportsAntiAliasing)\n features.push(WebGLFeature.AntiAliasing);\n\n if (DepthType.TextureUnsignedInt24Stencil8 === this._maxDepthType)\n features.push(WebGLFeature.DepthTexture);\n\n // check if at least half-float rendering is available based on maximum discovered renderable target\n if (RenderType.TextureUnsignedByte !== this._maxRenderType)\n features.push(WebGLFeature.FloatRendering);\n\n return features;\n }\n\n /** Retrieve compatibility status based on presence of various features. */\n private _getCompatibilityStatus(missingRequiredFeatures: WebGLFeature[], missingOptionalFeatures: WebGLFeature[]): WebGLRenderCompatibilityStatus {\n let status: WebGLRenderCompatibilityStatus = WebGLRenderCompatibilityStatus.AllOkay;\n if (missingOptionalFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingOptionalFeatures;\n if (missingRequiredFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingRequiredFeatures;\n return status;\n }\n\n /** Initializes the capabilities based on a GL context. Must be called first. */\n public init(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): WebGLRenderCompatibilityInfo {\n const gl2 = !(gl instanceof WebGLRenderingContext) ? gl : undefined;\n this._isWebGL2 = undefined !== gl2;\n\n this._isMobile = ProcessDetector.isMobileBrowser;\n\n const debugInfo = gl.getExtension(\"WEBGL_debug_renderer_info\");\n const unmaskedRenderer = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) : undefined;\n const unmaskedVendor = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) : undefined;\n\n this._driverBugs = {};\n if (unmaskedRenderer && buggyIntelMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.fragDepthDoesNotDisableEarlyZ = true;\n\n if (unmaskedRenderer && buggyMaliMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.msaaWillHang = true;\n\n this._maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n this._supportsCreateImageBitmap = typeof createImageBitmap === \"function\" && ProcessDetector.isChromium && !ProcessDetector.isIOSBrowser;\n this._maxTexSizeAllow = Math.min(this._maxTextureSize, maxTexSizeAllowed);\n this._maxFragTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n this._maxVertTextureUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\n this._maxVertAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n this._maxVertUniformVectors = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);\n this._maxVaryingVectors = gl.getParameter(gl.MAX_VARYING_VECTORS);\n this._maxFragUniformVectors = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);\n this._maxAntialiasSamples = this._driverBugs.msaaWillHang ? 1 : (this._isWebGL2 && undefined !== gl2 ? gl.getParameter(gl2.MAX_SAMPLES) : 1);\n\n const extensions = gl.getSupportedExtensions(); // This just retrieves a list of available extensions (not necessarily enabled).\n if (extensions) {\n for (const extStr of extensions) {\n const ext = extStr as WebGLExtensionName;\n if (-1 === knownExtensions.indexOf(ext))\n continue;\n else if (undefined !== disabledExtensions && -1 !== disabledExtensions.indexOf(ext))\n continue;\n\n const extObj: any = gl.getExtension(ext); // This call enables the extension and returns a WebGLObject containing extension instance.\n if (null !== extObj)\n this._extensionMap[ext] = extObj;\n }\n }\n\n if (this._isWebGL2 && undefined !== gl2) {\n this._maxColorAttachments = gl.getParameter(gl2.MAX_COLOR_ATTACHMENTS);\n this._maxDrawBuffers = gl.getParameter(gl2.MAX_DRAW_BUFFERS);\n } else {\n const dbExt: WEBGL_draw_buffers | undefined = this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\");\n this._maxColorAttachments = dbExt !== undefined ? gl.getParameter(dbExt.MAX_COLOR_ATTACHMENTS_WEBGL) : 1;\n this._maxDrawBuffers = dbExt !== undefined ? gl.getParameter(dbExt.MAX_DRAW_BUFFERS_WEBGL) : 1;\n }\n\n // Determine the maximum color-renderable attachment type.\n const allowFloatRender =\n (undefined === disabledExtensions || -1 === disabledExtensions.indexOf(\"OES_texture_float\"))\n // iOS>=15 allows full-float rendering. However, it does not actually work on non-M1 devices.\n // Because of this, for now we disallow full float rendering on iOS devices.\n // ###TODO: Re-assess this after future iOS updates.\n && !ProcessDetector.isIOSBrowser\n // Samsung Galaxy Note 8 exhibits same issue as described above for iOS >= 15.\n // It uses specifically Mali-G71 MP20 but reports its renderer as follows.\n // Samsung Galaxy A50 and S9 exhibits same issue; they use Mali-G72.\n // HUAWEI P30 exhibits same issue; it uses Mali-G76.\n && unmaskedRenderer !== \"Mali-G71\" && unmaskedRenderer !== \"Mali-G72\" && unmaskedRenderer !== \"Mali-G76\";\n\n if (allowFloatRender && undefined !== this.queryExtensionObject(\"EXT_float_blend\") && this.isTextureRenderable(gl, gl.FLOAT)) {\n this._maxRenderType = RenderType.TextureFloat;\n } else if (this.isWebGL2) {\n this._maxRenderType = (this.isTextureRenderable(gl, (gl as WebGL2RenderingContext).HALF_FLOAT)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n } else {\n const hfExt: OES_texture_half_float | undefined = this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\");\n this._maxRenderType = (hfExt !== undefined && this.isTextureRenderable(gl, hfExt.HALF_FLOAT_OES)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n }\n\n // Determine the maximum depth attachment type.\n // this._maxDepthType = this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt32 : DepthType.RenderBufferUnsignedShort16;\n this._maxDepthType = this._isWebGL2 || this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt24Stencil8 : DepthType.RenderBufferUnsignedShort16;\n\n this._presentFeatures = this._gatherFeatures();\n const missingRequiredFeatures = this._findMissingFeatures(Capabilities.requiredFeatures);\n const missingOptionalFeatures = this._findMissingFeatures(Capabilities.optionalFeatures);\n\n return {\n status: this._getCompatibilityStatus(missingRequiredFeatures, missingOptionalFeatures),\n missingRequiredFeatures,\n missingOptionalFeatures,\n unmaskedRenderer,\n unmaskedVendor,\n usingIntegratedGraphics: isIntegratedGraphics({unmaskedVendor, unmaskedRenderer}),\n driverBugs: { ...this._driverBugs },\n userAgent: navigator.userAgent,\n createdContext: gl,\n };\n }\n\n public static create(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): Capabilities | undefined {\n const caps = new Capabilities();\n const compatibility = caps.init(gl, disabledExtensions);\n if (WebGLRenderCompatibilityStatus.CannotCreateContext === compatibility.status || WebGLRenderCompatibilityStatus.MissingRequiredFeatures === compatibility.status)\n return undefined;\n return caps;\n }\n\n /** Determines if a particular texture type is color-renderable on the host system. */\n private isTextureRenderable(gl: WebGLContext, texType: number): boolean {\n const tex: WebGLTexture | null = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, tex);\n if (this.isWebGL2) {\n if (gl.FLOAT === texType)\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA32F, 1, 1, 0, gl.RGBA, texType, null);\n else\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA16F, 1, 1, 0, gl.RGBA, texType, null);\n } else\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, texType, null);\n\n const fb: WebGLFramebuffer | null = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);\n\n const fbStatus: number = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteFramebuffer(fb);\n gl.deleteTexture(tex);\n\n gl.getError(); // clear any errors\n\n return fbStatus === gl.FRAMEBUFFER_COMPLETE;\n }\n\n public setMaxAnisotropy(desiredMax: number | undefined, gl: WebGLContext): void {\n const ext = this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\");\n if (undefined === ext)\n return;\n\n if (undefined === this._maxAnisotropy)\n this._maxAnisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) as number;\n\n const max = (undefined !== desiredMax) ? Math.min(desiredMax, this._maxAnisotropy) : this._maxAnisotropy;\n gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max);\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"Capabilities.js","sourceRoot":"","sources":["../../src/Capabilities.ts"],"names":[],"mappings":"AAAA;;;+FAG+F;AAC/F;;GAEG;AAEH,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAC6B,YAAY,EAAgC,8BAA8B,GAC7G,MAAM,uBAAuB,CAAC;AAS/B,MAAM,eAAe,GAAyB;IAC5C,oBAAoB;IACpB,wBAAwB;IACxB,mBAAmB;IACnB,0BAA0B;IAC1B,wBAAwB;IACxB,+BAA+B;IAC/B,gCAAgC;IAChC,qBAAqB;IACrB,wBAAwB;IACxB,wBAAwB;IACxB,gBAAgB;IAChB,wBAAwB;IACxB,yBAAyB;IACzB,oBAAoB;IACpB,0BAA0B;IAC1B,iCAAiC;IACjC,0BAA0B;IAC1B,iBAAiB;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAN,IAAY,UAIX;AAJD,WAAY,UAAU;IACpB,yEAAmB,CAAA;IACnB,mEAAgB,CAAA;IAChB,2DAAY,CAAA;AACd,CAAC,EAJW,UAAU,KAAV,UAAU,QAIrB;AAED;;;;GAIG;AACH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,CAAC,CAAC,mBAAmB;QAElC,OAAO,QAAQ,KAAK,EAAE,CAAC,oBAAoB,CAAC;IAC9C,CAAC;IAEM,gBAAgB,CAAC,UAA8B,EAAE,EAAgB;QACtE,MAAM,GAAG,GAAG,IAAI,CAAC,oBAAoB,CAAiC,gCAAgC,CAAC,CAAC;QACxG,IAAI,SAAS,KAAK,GAAG;YACnB,OAAO;QAET,IAAI,SAAS,KAAK,IAAI,CAAC,cAAc;YACnC,IAAI,CAAC,cAAc,GAAG,EAAE,CAAC,YAAY,CAAC,GAAG,CAAC,8BAA8B,CAAW,CAAC;QAEtF,MAAM,GAAG,GAAG,CAAC,SAAS,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC;QACzG,EAAE,CAAC,aAAa,CAAC,EAAE,CAAC,UAAU,EAAE,GAAG,CAAC,0BAA0B,EAAE,GAAG,CAAC,CAAC;IACvE,CAAC","sourcesContent":["/*---------------------------------------------------------------------------------------------\n* Copyright (c) Bentley Systems, Incorporated. All rights reserved.\n* See LICENSE.md in the project root for license terms and full copyright notice.\n*--------------------------------------------------------------------------------------------*/\n/** @packageDocumentation\n * @module Compatibility\n */\n\nimport { ProcessDetector } from \"@itwin/core-bentley\";\nimport {\n GraphicsDriverBugs, WebGLContext, WebGLFeature, WebGLRenderCompatibilityInfo, WebGLRenderCompatibilityStatus,\n} from \"./RenderCompatibility\";\n\n/** @internal */\nexport type WebGLExtensionName =\n \"WEBGL_draw_buffers\" | \"OES_element_index_uint\" | \"OES_texture_float\" | \"OES_texture_float_linear\" |\n \"OES_texture_half_float\" | \"OES_texture_half_float_linear\" | \"EXT_texture_filter_anisotropic\" | \"WEBGL_depth_texture\" |\n \"EXT_color_buffer_float\" | \"EXT_shader_texture_lod\" | \"ANGLE_instanced_arrays\" | \"OES_vertex_array_object\" | \"WEBGL_lose_context\" |\n \"EXT_frag_depth\" | \"EXT_disjoint_timer_query\" | \"EXT_disjoint_timer_query_webgl2\" | \"OES_standard_derivatives\" | \"EXT_float_blend\";\n\nconst knownExtensions: WebGLExtensionName[] = [\n \"WEBGL_draw_buffers\",\n \"OES_element_index_uint\",\n \"OES_texture_float\",\n \"OES_texture_float_linear\",\n \"OES_texture_half_float\",\n \"OES_texture_half_float_linear\",\n \"EXT_texture_filter_anisotropic\",\n \"WEBGL_depth_texture\",\n \"EXT_color_buffer_float\",\n \"EXT_shader_texture_lod\",\n \"EXT_frag_depth\",\n \"ANGLE_instanced_arrays\",\n \"OES_vertex_array_object\",\n \"WEBGL_lose_context\",\n \"EXT_disjoint_timer_query\",\n \"EXT_disjoint_timer_query_webgl2\",\n \"OES_standard_derivatives\",\n \"EXT_float_blend\",\n];\n\n/** Describes the type of a render target. Used by Capabilities to represent maximum precision render target available on host system.\n * @internal\n */\nexport enum RenderType {\n TextureUnsignedByte,\n TextureHalfFloat,\n TextureFloat,\n}\n\n/**\n * Describes the type of a depth buffer. Used by Capabilities to represent maximum depth buffer precision available on host system.\n * Note: the commented-out values are unimplemented but left in place for reference, in case desired for future implementation.\n * @internal\n */\nexport enum DepthType {\n RenderBufferUnsignedShort16, // core to WebGL1\n // TextureUnsignedShort16, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureUnsignedInt24, // core to WebGL2\n TextureUnsignedInt24Stencil8, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n TextureUnsignedInt32, // core to WebGL2; available to WebGL1 via WEBGL_depth_texture\n // TextureFloat32, // core to WebGL2\n // TextureFloat32Stencil8, // core to WeBGL2\n}\n\nconst maxTexSizeAllowed = 4096; // many devices and browsers have issues with source textures larger than this\n\n// Regexes to match Intel UHD/HD 620/630 integrated GPUS that suffer from GraphicsDriverBugs.fragDepthDoesNotDisableEarlyZ.\nconst buggyIntelMatchers = [\n // Original unmasked renderer string when workaround we implemented.\n /ANGLE \\(Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n // New unmasked renderer string circa October 2021.\n /ANGLE \\(Intel, Intel\\(R\\) (U)?HD Graphics 6(2|3)0 Direct3D11/,\n];\n\n// Regexes to match Mali GPUs known to suffer from GraphicsDriverBugs.msaaWillHang.\nconst buggyMaliMatchers = [\n /Mali-G71/,\n /Mali-G72/,\n /Mali-G76/,\n];\n\n// Regexes to match as many Intel integrated GPUs as possible.\n// https://en.wikipedia.org/wiki/List_of_Intel_graphics_processing_units\nconst integratedIntelGpuMatchers = [\n /(U)?HD Graphics/,\n /Iris/,\n];\n\nfunction isIntegratedGraphics(args: {unmaskedVendor?: string, unmaskedRenderer?: string}): boolean {\n if (args.unmaskedRenderer && args.unmaskedRenderer.includes(\"Intel\") && integratedIntelGpuMatchers.some((x) => x.test(args.unmaskedRenderer!)))\n return true;\n\n // NB: For now, we do not attempt to detect AMD integrated graphics.\n // It appears that AMD integrated graphics are not usually paired with a graphics card so detecting integrated usage there is less important than Intel.\n\n return false;\n}\n\n/** Describes the rendering capabilities of the host system.\n * @internal\n */\nexport class Capabilities {\n private _maxRenderType: RenderType = RenderType.TextureUnsignedByte;\n private _maxDepthType: DepthType = DepthType.RenderBufferUnsignedShort16;\n private _maxTextureSize: number = 0;\n private _maxColorAttachments: number = 0;\n private _maxDrawBuffers: number = 0;\n private _maxFragTextureUnits: number = 0;\n private _maxVertTextureUnits: number = 0;\n private _maxVertAttribs: number = 0;\n private _maxVertUniformVectors: number = 0;\n private _maxVaryingVectors: number = 0;\n private _maxFragUniformVectors: number = 0;\n private _maxAnisotropy?: number;\n private _maxAntialiasSamples: number = 1;\n private _supportsCreateImageBitmap: boolean = false;\n private _maxTexSizeAllow: number = maxTexSizeAllowed;\n\n private _extensionMap: { [key: string]: any } = {}; // Use this map to store actual extension objects retrieved from GL.\n private _presentFeatures: WebGLFeature[] = []; // List of features the system can support (not necessarily dependent on extensions)\n\n private _isWebGL2: boolean = false;\n private _isMobile: boolean = false;\n private _driverBugs: GraphicsDriverBugs = {};\n\n public get maxRenderType(): RenderType { return this._maxRenderType; }\n public get maxDepthType(): DepthType { return this._maxDepthType; }\n public get maxTextureSize(): number { return this._maxTextureSize; }\n public get maxTexSizeAllow(): number { return this._maxTexSizeAllow; }\n public get supportsCreateImageBitmap(): boolean { return this._supportsCreateImageBitmap; }\n public get maxColorAttachments(): number { return this._maxColorAttachments; }\n public get maxDrawBuffers(): number { return this._maxDrawBuffers; }\n public get maxFragTextureUnits(): number { return this._maxFragTextureUnits; }\n public get maxVertTextureUnits(): number { return this._maxVertTextureUnits; }\n public get maxVertAttribs(): number { return this._maxVertAttribs; }\n public get maxVertUniformVectors(): number { return this._maxVertUniformVectors; }\n public get maxVaryingVectors(): number { return this._maxVaryingVectors; }\n public get maxFragUniformVectors(): number { return this._maxFragUniformVectors; }\n public get maxAntialiasSamples(): number { return this._maxAntialiasSamples; }\n public get isWebGL2(): boolean { return this._isWebGL2; }\n public get driverBugs(): GraphicsDriverBugs { return this._driverBugs; }\n\n /** These getters check for existence of extension objects to determine availability of features. In WebGL2, could just return true for some. */\n public get supportsNonPowerOf2Textures(): boolean { return false; }\n public get supportsDrawBuffers(): boolean { return this._isWebGL2 || this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\") !== undefined; }\n public get supportsInstancing(): boolean { return this._isWebGL2 || this.queryExtensionObject<ANGLE_instanced_arrays>(\"ANGLE_instanced_arrays\") !== undefined; }\n public get supports32BitElementIndex(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_element_index_uint>(\"OES_element_index_uint\") !== undefined; }\n public get supportsTextureFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float>(\"OES_texture_float\") !== undefined; }\n public get supportsTextureFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_float_linear>(\"OES_texture_float_linear\") !== undefined; }\n public get supportsTextureHalfFloat(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\") !== undefined; }\n public get supportsTextureHalfFloatLinear(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_texture_half_float_linear>(\"OES_texture_half_float_linear\") !== undefined; }\n public get supportsTextureFilterAnisotropic(): boolean { return this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\") !== undefined; }\n public get supportsShaderTextureLOD(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_shader_texture_lod>(\"EXT_shader_texture_lod\") !== undefined; }\n public get supportsVertexArrayObjects(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_vertex_array_object>(\"OES_vertex_array_object\") !== undefined; }\n public get supportsFragDepth(): boolean { return this._isWebGL2 || this.queryExtensionObject<EXT_frag_depth>(\"EXT_frag_depth\") !== undefined; }\n public get supportsDisjointTimerQuery(): boolean { return (this._isWebGL2 && this.queryExtensionObject<any>(\"EXT_disjoint_timer_query_webgl2\") !== undefined) || this.queryExtensionObject<any>(\"EXT_disjoint_timer_query\") !== undefined; }\n public get supportsStandardDerivatives(): boolean { return this._isWebGL2 || this.queryExtensionObject<OES_standard_derivatives>(\"OES_standard_derivatives\") !== undefined; }\n\n public get supportsMRTTransparency(): boolean { return this.maxColorAttachments >= 2; }\n public get supportsMRTPickShaders(): boolean { return this.maxColorAttachments >= 3; }\n\n public get supportsShadowMaps(): boolean {\n return this.supportsTextureFloat || this.supportsTextureHalfFloat;\n }\n\n public get supportsAntiAliasing(): boolean { return this._isWebGL2 && this.maxAntialiasSamples > 1; }\n\n public get isMobile(): boolean { return this._isMobile; }\n\n private findExtension(name: WebGLExtensionName): any {\n const ext = this._extensionMap[name];\n return null !== ext ? ext : undefined;\n }\n\n /** Queries an extension object if available. This is necessary for other parts of the system to access some constants within extensions. */\n public queryExtensionObject<T>(ext: WebGLExtensionName): T | undefined {\n return this.findExtension(ext) as T;\n }\n\n public static readonly optionalFeatures: WebGLFeature[] = [\n WebGLFeature.MrtTransparency,\n WebGLFeature.MrtPick,\n WebGLFeature.DepthTexture,\n WebGLFeature.FloatRendering,\n WebGLFeature.Instancing,\n WebGLFeature.ShadowMaps,\n WebGLFeature.FragDepth,\n WebGLFeature.StandardDerivatives,\n WebGLFeature.AntiAliasing,\n ];\n public static readonly requiredFeatures: WebGLFeature[] = [\n WebGLFeature.UintElementIndex,\n WebGLFeature.MinimalTextureUnits,\n ];\n\n private get _hasRequiredTextureUnits(): boolean { return this.maxFragTextureUnits >= 4 && this.maxVertTextureUnits >= 5; }\n\n /** Return an array containing any features not supported by the system as compared to the input array. */\n private _findMissingFeatures(featuresToSeek: WebGLFeature[]): WebGLFeature[] {\n const missingFeatures: WebGLFeature[] = [];\n for (const featureName of featuresToSeek) {\n if (-1 === this._presentFeatures.indexOf(featureName))\n missingFeatures.push(featureName);\n }\n return missingFeatures;\n }\n\n /** Populate and return an array containing features that this system supports. */\n private _gatherFeatures(): WebGLFeature[] {\n const features: WebGLFeature[] = [];\n\n // simply check for presence of various extensions if that gives enough information\n if (this._isWebGL2 || this._extensionMap[\"OES_element_index_uint\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.UintElementIndex);\n if (this._isWebGL2 || this._extensionMap[\"ANGLE_instanced_arrays\" as WebGLExtensionName] !== undefined)\n features.push(WebGLFeature.Instancing);\n\n if (this.supportsMRTTransparency)\n features.push(WebGLFeature.MrtTransparency);\n if (this.supportsMRTPickShaders)\n features.push(WebGLFeature.MrtPick);\n if (this.supportsShadowMaps)\n features.push(WebGLFeature.ShadowMaps);\n if (this._hasRequiredTextureUnits)\n features.push(WebGLFeature.MinimalTextureUnits);\n if (this.supportsFragDepth)\n features.push(WebGLFeature.FragDepth);\n if (this.supportsStandardDerivatives)\n features.push(WebGLFeature.StandardDerivatives);\n if (this.supportsAntiAliasing)\n features.push(WebGLFeature.AntiAliasing);\n\n if (DepthType.TextureUnsignedInt24Stencil8 === this._maxDepthType)\n features.push(WebGLFeature.DepthTexture);\n\n // check if at least half-float rendering is available based on maximum discovered renderable target\n if (RenderType.TextureUnsignedByte !== this._maxRenderType)\n features.push(WebGLFeature.FloatRendering);\n\n return features;\n }\n\n /** Retrieve compatibility status based on presence of various features. */\n private _getCompatibilityStatus(missingRequiredFeatures: WebGLFeature[], missingOptionalFeatures: WebGLFeature[]): WebGLRenderCompatibilityStatus {\n let status: WebGLRenderCompatibilityStatus = WebGLRenderCompatibilityStatus.AllOkay;\n if (missingOptionalFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingOptionalFeatures;\n if (missingRequiredFeatures.length > 0)\n status = WebGLRenderCompatibilityStatus.MissingRequiredFeatures;\n return status;\n }\n\n /** Initializes the capabilities based on a GL context. Must be called first. */\n public init(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): WebGLRenderCompatibilityInfo {\n const gl2 = !(gl instanceof WebGLRenderingContext) ? gl : undefined;\n this._isWebGL2 = undefined !== gl2;\n\n this._isMobile = ProcessDetector.isMobileBrowser;\n\n const debugInfo = gl.getExtension(\"WEBGL_debug_renderer_info\");\n const unmaskedRenderer = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_RENDERER_WEBGL) : undefined;\n const unmaskedVendor = debugInfo !== null ? gl.getParameter(debugInfo.UNMASKED_VENDOR_WEBGL) : undefined;\n\n this._driverBugs = {};\n if (unmaskedRenderer && buggyIntelMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.fragDepthDoesNotDisableEarlyZ = true;\n\n if (unmaskedRenderer && buggyMaliMatchers.some((x) => x.test(unmaskedRenderer)))\n this._driverBugs.msaaWillHang = true;\n\n this._maxTextureSize = gl.getParameter(gl.MAX_TEXTURE_SIZE);\n this._supportsCreateImageBitmap = typeof createImageBitmap === \"function\" && ProcessDetector.isChromium && !ProcessDetector.isIOSBrowser;\n this._maxTexSizeAllow = Math.min(this._maxTextureSize, maxTexSizeAllowed);\n this._maxFragTextureUnits = gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS);\n this._maxVertTextureUnits = gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS);\n this._maxVertAttribs = gl.getParameter(gl.MAX_VERTEX_ATTRIBS);\n this._maxVertUniformVectors = gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS);\n this._maxVaryingVectors = gl.getParameter(gl.MAX_VARYING_VECTORS);\n this._maxFragUniformVectors = gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS);\n this._maxAntialiasSamples = this._driverBugs.msaaWillHang ? 1 : (this._isWebGL2 && undefined !== gl2 ? gl.getParameter(gl2.MAX_SAMPLES) : 1);\n\n const extensions = gl.getSupportedExtensions(); // This just retrieves a list of available extensions (not necessarily enabled).\n if (extensions) {\n for (const extStr of extensions) {\n const ext = extStr as WebGLExtensionName;\n if (-1 === knownExtensions.indexOf(ext))\n continue;\n else if (undefined !== disabledExtensions && -1 !== disabledExtensions.indexOf(ext))\n continue;\n\n const extObj: any = gl.getExtension(ext); // This call enables the extension and returns a WebGLObject containing extension instance.\n if (null !== extObj)\n this._extensionMap[ext] = extObj;\n }\n }\n\n if (this._isWebGL2 && undefined !== gl2) {\n this._maxColorAttachments = gl.getParameter(gl2.MAX_COLOR_ATTACHMENTS);\n this._maxDrawBuffers = gl.getParameter(gl2.MAX_DRAW_BUFFERS);\n } else {\n const dbExt: WEBGL_draw_buffers | undefined = this.queryExtensionObject<WEBGL_draw_buffers>(\"WEBGL_draw_buffers\");\n this._maxColorAttachments = dbExt !== undefined ? gl.getParameter(dbExt.MAX_COLOR_ATTACHMENTS_WEBGL) : 1;\n this._maxDrawBuffers = dbExt !== undefined ? gl.getParameter(dbExt.MAX_DRAW_BUFFERS_WEBGL) : 1;\n }\n\n // Determine the maximum color-renderable attachment type.\n const allowFloatRender =\n (undefined === disabledExtensions || -1 === disabledExtensions.indexOf(\"OES_texture_float\"))\n // iOS>=15 allows full-float rendering. However, it does not actually work on non-M1 devices.\n // Because of this, for now we disallow full float rendering on iOS devices.\n // ###TODO: Re-assess this after future iOS updates.\n && !ProcessDetector.isIOSBrowser\n // Samsung Galaxy Note 8 exhibits same issue as described above for iOS >= 15.\n // It uses specifically Mali-G71 MP20 but reports its renderer as follows.\n // Samsung Galaxy A50 and S9 exhibits same issue; they use Mali-G72.\n // HUAWEI P30 exhibits same issue; it uses Mali-G76.\n && unmaskedRenderer !== \"Mali-G71\" && unmaskedRenderer !== \"Mali-G72\" && unmaskedRenderer !== \"Mali-G76\";\n\n if (allowFloatRender && undefined !== this.queryExtensionObject(\"EXT_float_blend\") && this.isTextureRenderable(gl, gl.FLOAT)) {\n this._maxRenderType = RenderType.TextureFloat;\n } else if (this.isWebGL2) {\n this._maxRenderType = (this.isTextureRenderable(gl, (gl as WebGL2RenderingContext).HALF_FLOAT)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n } else {\n const hfExt: OES_texture_half_float | undefined = this.queryExtensionObject<OES_texture_half_float>(\"OES_texture_half_float\");\n this._maxRenderType = (hfExt !== undefined && this.isTextureRenderable(gl, hfExt.HALF_FLOAT_OES)) ? RenderType.TextureHalfFloat : RenderType.TextureUnsignedByte;\n }\n\n // Determine the maximum depth attachment type.\n // this._maxDepthType = this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt32 : DepthType.RenderBufferUnsignedShort16;\n this._maxDepthType = this._isWebGL2 || this.queryExtensionObject(\"WEBGL_depth_texture\") !== undefined ? DepthType.TextureUnsignedInt24Stencil8 : DepthType.RenderBufferUnsignedShort16;\n\n this._presentFeatures = this._gatherFeatures();\n const missingRequiredFeatures = this._findMissingFeatures(Capabilities.requiredFeatures);\n const missingOptionalFeatures = this._findMissingFeatures(Capabilities.optionalFeatures);\n\n return {\n status: this._getCompatibilityStatus(missingRequiredFeatures, missingOptionalFeatures),\n missingRequiredFeatures,\n missingOptionalFeatures,\n unmaskedRenderer,\n unmaskedVendor,\n usingIntegratedGraphics: isIntegratedGraphics({unmaskedVendor, unmaskedRenderer}),\n driverBugs: { ...this._driverBugs },\n userAgent: navigator.userAgent,\n createdContext: gl,\n };\n }\n\n public static create(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): Capabilities | undefined {\n const caps = new Capabilities();\n const compatibility = caps.init(gl, disabledExtensions);\n if (WebGLRenderCompatibilityStatus.CannotCreateContext === compatibility.status || WebGLRenderCompatibilityStatus.MissingRequiredFeatures === compatibility.status)\n return undefined;\n return caps;\n }\n\n /** Determines if a particular texture type is color-renderable on the host system. */\n private isTextureRenderable(gl: WebGLContext, texType: number): boolean {\n const tex: WebGLTexture | null = gl.createTexture();\n gl.bindTexture(gl.TEXTURE_2D, tex);\n if (this.isWebGL2) {\n if (gl.FLOAT === texType)\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA32F, 1, 1, 0, gl.RGBA, texType, null);\n else\n gl.texImage2D(gl.TEXTURE_2D, 0, (gl as WebGL2RenderingContext).RGBA16F, 1, 1, 0, gl.RGBA, texType, null);\n } else\n gl.texImage2D(gl.TEXTURE_2D, 0, gl.RGBA, 1, 1, 0, gl.RGBA, texType, null);\n\n const fb: WebGLFramebuffer | null = gl.createFramebuffer();\n gl.bindFramebuffer(gl.FRAMEBUFFER, fb);\n gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, tex, 0);\n\n const fbStatus: number = gl.checkFramebufferStatus(gl.FRAMEBUFFER);\n gl.bindFramebuffer(gl.FRAMEBUFFER, null);\n gl.deleteFramebuffer(fb);\n gl.deleteTexture(tex);\n\n gl.getError(); // clear any errors\n\n return fbStatus === gl.FRAMEBUFFER_COMPLETE;\n }\n\n public setMaxAnisotropy(desiredMax: number | undefined, gl: WebGLContext): void {\n const ext = this.queryExtensionObject<EXT_texture_filter_anisotropic>(\"EXT_texture_filter_anisotropic\");\n if (undefined === ext)\n return;\n\n if (undefined === this._maxAnisotropy)\n this._maxAnisotropy = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT) as number;\n\n const max = (undefined !== desiredMax) ? Math.min(desiredMax, this._maxAnisotropy) : this._maxAnisotropy;\n gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max);\n }\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itwin/webgl-compatibility",
|
|
3
|
-
"version": "5.0.0-dev.
|
|
3
|
+
"version": "5.0.0-dev.82",
|
|
4
4
|
"description": "APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "lib/cjs/webgl-compatibility.js",
|
|
@@ -24,30 +24,30 @@
|
|
|
24
24
|
"url": "http://www.bentley.com"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@itwin/core-bentley": "5.0.0-dev.
|
|
27
|
+
"@itwin/core-bentley": "5.0.0-dev.82"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@itwin/eslint-plugin": "5.0.0-dev.1",
|
|
31
31
|
"@types/chai": "4.3.1",
|
|
32
32
|
"@types/mocha": "^10.0.6",
|
|
33
33
|
"babel-loader": "~8.2.5",
|
|
34
|
-
"babel-plugin-istanbul": "
|
|
34
|
+
"babel-plugin-istanbul": "^7.0.0",
|
|
35
35
|
"chai": "^4.3.10",
|
|
36
36
|
"eslint": "^9.13.0",
|
|
37
37
|
"glob": "^10.3.12",
|
|
38
|
-
"mocha": "^
|
|
39
|
-
"rimraf": "^
|
|
40
|
-
"source-map-loader": "^
|
|
38
|
+
"mocha": "^11.1.0",
|
|
39
|
+
"rimraf": "^6.0.1",
|
|
40
|
+
"source-map-loader": "^5.0.0",
|
|
41
41
|
"typescript": "~5.6.2",
|
|
42
|
-
"webpack": "^5.
|
|
43
|
-
"@itwin/
|
|
44
|
-
"@itwin/
|
|
42
|
+
"webpack": "^5.97.1",
|
|
43
|
+
"@itwin/certa": "5.0.0-dev.82",
|
|
44
|
+
"@itwin/build-tools": "5.0.0-dev.82"
|
|
45
45
|
},
|
|
46
46
|
"scripts": {
|
|
47
47
|
"build": "npm run -s build:cjs && npm run -s build:esm",
|
|
48
48
|
"build:cjs": "tsc 1>&2 --outDir lib/cjs",
|
|
49
|
-
"build:esm": "tsc 1>&2 --module
|
|
50
|
-
"clean": "rimraf lib .rush/temp/package-deps*.json",
|
|
49
|
+
"build:esm": "tsc 1>&2 --module ES2022 --outDir lib/esm",
|
|
50
|
+
"clean": "rimraf -g lib .rush/temp/package-deps*.json",
|
|
51
51
|
"cover": "npm -s test",
|
|
52
52
|
"docs": "betools docs --json=../../generated-docs/core/webgl-compatibility/file.json --tsIndexFile=./webgl-compatibility.ts --onlyJson",
|
|
53
53
|
"extract-api": "betools extract-api --entry=webgl-compatibility",
|