UNPKG

@itwin/webgl-compatibility

Version:

APIs for determining the level of compatibility of a browser+device with the iTwin.js rendering system.

104 lines 5.08 kB
/** @packageDocumentation * @module Compatibility */ import { GraphicsDriverBugs, WebGLContext, WebGLFeature, WebGLRenderCompatibilityInfo } from "./RenderCompatibility"; /** @internal */ export type WebGLExtensionName = "WEBGL_draw_buffers" | "OES_element_index_uint" | "OES_texture_float" | "OES_texture_float_linear" | "OES_texture_half_float" | "OES_texture_half_float_linear" | "EXT_texture_filter_anisotropic" | "WEBGL_depth_texture" | "EXT_color_buffer_float" | "EXT_shader_texture_lod" | "ANGLE_instanced_arrays" | "OES_vertex_array_object" | "WEBGL_lose_context" | "EXT_frag_depth" | "EXT_disjoint_timer_query" | "EXT_disjoint_timer_query_webgl2" | "OES_standard_derivatives" | "EXT_float_blend"; /** Describes the type of a render target. Used by Capabilities to represent maximum precision render target available on host system. * @internal */ export declare enum RenderType { TextureUnsignedByte = 0, TextureHalfFloat = 1, TextureFloat = 2 } /** * Describes the type of a depth buffer. Used by Capabilities to represent maximum depth buffer precision available on host system. * Note: the commented-out values are unimplemented but left in place for reference, in case desired for future implementation. * @internal */ export declare enum DepthType { RenderBufferUnsignedShort16 = 0,// core to WebGL1 TextureUnsignedInt24Stencil8 = 1,// core to WebGL2; available to WebGL1 via WEBGL_depth_texture TextureUnsignedInt32 = 2 } /** Describes the rendering capabilities of the host system. * @internal */ export declare class Capabilities { private _maxRenderType; private _maxDepthType; private _maxTextureSize; private _maxColorAttachments; private _maxDrawBuffers; private _maxFragTextureUnits; private _maxVertTextureUnits; private _maxVertAttribs; private _maxVertUniformVectors; private _maxVaryingVectors; private _maxFragUniformVectors; private _maxAnisotropy?; private _maxAntialiasSamples; private _supportsCreateImageBitmap; private _maxTexSizeAllow; private _extensionMap; private _presentFeatures; private _isWebGL2; private _isMobile; private _driverBugs; get maxRenderType(): RenderType; get maxDepthType(): DepthType; get maxTextureSize(): number; get maxTexSizeAllow(): number; get supportsCreateImageBitmap(): boolean; get maxColorAttachments(): number; get maxDrawBuffers(): number; get maxFragTextureUnits(): number; get maxVertTextureUnits(): number; get maxVertAttribs(): number; get maxVertUniformVectors(): number; get maxVaryingVectors(): number; get maxFragUniformVectors(): number; get maxAntialiasSamples(): number; get isWebGL2(): boolean; get driverBugs(): GraphicsDriverBugs; /** These getters check for existence of extension objects to determine availability of features. In WebGL2, could just return true for some. */ get supportsNonPowerOf2Textures(): boolean; get supportsDrawBuffers(): boolean; get supportsInstancing(): boolean; get supports32BitElementIndex(): boolean; get supportsTextureFloat(): boolean; get supportsTextureFloatLinear(): boolean; get supportsTextureHalfFloat(): boolean; get supportsTextureHalfFloatLinear(): boolean; get supportsTextureFilterAnisotropic(): boolean; get supportsShaderTextureLOD(): boolean; get supportsVertexArrayObjects(): boolean; get supportsFragDepth(): boolean; get supportsDisjointTimerQuery(): boolean; get supportsStandardDerivatives(): boolean; get supportsMRTTransparency(): boolean; get supportsMRTPickShaders(): boolean; get supportsShadowMaps(): boolean; get supportsAntiAliasing(): boolean; get isMobile(): boolean; private findExtension; /** Queries an extension object if available. This is necessary for other parts of the system to access some constants within extensions. */ queryExtensionObject<T>(ext: WebGLExtensionName): T | undefined; static readonly optionalFeatures: WebGLFeature[]; static readonly requiredFeatures: WebGLFeature[]; private get _hasRequiredTextureUnits(); /** Return an array containing any features not supported by the system as compared to the input array. */ private _findMissingFeatures; /** Populate and return an array containing features that this system supports. */ private _gatherFeatures; /** Retrieve compatibility status based on presence of various features. */ private _getCompatibilityStatus; /** Initializes the capabilities based on a GL context. Must be called first. */ init(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): WebGLRenderCompatibilityInfo; static create(gl: WebGLContext, disabledExtensions?: WebGLExtensionName[]): Capabilities | undefined; /** Determines if a particular texture type is color-renderable on the host system. */ private isTextureRenderable; setMaxAnisotropy(desiredMax: number | undefined, gl: WebGLContext): void; } //# sourceMappingURL=Capabilities.d.ts.map