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

Function TransformEndPoints

cmp_core/shaders/bc6_encode_kernel.cpp:2778–2844  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2776}
2777
2778CGU_BOOL TransformEndPoints(BC6H_Encode_local* BC6H_data,
2779 CGU_INT iEndPoints[MAX_SUBSETS][MAX_END_POINTS][MAX_DIMENSION_BIG],
2780 CGU_INT oEndPoints[MAX_SUBSETS][MAX_END_POINTS][MAX_DIMENSION_BIG],
2781 CGU_INT max_subsets,
2782 CGU_INT mode)
2783{
2784 CGU_INT Mask;
2785 if (ModePartition[mode].transformed)
2786 {
2787 BC6H_data->istransformed = true;
2788 for (CGU_INT i = 0; i < 3; ++i)
2789 {
2790 Mask = MASK(ModePartition[mode].nbits);
2791 oEndPoints[0][0][i] = iEndPoints[0][0][i] & Mask; // [0][A]
2792
2793 Mask = MASK(ModePartition[mode].prec[i]);
2794 oEndPoints[0][1][i] = iEndPoints[0][1][i] - iEndPoints[0][0][i]; // [0][B] - [0][A]
2795
2796 if (isOverflow(oEndPoints[0][1][i], ModePartition[mode].prec[i]))
2797 return false;
2798
2799 oEndPoints[0][1][i] = (oEndPoints[0][1][i] & Mask);
2800
2801 //redo the check for sign overflow for one region case
2802 if (max_subsets <= 1)
2803 {
2804 if (isOverflow(oEndPoints[0][1][i], ModePartition[mode].prec[i]))
2805 return false;
2806 }
2807
2808 if (max_subsets > 1)
2809 {
2810 oEndPoints[1][0][i] = iEndPoints[1][0][i] - iEndPoints[0][0][i]; // [1][A] - [0][A]
2811 if (isOverflow(oEndPoints[1][0][i], ModePartition[mode].prec[i]))
2812 return false;
2813
2814 oEndPoints[1][0][i] = (oEndPoints[1][0][i] & Mask);
2815
2816 oEndPoints[1][1][i] = iEndPoints[1][1][i] - iEndPoints[0][0][i]; // [1][B] - [0][A]
2817 if (isOverflow(oEndPoints[1][1][i], ModePartition[mode].prec[i]))
2818 return false;
2819
2820 oEndPoints[1][1][i] = (oEndPoints[1][1][i] & Mask);
2821 }
2822 }
2823 }
2824 else
2825 {
2826 BC6H_data->istransformed = false;
2827 for (CGU_INT i = 0; i < 3; ++i)
2828 {
2829 Mask = MASK(ModePartition[mode].nbits);
2830 oEndPoints[0][0][i] = iEndPoints[0][0][i] & Mask;
2831
2832 Mask = MASK(ModePartition[mode].prec[i]);
2833 oEndPoints[0][1][i] = iEndPoints[0][1][i] & Mask;
2834
2835 if (max_subsets > 1)

Callers 2

EncodePatternFunction · 0.85
EncodePatternMethod · 0.85

Calls 1

isOverflowFunction · 0.70

Tested by

no test coverage detected