/* Copyright 2026 Edward Li This file is part of Flycast. Flycast is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 2 of the License, or (at your option) any later version. Flycast is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with Flycast. If not, see . */ #pragma once #include "CustomTextureTypes.h" #include #include #include namespace basist { class dds_transcoder; class ktx2_transcoder; } struct TextureInspection { CustomTextureCodec codec = CustomTextureCodec::Xubc7; uint32_t width = 0; uint32_t height = 0; uint32_t levels = 0; uint32_t blockWidth = 1; uint32_t blockHeight = 1; bool hasAlpha = true; }; class TextureTranscoder { public: using CancellationCheck = std::function; TextureTranscoder(); ~TextureTranscoder(); TextureInspection inspect(CustomTextureSourceKind hintedKind, std::vector fileBytes); PreparedCustomTexture::Ptr prepare(NativeTextureFormat target, uint32_t replacementHash, const CancellationCheck& cancelled); private: static void initializeOnce(); std::vector fileBytes; TextureInspection inspection; std::unique_ptr ddsTranscoder; std::unique_ptr ktx2Transcoder; };