@tolokoban/tgd
Version:
ToloGameDev library for WebGL2
174 lines • 7.23 kB
TypeScript
export declare class TgdExtensions {
readonly gl: WebGL2RenderingContext;
/**
* Render to 32-bit float color buffers
*
* Enables rendering to textures with 32-bit floating-point components
* (R32F, RG32F, RGBA32F, R16F, RG16F, RGBA16F) as color-renderable formats in framebuffers.
*/
readonly EXT_color_buffer_float: EXT_color_buffer_float | null;
/**
* Render to 16-bit float color buffers
*
* Enables rendering to textures with 16-bit half-float components
* (R16F, RG16F, RGBA16F) as color-renderable formats in framebuffers.
*/
readonly EXT_color_buffer_half_float: EXT_color_buffer_half_float | null;
/**
* Blending with float textures
*
* Allows blending operations on framebuffer attachments that use
* 32-bit or 16-bit floating-point formats. Without this extension,
* blending is disabled when rendering to float targets.
*/
readonly EXT_float_blend: EXT_float_blend | null;
/**
* BC6H/BC7 compressed texture formats
*
* Exposes BC6H (HDR) and BC7 (high-quality LDR) block compression
* formats, commonly used on desktop GPUs for high-fidelity textures
* with a fixed 8:1 compression ratio.
*/
readonly EXT_texture_compression_bptc: EXT_texture_compression_bptc | null;
/**
* BC4/BC5 compressed texture formats
*
* Exposes BC4 (single-channel) and BC5 (two-channel) block compression
* formats, ideal for normal maps and grayscale data where only one or
* two components are needed.
*/
readonly EXT_texture_compression_rgtc: EXT_texture_compression_rgtc | null;
/**
* Anisotropic texture filtering
*
* Improves texture quality at oblique viewing angles by sampling
* more texels along the axis of maximum distortion. Controlled via
* the TEXTURE_MAX_ANISOTROPY_EXT parameter on texture objects.
*/
readonly EXT_texture_filter_anisotropic: EXT_texture_filter_anisotropic | null;
/**
* Non-blocking shader compilation status query
*
* Allows querying COMPLETION_STATUS_KHR to check if a shader or
* program has finished compiling/linking without blocking the main
* thread, enabling asynchronous shader pipelines.
*/
readonly KHR_parallel_shader_compile: KHR_parallel_shader_compile | null;
/**
* Linear filtering for 32-bit float textures
*
* Enables LINEAR and LINEAR_MIPMAP_* filtering modes on textures
* with 32-bit float components. Without this extension, only NEAREST
* filtering is guaranteed for float textures.
*/
readonly OES_texture_float_linear: OES_texture_float_linear | null;
/**
* Linear filtering for 16-bit half-float textures
*
* Enables LINEAR and LINEAR_MIPMAP_* filtering modes on textures
* with 16-bit half-float components. Without this extension, only
* NEAREST filtering is guaranteed for half-float textures.
*/
readonly OES_texture_half_float_linear: OES_texture_half_float_linear | null;
/**
* Multi-view rendering for VR/AR
*
* Renders to multiple views (e.g. left/right eye) in a single draw
* call using gl_ViewID_OVR in the shader, significantly reducing
* CPU overhead for stereoscopic rendering.
*/
readonly OVR_multiview2: OVR_multiview2 | null;
/**
* Render to 32-bit float color buffers (WebGL1 variant)
*
* WebGL1-era extension that enables float color-renderable formats.
* In WebGL2 contexts, prefer EXT_color_buffer_float instead; this
* is kept for broader compatibility.
*/
readonly WEBGL_color_buffer_float: WEBGL_color_buffer_float | null;
/**
* ASTC compressed texture formats
*
* Exposes Adaptive Scalable Texture Compression with variable block
* sizes (4x4 to 12x12), supporting LDR and HDR content. Widely
* available on mobile GPUs (ARM Mali, Qualcomm Adreno).
*/
readonly WEBGL_compressed_texture_astc: WEBGL_compressed_texture_astc | null;
/**
* ETC2/EAC compressed texture formats
*
* Exposes ETC2 (RGB/RGBA) and EAC (1-2 channel) compression formats
* mandated by OpenGL ES 3.0. Guaranteed on conformant mobile GPUs
* but may use software decompression on desktop.
*/
readonly WEBGL_compressed_texture_etc: WEBGL_compressed_texture_etc | null;
/**
* ETC1 compressed texture format
*
* Exposes the legacy ETC1 RGB-only compression format. Superseded
* by ETC2 but still useful for older Android devices that lack
* OpenGL ES 3.0 support.
*/
readonly WEBGL_compressed_texture_etc1: WEBGL_compressed_texture_etc1 | null;
/**
* PVRTC compressed texture formats (iOS)
*
* Exposes PowerVR Texture Compression (2bpp and 4bpp, RGB/RGBA)
* used primarily on Apple iOS devices with Imagination Technologies
* GPUs. Not available on most Android or desktop hardware.
*/
readonly WEBGL_compressed_texture_pvrtc: WEBGL_compressed_texture_pvrtc | null;
/**
* S3TC/DXT compressed texture formats
*
* Exposes DXT1 (BC1), DXT3 (BC2), and DXT5 (BC3) block compression
* formats. Ubiquitous on desktop GPUs (NVIDIA, AMD, Intel) but
* rarely supported on mobile.
*/
readonly WEBGL_compressed_texture_s3tc: WEBGL_compressed_texture_s3tc | null;
/**
* S3TC compressed textures with sRGB encoding
*
* Same as WEBGL_compressed_texture_s3tc but with sRGB color space
* decoding, enabling hardware gamma-correct sampling without
* manual conversion in the shader.
*/
readonly WEBGL_compressed_texture_s3tc_srgb: WEBGL_compressed_texture_s3tc_srgb | null;
/**
* Expose GPU vendor/renderer strings
*
* Provides UNMASKED_VENDOR_WEBGL and UNMASKED_RENDERER_WEBGL
* parameters for getParameter(), revealing the actual GPU driver
* identity. Useful for analytics and GPU-specific workarounds.
*/
readonly WEBGL_debug_renderer_info: WEBGL_debug_renderer_info | null;
/**
* Access translated shader source
*
* Exposes getTranslatedShaderSource() to retrieve the platform-
* specific shader code (e.g. HLSL, Metal) that the driver actually
* compiles, useful for debugging shader translation issues.
*/
readonly WEBGL_debug_shaders: WEBGL_debug_shaders | null;
/**
* Simulate context loss/restore for testing
*
* Provides loseContext() and restoreContext() methods to manually
* trigger WebGL context loss and restoration events, enabling
* robust testing of resource recovery logic.
*/
readonly WEBGL_lose_context: WEBGL_lose_context | null;
/**
* Batch multiple draw calls into one
*
* Provides multiDrawArrays and multiDrawElements to submit multiple
* draw commands in a single API call, reducing driver overhead when
* rendering many independent meshes with the same state.
*/
readonly WEBGL_multi_draw: WEBGL_multi_draw | null;
private readonly logs;
constructor(gl: WebGL2RenderingContext);
activate(extensionName: string): any;
debug(): void;
}
//# sourceMappingURL=extensions.d.ts.map