@@ -46,6 +46,7 @@ void decodeBC3Block_UNORM(uint8* inputData, float* imageRGBA);
4646void decodeBC4Block_UNORM (uint8* blockStorage, float * rOutput);
4747void decodeBC5Block_UNORM (uint8* blockStorage, float * rgOutput);
4848void decodeBC5Block_SNORM (uint8* blockStorage, float * rgOutput);
49+ using decodingFn = void (uint8 *, float *);
4950
5051inline void BC1_GetPixel (uint8* inputData, sint32 x, sint32 y, uint8 rgba[4 ])
5152{
@@ -2171,8 +2172,8 @@ class TextureDecoder_BC4 : public TextureDecoder, public SingletonClass<TextureD
21712172 *(outputPixel + 3 ) = 255 ;
21722173 }
21732174};
2174-
2175- class TextureDecoder_BC5_To_R8G8 : public TextureDecoder , public SingletonClass <TextureDecoder_BC5_To_R8G8>
2175+ template <decodingFn fn>
2176+ class TextureDecoder_BC5_To_R8G8 : public TextureDecoder , public SingletonClass <TextureDecoder_BC5_To_R8G8<fn> >
21762177{
21772178public:
21782179
@@ -2192,7 +2193,7 @@ class TextureDecoder_BC5_To_R8G8 : public TextureDecoder, public SingletonClass<
21922193 sint32 blockSizeY = (std::min)(4 , textureLoader->height - y);
21932194 // decode 4x4 pixels at once
21942195 float rgBlock[4 * 4 * 2 ];
2195- decodeBC5Block_UNORM (blockData, rgBlock);
2196+ fn (blockData, rgBlock);
21962197
21972198 for (sint32 py = 0 ; py < blockSizeY; py++)
21982199 {
0 commit comments