MCPcopy Create free account
hub / github.com/GPUOpen-Tools/compressonator / CompressBlockBC2

Function CompressBlockBC2

cmp_core/shaders/bc2_encode_kernel.cpp:167–201  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

165}
166
167int CMP_CDECL CompressBlockBC2(const unsigned char* srcBlock,
168 unsigned int srcStrideInBytes,
169 CMP_GLOBAL unsigned char cmpBlock[16],
170 CMP_GLOBAL const void* options = NULL)
171{
172 CMP_Vec4uc inBlock[16];
173
174 //----------------------------------
175 // Fill the inBlock with source data
176 //----------------------------------
177 CGU_INT srcpos = 0;
178 CGU_INT dstptr = 0;
179 for (CGU_UINT8 row = 0; row < 4; row++)
180 {
181 srcpos = row * srcStrideInBytes;
182 for (CGU_UINT8 col = 0; col < 4; col++)
183 {
184 inBlock[dstptr].x = CGU_UINT8(srcBlock[srcpos++]);
185 inBlock[dstptr].y = CGU_UINT8(srcBlock[srcpos++]);
186 inBlock[dstptr].z = CGU_UINT8(srcBlock[srcpos++]);
187 inBlock[dstptr].w = CGU_UINT8(srcBlock[srcpos++]);
188 dstptr++;
189 }
190 }
191
192 CMP_BC15Options* BC15options = (CMP_BC15Options*)options;
193 CMP_BC15Options BC15optionsDefault;
194 if (BC15options == NULL)
195 {
196 BC15options = &BC15optionsDefault;
197 SetDefaultBC15Options(BC15options);
198 }
199 CompressBlockBC2_Internal(inBlock, (CMP_GLOBAL CGU_UINT32*)cmpBlock, BC15options);
200 return CGU_CORE_OK;
201}
202
203int CMP_CDECL DecompressBlockBC2(const unsigned char cmpBlock[16], CMP_GLOBAL unsigned char srcBlock[64], const void* options = NULL)
204{

Callers 3

core_tests.cppFile · 0.85
mainFunction · 0.85
mainFunction · 0.85

Calls 2

SetDefaultBC15OptionsFunction · 0.85

Tested by 1

mainFunction · 0.68