#pragma once #include "ShaderTypes.h" #include #include class ShaderCompiler { public: ShaderCompiler( const std::filesystem::path& repoRoot, const std::filesystem::path& wrapperPath, const std::filesystem::path& generatedGlslPath, const std::filesystem::path& patchedGlslPath, unsigned maxTemporalHistoryFrames); bool BuildPassFragmentShaderSource(const ShaderPackage& shaderPackage, const ShaderPassDefinition& pass, std::string& fragmentShaderSource, std::string& error) const; private: bool BuildWrapperSlangSource(const ShaderPackage& shaderPackage, const ShaderPassDefinition& pass, std::string& wrapperSource, std::string& error) const; bool FindSlangCompiler(std::filesystem::path& compilerPath, std::string& error) const; bool RunSlangCompiler(const std::filesystem::path& wrapperPath, const std::filesystem::path& outputPath, std::string& error) const; bool PatchGeneratedGlsl(std::string& shaderText, std::string& error) const; std::string ReadTextFile(const std::filesystem::path& path, std::string& error) const; bool WriteTextFile(const std::filesystem::path& path, const std::string& contents, std::string& error) const; private: std::filesystem::path mRepoRoot; std::filesystem::path mWrapperPath; std::filesystem::path mGeneratedGlslPath; std::filesystem::path mPatchedGlslPath; unsigned mMaxTemporalHistoryFrames; };