[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

@@ -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)
;
}