#ifndef EMULATOR_INCLUDE_EMULATOR_GRAPHICS_SHADER_RECOMPILER_SHADERRECOMPILER_H_ #define EMULATOR_INCLUDE_EMULATOR_GRAPHICS_SHADER_RECOMPILER_SHADERRECOMPILER_H_ #include "common/common.h" #include "common/stringUtils.h" #include "graphics/shader/recompiler/ir/passes/ResourceMaterialization.h" #include "graphics/shader/recompiler/frontend/decode/ShaderDecoder.h" #include "graphics/shader/shader.h" #include #include #include #include namespace Libs::Graphics::ShaderRecompiler { struct CompileOptions { ShaderType stage = ShaderType::Compute; uint32_t wave_size = 64; uint32_t user_data_base = 0; uint64_t shader_hash = 0; bool dump_ir = true; bool early_dump = false; bool maintenance8_enabled = false; const char* dump_label = nullptr; std::span user_data; std::span back_code; ShaderStageInputInfo input_info; }; struct TranslateResult { IR::Program program; std::string decoded_dump; std::string cfg_dump; }; struct CompileResult { std::vector spirv; std::string decoded_dump; std::string ir_dump; IR::Program program; }; // Decoded source and typed scalar call queries are retained once per cache source. struct ShaderSource { struct Call { uint32_t instruction; std::array target; }; struct Linked { std::vector code; Decoder::Program decoded; std::vector observed_function; }; std::vector code; Decoder::Program decoded; IR::ResourcePlan call_targets; std::optional call; std::optional linked; uint64_t revision = 0; std::vector> reads; }; [[nodiscard]] ShaderSource PrepareShaderSource(std::span code, const CompileOptions& options); const Decoder::Program& RefreshShaderSource(ShaderSource& source, const IR::SrtRuntime& runtime); [[nodiscard]] TranslateResult TranslateProgram(const Decoder::Program& decoded, const CompileOptions& options); [[nodiscard]] TranslateResult TranslateProgram(std::span code, const CompileOptions& options); [[nodiscard]] CompileResult CompileProgram(TranslateResult translated, const CompileOptions& options, const IR::ResourceSpecialization& specialization, uint32_t push_data_start_dword = 0); } // namespace Libs::Graphics::ShaderRecompiler #endif /* EMULATOR_INCLUDE_EMULATOR_GRAPHICS_SHADER_RECOMPILER_SHADERRECOMPILER_H_ */