Make the block index for the stat function the pointer reinterpreted as an integer. This way we know exactly what block it is because we simply need to sort the stats in the output log.

This commit is contained in:
Pavel Krajcevski 2013-09-28 22:39:27 -04:00
parent baab69dc99
commit 289bcc9d44

View file

@ -1545,13 +1545,13 @@ namespace BC7C {
class BlockLogger { class BlockLogger {
public: public:
BlockLogger(uint32 blockIdx, std::ostream &os) BlockLogger(uint64 blockIdx, std::ostream &os)
: m_BlockIdx(blockIdx), m_Stream(os) { } : m_BlockIdx(blockIdx), m_Stream(os) { }
template<typename T> template<typename T>
friend std::ostream &operator<<(const BlockLogger &bl, const T &v); friend std::ostream &operator<<(const BlockLogger &bl, const T &v);
uint32 m_BlockIdx; uint64 m_BlockIdx;
std::ostream &m_Stream; std::ostream &m_Stream;
}; };
@ -1738,7 +1738,7 @@ namespace BC7C {
const uint32 *pixelBuf = reinterpret_cast<const uint32 *>(inBuf); const uint32 *pixelBuf = reinterpret_cast<const uint32 *>(inBuf);
if(logStream) { if(logStream) {
uint32 blockIdx = (j/4) * (cj.width/4) + (i/4); uint64 blockIdx = reinterpret_cast<uint64>(pixelBuf);
CompressBC7Block(pixelBuf, outBuf, BlockLogger(blockIdx, *logStream)); CompressBC7Block(pixelBuf, outBuf, BlockLogger(blockIdx, *logStream));
} else { } else {
CompressBC7Block(pixelBuf, outBuf); CompressBC7Block(pixelBuf, outBuf);