Skip to content

Commit

Permalink
[Fix] Remove PVRT texture formats with sRGB encoding as not supported…
Browse files Browse the repository at this point in the history
… on any platform (#7256)

Co-authored-by: Martin Valigursky <[email protected]>
  • Loading branch information
mvaligursky and Martin Valigursky authored Jan 10, 2025
1 parent d60ba07 commit a7b8ae5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 64 deletions.
44 changes: 4 additions & 40 deletions src/platform/graphics/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -971,38 +971,6 @@ export const PIXELFORMAT_DXT3_SRGBA = 55;
*/
export const PIXELFORMAT_DXT5_SRGBA = 56;

/**
* Format equivalent to {@link PIXELFORMAT_PVRTC_2BPP_RGB_1} but sampled in linear color space.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_PVRTC_2BPP_SRGB_1 = 57;

/**
* Format equivalent to {@link PIXELFORMAT_PVRTC_2BPP_RGBA_1} but sampled in linear color space.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_PVRTC_2BPP_SRGBA_1 = 58;

/**
* Format equivalent to {@link PIXELFORMAT_PVRTC_4BPP_RGB_1} but sampled in linear color space.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_PVRTC_4BPP_SRGB_1 = 59;

/**
* Format equivalent to {@link PIXELFORMAT_PVRTC_4BPP_RGBA_1} but sampled in linear color space.
*
* @type {number}
* @category Graphics
*/
export const PIXELFORMAT_PVRTC_4BPP_SRGBA_1 = 60;

/**
* Format equivalent to {@link PIXELFORMAT_ETC2_RGB} but sampled in linear color space.
*
Expand Down Expand Up @@ -1123,10 +1091,10 @@ export const pixelFormatInfo = new Map([
[PIXELFORMAT_ETC1, { name: 'ETC1', blockSize: 8, ldr: true }],
[PIXELFORMAT_ETC2_RGB, { name: 'ETC2_RGB', blockSize: 8, ldr: true, srgbFormat: PIXELFORMAT_ETC2_SRGB }],
[PIXELFORMAT_ETC2_RGBA, { name: 'ETC2_RGBA', blockSize: 16, ldr: true, srgbFormat: PIXELFORMAT_ETC2_SRGBA }],
[PIXELFORMAT_PVRTC_2BPP_RGB_1, { name: 'PVRTC_2BPP_RGB_1', ldr: true, blockSize: 8, srgbFormat: PIXELFORMAT_PVRTC_2BPP_SRGB_1 }],
[PIXELFORMAT_PVRTC_2BPP_RGBA_1, { name: 'PVRTC_2BPP_RGBA_1', ldr: true, blockSize: 8, srgbFormat: PIXELFORMAT_PVRTC_2BPP_SRGBA_1 }],
[PIXELFORMAT_PVRTC_4BPP_RGB_1, { name: 'PVRTC_4BPP_RGB_1', ldr: true, blockSize: 8, srgbFormat: PIXELFORMAT_PVRTC_4BPP_SRGB_1 }],
[PIXELFORMAT_PVRTC_4BPP_RGBA_1, { name: 'PVRTC_4BPP_RGBA_1', ldr: true, blockSize: 8, srgbFormat: PIXELFORMAT_PVRTC_4BPP_SRGBA_1 }],
[PIXELFORMAT_PVRTC_2BPP_RGB_1, { name: 'PVRTC_2BPP_RGB_1', ldr: true, blockSize: 8 }],
[PIXELFORMAT_PVRTC_2BPP_RGBA_1, { name: 'PVRTC_2BPP_RGBA_1', ldr: true, blockSize: 8 }],
[PIXELFORMAT_PVRTC_4BPP_RGB_1, { name: 'PVRTC_4BPP_RGB_1', ldr: true, blockSize: 8 }],
[PIXELFORMAT_PVRTC_4BPP_RGBA_1, { name: 'PVRTC_4BPP_RGBA_1', ldr: true, blockSize: 8 }],
[PIXELFORMAT_ASTC_4x4, { name: 'ASTC_4x4', blockSize: 16, ldr: true, srgbFormat: PIXELFORMAT_ASTC_4x4_SRGB }],
[PIXELFORMAT_ATC_RGB, { name: 'ATC_RGB', blockSize: 8, ldr: true }],
[PIXELFORMAT_ATC_RGBA, { name: 'ATC_RGBA', blockSize: 16, ldr: true }],
Expand All @@ -1138,10 +1106,6 @@ export const pixelFormatInfo = new Map([
[PIXELFORMAT_DXT1_SRGB, { name: 'DXT1_SRGB', blockSize: 8, ldr: true, srgb: true }],
[PIXELFORMAT_DXT3_SRGBA, { name: 'DXT3_SRGBA', blockSize: 16, ldr: true, srgb: true }],
[PIXELFORMAT_DXT5_SRGBA, { name: 'DXT5_SRGBA', blockSize: 16, ldr: true, srgb: true }],
[PIXELFORMAT_PVRTC_2BPP_SRGB_1, { name: 'PVRTC_2BPP_SRGB_1', blockSize: 8, ldr: true, srgb: true }],
[PIXELFORMAT_PVRTC_2BPP_SRGBA_1, { name: 'PVRTC_2BPP_SRGBA_1', blockSize: 8, ldr: true, srgb: true }],
[PIXELFORMAT_PVRTC_4BPP_SRGB_1, { name: 'PVRTC_4BPP_SRGB_1', blockSize: 8, ldr: true, srgb: true }],
[PIXELFORMAT_PVRTC_4BPP_SRGBA_1, { name: 'PVRTC_4BPP_SRGBA_1', blockSize: 8, ldr: true, srgb: true }],
[PIXELFORMAT_ETC2_SRGB, { name: 'ETC2_SRGB', blockSize: 8, ldr: true, srgb: true }],
[PIXELFORMAT_ETC2_SRGBA, { name: 'ETC2_SRGBA', blockSize: 16, ldr: true, srgb: true }],
[PIXELFORMAT_ASTC_4x4_SRGB, { name: 'ASTC_4x4_SRGB', blockSize: 16, ldr: true, srgb: true }],
Expand Down
19 changes: 1 addition & 18 deletions src/platform/graphics/webgl/webgl-texture.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import {
PIXELFORMAT_R32I, PIXELFORMAT_R32U, PIXELFORMAT_RG16I, PIXELFORMAT_RG16U, PIXELFORMAT_RG32I, PIXELFORMAT_RG32U,
PIXELFORMAT_RG8I, PIXELFORMAT_RG8U, PIXELFORMAT_RGBA16I, PIXELFORMAT_RGBA16U, PIXELFORMAT_RGBA32I, PIXELFORMAT_RGBA32U,
PIXELFORMAT_RGBA8I, PIXELFORMAT_RGBA8U, PIXELFORMAT_R16F, PIXELFORMAT_RG16F, PIXELFORMAT_R8, PIXELFORMAT_RG8,
PIXELFORMAT_DXT1_SRGB, PIXELFORMAT_DXT3_SRGBA, PIXELFORMAT_DXT5_SRGBA, PIXELFORMAT_PVRTC_2BPP_SRGB_1,
PIXELFORMAT_PVRTC_2BPP_SRGBA_1, PIXELFORMAT_PVRTC_4BPP_SRGB_1, PIXELFORMAT_PVRTC_4BPP_SRGBA_1,
PIXELFORMAT_DXT1_SRGB, PIXELFORMAT_DXT3_SRGBA, PIXELFORMAT_DXT5_SRGBA,
PIXELFORMAT_ETC2_SRGB, PIXELFORMAT_ETC2_SRGBA, PIXELFORMAT_ASTC_4x4_SRGB, PIXELFORMAT_SBGRA8,
PIXELFORMAT_BC6F, PIXELFORMAT_BC6UF, PIXELFORMAT_BC7, PIXELFORMAT_BC7_SRGBA,
PIXELFORMAT_DEPTH16
Expand Down Expand Up @@ -252,22 +251,6 @@ class WebglTexture {
this._glFormat = gl.SRGB_ALPHA;
this._glInternalFormat = device.extCompressedTextureS3TC_SRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT;
break;
case PIXELFORMAT_PVRTC_2BPP_SRGB_1:
this._glFormat = gl.SRGB;
this._glInternalFormat = device.extCompressedTexturePVRTC.COMPRESSED_SRGB_PVRTC_2BPPV1_EXT;
break;
case PIXELFORMAT_PVRTC_2BPP_SRGBA_1:
this._glFormat = gl.SRGB_ALPHA;
this._glInternalFormat = device.extCompressedTexturePVRTC.COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT;
break;
case PIXELFORMAT_PVRTC_4BPP_SRGB_1:
this._glFormat = gl.SRGB;
this._glInternalFormat = device.extCompressedTexturePVRTC.COMPRESSED_SRGB_PVRTC_4BPPV1_EXT;
break;
case PIXELFORMAT_PVRTC_4BPP_SRGBA_1:
this._glFormat = gl.SRGB_ALPHA;
this._glInternalFormat = device.extCompressedTexturePVRTC.COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT;
break;
case PIXELFORMAT_ETC2_SRGB:
this._glFormat = gl.RGB;
this._glInternalFormat = device.extCompressedTextureETC.COMPRESSED_RGB8_ETC2;
Expand Down
7 changes: 1 addition & 6 deletions src/platform/graphics/webgpu/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@ import {
PIXELFORMAT_R32I, PIXELFORMAT_R32U, PIXELFORMAT_RG16I, PIXELFORMAT_RG16U, PIXELFORMAT_RG32I, PIXELFORMAT_RG32U,
PIXELFORMAT_RG8I, PIXELFORMAT_RG8U, PIXELFORMAT_RGBA16I, PIXELFORMAT_RGBA16U, PIXELFORMAT_RGBA32I, PIXELFORMAT_RGBA32U,
PIXELFORMAT_RGBA8I, PIXELFORMAT_RGBA8U, PIXELFORMAT_R16F, PIXELFORMAT_RG16F, PIXELFORMAT_R8, PIXELFORMAT_RG8,
PIXELFORMAT_DXT1_SRGB, PIXELFORMAT_DXT3_SRGBA, PIXELFORMAT_DXT5_SRGBA, PIXELFORMAT_PVRTC_2BPP_SRGB_1,
PIXELFORMAT_PVRTC_2BPP_SRGBA_1, PIXELFORMAT_PVRTC_4BPP_SRGB_1, PIXELFORMAT_PVRTC_4BPP_SRGBA_1,
PIXELFORMAT_DXT1_SRGB, PIXELFORMAT_DXT3_SRGBA, PIXELFORMAT_DXT5_SRGBA,
PIXELFORMAT_ETC2_SRGB, PIXELFORMAT_ETC2_SRGBA, PIXELFORMAT_SBGRA8,
PIXELFORMAT_BC6F, PIXELFORMAT_BC6UF, PIXELFORMAT_BC7, PIXELFORMAT_BC7_SRGBA,
PIXELFORMAT_ASTC_4x4_SRGB,
Expand Down Expand Up @@ -83,10 +82,6 @@ gpuTextureFormats[PIXELFORMAT_BC7] = 'bc7-rgba-unorm';
gpuTextureFormats[PIXELFORMAT_DXT1_SRGB] = 'bc1-rgba-unorm-srgb';
gpuTextureFormats[PIXELFORMAT_DXT3_SRGBA] = 'bc2-rgba-unorm-srgb';
gpuTextureFormats[PIXELFORMAT_DXT5_SRGBA] = 'bc3-rgba-unorm-srgb';
gpuTextureFormats[PIXELFORMAT_PVRTC_2BPP_SRGB_1] = '';
gpuTextureFormats[PIXELFORMAT_PVRTC_2BPP_SRGBA_1] = '';
gpuTextureFormats[PIXELFORMAT_PVRTC_4BPP_SRGB_1] = '';
gpuTextureFormats[PIXELFORMAT_PVRTC_4BPP_SRGBA_1] = '';
gpuTextureFormats[PIXELFORMAT_ETC2_SRGB] = 'etc2-rgb8unorm-srgb';
gpuTextureFormats[PIXELFORMAT_ETC2_SRGBA] = 'etc2-rgba8unorm-srgb';
gpuTextureFormats[PIXELFORMAT_BC7_SRGBA] = 'bc7-rgba-unorm-srgb';
Expand Down

0 comments on commit a7b8ae5

Please sign in to comment.