From b053182c3ceb4dbde997ebfda3e70d1a7351f381 Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Tue, 18 Nov 2025 15:19:18 -0800 Subject: [PATCH 01/11] Add EAC formats. --- src/constants.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/constants.js b/src/constants.js index 100bf0a5b4b3dd..64e174108093b0 100644 --- a/src/constants.js +++ b/src/constants.js @@ -907,6 +907,38 @@ export const RGB_ETC2_Format = 37492; */ export const RGBA_ETC2_EAC_Format = 37496; +/** + * EAC R11 UNORM format. + * + * @type {number} + * @constant + */ +export const R11_UNORM_EAC_Format = 37488; // 0x9270 + +/** + * EAC R11 SNORM format. + * + * @type {number} + * @constant + */ +export const R11_SNORM_EAC_Format = 37489; // 0x9271 + +/** + * EAC RG11 UNORM format. + * + * @type {number} + * @constant + */ +export const RG11_UNORM_EAC_Format = 37490; // 0x9272 + +/** + * EAC RG11 SNORM format. + * + * @type {number} + * @constant + */ +export const RG11_SNORM_EAC_Format = 37491; // 0x9273 + /** * ASTC RGBA 4x4 format. * From 8af664f091bf2206c340a2458923c42250b1b77c Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Tue, 18 Nov 2025 15:19:41 -0800 Subject: [PATCH 02/11] Handle new EAC formats in getByteLength --- src/extras/TextureUtils.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/extras/TextureUtils.js b/src/extras/TextureUtils.js index ce1705e613f011..460621b40dec53 100644 --- a/src/extras/TextureUtils.js +++ b/src/extras/TextureUtils.js @@ -1,4 +1,4 @@ -import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js'; +import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_UNORM_EAC_Format, R11_SNORM_EAC_Format, RG11_UNORM_EAC_Format, RG11_SNORM_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js'; /** * Scales the texture as large as possible within its surface without cropping @@ -140,8 +140,12 @@ function getByteLength( width, height, format, type ) { // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/ case RGB_ETC1_Format: case RGB_ETC2_Format: + case R11_UNORM_EAC_Format: + case R11_SNORM_EAC_Format: return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8; case RGBA_ETC2_EAC_Format: + case RG11_UNORM_EAC_Format: + case RG11_SNORM_EAC_Format: return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16; // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/ From d80d292815db697694b212163dc88e728d282363 Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Tue, 18 Nov 2025 15:20:02 -0800 Subject: [PATCH 03/11] Add support for EAC formats in WebGPU backend. --- .../webgpu/utils/WebGPUTextureUtils.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/src/renderers/webgpu/utils/WebGPUTextureUtils.js b/src/renderers/webgpu/utils/WebGPUTextureUtils.js index 4b449a60e65fba..b2995c418cd321 100644 --- a/src/renderers/webgpu/utils/WebGPUTextureUtils.js +++ b/src/renderers/webgpu/utils/WebGPUTextureUtils.js @@ -14,7 +14,8 @@ import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, UnsignedIntType, UnsignedShortType, UnsignedInt248Type, UnsignedInt5999Type, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, IntType, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, - UnsignedInt101111Type, RGBA_BPTC_Format, RGB_ETC1_Format, RGB_S3TC_DXT1_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format + UnsignedInt101111Type, RGBA_BPTC_Format, RGB_ETC1_Format, RGB_S3TC_DXT1_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, + R11_UNORM_EAC_Format, R11_SNORM_EAC_Format, RG11_UNORM_EAC_Format, RG11_SNORM_EAC_Format, } from '../../../constants.js'; import { CubeTexture } from '../../../textures/CubeTexture.js'; import { Texture } from '../../../textures/Texture.js'; @@ -1239,6 +1240,22 @@ export function getFormat( texture, device = null ) { formatGPU = ( transfer === SRGBTransfer ) ? GPUTextureFormat.ETC2RGBA8UnormSRGB : GPUTextureFormat.ETC2RGBA8Unorm; break; + case R11_UNORM_EAC_Format: + formatGPU = GPUTextureFormat.EACR11Unorm; + break; + + case R11_SNORM_EAC_Format: + formatGPU = GPUTextureFormat.EACR11Snorm; + break; + + case RG11_UNORM_EAC_Format: + formatGPU = GPUTextureFormat.EACRG11Unorm; + break; + + case RG11_SNORM_EAC_Format: + formatGPU = GPUTextureFormat.EACRG11Snorm; + break; + case RGBA_ASTC_4x4_Format: formatGPU = ( transfer === SRGBTransfer ) ? GPUTextureFormat.ASTC4x4UnormSRGB : GPUTextureFormat.ASTC4x4Unorm; break; From 65b69830876f05ef618da622445e14605631123f Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Tue, 18 Nov 2025 15:20:19 -0800 Subject: [PATCH 04/11] Add support for EAC formats in KTX2Loader. --- examples/jsm/loaders/KTX2Loader.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/examples/jsm/loaders/KTX2Loader.js b/examples/jsm/loaders/KTX2Loader.js index 8486bf81339b0d..2339a855229a90 100644 --- a/examples/jsm/loaders/KTX2Loader.js +++ b/examples/jsm/loaders/KTX2Loader.js @@ -20,6 +20,8 @@ import { RGBA_BPTC_Format, RGBA_S3TC_DXT3_Format, RGBA_ETC2_EAC_Format, + R11_UNORM_EAC_Format, + RG11_UNORM_EAC_Format RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_S3TC_DXT1_Format, @@ -71,6 +73,8 @@ import { VK_FORMAT_BC7_UNORM_BLOCK, VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK, + VK_FORMAT_EAC_R11_UNORM_BLOCK, + VK_FORMAT_EAC_R11G11_UNORM_BLOCK, VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG, VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG, VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG, @@ -968,6 +972,10 @@ const FORMAT_MAP = { [ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK ]: RGBA_ETC2_EAC_Format, [ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK ]: RGB_ETC2_Format, + [ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: R11_UNORM_EAC_Format, + [ VK_FORMAT_EAC_R11_SNORM_BLOCK ]: R11_SNORM_EAC_Format, + [ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: RG11_UNORM_EAC_Format, + [ VK_FORMAT_EAC_R11G11_SNORM_BLOCK ]: RG11_SNORM_EAC_Format, [ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: RGBA_ASTC_4x4_Format, [ VK_FORMAT_ASTC_4x4_SRGB_BLOCK ]: RGBA_ASTC_4x4_Format, @@ -1022,6 +1030,10 @@ const TYPE_MAP = { [ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK ]: UnsignedByteType, [ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK ]: UnsignedByteType, + [ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: UnsignedByteType, + [ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: UnsignedByteType, + [ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: UnsignedByteType, + [ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: UnsignedByteType, [ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: HalfFloatType, [ VK_FORMAT_ASTC_4x4_SRGB_BLOCK ]: UnsignedByteType, From 4348cb63e6457f526eef9e635b6b5138d10ada9d Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Tue, 18 Nov 2025 15:21:08 -0800 Subject: [PATCH 05/11] Automatically select normal RG packing for EAC_RG textures in normal map nodes. --- src/nodes/accessors/MaterialNode.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nodes/accessors/MaterialNode.js b/src/nodes/accessors/MaterialNode.js index e813d998b6aa7a..57fa61e9486bce 100644 --- a/src/nodes/accessors/MaterialNode.js +++ b/src/nodes/accessors/MaterialNode.js @@ -7,7 +7,7 @@ import { uniform } from '../core/UniformNode.js'; import { normalMap } from '../display/NormalMapNode.js'; import { bumpMap } from '../display/BumpMapNode.js'; import { Vector2 } from '../../math/Vector2.js'; -import { RGFormat, RED_GREEN_RGTC2_Format, NormalRGPacking } from '../../constants.js'; +import { RGFormat, RED_GREEN_RGTC2_Format, RG11_UNORM_EAC_Format, NormalRGPacking } from '../../constants.js'; const _propertyCache = new Map(); @@ -237,7 +237,7 @@ class MaterialNode extends Node { node = normalMap( this.getTexture( 'normal' ), this.getCache( 'normalScale', 'vec2' ) ); node.normalMapType = material.normalMapType; - if ( material.normalMap.format == RGFormat || material.normalMap.format == RED_GREEN_RGTC2_Format ) { + if ( material.normalMap.format == RGFormat || material.normalMap.format == RED_GREEN_RGTC2_Format || material.normalMap.format == RG11_UNORM_EAC_Format ) { node.unpackNormalMode = NormalRGPacking; From 40b442696ea4622518dac99206d2a228453fcd0a Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Tue, 18 Nov 2025 15:40:13 -0800 Subject: [PATCH 06/11] Fix missing comma. --- examples/jsm/loaders/KTX2Loader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/jsm/loaders/KTX2Loader.js b/examples/jsm/loaders/KTX2Loader.js index 2339a855229a90..12dd1da62b3aa3 100644 --- a/examples/jsm/loaders/KTX2Loader.js +++ b/examples/jsm/loaders/KTX2Loader.js @@ -21,7 +21,7 @@ import { RGBA_S3TC_DXT3_Format, RGBA_ETC2_EAC_Format, R11_UNORM_EAC_Format, - RG11_UNORM_EAC_Format + RG11_UNORM_EAC_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_S3TC_DXT1_Format, From 31e0469a63b981d51fee71ab7a5940ece071d8a1 Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Tue, 18 Nov 2025 16:27:36 -0800 Subject: [PATCH 07/11] Add missing imports. --- examples/jsm/loaders/KTX2Loader.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/examples/jsm/loaders/KTX2Loader.js b/examples/jsm/loaders/KTX2Loader.js index 12dd1da62b3aa3..125d24cf9a6839 100644 --- a/examples/jsm/loaders/KTX2Loader.js +++ b/examples/jsm/loaders/KTX2Loader.js @@ -21,7 +21,9 @@ import { RGBA_S3TC_DXT3_Format, RGBA_ETC2_EAC_Format, R11_UNORM_EAC_Format, + R11_SNORM_EAC_Format, RG11_UNORM_EAC_Format, + RG11_SNORM_EAC_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_S3TC_DXT1_Format, @@ -74,7 +76,9 @@ import { VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK, VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK, VK_FORMAT_EAC_R11_UNORM_BLOCK, + VK_FORMAT_EAC_R11_SNORM_BLOCK, VK_FORMAT_EAC_R11G11_UNORM_BLOCK, + VK_FORMAT_EAC_R11G11_SNORM_BLOCK, VK_FORMAT_PVRTC1_4BPP_SRGB_BLOCK_IMG, VK_FORMAT_PVRTC1_4BPP_UNORM_BLOCK_IMG, VK_FORMAT_PVRTC1_2BPP_SRGB_BLOCK_IMG, From b1140cade9f28a9b20855e94f85901068e89186f Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Wed, 19 Nov 2025 20:13:29 -0800 Subject: [PATCH 08/11] Rename format enums to follow prior convention. --- examples/jsm/loaders/KTX2Loader.js | 16 ++++++++-------- src/constants.js | 8 ++++---- src/extras/TextureUtils.js | 10 +++++----- src/nodes/accessors/MaterialNode.js | 4 ++-- src/renderers/webgpu/utils/WebGPUTextureUtils.js | 10 +++++----- 5 files changed, 24 insertions(+), 24 deletions(-) diff --git a/examples/jsm/loaders/KTX2Loader.js b/examples/jsm/loaders/KTX2Loader.js index 125d24cf9a6839..39c8f87bd21a6d 100644 --- a/examples/jsm/loaders/KTX2Loader.js +++ b/examples/jsm/loaders/KTX2Loader.js @@ -20,10 +20,10 @@ import { RGBA_BPTC_Format, RGBA_S3TC_DXT3_Format, RGBA_ETC2_EAC_Format, - R11_UNORM_EAC_Format, - R11_SNORM_EAC_Format, - RG11_UNORM_EAC_Format, - RG11_SNORM_EAC_Format, + R11_EAC_Format, + R11_SIGNED_EAC_Format, + RG11_EAC_Format, + RG11_SIGNED_EAC_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_S3TC_DXT1_Format, @@ -976,10 +976,10 @@ const FORMAT_MAP = { [ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK ]: RGBA_ETC2_EAC_Format, [ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK ]: RGB_ETC2_Format, - [ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: R11_UNORM_EAC_Format, - [ VK_FORMAT_EAC_R11_SNORM_BLOCK ]: R11_SNORM_EAC_Format, - [ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: RG11_UNORM_EAC_Format, - [ VK_FORMAT_EAC_R11G11_SNORM_BLOCK ]: RG11_SNORM_EAC_Format, + [ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: R11_EAC_Format, + [ VK_FORMAT_EAC_R11_SNORM_BLOCK ]: R11_SIGNED_EAC_Format, + [ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: RG11_EAC_Format, + [ VK_FORMAT_EAC_R11G11_SNORM_BLOCK ]: RG11_SIGNED_EAC_Format, [ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: RGBA_ASTC_4x4_Format, [ VK_FORMAT_ASTC_4x4_SRGB_BLOCK ]: RGBA_ASTC_4x4_Format, diff --git a/src/constants.js b/src/constants.js index 64e174108093b0..dd132a8e3a1266 100644 --- a/src/constants.js +++ b/src/constants.js @@ -913,7 +913,7 @@ export const RGBA_ETC2_EAC_Format = 37496; * @type {number} * @constant */ -export const R11_UNORM_EAC_Format = 37488; // 0x9270 +export const R11_EAC_Format = 37488; // 0x9270 /** * EAC R11 SNORM format. @@ -921,7 +921,7 @@ export const R11_UNORM_EAC_Format = 37488; // 0x9270 * @type {number} * @constant */ -export const R11_SNORM_EAC_Format = 37489; // 0x9271 +export const R11_SIGNED_EAC_Format = 37489; // 0x9271 /** * EAC RG11 UNORM format. @@ -929,7 +929,7 @@ export const R11_SNORM_EAC_Format = 37489; // 0x9271 * @type {number} * @constant */ -export const RG11_UNORM_EAC_Format = 37490; // 0x9272 +export const RG11_EAC_Format = 37490; // 0x9272 /** * EAC RG11 SNORM format. @@ -937,7 +937,7 @@ export const RG11_UNORM_EAC_Format = 37490; // 0x9272 * @type {number} * @constant */ -export const RG11_SNORM_EAC_Format = 37491; // 0x9273 +export const RG11_SIGNED_EAC_Format = 37491; // 0x9273 /** * ASTC RGBA 4x4 format. diff --git a/src/extras/TextureUtils.js b/src/extras/TextureUtils.js index 460621b40dec53..88d424b8ce07b4 100644 --- a/src/extras/TextureUtils.js +++ b/src/extras/TextureUtils.js @@ -1,4 +1,4 @@ -import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_UNORM_EAC_Format, R11_SNORM_EAC_Format, RG11_UNORM_EAC_Format, RG11_SNORM_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js'; +import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, R11_SIGNED_EAC_Format, RG11_EAC_Format, RG11_SIGNED_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js'; /** * Scales the texture as large as possible within its surface without cropping @@ -140,12 +140,12 @@ function getByteLength( width, height, format, type ) { // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_etc/ case RGB_ETC1_Format: case RGB_ETC2_Format: - case R11_UNORM_EAC_Format: - case R11_SNORM_EAC_Format: + case R11_EAC_Format: + case R11_SIGNED_EAC_Format: return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8; case RGBA_ETC2_EAC_Format: - case RG11_UNORM_EAC_Format: - case RG11_SNORM_EAC_Format: + case RG11_EAC_Format: + case RG11_SIGNED_EAC_Format: return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16; // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/ diff --git a/src/nodes/accessors/MaterialNode.js b/src/nodes/accessors/MaterialNode.js index 57fa61e9486bce..802dd8b0c148bb 100644 --- a/src/nodes/accessors/MaterialNode.js +++ b/src/nodes/accessors/MaterialNode.js @@ -7,7 +7,7 @@ import { uniform } from '../core/UniformNode.js'; import { normalMap } from '../display/NormalMapNode.js'; import { bumpMap } from '../display/BumpMapNode.js'; import { Vector2 } from '../../math/Vector2.js'; -import { RGFormat, RED_GREEN_RGTC2_Format, RG11_UNORM_EAC_Format, NormalRGPacking } from '../../constants.js'; +import { RGFormat, RED_GREEN_RGTC2_Format, RG11_EAC_Format, NormalRGPacking } from '../../constants.js'; const _propertyCache = new Map(); @@ -237,7 +237,7 @@ class MaterialNode extends Node { node = normalMap( this.getTexture( 'normal' ), this.getCache( 'normalScale', 'vec2' ) ); node.normalMapType = material.normalMapType; - if ( material.normalMap.format == RGFormat || material.normalMap.format == RED_GREEN_RGTC2_Format || material.normalMap.format == RG11_UNORM_EAC_Format ) { + if ( material.normalMap.format == RGFormat || material.normalMap.format == RED_GREEN_RGTC2_Format || material.normalMap.format == RG11_EAC_Format ) { node.unpackNormalMode = NormalRGPacking; diff --git a/src/renderers/webgpu/utils/WebGPUTextureUtils.js b/src/renderers/webgpu/utils/WebGPUTextureUtils.js index b2995c418cd321..d320c72a2e5957 100644 --- a/src/renderers/webgpu/utils/WebGPUTextureUtils.js +++ b/src/renderers/webgpu/utils/WebGPUTextureUtils.js @@ -15,7 +15,7 @@ import { RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, UnsignedIntType, UnsignedShortType, UnsignedInt248Type, UnsignedInt5999Type, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, IntType, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, UnsignedInt101111Type, RGBA_BPTC_Format, RGB_ETC1_Format, RGB_S3TC_DXT1_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, - R11_UNORM_EAC_Format, R11_SNORM_EAC_Format, RG11_UNORM_EAC_Format, RG11_SNORM_EAC_Format, + R11_EAC_Format, R11_SIGNED_EAC_Format, RG11_EAC_Format, RG11_SIGNED_EAC_Format, } from '../../../constants.js'; import { CubeTexture } from '../../../textures/CubeTexture.js'; import { Texture } from '../../../textures/Texture.js'; @@ -1240,19 +1240,19 @@ export function getFormat( texture, device = null ) { formatGPU = ( transfer === SRGBTransfer ) ? GPUTextureFormat.ETC2RGBA8UnormSRGB : GPUTextureFormat.ETC2RGBA8Unorm; break; - case R11_UNORM_EAC_Format: + case R11_EAC_Format: formatGPU = GPUTextureFormat.EACR11Unorm; break; - case R11_SNORM_EAC_Format: + case R11_SIGNED_EAC_Format: formatGPU = GPUTextureFormat.EACR11Snorm; break; - case RG11_UNORM_EAC_Format: + case RG11_EAC_Format: formatGPU = GPUTextureFormat.EACRG11Unorm; break; - case RG11_SNORM_EAC_Format: + case RG11_SIGNED_EAC_Format: formatGPU = GPUTextureFormat.EACRG11Snorm; break; From 369cf9a6a0539bd6f1a07b33b704d37a990a8ced Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Wed, 19 Nov 2025 21:19:41 -0800 Subject: [PATCH 09/11] Match WebGL naming convention exactly. --- examples/jsm/loaders/KTX2Loader.js | 8 ++++---- src/constants.js | 4 ++-- src/extras/TextureUtils.js | 6 +++--- src/renderers/webgpu/utils/WebGPUTextureUtils.js | 6 +++--- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/examples/jsm/loaders/KTX2Loader.js b/examples/jsm/loaders/KTX2Loader.js index 39c8f87bd21a6d..9ffc1c6336269d 100644 --- a/examples/jsm/loaders/KTX2Loader.js +++ b/examples/jsm/loaders/KTX2Loader.js @@ -21,9 +21,9 @@ import { RGBA_S3TC_DXT3_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, - R11_SIGNED_EAC_Format, + SIGNED_R11_EAC_Format, RG11_EAC_Format, - RG11_SIGNED_EAC_Format, + SIGNED_RG11_EAC_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_S3TC_DXT1_Format, @@ -977,9 +977,9 @@ const FORMAT_MAP = { [ VK_FORMAT_ETC2_R8G8B8A8_SRGB_BLOCK ]: RGBA_ETC2_EAC_Format, [ VK_FORMAT_ETC2_R8G8B8_SRGB_BLOCK ]: RGB_ETC2_Format, [ VK_FORMAT_EAC_R11_UNORM_BLOCK ]: R11_EAC_Format, - [ VK_FORMAT_EAC_R11_SNORM_BLOCK ]: R11_SIGNED_EAC_Format, + [ VK_FORMAT_EAC_R11_SNORM_BLOCK ]: SIGNED_R11_EAC_Format, [ VK_FORMAT_EAC_R11G11_UNORM_BLOCK ]: RG11_EAC_Format, - [ VK_FORMAT_EAC_R11G11_SNORM_BLOCK ]: RG11_SIGNED_EAC_Format, + [ VK_FORMAT_EAC_R11G11_SNORM_BLOCK ]: SIGNED_RG11_EAC_Format, [ VK_FORMAT_ASTC_4x4_SFLOAT_BLOCK_EXT ]: RGBA_ASTC_4x4_Format, [ VK_FORMAT_ASTC_4x4_SRGB_BLOCK ]: RGBA_ASTC_4x4_Format, diff --git a/src/constants.js b/src/constants.js index dd132a8e3a1266..39de2a5799219c 100644 --- a/src/constants.js +++ b/src/constants.js @@ -921,7 +921,7 @@ export const R11_EAC_Format = 37488; // 0x9270 * @type {number} * @constant */ -export const R11_SIGNED_EAC_Format = 37489; // 0x9271 +export const SIGNED_R11_EAC_Format = 37489; // 0x9271 /** * EAC RG11 UNORM format. @@ -937,7 +937,7 @@ export const RG11_EAC_Format = 37490; // 0x9272 * @type {number} * @constant */ -export const RG11_SIGNED_EAC_Format = 37491; // 0x9273 +export const SIGNED_RG11_EAC_Format = 37491; // 0x9273 /** * ASTC RGBA 4x4 format. diff --git a/src/extras/TextureUtils.js b/src/extras/TextureUtils.js index 88d424b8ce07b4..d3b7b4b4fb420e 100644 --- a/src/extras/TextureUtils.js +++ b/src/extras/TextureUtils.js @@ -1,4 +1,4 @@ -import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, R11_SIGNED_EAC_Format, RG11_EAC_Format, RG11_SIGNED_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js'; +import { AlphaFormat, RedFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBFormat, RGBAFormat, RGBAIntegerFormat, RGB_S3TC_DXT1_Format, RGBA_S3TC_DXT1_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT5_Format, RGB_PVRTC_2BPPV1_Format, RGBA_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, UnsignedByteType, ByteType, UnsignedShortType, ShortType, HalfFloatType, UnsignedShort4444Type, UnsignedShort5551Type, UnsignedIntType, IntType, FloatType, UnsignedInt5999Type, UnsignedInt101111Type } from '../constants.js'; /** * Scales the texture as large as possible within its surface without cropping @@ -141,11 +141,11 @@ function getByteLength( width, height, format, type ) { case RGB_ETC1_Format: case RGB_ETC2_Format: case R11_EAC_Format: - case R11_SIGNED_EAC_Format: + case SIGNED_R11_EAC_Format: return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 8; case RGBA_ETC2_EAC_Format: case RG11_EAC_Format: - case RG11_SIGNED_EAC_Format: + case SIGNED_RG11_EAC_Format: return Math.floor( ( width + 3 ) / 4 ) * Math.floor( ( height + 3 ) / 4 ) * 16; // https://registry.khronos.org/webgl/extensions/WEBGL_compressed_texture_astc/ diff --git a/src/renderers/webgpu/utils/WebGPUTextureUtils.js b/src/renderers/webgpu/utils/WebGPUTextureUtils.js index d320c72a2e5957..cde2d7a7eabbfd 100644 --- a/src/renderers/webgpu/utils/WebGPUTextureUtils.js +++ b/src/renderers/webgpu/utils/WebGPUTextureUtils.js @@ -15,7 +15,7 @@ import { RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, UnsignedIntType, UnsignedShortType, UnsignedInt248Type, UnsignedInt5999Type, NeverCompare, AlwaysCompare, LessCompare, LessEqualCompare, EqualCompare, GreaterEqualCompare, GreaterCompare, NotEqualCompare, IntType, RedIntegerFormat, RGIntegerFormat, RGBAIntegerFormat, UnsignedInt101111Type, RGBA_BPTC_Format, RGB_ETC1_Format, RGB_S3TC_DXT1_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, - R11_EAC_Format, R11_SIGNED_EAC_Format, RG11_EAC_Format, RG11_SIGNED_EAC_Format, + R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, } from '../../../constants.js'; import { CubeTexture } from '../../../textures/CubeTexture.js'; import { Texture } from '../../../textures/Texture.js'; @@ -1244,7 +1244,7 @@ export function getFormat( texture, device = null ) { formatGPU = GPUTextureFormat.EACR11Unorm; break; - case R11_SIGNED_EAC_Format: + case SIGNED_R11_EAC_Format: formatGPU = GPUTextureFormat.EACR11Snorm; break; @@ -1252,7 +1252,7 @@ export function getFormat( texture, device = null ) { formatGPU = GPUTextureFormat.EACRG11Unorm; break; - case RG11_SIGNED_EAC_Format: + case SIGNED_RG11_EAC_Format: formatGPU = GPUTextureFormat.EACRG11Snorm; break; From caf76c7d666bfe8caed0adef7655636bf9401987 Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Wed, 19 Nov 2025 21:20:35 -0800 Subject: [PATCH 10/11] Check for the presence of the ETC WebGL extension to use the EAC formats. --- src/renderers/webgl/WebGLUtils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderers/webgl/WebGLUtils.js b/src/renderers/webgl/WebGLUtils.js index d0ae49507e2901..7dc4d9dafad789 100644 --- a/src/renderers/webgl/WebGLUtils.js +++ b/src/renderers/webgl/WebGLUtils.js @@ -1,4 +1,4 @@ -import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat, UnsignedInt101111Type } from '../../constants.js'; +import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RGB_BPTC_SIGNED_Format, RGB_BPTC_UNSIGNED_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, NoColorSpace, SRGBTransfer, UnsignedInt5999Type, RGBFormat, UnsignedInt101111Type } from '../../constants.js'; import { ColorManagement } from '../../math/ColorManagement.js'; function WebGLUtils( gl, extensions ) { @@ -102,7 +102,7 @@ function WebGLUtils( gl, extensions ) { // ETC - if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) { + if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format || p === R11_EAC_Format || p === SIGNED_R11_EAC_Format || p === RG11_EAC_Format || p === SIGNED_RG11_EAC_Format ) { extension = extensions.get( 'WEBGL_compressed_texture_etc' ); @@ -110,6 +110,10 @@ function WebGLUtils( gl, extensions ) { if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2; if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC; + if ( p === R11_EAC_Format ) return extension.COMPRESSED_R11_EAC; + if ( p === SIGNED_R11_EAC_Format ) return extension.COMPRESSED_SIGNED_R11_EAC; + if ( p === RG11_EAC_Format ) return extension.COMPRESSED_RG11_EAC; + if ( p === SIGNED_RG11_EAC_Format ) return extension.COMPRESSED_SIGNED_RG11_EAC; } else { From ebb0d4ddffefd748b09ac0e1f66b92bc5eac49ec Mon Sep 17 00:00:00 2001 From: Ignacio Castano Date: Thu, 20 Nov 2025 10:03:34 -0800 Subject: [PATCH 11/11] Update WebGLUtils.convert in webgl-fallback. --- src/renderers/webgl-fallback/utils/WebGLUtils.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/renderers/webgl-fallback/utils/WebGLUtils.js b/src/renderers/webgl-fallback/utils/WebGLUtils.js index b3c06225c309c4..1cf05bc93de85e 100644 --- a/src/renderers/webgl-fallback/utils/WebGLUtils.js +++ b/src/renderers/webgl-fallback/utils/WebGLUtils.js @@ -1,4 +1,4 @@ -import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, SRGBTransfer, NoColorSpace, UnsignedInt101111Type } from '../../../constants.js'; +import { RGBA_ASTC_4x4_Format, RGBA_ASTC_5x4_Format, RGBA_ASTC_5x5_Format, RGBA_ASTC_6x5_Format, RGBA_ASTC_6x6_Format, RGBA_ASTC_8x5_Format, RGBA_ASTC_8x6_Format, RGBA_ASTC_8x8_Format, RGBA_ASTC_10x5_Format, RGBA_ASTC_10x6_Format, RGBA_ASTC_10x8_Format, RGBA_ASTC_10x10_Format, RGBA_ASTC_12x10_Format, RGBA_ASTC_12x12_Format, RGB_ETC1_Format, RGB_ETC2_Format, RGBA_ETC2_EAC_Format, R11_EAC_Format, SIGNED_R11_EAC_Format, RG11_EAC_Format, SIGNED_RG11_EAC_Format, RGBA_PVRTC_2BPPV1_Format, RGBA_PVRTC_4BPPV1_Format, RGB_PVRTC_2BPPV1_Format, RGB_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT3_Format, RGBA_S3TC_DXT1_Format, RGB_S3TC_DXT1_Format, DepthFormat, DepthStencilFormat, RedFormat, RGBFormat, RGBAFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedInt5999Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, RGBA_BPTC_Format, RED_RGTC1_Format, SIGNED_RED_RGTC1_Format, RED_GREEN_RGTC2_Format, SIGNED_RED_GREEN_RGTC2_Format, SRGBTransfer, NoColorSpace, UnsignedInt101111Type } from '../../../constants.js'; import { ColorManagement } from '../../../math/ColorManagement.js'; /** @@ -154,7 +154,7 @@ class WebGLUtils { // ETC - if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format ) { + if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format || p === RGBA_ETC2_EAC_Format || p === R11_EAC_Format || p === SIGNED_R11_EAC_Format || p === RG11_EAC_Format || p === SIGNED_RG11_EAC_Format ) { extension = extensions.get( 'WEBGL_compressed_texture_etc' ); @@ -162,6 +162,10 @@ class WebGLUtils { if ( p === RGB_ETC1_Format || p === RGB_ETC2_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ETC2 : extension.COMPRESSED_RGB8_ETC2; if ( p === RGBA_ETC2_EAC_Format ) return ( transfer === SRGBTransfer ) ? extension.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC : extension.COMPRESSED_RGBA8_ETC2_EAC; + if ( p === R11_EAC_Format ) return extension.COMPRESSED_R11_EAC; + if ( p === SIGNED_R11_EAC_Format ) return extension.COMPRESSED_SIGNED_R11_EAC; + if ( p === RG11_EAC_Format ) return extension.COMPRESSED_RG11_EAC; + if ( p === SIGNED_RG11_EAC_Format ) return extension.COMPRESSED_SIGNED_RG11_EAC; } else {