Files
video-shader-toys/apps/RenderCadenceCompositor/runtime/RuntimeSlangShaderCompiler.h
Aiden c0d7e84495
All checks were successful
CI / React UI Build (push) Successful in 11s
CI / Native Windows Build And Tests (push) Successful in 2m52s
CI / Windows Release Package (push) Successful in 2m59s
Shader ownership change
2026-05-12 02:15:03 +10:00

39 lines
895 B
C++

#pragma once
#include "RuntimeShaderArtifact.h"
#include <atomic>
#include <mutex>
#include <string>
#include <thread>
struct RuntimeSlangShaderBuild
{
bool available = false;
bool succeeded = false;
RuntimeShaderArtifact artifact;
std::string message;
};
class RuntimeSlangShaderCompiler
{
public:
RuntimeSlangShaderCompiler() = default;
RuntimeSlangShaderCompiler(const RuntimeSlangShaderCompiler&) = delete;
RuntimeSlangShaderCompiler& operator=(const RuntimeSlangShaderCompiler&) = delete;
~RuntimeSlangShaderCompiler();
void StartHappyAccidentBuild();
void Stop();
bool TryConsume(RuntimeSlangShaderBuild& build);
bool Running() const { return mRunning.load(std::memory_order_acquire); }
private:
RuntimeSlangShaderBuild BuildHappyAccident() const;
std::thread mThread;
std::atomic<bool> mRunning{ false };
std::mutex mMutex;
RuntimeSlangShaderBuild mReadyBuild;
};