yum-mirror/slang

Making it easier to work with shaders

git clone https://git.yummers.dev/yum-mirror/slang

Ellie Hermaszewskaformatf65d756bf

master
2.1 KiB70 linesraw
1#ifndef SLANG_COMPRESSION_SYSTEM_H
2#define SLANG_COMPRESSION_SYSTEM_H
3
4#include "slang-basic.h"
5
6namespace Slang
7{
8
9struct CompressionStyle
10{
11    enum class Type
12    {
13        Level,           ///< Use the value specified in 'level' to control compression
14        BestSpeed,       ///< Best for speed (typically lower compression ration)
15        BestCompression, ///< Best compression (typically slower)
16        Default,         ///< Default compression (a good balance between speed and size)
17    };
18    Type m_type = Type::Default; ///< The type
19    float m_level =
20        1.0f; ///< 0 lowest compression, 1 highest compression (Ignored if m_type != Type::Level)
21};
22
23enum class CompressionSystemType
24{
25    None,
26    Deflate,
27    LZ4,
28    CountOf,
29};
30
31class ICompressionSystem : public ISlangUnknown
32{
33    SLANG_COM_INTERFACE(
34        0xcc935840,
35        0xe059,
36        0x4bb8,
37        {0xa2, 0x2d, 0x92, 0x7b, 0x3c, 0x73, 0x8f, 0x85})
38
39    /** Get the compression system type
40    @return The compression system type */
41    virtual SLANG_NO_THROW CompressionSystemType SLANG_MCALL getSystemType() = 0;
42
43    /** compress
44    @param src Points to the start of the data to compress
45    @param srcSizeInBytes The size of the source data to compress in bytes
46    @param outBlob The input data compressed
47    @return SLANG_OK if successful */
48    virtual SLANG_NO_THROW SlangResult SLANG_MCALL compress(
49        const CompressionStyle* style,
50        const void* src,
51        size_t srcSizeInBytes,
52        ISlangBlob** outBlob) = 0;
53
54    /* decompress
55    @param compressed The start of the compressed data
56    @param compressedSizeInBytes The compressed size in bytes
57    @param decompressedSizeInBytes The size of the decompressed buffer. MUST be exactly the same as
58    the original source size.
59    @param outDecompressed Where decompressed data is written
60    @return SLANG_OK if successful */
61    virtual SLANG_NO_THROW SlangResult SLANG_MCALL decompress(
62        const void* compressed,
63        size_t compressedSizeInBytes,
64        size_t decompressedSizeInBytes,
65        void* outDecompressed) = 0;
66};
67
68} // namespace Slang
69
70#endif