Skip to content

Commit 4478a3d

Browse files
authored
Merge pull request #287 from w23/bc7-srgb
Add BC7_SRGB format support
2 parents cab3801 + b912125 commit 4478a3d

File tree

24 files changed

+90
-16
lines changed

24 files changed

+90
-16
lines changed

applications/_plugins/c3dmodel_viewers/gltf_dx12_ex/dx12util/cmp_texturedx12.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,9 @@ DXGI_FORMAT CMP2DXGIFormat(CMP_FORMAT cmp_format) {
524524
case CMP_FORMAT_BC7:
525525
dxgi_format = DXGI_FORMAT_BC7_UNORM;
526526
break;
527+
case CMP_FORMAT_BC7_SRGB:
528+
dxgi_format = DXGI_FORMAT_BC7_UNORM_SRGB;
529+
break;
527530
//uncompressed format
528531
case CMP_FORMAT_ARGB_8888:
529532
case CMP_FORMAT_RGBA_8888:

applications/_plugins/c3dmodel_viewers/vulkan/util/cmp_texturevk.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -355,6 +355,9 @@ VkFormat MIP2VK_Format(MipSet* pMipsTexture) {
355355
case CMP_FORMAT_BC7:
356356
m_VKnum = VK_FORMAT_BC7_UNORM_BLOCK;
357357
break;
358+
case CMP_FORMAT_BC7_SRGB:
359+
m_VKnum = VK_FORMAT_BC7_SRGB_BLOCK;
360+
break;
358361
case CMP_FORMAT_ETC_RGB:
359362
case CMP_FORMAT_ETC2_RGB:
360363
m_VKnum = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;

applications/_plugins/cgpudecode/directx/gpu_directx.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,9 @@ DXGI_FORMAT GPU_DirectX::CMP2DXGIFormat(CMP_FORMAT cmp_format)
614614
case CMP_FORMAT_BC7:
615615
dxgi_format = DXGI_FORMAT_BC7_UNORM;
616616
break;
617+
case CMP_FORMAT_BC7_SRGB:
618+
dxgi_format = DXGI_FORMAT_BC7_UNORM_SRGB;
619+
break;
617620

618621
// Unknown compression mapping to Direct X
619622
#if (OPTION_BUILD_ASTC == 1)

applications/_plugins/cgpudecode/opengl/gpu_opengl.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,9 @@ unsigned int GPU_OpenGL::MIP2OLG_Format(const CMP_Texture* pSourceTexture)
171171
case CMP_FORMAT_BC7:
172172
m_GLnum = GL_COMPRESSED_RGBA_BPTC_UNORM;
173173
break;
174+
case CMP_FORMAT_BC7_SRGB:
175+
m_GLnum = GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM;
176+
break;
174177
case CMP_FORMAT_ETC_RGB:
175178
case CMP_FORMAT_ETC2_RGB:
176179
m_GLnum = GL_COMPRESSED_RGB8_ETC2;

applications/_plugins/cgpudecode/vulkan/gpu_vulkan.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -956,6 +956,9 @@ VkFormat GPU_Vulkan::MIP2VK_Format(const CMP_Texture* pSourceTexture)
956956
case CMP_FORMAT_BC7:
957957
m_VKnum = VK_FORMAT_BC7_UNORM_BLOCK;
958958
break;
959+
case CMP_FORMAT_BC7_SRGB:
960+
m_VKnum = VK_FORMAT_BC7_SRGB_BLOCK;
961+
break;
959962
case CMP_FORMAT_ETC_RGB:
960963
case CMP_FORMAT_ETC2_RGB:
961964
m_VKnum = VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK;

applications/_plugins/cimage/dds/dds_dx10.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,17 @@ TC_PluginError LoadDDS_DX10(FILE* pFile, DDSD2* pDDSD, MipSet* pMipSet)
238238

239239
case DXGI_FORMAT_BC7_TYPELESS:
240240
case DXGI_FORMAT_BC7_UNORM:
241-
case DXGI_FORMAT_BC7_UNORM_SRGB:
242241
pMipSet->m_compressed = true;
243242
pMipSet->m_format = CMP_FORMAT_BC7;
244243
err = LoadDDS_DX10_FourCC(pFile, pDDSD, pMipSet, CMP_FOURCC_DX10);
245244
break;
246245

246+
case DXGI_FORMAT_BC7_UNORM_SRGB:
247+
pMipSet->m_compressed = true;
248+
pMipSet->m_format = CMP_FORMAT_BC7_SRGB;
249+
err = LoadDDS_DX10_FourCC(pFile, pDDSD, pMipSet, CMP_FOURCC_DX10);
250+
break;
251+
247252
// case DXGI_FORMAT_???:
248253
// pMipSet->m_compressed = true;
249254
// pMipSet->m_format = CMP_FORMAT_ASTC;
@@ -393,6 +398,8 @@ DXGI_FORMAT GetDXGIFormat(const MipSet* pMipSet)
393398
return DXGI_FORMAT_BC5_UNORM;
394399
case CMP_FORMAT_BC7:
395400
return DXGI_FORMAT_BC7_UNORM;
401+
case CMP_FORMAT_BC7_SRGB:
402+
return DXGI_FORMAT_BC7_UNORM_SRGB;
396403
// case CMP_FORMAT_ASTC: return DXGI_FORMAT_????; Not yet supported as of Jun 24 2015
397404
}
398405
}
@@ -476,6 +483,7 @@ TC_PluginError SaveDDS_DX10(FILE* pFile, const MipSet* pMipSet)
476483
ddsd2.lPitch = ddsd2.dwWidth * 4;
477484
break;
478485
case CMP_FORMAT_BC7:
486+
case CMP_FORMAT_BC7_SRGB:
479487
default:
480488
ddsd2.lPitch = ddsd2.dwWidth * 4;
481489
break;

