[engine] [cocos2d-x] [jsb-adapter] 适配引擎 v2.4.12 版本

This commit is contained in:
SmallMain
2023-10-30 22:32:32 +08:00
parent 2508616ad9
commit 0092eb9f05
787 changed files with 206249 additions and 422 deletions

View File

@@ -244,6 +244,38 @@ export enum GFXFormat {
PVRTC_RGBA4,
PVRTC2_2BPP,
PVRTC2_4BPP,
// ASTC (Adaptive Scalable Texture Compression)
ASTC_RGBA_4x4,
ASTC_RGBA_5x4,
ASTC_RGBA_5x5,
ASTC_RGBA_6x5,
ASTC_RGBA_6x6,
ASTC_RGBA_8x5,
ASTC_RGBA_8x6,
ASTC_RGBA_8x8,
ASTC_RGBA_10x5,
ASTC_RGBA_10x6,
ASTC_RGBA_10x8,
ASTC_RGBA_10x10,
ASTC_RGBA_12x10,
ASTC_RGBA_12x12,
// ASTC (Adaptive Scalable Texture Compression) SRGB
ASTC_SRGBA_4x4,
ASTC_SRGBA_5x4,
ASTC_SRGBA_5x5,
ASTC_SRGBA_6x5,
ASTC_SRGBA_6x6,
ASTC_SRGBA_8x5,
ASTC_SRGBA_8x6,
ASTC_SRGBA_8x8,
ASTC_SRGBA_10x5,
ASTC_SRGBA_10x6,
ASTC_SRGBA_10x8,
ASTC_SRGBA_10x10,
ASTC_SRGBA_12x10,
ASTC_SRGBA_12x12,
}
export enum GFXBufferUsageBit {
@@ -692,6 +724,36 @@ export const GFXFormatInfos: IGFXFormatInfo[] = [
{ name: 'PVRTC_RGBA4', size: 2, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'PVRTC2_2BPP', size: 2, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'PVRTC2_4BPP', size: 2, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_4x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_5x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_5x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_6x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_6x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_8x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_8x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_8x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_10x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_10x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_10x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_10x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_12x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_RGBA_12x12', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_4x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_5x4', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_5x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_6x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_6x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_8x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_8x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_8x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_10x5', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_10x6', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_10x8', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_10x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_12x10', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
{ name: 'ASTC_SRGBA_12x12', size: 1, count: 4, isFloating: false, hasAlpha: true, hasDepth: false, hasStencil: false, isCompressed: true },
];
// tslint:enable: max-line-length
@@ -742,6 +804,49 @@ export function GFXFormatSize (format: GFXFormat, width: number, height: number,
case GFXFormat.PVRTC2_4BPP:
return Math.ceil(Math.max(width, 16) * Math.max(height, 8) / 2) * depth;
case GFXFormat.ASTC_RGBA_4x4:
case GFXFormat.ASTC_SRGBA_4x4:
return Math.ceil(width / 4) * Math.ceil(height / 4) * 16 * depth;
case GFXFormat.ASTC_RGBA_5x4:
case GFXFormat.ASTC_SRGBA_5x4:
return Math.ceil(width / 5) * Math.ceil(height / 4) * 16 * depth;
case GFXFormat.ASTC_RGBA_5x5:
case GFXFormat.ASTC_SRGBA_5x5:
return Math.ceil(width / 5) * Math.ceil(height / 5) * 16 * depth;
case GFXFormat.ASTC_RGBA_6x5:
case GFXFormat.ASTC_SRGBA_6x5:
return Math.ceil(width / 6) * Math.ceil(height / 5) * 16 * depth;
case GFXFormat.ASTC_RGBA_6x6:
case GFXFormat.ASTC_SRGBA_6x6:
return Math.ceil(width / 6) * Math.ceil(height / 6) * 16 * depth;
case GFXFormat.ASTC_RGBA_8x5:
case GFXFormat.ASTC_SRGBA_8x5:
return Math.ceil(width / 8) * Math.ceil(height / 5) * 16 * depth;
case GFXFormat.ASTC_RGBA_8x6:
case GFXFormat.ASTC_SRGBA_8x6:
return Math.ceil(width / 8) * Math.ceil(height / 6) * 16 * depth;
case GFXFormat.ASTC_RGBA_8x8:
case GFXFormat.ASTC_SRGBA_8x8:
return Math.ceil(width / 8) * Math.ceil(height / 8) * 16 * depth;
case GFXFormat.ASTC_RGBA_10x5:
case GFXFormat.ASTC_SRGBA_10x5:
return Math.ceil(width / 10) * Math.ceil(height / 5) * 16 * depth;
case GFXFormat.ASTC_RGBA_10x6:
case GFXFormat.ASTC_SRGBA_10x6:
return Math.ceil(width / 10) * Math.ceil(height / 6) * 16 * depth;
case GFXFormat.ASTC_RGBA_10x8:
case GFXFormat.ASTC_SRGBA_10x8:
return Math.ceil(width / 10) * Math.ceil(height / 8) * 16 * depth;
case GFXFormat.ASTC_RGBA_10x10:
case GFXFormat.ASTC_SRGBA_10x10:
return Math.ceil(width / 10) * Math.ceil(height / 10) * 16 * depth;
case GFXFormat.ASTC_RGBA_12x10:
case GFXFormat.ASTC_SRGBA_12x10:
return Math.ceil(width / 12) * Math.ceil(height / 10) * 16 * depth;
case GFXFormat.ASTC_RGBA_12x12:
case GFXFormat.ASTC_SRGBA_12x12:
return Math.ceil(width / 12) * Math.ceil(height / 12) * 16 * depth;
default: {
return 0;
}

View File

@@ -91,6 +91,38 @@ const enums = {
TEXTURE_FMT_RGB_ETC2: 28,
TEXTURE_FMT_RGBA_ETC2: 29,
// astc format (Adaptive Scalable Texture Compression)
TEXTURE_FMT_RGBA_ASTC_4X4: 30,
TEXTURE_FMT_RGBA_ASTC_5X4: 31,
TEXTURE_FMT_RGBA_ASTC_5X5: 32,
TEXTURE_FMT_RGBA_ASTC_6X5: 33,
TEXTURE_FMT_RGBA_ASTC_6X6: 34,
TEXTURE_FMT_RGBA_ASTC_8X5: 35,
TEXTURE_FMT_RGBA_ASTC_8X6: 36,
TEXTURE_FMT_RGBA_ASTC_8X8: 37,
TEXTURE_FMT_RGBA_ASTC_10X5: 38,
TEXTURE_FMT_RGBA_ASTC_10X6: 39,
TEXTURE_FMT_RGBA_ASTC_10X8: 40,
TEXTURE_FMT_RGBA_ASTC_10X10: 41,
TEXTURE_FMT_RGBA_ASTC_12X10: 42,
TEXTURE_FMT_RGBA_ASTC_12X12: 43,
// astc format (Adaptive Scalable Texture Compression) SRGB
TEXTURE_FMT_SRGBA_ASTC_4X4: 44,
TEXTURE_FMT_SRGBA_ASTC_5X4: 45,
TEXTURE_FMT_SRGBA_ASTC_5X5: 46,
TEXTURE_FMT_SRGBA_ASTC_6X5: 47,
TEXTURE_FMT_SRGBA_ASTC_6X6: 48,
TEXTURE_FMT_SRGBA_ASTC_8X5: 49,
TEXTURE_FMT_SRGBA_ASTC_8X6: 50,
TEXTURE_FMT_SRGBA_ASTC_8X8: 51,
TEXTURE_FMT_SRGBA_ASTC_10X5: 52,
TEXTURE_FMT_SRGBA_ASTC_10X6: 53,
TEXTURE_FMT_SRGBA_ASTC_10X8: 54,
TEXTURE_FMT_SRGBA_ASTC_10X10: 55,
TEXTURE_FMT_SRGBA_ASTC_12X10: 56,
TEXTURE_FMT_SRGBA_ASTC_12X12: 57,
// depth and stencil function
DS_FUNC_NEVER: 512, // gl.NEVER
DS_FUNC_LESS: 513, // gl.LESS
@@ -449,6 +481,38 @@ var GFXFormat;
GFXFormat[GFXFormat["PVRTC_RGBA4"] = 89] = "PVRTC_RGBA4";
GFXFormat[GFXFormat["PVRTC2_2BPP"] = 90] = "PVRTC2_2BPP";
GFXFormat[GFXFormat["PVRTC2_4BPP"] = 91] = "PVRTC2_4BPP";
// ASTC (Adaptive Scalable Texture Compression)
GFXFormat[GFXFormat["ASTC_RGBA_4x4"] = 92] = "ASTC_RGBA_4x4";
GFXFormat[GFXFormat["ASTC_RGBA_5x4"] = 92] = "ASTC_RGBA_5x4";
GFXFormat[GFXFormat["ASTC_RGBA_5x5"] = 92] = "ASTC_RGBA_5x5";
GFXFormat[GFXFormat["ASTC_RGBA_6x5"] = 92] = "ASTC_RGBA_6x5";
GFXFormat[GFXFormat["ASTC_RGBA_6x6"] = 92] = "ASTC_RGBA_6x6";
GFXFormat[GFXFormat["ASTC_RGBA_8x5"] = 92] = "ASTC_RGBA_8x5";
GFXFormat[GFXFormat["ASTC_RGBA_8x6"] = 92] = "ASTC_RGBA_8x6";
GFXFormat[GFXFormat["ASTC_RGBA_8x8"] = 92] = "ASTC_RGBA_8x8";
GFXFormat[GFXFormat["ASTC_RGBA_10x5"] = 92] = "ASTC_RGBA_10x5";
GFXFormat[GFXFormat["ASTC_RGBA_10x6"] = 92] = "ASTC_RGBA_10x6";
GFXFormat[GFXFormat["ASTC_RGBA_10x8"] = 92] = "ASTC_RGBA_10x8";
GFXFormat[GFXFormat["ASTC_RGBA_10x10"] = 92] = "ASTC_RGBA_10x10";
GFXFormat[GFXFormat["ASTC_RGBA_12x10"] = 92] = "ASTC_RGBA_12x10";
GFXFormat[GFXFormat["ASTC_RGBA_12x12"] = 92] = "ASTC_RGBA_12x12";
// ASTC (Adaptive Scalable Texture Compression) SRGB
GFXFormat[GFXFormat["ASTC_SRGBA_4x4"] = 92] = "ASTC_SRGBA_4x4";
GFXFormat[GFXFormat["ASTC_SRGBA_5x4"] = 92] = "ASTC_SRGBA_5x4";
GFXFormat[GFXFormat["ASTC_SRGBA_5x5"] = 92] = "ASTC_SRGBA_5x5";
GFXFormat[GFXFormat["ASTC_SRGBA_6x5"] = 92] = "ASTC_SRGBA_6x5";
GFXFormat[GFXFormat["ASTC_SRGBA_6x6"] = 92] = "ASTC_SRGBA_6x6";
GFXFormat[GFXFormat["ASTC_SRGBA_8x5"] = 92] = "ASTC_SRGBA_8x5";
GFXFormat[GFXFormat["ASTC_SRGBA_8x6"] = 92] = "ASTC_SRGBA_8x6";
GFXFormat[GFXFormat["ASTC_SRGBA_8x8"] = 92] = "ASTC_SRGBA_8x8";
GFXFormat[GFXFormat["ASTC_SRGBA_10x5"] = 92] = "ASTC_SRGBA_10x5";
GFXFormat[GFXFormat["ASTC_SRGBA_10x6"] = 92] = "ASTC_SRGBA_10x6";
GFXFormat[GFXFormat["ASTC_SRGBA_10x8"] = 92] = "ASTC_SRGBA_10x8";
GFXFormat[GFXFormat["ASTC_SRGBA_10x10"] = 92] = "ASTC_SRGBA_10x10";
GFXFormat[GFXFormat["ASTC_SRGBA_12x10"] = 92] = "ASTC_SRGBA_12x10";
GFXFormat[GFXFormat["ASTC_SRGBA_12x12"] = 92] = "ASTC_SRGBA_12x12";
})(GFXFormat || (GFXFormat = {}));
var GFXBufferUsageBit;
(function (GFXBufferUsageBit) {

View File

@@ -637,7 +637,7 @@ export default class Device {
'OES_texture_half_float',
'OES_texture_half_float_linear',
'OES_vertex_array_object',
'WEBGL_compressed_texture_atc',
'WEBGL_compressed_texture_astc',
'WEBGL_compressed_texture_etc',
'WEBGL_compressed_texture_etc1',
'WEBGL_compressed_texture_pvrtc',

View File

@@ -39,6 +39,36 @@ const GL_COMPRESSED_RGB_ETC1_WEBGL = 0x8D64; // ext.COMPRESSED_RGB_ETC1_WEBGL
const GL_COMPRESSED_RGB8_ETC2 = 0x9274; // ext.COMPRESSED_RGB8_ETC2
const GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278; // ext.COMPRESSED_RGBA8_ETC2_EAC
const GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0;
const GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1;
const GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2;
const GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3;
const GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4;
const GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5;
const GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6;
const GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7;
const GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8;
const GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9;
const GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA;
const GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB;
const GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC;
const GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC;
const GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD;
const _filterGL = [
[ GL_NEAREST, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR ],
[ GL_LINEAR, GL_LINEAR_MIPMAP_NEAREST, GL_LINEAR_MIPMAP_LINEAR ],
@@ -134,6 +164,91 @@ const _textureFmtGL = [
// TEXTURE_FMT_RGBA_ETC2: 29
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA8_ETC2_EAC, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_4X4: 30
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_4x4_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_5X4: 31
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_5x4_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_5X5: 32
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_5x5_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_6X5: 33
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_6x5_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_6X6: 34
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_6x6_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_8X5: 35
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x5_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_8X6: 36
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x6_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_8X8: 37
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_8x8_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_10X5: 38
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x5_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_10X6: 39
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x6_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_10X8: 40
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x8_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_10X10: 41
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_10x10_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_12X10: 42
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_12x10_KHR, pixelType: null },
// TEXTURE_FMT_RGBA_ASTC_12X12: 43
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_RGBA_ASTC_12x12_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_4X4: 44
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_5X4: 45
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_5X5: 46
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_6X5: 47
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_6X6: 48
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_8X5: 49
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_8X6: 50
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_8X8: 51
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_10X5: 52
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_10X6: 53
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_10X8: 54
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_10X10: 55
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_12X10: 56
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR, pixelType: null },
// TEXTURE_FMT_SRGBA_ASTC_12X12: 57
{ format: GL_RGBA, internalFormat: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR, pixelType: null },
];
/**
@@ -238,6 +353,38 @@ export const enums = {
TEXTURE_FMT_RGB_ETC2: 28,
TEXTURE_FMT_RGBA_ETC2: 29,
// astc format (Adaptive Scalable Texture Compression)
TEXTURE_FMT_RGBA_ASTC_4X4: 30,
TEXTURE_FMT_RGBA_ASTC_5X4: 31,
TEXTURE_FMT_RGBA_ASTC_5X5: 32,
TEXTURE_FMT_RGBA_ASTC_6X5: 33,
TEXTURE_FMT_RGBA_ASTC_6X6: 34,
TEXTURE_FMT_RGBA_ASTC_8X5: 35,
TEXTURE_FMT_RGBA_ASTC_8X6: 36,
TEXTURE_FMT_RGBA_ASTC_8X8: 37,
TEXTURE_FMT_RGBA_ASTC_10X5: 38,
TEXTURE_FMT_RGBA_ASTC_10X6: 39,
TEXTURE_FMT_RGBA_ASTC_10X8: 40,
TEXTURE_FMT_RGBA_ASTC_10X10: 41,
TEXTURE_FMT_RGBA_ASTC_12X10: 42,
TEXTURE_FMT_RGBA_ASTC_12X12: 43,
// astc format (Adaptive Scalable Texture Compression) SRGB
TEXTURE_FMT_SRGBA_ASTC_4X4: 44,
TEXTURE_FMT_SRGBA_ASTC_5X4: 45,
TEXTURE_FMT_SRGBA_ASTC_5X5: 46,
TEXTURE_FMT_SRGBA_ASTC_6X5: 47,
TEXTURE_FMT_SRGBA_ASTC_6X6: 48,
TEXTURE_FMT_SRGBA_ASTC_8X5: 49,
TEXTURE_FMT_SRGBA_ASTC_8X6: 50,
TEXTURE_FMT_SRGBA_ASTC_8X8: 51,
TEXTURE_FMT_SRGBA_ASTC_10X5: 52,
TEXTURE_FMT_SRGBA_ASTC_10X6: 53,
TEXTURE_FMT_SRGBA_ASTC_10X8: 54,
TEXTURE_FMT_SRGBA_ASTC_10X10: 55,
TEXTURE_FMT_SRGBA_ASTC_12X10: 56,
TEXTURE_FMT_SRGBA_ASTC_12X12: 57,
// depth and stencil function
DS_FUNC_NEVER: 512, // gl.NEVER
DS_FUNC_LESS: 513, // gl.LESS

View File

@@ -65,8 +65,8 @@ export default class Texture2D extends Texture {
this._format = options.format;
this._compressed =
(this._format >= enums.TEXTURE_FMT_RGB_DXT1 && this._format <= enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1) ||
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2)
;
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2) ||
(this._format >= enums.TEXTURE_FMT_RGBA_ASTC_4X4 && this._format <= enums.TEXTURE_FMT_SRGBA_ASTC_12X12);
}
// check if generate mipmap

View File

@@ -85,7 +85,8 @@ export default class TextureCube extends Texture {
this._format = options.format;
this._compressed =
(this._format >= enums.TEXTURE_FMT_RGB_DXT1 && this._format <= enums.TEXTURE_FMT_RGBA_PVRTC_4BPPV1) ||
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2)
(this._format >= enums.TEXTURE_FMT_RGB_ETC2 && this._format <= enums.TEXTURE_FMT_RGBA_ETC2) ||
(this._format >= enums.TEXTURE_FMT_RGBA_ASTC_4X4 && this._format <= enums.TEXTURE_FMT_SRGBA_ASTC_12X12)
;
}