feat(shader): refactor and enhance shader pipeline
Refactored the shader compilation pipeline to introduce modularity, improve performance, and enhance maintainability. Key changes include: - Added `ShaderCompilationConfig`, `CompilerOptimizeLevel`, and `ShaderStage` enums. - Replaced `SM` property with `ShaderModel` in shader models. - Introduced `ShaderLibrary` for in-memory and disk-based shader caching. - Refactored `DSLShaderCompiler` and `AntlrShaderCompiler` for better hashing and error handling. - Centralized shader compilation logic in `ShaderCompilerUtility`. - Removed legacy shader compilation logic from `IShaderCompiler`. - Updated `RenderGraph`, `ResourceManager`, and `Material` to integrate with the new caching system. - Improved memory management with `NativeMemoryManager<T>`. BREAKING CHANGE: Removed legacy shader compilation methods and replaced them with a new caching and compilation system.
This commit is contained in:
19
src/Runtime/Ghost.Graphics/IShaderCompilationBridge.cs
Normal file
19
src/Runtime/Ghost.Graphics/IShaderCompilationBridge.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
namespace Ghost.Graphics;
|
||||
|
||||
public interface IShaderCompilationBridge
|
||||
{
|
||||
bool TryGetBytecode(ulong manifestKey, out ReadOnlyMemory<byte> bytecode);
|
||||
bool IsCompiling(ulong manifestKey);
|
||||
}
|
||||
|
||||
// NOTE: For testing only.
|
||||
internal sealed class NullShaderCompilationBridge : IShaderCompilationBridge
|
||||
{
|
||||
public bool TryGetBytecode(ulong manifestKey, out ReadOnlyMemory<byte> bytecode)
|
||||
{
|
||||
bytecode = default;
|
||||
return false; // Always fall through to ShaderLibrary's disk cache
|
||||
}
|
||||
|
||||
public bool IsCompiling(ulong manifestKey) => false;
|
||||
}
|
||||
Reference in New Issue
Block a user