MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / CompressDXT5

Function CompressDXT5

engine/Poseidon/Graphics/Textures/DXTCompressor.cpp:956–976  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

954}
955
956std::vector<uint8_t> CompressDXT5(const uint8_t* rgba, int width, int height)
957{
958 size_t sz = CompressedSize(width, height, false);
959 std::vector<uint8_t> out(sz);
960 int bw = (width + 3) / 4;
961 int bh = (height + 3) / 4;
962 auto* dst = reinterpret_cast<DXTBlock128*>(out.data());
963
964 for (int by = 0; by < bh; ++by)
965 {
966 for (int bx = 0; bx < bw; ++bx)
967 {
968 DWORD pixels[16];
969 extractBlockARGB(rgba, width, height, bx, by, pixels);
970 CompressDXT1Block(dst->color, pixels, true);
971 CompressDXTABlock(dst->alphaImp, pixels);
972 dst++;
973 }
974 }
975 return out;
976}
977
978} // namespace DXTCompressor
979

Callers 3

encodeLevelFunction · 0.85
ConvertPixelsFunction · 0.85

Calls 4

CompressedSizeFunction · 0.85
extractBlockARGBFunction · 0.85
CompressDXT1BlockFunction · 0.85
CompressDXTABlockFunction · 0.85

Tested by

no test coverage detected