Shader test past
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
#include <mutex>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
|
||||
struct RuntimeSlangShaderBuild
|
||||
{
|
||||
bool available = false;
|
||||
bool succeeded = false;
|
||||
std::string shaderId;
|
||||
std::string fragmentShaderSource;
|
||||
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;
|
||||
};
|
||||
Reference in New Issue
Block a user