| 334 | }; |
| 335 | |
| 336 | void unpack_bc4(const void *pBlock_bits, uint8_t *pPixels, uint32_t stride) |
| 337 | { |
| 338 | static_assert(sizeof(bc4_block) == 8, "sizeof(bc4_block) == 8"); |
| 339 | |
| 340 | const bc4_block *pBlock = static_cast<const bc4_block *>(pBlock_bits); |
| 341 | |
| 342 | uint8_t sel_values[8]; |
| 343 | bc4_block::get_block_values(sel_values, pBlock->get_low_alpha(), pBlock->get_high_alpha()); |
| 344 | |
| 345 | const uint64_t selector_bits = pBlock->get_selector_bits(); |
| 346 | |
| 347 | for (uint32_t y = 0; y < 4; y++, pPixels += (stride * 4U)) |
| 348 | { |
| 349 | pPixels[0] = sel_values[pBlock->get_selector(0, y, selector_bits)]; |
| 350 | pPixels[stride * 1] = sel_values[pBlock->get_selector(1, y, selector_bits)]; |
| 351 | pPixels[stride * 2] = sel_values[pBlock->get_selector(2, y, selector_bits)]; |
| 352 | pPixels[stride * 3] = sel_values[pBlock->get_selector(3, y, selector_bits)]; |
| 353 | } |
| 354 | } |
| 355 | |
| 356 | // Returns false if the block uses 3-color punchthrough alpha mode, which isn't supported on some GPU's for BC3. |
| 357 | bool unpack_bc3(const void *pBlock_bits, color_rgba *pPixels) |
no test coverage detected