Shader ownership change
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

This commit is contained in:
Aiden
2026-05-12 02:15:03 +10:00
parent 4ea829af85
commit c0d7e84495
12 changed files with 370 additions and 36 deletions

View File

@@ -0,0 +1,10 @@
#pragma once
#include <string>
struct RuntimeShaderArtifact
{
std::string shaderId;
std::string fragmentShaderSource;
std::string message;
};

View File

@@ -89,7 +89,7 @@ bool RuntimeSlangShaderCompiler::TryConsume(RuntimeSlangShaderBuild& build)
RuntimeSlangShaderBuild RuntimeSlangShaderCompiler::BuildHappyAccident() const
{
RuntimeSlangShaderBuild build;
build.shaderId = "happy-accident";
build.artifact.shaderId = "happy-accident";
try
{
@@ -126,7 +126,7 @@ RuntimeSlangShaderBuild RuntimeSlangShaderCompiler::BuildHappyAccident() const
std::string error;
const auto start = std::chrono::steady_clock::now();
if (!compiler.BuildPassFragmentShaderSource(shaderPackage, pass, build.fragmentShaderSource, error))
if (!compiler.BuildPassFragmentShaderSource(shaderPackage, pass, build.artifact.fragmentShaderSource, error))
{
build.succeeded = false;
build.message = error.empty() ? "Happy Accident Slang compile failed." : error;
@@ -136,7 +136,8 @@ RuntimeSlangShaderBuild RuntimeSlangShaderCompiler::BuildHappyAccident() const
const auto end = std::chrono::steady_clock::now();
const double milliseconds = std::chrono::duration_cast<std::chrono::duration<double, std::milli>>(end - start).count();
build.succeeded = true;
build.message = "Happy Accident Slang compile completed in " + std::to_string(milliseconds) + " ms.";
build.artifact.message = "Happy Accident Slang compile completed in " + std::to_string(milliseconds) + " ms.";
build.message = build.artifact.message;
return build;
}
catch (const std::exception& exception)

View File

@@ -1,5 +1,7 @@
#pragma once
#include "RuntimeShaderArtifact.h"
#include <atomic>
#include <mutex>
#include <string>
@@ -9,8 +11,7 @@ struct RuntimeSlangShaderBuild
{
bool available = false;
bool succeeded = false;
std::string shaderId;
std::string fragmentShaderSource;
RuntimeShaderArtifact artifact;
std::string message;
};