From b3d5f7e64a34a6637198502c58b4b63bb8d114fb Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Tue, 6 Oct 2015 14:50:10 +0200 Subject: [PATCH 1/6] add missing optional attributes parameter for getContext() and missing context attribute defs, thanks to @ander-nz --- webgl-ext/webgl-ext.d.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/webgl-ext/webgl-ext.d.ts b/webgl-ext/webgl-ext.d.ts index c6a8cb34a1..42a4ee21b8 100644 --- a/webgl-ext/webgl-ext.d.ts +++ b/webgl-ext/webgl-ext.d.ts @@ -6,9 +6,19 @@ // These definitions go beyond those already defined in TS 1.6.2 stdlib // All non-draft WebGL 1.0 extensions and prefixed extension names are // covered. +// Some missing parameters for getContext and fields for +// WebGLContextAttributes are added as well, copied over from +// Shane Anderson's webgl interfaces. + + +interface WebGLContextAttributes { + preferLowPowerToHighPerformance?: boolean; + failIfMajorPerformanceCaveat?: boolean; +} interface HTMLCanvasElement { - getContext(contextId: "webgl"): WebGLRenderingContext; + getContext(contextId: "experimental-webgl", attributes?: WebGLContextAttributes): WebGLRenderingContext; + getContext(contextId: "webgl", attributes?: WebGLContextAttributes): WebGLRenderingContext; } interface WebGLRenderingContext { From 09218a9c29af6d9b887c8b9bf593001e737addf2 Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Wed, 7 Oct 2015 10:55:34 +0200 Subject: [PATCH 2/6] name update --- webgl-ext/webgl-ext.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/webgl-ext/webgl-ext.d.ts b/webgl-ext/webgl-ext.d.ts index 42a4ee21b8..5be2ee07c3 100644 --- a/webgl-ext/webgl-ext.d.ts +++ b/webgl-ext/webgl-ext.d.ts @@ -8,7 +8,7 @@ // covered. // Some missing parameters for getContext and fields for // WebGLContextAttributes are added as well, copied over from -// Shane Anderson's webgl interfaces. +// Shane S. Anderson's definitions file. interface WebGLContextAttributes { From 09ca290d319700137d9a5fc66ce9f39f5813fee5 Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Wed, 7 Oct 2015 11:15:03 +0200 Subject: [PATCH 3/6] add pre-defined attrs and link to spec for WebGLContextAttributes --- webgl-ext/webgl-ext.d.ts | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/webgl-ext/webgl-ext.d.ts b/webgl-ext/webgl-ext.d.ts index 5be2ee07c3..f29d2c98d2 100644 --- a/webgl-ext/webgl-ext.d.ts +++ b/webgl-ext/webgl-ext.d.ts @@ -6,14 +6,28 @@ // These definitions go beyond those already defined in TS 1.6.2 stdlib // All non-draft WebGL 1.0 extensions and prefixed extension names are // covered. -// Some missing parameters for getContext and fields for +// Some missing parameters for getContext and attributes for // WebGLContextAttributes are added as well, copied over from // Shane S. Anderson's definitions file. interface WebGLContextAttributes { + // The following attributes are missing from TypeScript 1.6.2's lib.d.ts preferLowPowerToHighPerformance?: boolean; failIfMajorPerformanceCaveat?: boolean; + + // All others duplicated here for reference + /* + alpha?: boolean; + depth?: boolean; + stencil?: boolean; + antialias?: boolean; + premultipliedAlpha?: boolean; + preserveDrawingBuffer?: boolean; + */ + + // For the meanings and default values of these attributes, see the full spec at: + // https://www.khronos.org/registry/webgl/specs/latest/1.0/index.html#5.2 } interface HTMLCanvasElement { From a84a94976488ce105ca97cde01fc58bc9a233fc4 Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Tue, 23 Oct 2018 14:37:56 +0200 Subject: [PATCH 4/6] Remove types from old location --- webgl-ext/webgl-ext.d.ts | 238 --------------------------------------- 1 file changed, 238 deletions(-) delete mode 100644 webgl-ext/webgl-ext.d.ts diff --git a/webgl-ext/webgl-ext.d.ts b/webgl-ext/webgl-ext.d.ts deleted file mode 100644 index f29d2c98d2..0000000000 --- a/webgl-ext/webgl-ext.d.ts +++ /dev/null @@ -1,238 +0,0 @@ -// Type definitions for WebGL Extensions -// Project: http://webgl.org/ -// Definitions by: Arthur Langereis -// Definitions: https://github.com/borisyankov/DefinitelyTyped/webgl-ext - -// These definitions go beyond those already defined in TS 1.6.2 stdlib -// All non-draft WebGL 1.0 extensions and prefixed extension names are -// covered. -// Some missing parameters for getContext and attributes for -// WebGLContextAttributes are added as well, copied over from -// Shane S. Anderson's definitions file. - - -interface WebGLContextAttributes { - // The following attributes are missing from TypeScript 1.6.2's lib.d.ts - preferLowPowerToHighPerformance?: boolean; - failIfMajorPerformanceCaveat?: boolean; - - // All others duplicated here for reference - /* - alpha?: boolean; - depth?: boolean; - stencil?: boolean; - antialias?: boolean; - premultipliedAlpha?: boolean; - preserveDrawingBuffer?: boolean; - */ - - // For the meanings and default values of these attributes, see the full spec at: - // https://www.khronos.org/registry/webgl/specs/latest/1.0/index.html#5.2 -} - -interface HTMLCanvasElement { - getContext(contextId: "experimental-webgl", attributes?: WebGLContextAttributes): WebGLRenderingContext; - getContext(contextId: "webgl", attributes?: WebGLContextAttributes): WebGLRenderingContext; -} - -interface WebGLRenderingContext { - getExtension(name: "ANGLE_instanced_arrays"): ANGLEInstancedArrays; - - getExtension(name: "EXT_blend_minmax"): EXTBlendMinMax; - getExtension(name: "EXT_color_buffer_half_float"): EXTColorBufferHalfFloat; - getExtension(name: "EXT_frag_depth"): EXTFragDepth; - getExtension(name: "EXT_sRGB"): EXTsRGB; - getExtension(name: "EXT_shader_texture_lod"): EXTShaderTextureLOD; - getExtension(name: "EXT_texture_filter_anisotropic"): EXTTextureFilterAnisotropic; - - getExtension(name: "OES_element_index_uint"): OESElementIndexUint; - getExtension(name: "OES_standard_derivatives"): OESStandardDerivatives; - getExtension(name: "OES_texture_float"): OESTextureFloat; - getExtension(name: "OES_texture_float_linear"): OESTextureFloatLinear; - getExtension(name: "OES_texture_half_float"): OESTextureHalfFloat; - getExtension(name: "OES_texture_half_float_linear"): OESTextureHalfFloatLinear; - getExtension(name: "OES_vertex_array_object"): OESVertexArrayObject; - - getExtension(name: "WEBGL_color_buffer_float"): WebGLColorBufferFloat; - getExtension(name: "WEBGL_compressed_texture_atc"): WebGLCompressedTextureATC; - getExtension(name: "WEBGL_compressed_texture_etc1"): WebGLCompressedTextureETC1; - getExtension(name: "WEBGL_compressed_texture_pvrtc"): WebGLCompressedTexturePVRTC; - getExtension(name: "WEBGL_compressed_texture_s3tc"): WebGLCompressedTextureS3TC; - getExtension(name: "WEBGL_debug_renderer_info"): WebGLDebugRendererInfo; - getExtension(name: "WEBGL_debug_shaders"): WebGLDebugShaders; - getExtension(name: "WEBGL_depth_texture"): WebGLDepthTexture; - getExtension(name: "WEBGL_draw_buffers"): WebGLDrawBuffers; - getExtension(name: "WEBGL_lose_context"): WebGLLoseContext; - - // Prefixed versions appearing in the wild as per September 2015 - - getExtension(name: "WEBKIT_EXT_texture_filter_anisotropic"): EXTTextureFilterAnisotropic; - getExtension(name: "WEBKIT_WEBGL_compressed_texture_atc"): WebGLCompressedTextureATC; - getExtension(name: "WEBKIT_WEBGL_compressed_texture_pvrtc"): WebGLCompressedTexturePVRTC; - getExtension(name: "WEBKIT_WEBGL_compressed_texture_s3tc"): WebGLCompressedTextureS3TC; - getExtension(name: "WEBKIT_WEBGL_depth_texture"): WebGLDepthTexture; - getExtension(name: "WEBKIT_WEBGL_lose_context"): WebGLLoseContext; - - getExtension(name: "MOZ_WEBGL_compressed_texture_s3tc"): WebGLCompressedTextureS3TC; - getExtension(name: "MOZ_WEBGL_depth_texture"): WebGLDepthTexture; - getExtension(name: "MOZ_WEBGL_lose_context"): WebGLLoseContext; -} - -interface ANGLEInstancedArrays { - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; - - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; -} - -interface EXTBlendMinMax { - MIN_EXT: number; - MAX_EXT: number; -} - -interface EXTColorBufferHalfFloat { - RGBA16F_EXT: number; - RGB16F_EXT: number; - FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: number; - UNSIGNED_NORMALIZED_EXT: number; -} - -interface EXTFragDepth { -} - -interface EXTsRGB { - SRGB_EXT: number; - SRGB_ALPHA_EXT: number; - SRGB8_ALPHA8_EXT: number; - FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: number; -} - -interface EXTShaderTextureLOD { -} - -interface EXTTextureFilterAnisotropic { - TEXTURE_MAX_ANISOTROPY_EXT: number; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface OESElementIndexUint { -} - -interface OESStandardDerivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OESTextureFloat { -} - -interface OESTextureFloatLinear { -} - -interface OESTextureHalfFloat { - HALF_FLOAT_OES: number; -} - -interface OESTextureHalfFloatLinear { -} - -interface WebGLVertexArrayObjectOES extends WebGLObject { -} - -interface OESVertexArrayObject { - VERTEX_ARRAY_BINDING_OES: number; - - createVertexArrayOES(): WebGLVertexArrayObjectOES; - deleteVertexArrayOES(arrayObject: WebGLVertexArrayObjectOES): void; - isVertexArrayOES(arrayObject: WebGLVertexArrayObjectOES): boolean; - bindVertexArrayOES(arrayObject: WebGLVertexArrayObjectOES): void; -} - -interface WebGLColorBufferFloat { - RGBA32F_EXT: number; - FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: number; - UNSIGNED_NORMALIZED_EXT: number; -} - -interface WebGLCompressedTextureATC { - COMPRESSED_RGB_ATC_WEBGL: number; - COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: number; - COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: number; -} - -interface WebGLCompressedTextureETC1 { - COMPRESSED_RGB_ETC1_WEBGL: number; -} - -interface WebGLCompressedTexturePVRTC { - COMPRESSED_RGB_PVRTC_4BPPV1_IMG: number; - COMPRESSED_RGB_PVRTC_2BPPV1_IMG: number; - COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: number; - COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: number; -} - -interface WebGLCompressedTextureS3TC { - COMPRESSED_RGB_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; -} - -interface WebGLDebugRendererInfo { - UNMASKED_VENDOR_WEBGL: number; - UNMASKED_RENDERER_WEBGL: number; -} - -interface WebGLDebugShaders { - getTranslatedShaderSource(shader: WebGLShader): string; -} - -interface WebGLDepthTexture { - UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WebGLDrawBuffers { - COLOR_ATTACHMENT0_WEBGL: number; - COLOR_ATTACHMENT1_WEBGL: number; - COLOR_ATTACHMENT2_WEBGL: number; - COLOR_ATTACHMENT3_WEBGL: number; - COLOR_ATTACHMENT4_WEBGL: number; - COLOR_ATTACHMENT5_WEBGL: number; - COLOR_ATTACHMENT6_WEBGL: number; - COLOR_ATTACHMENT7_WEBGL: number; - COLOR_ATTACHMENT8_WEBGL: number; - COLOR_ATTACHMENT9_WEBGL: number; - COLOR_ATTACHMENT10_WEBGL: number; - COLOR_ATTACHMENT11_WEBGL: number; - COLOR_ATTACHMENT12_WEBGL: number; - COLOR_ATTACHMENT13_WEBGL: number; - COLOR_ATTACHMENT14_WEBGL: number; - COLOR_ATTACHMENT15_WEBGL: number; - - DRAW_BUFFER0_WEBGL: number; - DRAW_BUFFER1_WEBGL: number; - DRAW_BUFFER2_WEBGL: number; - DRAW_BUFFER3_WEBGL: number; - DRAW_BUFFER4_WEBGL: number; - DRAW_BUFFER5_WEBGL: number; - DRAW_BUFFER6_WEBGL: number; - DRAW_BUFFER7_WEBGL: number; - DRAW_BUFFER8_WEBGL: number; - DRAW_BUFFER9_WEBGL: number; - DRAW_BUFFER10_WEBGL: number; - DRAW_BUFFER11_WEBGL: number; - DRAW_BUFFER12_WEBGL: number; - DRAW_BUFFER13_WEBGL: number; - DRAW_BUFFER14_WEBGL: number; - DRAW_BUFFER15_WEBGL: number; - - MAX_COLOR_ATTACHMENTS_WEBGL: number; - MAX_DRAW_BUFFERS_WEBGL: number; - - drawBuffersWEBGL(buffers: number[]): void; -} - -interface WebGLLoseContext { - loseContext(): void; - restoreContext(): void; -} From 423e76ee7945b77377d5602ff3f5e6d29a815adf Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Tue, 23 Oct 2018 14:38:55 +0200 Subject: [PATCH 5/6] Update webgl-ext types to work with TS3 --- types/webgl-ext/index.d.ts | 241 +++++++---------------------- types/webgl-ext/webgl-ext-tests.ts | 80 ---------- 2 files changed, 54 insertions(+), 267 deletions(-) diff --git a/types/webgl-ext/index.d.ts b/types/webgl-ext/index.d.ts index 3f0da0c679..4b9b6c579d 100644 --- a/types/webgl-ext/index.d.ts +++ b/types/webgl-ext/index.d.ts @@ -3,212 +3,79 @@ // Definitions by: Arthur Langereis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/webgl-ext -// These definitions go beyond those already defined in TS 1.6.2 stdlib -// All non-draft WebGL 1.0 extensions and prefixed extension names are -// covered. +// render-gl1/declarations - WebGL 1 extension definitions (beyond TS lib) +// Extracted from Stardazed - https://github.com/stardazed/stardazed interface HTMLCanvasElement { - getContext(contextId: "webgl"): WebGLRenderingContext; + getContext(contextId: "webgl" | "experimental-webgl", contextAttributes?: WebGLContextAttributes): (WebGLRenderingContext & WebGL1Extensions) | null; } -interface WebGLRenderingContext { - getExtension(name: "ANGLE_instanced_arrays"): ANGLEInstancedArrays; +interface WebGL1Extensions { + getExtension(name: "EXT_color_buffer_half_float"): EXT_color_buffer_half_float; - getExtension(name: "EXT_blend_minmax"): EXTBlendMinMax; - getExtension(name: "EXT_color_buffer_half_float"): EXTColorBufferHalfFloat; - getExtension(name: "EXT_frag_depth"): EXTFragDepth; - getExtension(name: "EXT_sRGB"): EXTsRGB; - getExtension(name: "EXT_shader_texture_lod"): EXTShaderTextureLOD; - getExtension(name: "EXT_texture_filter_anisotropic"): EXTTextureFilterAnisotropic; + getExtension(name: "WEBGL_compressed_texture_atc"): WEBGL_compressed_texture_atc; + getExtension(name: "WEBGL_compressed_texture_etc1"): WEBGL_compressed_texture_etc1; + getExtension(name: "WEBGL_compressed_texture_pvrtc"): WEBKIT_WEBGL_compressed_texture_pvrtc; - getExtension(name: "OES_element_index_uint"): OESElementIndexUint; - getExtension(name: "OES_standard_derivatives"): OESStandardDerivatives; - getExtension(name: "OES_texture_float"): OESTextureFloat; - getExtension(name: "OES_texture_float_linear"): OESTextureFloatLinear; - getExtension(name: "OES_texture_half_float"): OESTextureHalfFloat; - getExtension(name: "OES_texture_half_float_linear"): OESTextureHalfFloatLinear; - getExtension(name: "OES_vertex_array_object"): OESVertexArrayObject; - - getExtension(name: "WEBGL_color_buffer_float"): WebGLColorBufferFloat; - getExtension(name: "WEBGL_compressed_texture_atc"): WebGLCompressedTextureATC; - getExtension(name: "WEBGL_compressed_texture_etc1"): WebGLCompressedTextureETC1; - getExtension(name: "WEBGL_compressed_texture_pvrtc"): WebGLCompressedTexturePVRTC; - getExtension(name: "WEBGL_compressed_texture_s3tc"): WebGLCompressedTextureS3TC; - getExtension(name: "WEBGL_debug_renderer_info"): WebGLDebugRendererInfo; - getExtension(name: "WEBGL_debug_shaders"): WebGLDebugShaders; - getExtension(name: "WEBGL_depth_texture"): WebGLDepthTexture; - getExtension(name: "WEBGL_draw_buffers"): WebGLDrawBuffers; - getExtension(name: "WEBGL_lose_context"): WebGLLoseContext; - - // Prefixed versions appearing in the wild as per September 2015 - - getExtension(name: "WEBKIT_EXT_texture_filter_anisotropic"): EXTTextureFilterAnisotropic; - getExtension(name: "WEBKIT_WEBGL_compressed_texture_atc"): WebGLCompressedTextureATC; - getExtension(name: "WEBKIT_WEBGL_compressed_texture_pvrtc"): WebGLCompressedTexturePVRTC; - getExtension(name: "WEBKIT_WEBGL_compressed_texture_s3tc"): WebGLCompressedTextureS3TC; - getExtension(name: "WEBKIT_WEBGL_depth_texture"): WebGLDepthTexture; - getExtension(name: "WEBKIT_WEBGL_lose_context"): WebGLLoseContext; - - getExtension(name: "MOZ_WEBGL_compressed_texture_s3tc"): WebGLCompressedTextureS3TC; - getExtension(name: "MOZ_WEBGL_depth_texture"): WebGLDepthTexture; - getExtension(name: "MOZ_WEBGL_lose_context"): WebGLLoseContext; + // Prefixed versions appearing in the wild as per February 2018 + getExtension(name: "WEBKIT_EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic; // Chrome + getExtension(name: "WEBKIT_WEBGL_compressed_texture_atc"): WEBGL_compressed_texture_atc; // Android + getExtension(name: "WEBKIT_WEBGL_compressed_texture_pvrtc"): WEBKIT_WEBGL_compressed_texture_pvrtc; // Safari iOS + getExtension(name: "WEBKIT_WEBGL_compressed_texture_s3tc"): WEBGL_compressed_texture_s3tc; // Chrome + getExtension(name: "WEBKIT_WEBGL_depth_texture"): WEBGL_depth_texture; // Chrome + getExtension(name: "WEBKIT_WEBGL_lose_context"): WEBGL_lose_context; // Chrome } -interface ANGLEInstancedArrays { - VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE: number; - drawArraysInstancedANGLE(mode: number, first: number, count: number, primcount: number): void; - drawElementsInstancedANGLE(mode: number, count: number, type: number, offset: number, primcount: number): void; - vertexAttribDivisorANGLE(index: number, divisor: number): void; +// WebGL 1 Type Branding +interface WebGLObject { readonly __WebGLObject: void; } +interface WebGLBuffer { readonly __WebGLBuffer: void; } +interface WebGLFramebuffer { readonly __WebGLFramebuffer: void; } +interface WebGLProgram { readonly __WebGLProgram: void; } +interface WebGLRenderbuffer { readonly __WebGLRenderbuffer: void; } +interface WebGLShader { readonly __WebGLShader: void; } +interface WebGLTexture { readonly __WebGLTexture: void; } +interface WebGLUniformLocation { readonly __WebGLUniformLocation: void; } +interface WebGLVertexArrayObjectOES extends WebGLObject { readonly __WebGLVertexArrayObjectOES: void; } + +interface EXT_frag_depth { readonly __EXT_frag_depth: void; } +interface EXT_shader_texture_lod { readonly __EXT_shader_texture_lod: void; } + +interface OES_element_index_uint { readonly __OESElementIndexUint: void; } +interface OES_texture_float { readonly __OES_texture_float: void; } +interface OES_texture_float_linear { readonly __OES_texture_float_linear: void; } +interface OES_texture_half_float_linear { readonly __OES_texture_half_float_linear: void; } + + +// WebGL 1 Extensions +interface EXT_color_buffer_half_float { + readonly RGBA16F_EXT: number; + readonly RGB16F_EXT: number; + readonly FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: number; + readonly UNSIGNED_NORMALIZED_EXT: number; } -interface EXTBlendMinMax { - MIN_EXT: number; - MAX_EXT: number; -} - -interface EXTColorBufferHalfFloat { - RGBA16F_EXT: number; - RGB16F_EXT: number; - FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: number; - UNSIGNED_NORMALIZED_EXT: number; -} - -interface EXTFragDepth { -} - -interface EXTsRGB { - SRGB_EXT: number; - SRGB_ALPHA_EXT: number; - SRGB8_ALPHA8_EXT: number; - FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT: number; -} - -interface EXTShaderTextureLOD { -} - -interface EXTTextureFilterAnisotropic { - TEXTURE_MAX_ANISOTROPY_EXT: number; - MAX_TEXTURE_MAX_ANISOTROPY_EXT: number; -} - -interface OESElementIndexUint { -} - -interface OESStandardDerivatives { - FRAGMENT_SHADER_DERIVATIVE_HINT_OES: number; -} - -interface OESTextureFloat { -} - -interface OESTextureFloatLinear { -} - -interface OESTextureHalfFloat { - HALF_FLOAT_OES: number; -} - -interface OESTextureHalfFloatLinear { -} - -interface WebGLVertexArrayObjectOES extends WebGLObject { -} - -interface OESVertexArrayObject { - VERTEX_ARRAY_BINDING_OES: number; - +interface OES_vertex_array_object { + // TS's lib.dom (as of v3.1.3) does not specify the nulls createVertexArrayOES(): WebGLVertexArrayObjectOES | null; deleteVertexArrayOES(arrayObject: WebGLVertexArrayObjectOES | null): void; isVertexArrayOES(arrayObject: WebGLVertexArrayObjectOES | null): boolean; bindVertexArrayOES(arrayObject: WebGLVertexArrayObjectOES | null): void; } -interface WebGLColorBufferFloat { - RGBA32F_EXT: number; - FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT: number; - UNSIGNED_NORMALIZED_EXT: number; +interface WEBGL_compressed_texture_atc { + readonly COMPRESSED_RGB_ATC_WEBGL: number; + readonly COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: number; + readonly COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: number; } -interface WebGLCompressedTextureATC { - COMPRESSED_RGB_ATC_WEBGL: number; - COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: number; - COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: number; +interface WEBGL_compressed_texture_etc1 { + readonly COMPRESSED_RGB_ETC1_WEBGL: number; } -interface WebGLCompressedTextureETC1 { - COMPRESSED_RGB_ETC1_WEBGL: number; -} - -interface WebGLCompressedTexturePVRTC { - COMPRESSED_RGB_PVRTC_4BPPV1_IMG: number; - COMPRESSED_RGB_PVRTC_2BPPV1_IMG: number; - COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: number; - COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: number; -} - -interface WebGLCompressedTextureS3TC { - COMPRESSED_RGB_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT1_EXT: number; - COMPRESSED_RGBA_S3TC_DXT3_EXT: number; - COMPRESSED_RGBA_S3TC_DXT5_EXT: number; -} - -interface WebGLDebugRendererInfo { - UNMASKED_VENDOR_WEBGL: number; - UNMASKED_RENDERER_WEBGL: number; -} - -interface WebGLDebugShaders { - getTranslatedShaderSource(shader: WebGLShader): string; -} - -interface WebGLDepthTexture { - UNSIGNED_INT_24_8_WEBGL: number; -} - -interface WebGLDrawBuffers { - COLOR_ATTACHMENT0_WEBGL: number; - COLOR_ATTACHMENT1_WEBGL: number; - COLOR_ATTACHMENT2_WEBGL: number; - COLOR_ATTACHMENT3_WEBGL: number; - COLOR_ATTACHMENT4_WEBGL: number; - COLOR_ATTACHMENT5_WEBGL: number; - COLOR_ATTACHMENT6_WEBGL: number; - COLOR_ATTACHMENT7_WEBGL: number; - COLOR_ATTACHMENT8_WEBGL: number; - COLOR_ATTACHMENT9_WEBGL: number; - COLOR_ATTACHMENT10_WEBGL: number; - COLOR_ATTACHMENT11_WEBGL: number; - COLOR_ATTACHMENT12_WEBGL: number; - COLOR_ATTACHMENT13_WEBGL: number; - COLOR_ATTACHMENT14_WEBGL: number; - COLOR_ATTACHMENT15_WEBGL: number; - - DRAW_BUFFER0_WEBGL: number; - DRAW_BUFFER1_WEBGL: number; - DRAW_BUFFER2_WEBGL: number; - DRAW_BUFFER3_WEBGL: number; - DRAW_BUFFER4_WEBGL: number; - DRAW_BUFFER5_WEBGL: number; - DRAW_BUFFER6_WEBGL: number; - DRAW_BUFFER7_WEBGL: number; - DRAW_BUFFER8_WEBGL: number; - DRAW_BUFFER9_WEBGL: number; - DRAW_BUFFER10_WEBGL: number; - DRAW_BUFFER11_WEBGL: number; - DRAW_BUFFER12_WEBGL: number; - DRAW_BUFFER13_WEBGL: number; - DRAW_BUFFER14_WEBGL: number; - DRAW_BUFFER15_WEBGL: number; - - MAX_COLOR_ATTACHMENTS_WEBGL: number; - MAX_DRAW_BUFFERS_WEBGL: number; - - drawBuffersWEBGL(buffers: number[]): void; -} - -interface WebGLLoseContext { - loseContext(): void; - restoreContext(): void; +interface WEBKIT_WEBGL_compressed_texture_pvrtc { + readonly COMPRESSED_RGB_PVRTC_4BPPV1_IMG: number; + readonly COMPRESSED_RGB_PVRTC_2BPPV1_IMG: number; + readonly COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: number; + readonly COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: number; } diff --git a/types/webgl-ext/webgl-ext-tests.ts b/types/webgl-ext/webgl-ext-tests.ts index 6e0580643b..6d7739cf32 100644 --- a/types/webgl-ext/webgl-ext-tests.ts +++ b/types/webgl-ext/webgl-ext-tests.ts @@ -5,66 +5,10 @@ var gl = canvas.getContext("webgl"); var ext: any; var t: any; -if (ext = gl.getExtension("ANGLE_instanced_arrays")) { - t = ext.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE; -} - -if (ext = gl.getExtension("EXT_blend_minmax")) { - t = ext.MIN_EXT; -} - if (ext = gl.getExtension("EXT_color_buffer_half_float")) { t = ext.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT; } -if (ext = gl.getExtension("EXT_frag_depth")) { - // no fields -} - -if (ext = gl.getExtension("EXT_sRGB")) { - t = ext.SRGB8_ALPHA8_EXT; -} - -if (ext = gl.getExtension("EXT_shader_texture_lod")) { - // no fields -} - -if (ext = gl.getExtension("EXT_texture_filter_anisotropic")) { - t = ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT; -} - -if (ext = gl.getExtension("OES_element_index_uint")) { - // no fields -} - -if (ext = gl.getExtension("OES_standard_derivatives")) { - t = ext.FRAGMENT_SHADER_DERIVATIVE_HINT_OES; -} - -if (ext = gl.getExtension("OES_texture_float")) { - // no fields -} - -if (ext = gl.getExtension("OES_texture_float_linear")) { - // no fields -} - -if (ext = gl.getExtension("OES_texture_half_float")) { - t = ext.HALF_FLOAT_OES; -} - -if (ext = gl.getExtension("OES_texture_half_float_linear")) { - // no fields -} - -if (ext = gl.getExtension("OES_vertex_array_object")) { - t = ext.createVertexArrayOES; // just get fn ref, don't call -} - -if (ext = gl.getExtension("WEBGL_color_buffer_float")) { - t = ext.FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT; -} - if (ext = gl.getExtension("WEBGL_compressed_texture_atc")) { t = ext.COMPRESSED_RGB_ATC_WEBGL; } @@ -76,27 +20,3 @@ if (ext = gl.getExtension("WEBGL_compressed_texture_etc1")) { if (ext = gl.getExtension("WEBGL_compressed_texture_pvrtc")) { t = ext.COMPRESSED_RGB_PVRTC_4BPPV1_IMG; } - -if (ext = gl.getExtension("WEBGL_compressed_texture_s3tc")) { - t = ext.COMPRESSED_RGBA_S3TC_DXT5_EXT; -} - -if (ext = gl.getExtension("WEBGL_debug_renderer_info")) { - t = ext.UNMASKED_VENDOR_WEBGL; -} - -if (ext = gl.getExtension("WEBGL_debug_shaders")) { - t = ext.getTranslatedShaderSource; // just get fn ref, don't call -} - -if (ext = gl.getExtension("WEBGL_depth_texture")) { - t = ext.UNSIGNED_INT_24_8_WEBGL; -} - -if (ext = gl.getExtension("WEBGL_draw_buffers")) { - t = ext.MAX_COLOR_ATTACHMENTS_WEBGL; -} - -if (ext = gl.getExtension("WEBGL_lose_context")) { - t = ext.loseContext; // just get fn ref, don't call -} From aec45b1b4d67ef012d874ac3ddf80e10e677fb09 Mon Sep 17 00:00:00 2001 From: Arthur Langereis Date: Tue, 23 Oct 2018 14:44:30 +0200 Subject: [PATCH 6/6] Add TS min version header to webgl-ext --- types/webgl-ext/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/webgl-ext/index.d.ts b/types/webgl-ext/index.d.ts index 4b9b6c579d..e8e2e94e2f 100644 --- a/types/webgl-ext/index.d.ts +++ b/types/webgl-ext/index.d.ts @@ -2,6 +2,7 @@ // Project: http://webgl.org/ // Definitions by: Arthur Langereis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped/webgl-ext +// TypeScript Version: 2.7 // render-gl1/declarations - WebGL 1 extension definitions (beyond TS lib) // Extracted from Stardazed - https://github.com/stardazed/stardazed