Browse Source

CompressedTexture: Add more ASTC formats.

Mugen87 5 years ago
parent
commit
b069f46c51
3 changed files with 35 additions and 2 deletions
  1. 14 0
      src/constants.d.ts
  2. 14 0
      src/constants.js
  3. 7 2
      src/renderers/webgl/WebGLUtils.js

+ 14 - 0
src/constants.d.ts

@@ -270,6 +270,20 @@ export const RGBA_ASTC_10x8_Format: CompressedPixelFormat;
 export const RGBA_ASTC_10x10_Format: CompressedPixelFormat;
 export const RGBA_ASTC_12x10_Format: CompressedPixelFormat;
 export const RGBA_ASTC_12x12_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_4x4_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_5x4_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_5x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_6x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_6x6_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_8x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_8x6_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_8x8_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x5_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x6_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x8_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_10x10_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_12x10_Format: CompressedPixelFormat;
+export const SRGB8_ALPHA8_ASTC_12x12_Format: CompressedPixelFormat;
 
 // Loop styles for AnimationAction
 export enum AnimationActionLoopStyles {}

+ 14 - 0
src/constants.js

@@ -129,6 +129,20 @@ export var RGBA_ASTC_10x8_Format = 37818;
 export var RGBA_ASTC_10x10_Format = 37819;
 export var RGBA_ASTC_12x10_Format = 37820;
 export var RGBA_ASTC_12x12_Format = 37821;
+export var SRGB8_ALPHA8_ASTC_4x4_Format = 37840;
+export var SRGB8_ALPHA8_ASTC_5x4_Format = 37841;
+export var SRGB8_ALPHA8_ASTC_5x5_Format = 37842;
+export var SRGB8_ALPHA8_ASTC_6x5_Format = 37843;
+export var SRGB8_ALPHA8_ASTC_6x6_Format = 37844;
+export var SRGB8_ALPHA8_ASTC_8x5_Format = 37845;
+export var SRGB8_ALPHA8_ASTC_8x6_Format = 37846;
+export var SRGB8_ALPHA8_ASTC_8x8_Format = 37847;
+export var SRGB8_ALPHA8_ASTC_10x5_Format = 37848;
+export var SRGB8_ALPHA8_ASTC_10x6_Format = 37849;
+export var SRGB8_ALPHA8_ASTC_10x8_Format = 37850;
+export var SRGB8_ALPHA8_ASTC_10x10_Format = 37851;
+export var SRGB8_ALPHA8_ASTC_12x10_Format = 37852;
+export var SRGB8_ALPHA8_ASTC_12x12_Format = 37853;
 export var LoopOnce = 2200;
 export var LoopRepeat = 2201;
 export var LoopPingPong = 2202;

+ 7 - 2
src/renderers/webgl/WebGLUtils.js

@@ -2,7 +2,7 @@
  * @author thespite / http://www.twitter.com/thespite
  */
 
-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, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBAFormat, RGBFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort565Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType } 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, 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, LuminanceAlphaFormat, LuminanceFormat, RedFormat, RGBAFormat, RGBFormat, AlphaFormat, RedIntegerFormat, RGFormat, RGIntegerFormat, RGBIntegerFormat, RGBAIntegerFormat, HalfFloatType, FloatType, UnsignedIntType, IntType, UnsignedShortType, ShortType, ByteType, UnsignedInt248Type, UnsignedShort565Type, UnsignedShort5551Type, UnsignedShort4444Type, UnsignedByteType, SRGB8_ALPHA8_ASTC_4x4_Format, SRGB8_ALPHA8_ASTC_5x4_Format, SRGB8_ALPHA8_ASTC_5x5_Format, SRGB8_ALPHA8_ASTC_6x5_Format, SRGB8_ALPHA8_ASTC_6x6_Format, SRGB8_ALPHA8_ASTC_8x5_Format, SRGB8_ALPHA8_ASTC_8x6_Format, SRGB8_ALPHA8_ASTC_8x8_Format, SRGB8_ALPHA8_ASTC_10x5_Format, SRGB8_ALPHA8_ASTC_10x6_Format, SRGB8_ALPHA8_ASTC_10x8_Format, SRGB8_ALPHA8_ASTC_10x10_Format, SRGB8_ALPHA8_ASTC_12x10_Format, SRGB8_ALPHA8_ASTC_12x12_Format } from '../../constants.js';
 
 function WebGLUtils( gl, extensions, capabilities ) {
 
@@ -132,7 +132,12 @@ function WebGLUtils( gl, extensions, capabilities ) {
 			p === RGBA_ASTC_6x5_Format || p === RGBA_ASTC_6x6_Format || p === RGBA_ASTC_8x5_Format ||
 			p === RGBA_ASTC_8x6_Format || p === RGBA_ASTC_8x8_Format || p === RGBA_ASTC_10x5_Format ||
 			p === RGBA_ASTC_10x6_Format || p === RGBA_ASTC_10x8_Format || p === RGBA_ASTC_10x10_Format ||
-			p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ) {
+			p === RGBA_ASTC_12x10_Format || p === RGBA_ASTC_12x12_Format ||
+			p === SRGB8_ALPHA8_ASTC_4x4_Format || p === SRGB8_ALPHA8_ASTC_5x4_Format || p === SRGB8_ALPHA8_ASTC_5x5_Format ||
+			p === SRGB8_ALPHA8_ASTC_6x5_Format || p === SRGB8_ALPHA8_ASTC_6x6_Format || p === SRGB8_ALPHA8_ASTC_8x5_Format ||
+			p === SRGB8_ALPHA8_ASTC_8x6_Format || p === SRGB8_ALPHA8_ASTC_8x8_Format || p === SRGB8_ALPHA8_ASTC_10x5_Format ||
+			p === SRGB8_ALPHA8_ASTC_10x6_Format || p === SRGB8_ALPHA8_ASTC_10x8_Format || p === SRGB8_ALPHA8_ASTC_10x10_Format ||
+			p === SRGB8_ALPHA8_ASTC_12x10_Format || p === SRGB8_ALPHA8_ASTC_12x12_Format ) {
 
 			extension = extensions.get( 'WEBGL_compressed_texture_astc' );