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

Function CompressBlockBC5S

cmp_core/shaders/bc5_encode_kernel.cpp:337–385  ·  view source on GitHub ↗

prototype code

Source from the content-addressed store, hash-verified

335
336// prototype code
337int CMP_CDECL CompressBlockBC5S(const CGU_INT8* srcBlockR,
338 unsigned int srcStrideInBytes1,
339 const CGU_INT8* srcBlockG,
340 unsigned int srcStrideInBytes2,
341 CMP_GLOBAL CGU_UINT8 cmpBlock[16],
342 const void* options = NULL)
343{
344 CGU_INT8 inBlockR[16];
345
346 //----------------------------------
347 // Fill the inBlock with source data
348 //----------------------------------
349 CGU_INT srcpos = 0;
350 CGU_INT dstptr = 0;
351 for (CGU_UINT8 row = 0; row < 4; row++)
352 {
353 srcpos = row * srcStrideInBytes1;
354 for (CGU_UINT8 col = 0; col < 4; col++)
355 {
356 inBlockR[dstptr++] = CGU_INT8(srcBlockR[srcpos++]);
357 }
358 }
359
360 CGU_INT8 inBlockG[16];
361 //----------------------------------
362 // Fill the inBlock with source data
363 //----------------------------------
364 srcpos = 0;
365 dstptr = 0;
366 for (CGU_UINT8 row = 0; row < 4; row++)
367 {
368 srcpos = row * srcStrideInBytes2;
369 for (CGU_UINT8 col = 0; col < 4; col++)
370 {
371 inBlockG[dstptr++] = CGU_INT8(srcBlockG[srcpos++]);
372 }
373 }
374
375 CMP_BC15Options* BC15options = (CMP_BC15Options*)options;
376 CMP_BC15Options BC15optionsDefault;
377 if (BC15options == NULL)
378 {
379 BC15options = &BC15optionsDefault;
380 SetDefaultBC15Options(BC15options);
381 }
382
383 CompressBlockBC5S_DualChannel_Internal(inBlockR, inBlockG, (CMP_GLOBAL CGU_UINT32*)cmpBlock, BC15options);
384 return CGU_CORE_OK;
385}
386
387// prototype code
388int CMP_CDECL DecompressBlockBC5S(const CGU_UINT8 cmpBlock[16],

Callers 2

mainFunction · 0.85
mainFunction · 0.85

Tested by 1

mainFunction · 0.68