Files
video-shader-toys/apps/LoopThroughWithOpenGLCompositing/shader/ShaderCompiler.h
Aiden 596d370f43
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m17s
CI / Windows Release Package (push) Successful in 2m28s
Add manifest support for pass declarations
2026-05-08 17:19:30 +10:00

36 lines
1.5 KiB
C++

#pragma once
#include "ShaderTypes.h"
#include <filesystem>
#include <string>
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 BuildLayerFragmentShaderSource(const ShaderPackage& shaderPackage, std::string& fragmentShaderSource, std::string& error) const;
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;
};