#ifndef CPU_FALLBACK_H
#define CPU_FALLBACK_H

#include "utils.h"
#include "vkz_format.h"

// ── CPU Fallback Compression ───────────────────────────────────────
// Used when no Vulkan GPU is available.
// Same algorithm as GPU shader for format compatibility.

// Compress a single block using CPU
// Returns compressed data (caller must free), sets out_size
uint8_t *cpu_compress_block(const uint8_t *input, uint32_t input_size,
                            uint32_t *out_size);

// Decompress a single block using CPU
// Returns decompressed data (caller must free), sets out_size
uint8_t *cpu_decompress_block(const uint8_t *compressed,
                              uint32_t compressed_size, uint32_t original_size,
                              uint32_t *out_size);

// Compress entire file using CPU (multi-block)
int cpu_compress_file(const uint8_t *input_data, uint64_t input_size,
                      uint32_t block_size, uint8_t ***out_blocks,
                      uint32_t **out_block_sizes, uint32_t *out_block_count);

// Decompress entire archive using CPU
int cpu_decompress_file(const VkzArchive *archive, const char *archive_path,
                        uint8_t *output_data, uint64_t output_size);

#endif // CPU_FALLBACK_H