applications/_plugins/cimage/ktx/ktx1.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,10 @@ int Plugin_KTX::TC_PluginFileLoadTexture(const char* pszFilename, MipSet* pMipSe
465465
pMipSet->m_format = CMP_FORMAT_BC7;
466466
pMipSet->m_TextureDataType = TDT_ARGB;
467467
break;
468+
case RGB_BP_SRGB:
469+
pMipSet->m_format = CMP_FORMAT_BC7_SRGB;
470+
pMipSet->m_TextureDataType = TDT_ARGB;
471+
break;
468472
case RGB_BP_UNSIGNED_FLOAT:
469473
pMipSet->m_format = CMP_FORMAT_BC6H;
470474
pMipSet->m_TextureDataType = TDT_ARGB;
@@ -1101,6 +1105,7 @@ int Plugin_KTX::TC_PluginFileSaveTexture(const char* pszFilename, MipSet* pMipSe
11011105
case CMP_FORMAT_BC6H:
11021106
case CMP_FORMAT_BC6H_SF:
11031107
case CMP_FORMAT_BC7:
1108+
case CMP_FORMAT_BC7_SRGB:
11041109
case CMP_FORMAT_DXT1:
11051110
case CMP_FORMAT_DXT3:
11061111
case CMP_FORMAT_DXT5:
@@ -1251,6 +1256,9 @@ int Plugin_KTX::TC_PluginFileSaveTexture(const char* pszFilename, MipSet* pMipSe
12511256
case CMP_FORMAT_BC7:
12521257
textureinfo.glInternalFormat = RGB_BP_UNorm;
12531258
break;
1259+
case CMP_FORMAT_BC7_SRGB:
1260+
textureinfo.glInternalFormat = RGB_BP_SRGB;
1261+
break;
12541262
case CMP_FORMAT_ATI1N:
12551263
textureinfo.glInternalFormat = R_ATI1N_UNorm;
12561264
break;

applications/_plugins/cimage/ktx/ktx1.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ enum scanline_copy_method
164164
#define RGB_BP_UNSIGNED_FLOAT 0x8E8F // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB //bc6
165165
#define RGB_BP_SIGNED_FLOAT 0x8E8E // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
166166
#define RGB_BP_UNorm 0x8E8C // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB //bc7
167+
#define RGB_BP_SRGB 0x8E8D // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB //bc7_srgb
167168
#define COMPRESSED_RED_RGTC1 0x8DBB //bc4
168169
#define COMPRESSED_RG_RGTC2 0x8DBD //bc5 ATI2_XY
169170

applications/_plugins/cimage/ktx2/ktx2.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,9 @@ int Plugin_KTX2::TC_PluginFileLoadTexture(const char* pszFilename, MipSet* pMipS
217217
case VK_FORMAT_BC7_UNORM_BLOCK:
218218
pMipSet->m_format = CMP_FORMAT_BC7;
219219
break;
220+
case VK_FORMAT_BC7_SRGB_BLOCK:
221+
pMipSet->m_format = CMP_FORMAT_BC7_SRGB;
222+
break;
220223
case VK_FORMAT_ETC2_R8G8B8_UNORM_BLOCK:
221224
pMipSet->m_format = CMP_FORMAT_ETC2_RGB; // Skip ETC as ETC2 is backward comp
222225
break;
@@ -849,6 +852,10 @@ int Plugin_KTX2::TC_PluginFileSaveTexture(const char* pszFilename, MipSet* pMipS
849852
// RGB_BP_UNorm;
850853
textureCreateInfo.vkFormat = VK_FORMAT_BC7_UNORM_BLOCK;
851854
break;
855+
case CMP_FORMAT_BC7_SRGB:
856+
// RGB_BP_SRGB;
857+
textureCreateInfo.vkFormat = VK_FORMAT_BC7_SRGB_BLOCK;
858+
break;
852859
//case CMP_FORMAT_ATI1N:
853860
// // COMPRESSED_FORMAT_ATI1N_UNorm_TMP;
854861
// textureCreateInfo.vkFormat = VK_FORMAT_BC4_UNORM_BLOCK;

applications/_plugins/cimage/ktx2/ktx2.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ extern void* make_Plugin_KTX2();
9191
#define RGB_BP_UNSIGNED_FLOAT 0x8E8F // GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_ARB //bc6
9292
#define RGB_BP_SIGNED_FLOAT 0x8E8E // GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_ARB
9393
#define RGB_BP_UNorm 0x8E8C // GL_COMPRESSED_RGBA_BPTC_UNORM_ARB //bc7
94+
#define RGB_BP_SRGB 0x8E8D // GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB //bc7_srgb
9495
#define ATC_RGB_AMD 0x8C92
9596
#define ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93
9697
#define ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE

applications/_plugins/cmp_gpu/directx/compute_directx.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1022,6 +1022,7 @@ HRESULT CDirectX::GPU_Encode(ID3D11Buffer** ppDstTextureAsBufOut, int miplevel)
10221022
case DXGI_FORMAT_BC6H_UF16:
10231023
case DXGI_FORMAT_BC6H_SF16:
10241024
case DXGI_FORMAT_BC7_UNORM:
1025+
case DXGI_FORMAT_BC7_UNORM_SRGB:
10251026
default:
10261027
sbOutDesc.StructureByteStride = sizeof(OutCompressedStruct128Bits); // 16 Bytes
10271028
sbOutDesc.ByteWidth = NumOfBlocks * sizeof(OutCompressedStruct128Bits);
@@ -1650,6 +1651,10 @@ CMP_ERROR CDirectX::Compress(KernelOptions* KernelOptions, MipSet& srcTexture, M
16501651
m_fmtEncode = DXGI_FORMAT_BC6H_SF16;
16511652
m_activeEncoder = ACTIVE_ENCODER_BC6;
16521653
break;
1654+
case CMP_FORMAT_BC7_SRGB:
1655+
m_fmtEncode = DXGI_FORMAT_BC7_UNORM_SRGB;
1656+
m_activeEncoder = ACTIVE_ENCODER_BC7;
1657+
break;
16531658
default:
16541659
case CMP_FORMAT_BC7:
16551660
m_fmtEncode = DXGI_FORMAT_BC7_UNORM;

applications/_plugins/common/atiformats.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ CMP_FormatDesc g_FormatDesc[] = {
9797
{CMP_FORMAT_BC6H, "BC6H"},
9898
{CMP_FORMAT_BC6H_SF, "BC6H_SF"},
9999
{CMP_FORMAT_BC7, "BC7"},
100+
{CMP_FORMAT_BC7_SRGB, "BC7_SRGB"},
100101

101102
{CMP_FORMAT_DXT1, "DXT1"},
102103
{CMP_FORMAT_DXT3, "DXT3"},
@@ -322,6 +323,9 @@ void CMP_API CMP_Format2FourCC(CMP_FORMAT format, MipSet* pMipSet)
322323
case CMP_FORMAT_BC7:
323324
pMipSet->m_dwFourCC = CMP_FOURCC_DX10;
324325
break;
326+
case CMP_FORMAT_BC7_SRGB:
327+
pMipSet->m_dwFourCC = CMP_FOURCC_DX10;
328+
break;
325329
#if (OPTION_BUILD_ASTC == 1)
326330
case CMP_FORMAT_ASTC:
327331
pMipSet->m_dwFourCC = CMP_FOURCC_DX10;
@@ -468,6 +472,7 @@ CMP_BOOL CMP_API CMP_IsCompressedFormat(CMP_FORMAT format)
468472
case CMP_FORMAT_BC6H:
469473
case CMP_FORMAT_BC6H_SF:
470474
case CMP_FORMAT_BC7:
475+
case CMP_FORMAT_BC7_SRGB:
471476
case CMP_FORMAT_DXT1:
472477
case CMP_FORMAT_DXT3:
473478
case CMP_FORMAT_DXT5:
@@ -605,6 +610,7 @@ CMP_BOOL CMP_API CMP_IsValidFormat(CMP_FORMAT InFormat)
605610
case CMP_FORMAT_BC6H:
606611
case CMP_FORMAT_BC6H_SF:
607612
case CMP_FORMAT_BC7:
613+
case CMP_FORMAT_BC7_SRGB:
608614
case CMP_FORMAT_ATI1N:
609615
case CMP_FORMAT_ATI2N:
610616
case CMP_FORMAT_ATI2N_XY:
@@ -793,6 +799,8 @@ static CMP_FORMAT GetFormat(CMP_DWORD dwFourCC)
793799
return CMP_FORMAT_BC6H;
794800
case CMP_FOURCC_BC7:
795801
return CMP_FORMAT_BC7;
802+
case CMP_FOURCC_BC7_SRGB:
803+
return CMP_FORMAT_BC7_SRGB;
796804
#if (OPTION_BUILD_ASTC == 1)
797805
case CMP_FOURCC_ASTC:
798806
return CMP_FORMAT_ASTC;
@@ -877,4 +885,4 @@ CMP_FORMAT GetFormat(MipSet* pMipSet)
877885
default:
878886
return CMP_FORMAT_Unknown;
879887
}
880-
}
888+
}

applications/_plugins/common/cmdline.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,8 @@ static inline bool IsFileModel(const std::string& sourceFile)
183183
static inline bool IsFormatBCN(CMP_FORMAT format)
184184
{
185185
return format == CMP_FORMAT_BC1 || format == CMP_FORMAT_BC2 || format == CMP_FORMAT_BC3 || format == CMP_FORMAT_BC4 || format == CMP_FORMAT_BC4_S ||
186-
format == CMP_FORMAT_BC5 || format == CMP_FORMAT_BC5_S || format == CMP_FORMAT_BC6H || format == CMP_FORMAT_BC6H_SF || format == CMP_FORMAT_BC7;
186+
format == CMP_FORMAT_BC5 || format == CMP_FORMAT_BC5_S || format == CMP_FORMAT_BC6H || format == CMP_FORMAT_BC6H_SF || format == CMP_FORMAT_BC7 ||
187+
format == CMP_FORMAT_BC7_SRGB;
187188
}
188189

189190
static inline bool IsProcessingBRLG(const CCmdLineParamaters& params)
@@ -2057,6 +2058,7 @@ bool SVMInitCodec(KernelOptions* options)
20572058
case CMP_FORMAT_BC1:
20582059
case CMP_FORMAT_DXT1:
20592060
case CMP_FORMAT_BC7:
2061+
case CMP_FORMAT_BC7_SRGB:
20602062
#if (OPTION_BUILD_ASTC == 1)
20612063
case CMP_FORMAT_ASTC:
20622064
#endif
@@ -3278,7 +3280,7 @@ int ProcessCMDLine(CMP_Feedback_Proc pFeedbackProc, MipSet* p_userMipSetIn)
32783280
if (destFormat == CMP_FORMAT_BC1 || destFormat == CMP_FORMAT_BC4 || destFormat == CMP_FORMAT_BC4_S)
32793281
bytesPerBlock = 8;
32803282
else if (destFormat == CMP_FORMAT_BC2 || destFormat == CMP_FORMAT_BC3 || destFormat == CMP_FORMAT_BC5 || destFormat == CMP_FORMAT_BC5_S ||
3281-
destFormat == CMP_FORMAT_BC6H || destFormat == CMP_FORMAT_BC6H_SF || destFormat == CMP_FORMAT_BC7)
3283+
destFormat == CMP_FORMAT_BC6H || destFormat == CMP_FORMAT_BC6H_SF || destFormat == CMP_FORMAT_BC7 || destFormat == CMP_FORMAT_BC7_SRGB)
32823284
bytesPerBlock = 16;
32833285

32843286
CMP_DWORD remainingSize = destMipSet.dwDataSize;
@@ -3529,7 +3531,7 @@ int ProcessCMDLine(CMP_Feedback_Proc pFeedbackProc, MipSet* p_userMipSetIn)
35293531
if ((g_CmdPrams.CompressOptions.fquality > 0.00f) && (g_CmdPrams.CompressOptions.fquality < 0.01f))
35303532
{
35313533
// set default max quality for fast processing codecs
3532-
if ((destFormat != CMP_FORMAT_BC7) && (destFormat != CMP_FORMAT_BC6H) && (destFormat != CMP_FORMAT_BC6H_SF))
3534+
if ((destFormat != CMP_FORMAT_BC7_SRGB) && (destFormat != CMP_FORMAT_BC7) && (destFormat != CMP_FORMAT_BC6H) && (destFormat != CMP_FORMAT_BC6H_SF))
35333535
{
35343536
g_CmdPrams.CompressOptions.fquality = 1.0f;
35353537
}

applications/_plugins/common/codec_common.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,8 @@ CodecType GetCodecType(CMP_FORMAT format)
116116
return CT_BC6H_SF;
117117
case CMP_FORMAT_BC7:
118118
return CT_BC7;
119+
case CMP_FORMAT_BC7_SRGB:
120+
return CT_BC7_SRGB;
119121
#if (OPTION_BUILD_ASTC == 1)
120122
case CMP_FORMAT_ASTC:
121123
return CT_ASTC;
@@ -239,6 +241,7 @@ CMP_DWORD CalcBufferSize(CodecType nCodecType, CMP_DWORD dwWidth, CMP_DWORD dwHe
239241

240242
// Block size is 4x4 and 128 bits per block
241243
case CT_BC7:
244+
case CT_BC7_SRGB:
242245
dwWidth = ((dwWidth + 3) / 4) * 4;
243246
dwHeight = ((dwHeight + 3) / 4) * 4;
244247
buffsize = dwWidth * dwHeight;
@@ -296,4 +299,4 @@ CMP_DWORD CalcBufferSize(CodecType nCodecType, CMP_DWORD dwWidth, CMP_DWORD dwHe
296299
}
297300

298301
return buffsize;
299-
}
302+
}

applications/_plugins/common/codec_common.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ typedef enum _CodecType
6363
CT_BC6H,
6464
CT_BC6H_SF,
6565
CT_BC7,
66+
CT_BC7_SRGB,
6667
#if (OPTION_BUILD_ASTC == 1)
6768
CT_ASTC,
6869
#endif
@@ -85,4 +86,4 @@ typedef enum _CODECError
8586
CodecType GetCodecType(CMP_FORMAT format);
8687
CMP_DWORD CalcBufferSize(CodecType nCodecType, CMP_DWORD dwWidth, CMP_DWORD dwHeight, CMP_BYTE nBlockWidth, CMP_BYTE nBlockHeight);
8788

88-
#endif
89+
#endif

applications/_plugins/common/texture.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ extern "C" {
118118

119119
#define CMP_FOURCC_BC6H CMP_MAKEFOURCC('B', 'C', '6', 'H')
120120
#define CMP_FOURCC_BC7 CMP_MAKEFOURCC('B', 'C', '7', 'x')
121+
#define CMP_FOURCC_BC7_SRGB CMP_MAKEFOURCC('B', 'C', '7', 's')
122+
121123
#if (OPTION_BUILD_ASTC == 1)
122124
#define CMP_FOURCC_ASTC CMP_MAKEFOURCC('A', 'S', 'T', 'C')
123125
#endif

applications/_plugins/common/textureio.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -768,6 +768,7 @@ int AMDSaveMIPSTextureImage(const char* DestFile, MipSet* MipSetIn, bool use_OCV
768768
case CMP_FORMAT_ASTC:
769769
#endif
770770
case CMP_FORMAT_BC7:
771+
case CMP_FORMAT_BC7_SRGB:
771772
case CMP_FORMAT_BC6H:
772773
case CMP_FORMAT_BC6H_SF:
773774
case CMP_FORMAT_ETC_RGB:

cmp_compressonatorlib/bc7/codec_bc7.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,8 @@ unsigned int BC7ThreadProcEncode(void* param)
8383
// Construction/Destruction
8484
//////////////////////////////////////////////////////////////////////////////
8585

86-
CCodec_BC7::CCodec_BC7()
87-
: CCodec_DXTC(CT_BC7)
86+
CCodec_BC7::CCodec_BC7(CodecType codecType)
87+
: CCodec_DXTC(codecType) {
8888
{
8989
m_LibraryInitialized = false;
9090

cmp_compressonatorlib/bc7/codec_bc7.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ struct BC7EncodeThreadParam
5858
class CCodec_BC7 : public CCodec_DXTC
5959
{
6060
public:
61-
CCodec_BC7();
61+
CCodec_BC7(CodecType codecType);
6262
~CCodec_BC7();
6363

6464
virtual bool SetParameter(const CMP_CHAR* pszParamName, CMP_CHAR* sValue);

cmp_compressonatorlib/common/codec.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,8 @@ CCodec* CreateCodec(CodecType nCodecType)
234234
case CT_BC6H_SF:
235235
return new CCodec_BC6H(nCodecType);
236236
case CT_BC7:
237-
return new CCodec_BC7;
237+
case CT_BC7_SRGB:
238+
return new CCodec_BC7(nCodecType);
238239
#if (OPTION_BUILD_ASTC == 1)
239240
case CT_ASTC:
240241
return new CCodec_ASTC;

cmp_compressonatorlib/compress.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ static void CMP_PrepareCMPSourceForIMG_Destination(CMP_Texture* destTexture, CMP
164164
#endif
165165
case CMP_FORMAT_BC6H:
166166
case CMP_FORMAT_BC7:
167+
case CMP_FORMAT_BC7_SRGB:
167168
case CMP_FORMAT_GT:
168169
case CMP_FORMAT_ETC_RGB:
169170
case CMP_FORMAT_ETC2_RGB:
@@ -236,6 +237,7 @@ CMP_ERROR CodecCompressTexture(const CMP_Texture* srcTexture, CMP_Texture* destT
236237
switch (destType)
237238
{
238239
case CT_BC7:
240+
case CT_BC7_SRGB:
239241
codec->SetParameter("MultiThreading", (CMP_DWORD)!options->bDisableMultiThreading);
240242

241243
if (!options->bDisableMultiThreading)
@@ -517,6 +519,8 @@ CMP_ERROR CodecCompressTextureThreaded(const CMP_Texture* srcTexture,
517519
// Note function should not be called for the following Codecs....
518520
if (destType == CT_BC7)
519521
return CMP_ABORTED;
522+
if (destType == CT_BC7_SRGB)
523+
return CMP_ABORTED;
520524
#ifdef USE_APC
521525
if (destType == CT_APC)
522526
return CMP_ABORTED;

0 commit comments

Comments
 (0)