2019-04-04 02:46:41 +02:00
|
|
|
#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 {
|
2022-04-09 21:28:46 +02:00
|
|
|
|
2019-04-04 02:46:41 +02:00
|
|
|
public:
|
|
|
|
|
|
|
|
SpirvCompressedBuffer();
|
|
|
|
|
2022-04-09 21:28:46 +02:00
|
|
|
SpirvCompressedBuffer(SpirvCodeBuffer& code);
|
2019-04-04 02:46:41 +02:00
|
|
|
|
|
|
|
~SpirvCompressedBuffer();
|
|
|
|
|
|
|
|
SpirvCodeBuffer decompress() const;
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
2022-04-09 21:28:46 +02:00
|
|
|
size_t m_size;
|
|
|
|
std::vector<uint32_t> m_code;
|
|
|
|
|
|
|
|
void encodeDword(uint32_t dw);
|
|
|
|
|
|
|
|
uint32_t decodeDword(size_t& offset) const;
|
2019-04-04 02:46:41 +02:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|