Unpacks to RGBA, R, RG, or A
| 1093 | |
| 1094 | // Unpacks to RGBA, R, RG, or A |
| 1095 | bool unpack_block(texture_format fmt, const void* pBlock, color_rgba* pPixels) |
| 1096 | { |
| 1097 | switch (fmt) |
| 1098 | { |
| 1099 | case texture_format::cBC1: |
| 1100 | { |
| 1101 | unpack_bc1(pBlock, pPixels, true); |
| 1102 | break; |
| 1103 | } |
| 1104 | case texture_format::cBC1_NV: |
| 1105 | { |
| 1106 | unpack_bc1_nv(pBlock, pPixels, true); |
| 1107 | break; |
| 1108 | } |
| 1109 | case texture_format::cBC1_AMD: |
| 1110 | { |
| 1111 | unpack_bc1_amd(pBlock, pPixels, true); |
| 1112 | break; |
| 1113 | } |
| 1114 | case texture_format::cBC3: |
| 1115 | { |
| 1116 | return unpack_bc3(pBlock, pPixels); |
| 1117 | } |
| 1118 | case texture_format::cBC4: |
| 1119 | { |
| 1120 | // Unpack to R |
| 1121 | unpack_bc4(pBlock, &pPixels[0].r, sizeof(color_rgba)); |
| 1122 | break; |
| 1123 | } |
| 1124 | case texture_format::cBC5: |
| 1125 | { |
| 1126 | unpack_bc5(pBlock, pPixels); |
| 1127 | break; |
| 1128 | } |
| 1129 | case texture_format::cBC7: |
| 1130 | { |
| 1131 | return unpack_bc7(pBlock, pPixels); |
| 1132 | } |
| 1133 | // Full ETC2 color blocks (planar/T/H modes) is currently unsupported in basisu, but we do support ETC2 with alpha (using ETC1 for color) |
| 1134 | case texture_format::cETC2_RGB: |
| 1135 | case texture_format::cETC1: |
| 1136 | case texture_format::cETC1S: |
| 1137 | { |
| 1138 | return unpack_etc1(*static_cast<const etc_block*>(pBlock), pPixels); |
| 1139 | } |
| 1140 | case texture_format::cETC2_RGBA: |
| 1141 | { |
| 1142 | if (!unpack_etc1(static_cast<const etc_block*>(pBlock)[1], pPixels)) |
| 1143 | return false; |
| 1144 | unpack_etc2_eac(pBlock, pPixels); |
| 1145 | break; |
| 1146 | } |
| 1147 | case texture_format::cETC2_ALPHA: |
| 1148 | { |
| 1149 | // Unpack to A |
| 1150 | unpack_etc2_eac(pBlock, pPixels); |
| 1151 | break; |
| 1152 | } |
no test coverage detected