1
0
mirror of https://github.com/doitsujin/dxvk.git synced 2024-12-14 09:23:53 +01:00
dxvk/src/spirv/spirv_compression.h
Philip Rebohle 736f743ae4
[spirv] Implement faster in-memory compression for shaders
Seems to be anything up to 3x as fast to decode than the previous code,
with the compression ratio being slightly worse. Encoding seems faster
as well.
2022-04-11 02:55:12 +02:00

38 lines
600 B
C++

#pragma once
#include <vector>
#include "spirv_code_buffer.h"
namespace dxvk {
/**
* \brief Compressed SPIR-V code buffer
*
* Implements a fast in-memory compression
* to keep memory footprint low.
*/
class SpirvCompressedBuffer {
public:
SpirvCompressedBuffer();
SpirvCompressedBuffer(SpirvCodeBuffer& code);
~SpirvCompressedBuffer();
SpirvCodeBuffer decompress() const;
private:
size_t m_size;
std::vector<uint32_t> m_code;
void encodeDword(uint32_t dw);
uint32_t decodeDword(size_t& offset) const;
};
}