MCPcopy Create free account
hub / github.com/defold/defold / unpack_bc4

Function unpack_bc4

engine/dlib/src/basis/encoder/basisu_gpu_texture.cpp:336–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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)

Callers 3

unpack_bc3Function · 0.85
unpack_bc5Function · 0.85
unpack_blockFunction · 0.85

Calls 4

get_low_alphaMethod · 0.45
get_high_alphaMethod · 0.45
get_selector_bitsMethod · 0.45
get_selectorMethod · 0.45

Tested by

no test coverage detected