Skip to content

Commit c4df2ec

Browse files
lojjicgreggman
authored andcommitted
Add support for BPTC and RGTC compressed texture extensions
1 parent 9239a24 commit c4df2ec

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/texture-utils.js

+20
Original file line numberDiff line numberDiff line change
@@ -269,6 +269,16 @@ const COMPRESSED_SRGB_S3TC_DXT1_EXT = 0x8C4C;
269269
const COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 0x8C4D;
270270
const COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 0x8C4E;
271271
const COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 0x8C4F;
272+
// EXT_texture_compression_bptc
273+
const COMPRESSED_RGBA_BPTC_UNORM_EXT = 0x8E8C;
274+
const COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 0x8E8D;
275+
const COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 0x8E8E;
276+
const COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 0x8E8F;
277+
// EXT_texture_compression_rgtc
278+
const COMPRESSED_RED_RGTC1_EXT = 0x8DBB;
279+
const COMPRESSED_SIGNED_RED_RGTC1_EXT = 0x8DBC;
280+
const COMPRESSED_RED_GREEN_RGTC2_EXT = 0x8DBD;
281+
const COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 0x8DBE;
272282

273283
const compressedTextureFunctions = new Map([
274284
[ COMPRESSED_RGB_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],
@@ -328,6 +338,16 @@ const compressedTextureFunctions = new Map([
328338
[ COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT, makeComputeBlockRectSizeFunction(4, 4, 8) ],
329339
[ COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],
330340
[ COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT, makeComputeBlockRectSizeFunction(4, 4, 16) ],
341+
342+
[ COMPRESSED_RGBA_BPTC_UNORM_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
343+
[ COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
344+
[ COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
345+
[ COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
346+
347+
[ COMPRESSED_RED_RGTC1_EXT, makeComputeBlockRectSizeFunction( 4, 4, 8 ) ],
348+
[ COMPRESSED_SIGNED_RED_RGTC1_EXT, makeComputeBlockRectSizeFunction( 4, 4, 8 ) ],
349+
[ COMPRESSED_RED_GREEN_RGTC2_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
350+
[ COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT, makeComputeBlockRectSizeFunction( 4, 4, 16 ) ],
331351
]);
332352

333353
/**

0 commit comments

Comments
 (0)