forked from Misaki/GhostEngine
Refactor and enhance graphics and audio systems
Updated target frameworks to .NET 10.0 across multiple projects for compatibility with the latest features. Refactored namespaces and introduced new classes for shader descriptors, FMOD integration, and DirectX 12 utilities using TerraFX. Replaced `Win32` bindings with TerraFX equivalents for DirectX 12. Added a C# wrapper for FMOD Studio API, including DSP and error handling. Enhanced entity queries, component storage, and query filters for better performance and type safety. Introduced new test projects and updated the solution structure. Added `meshoptimizer` bindings and integrated `meshoptimizer_native.dll`. Improved code readability, maintainability, and performance.
This commit is contained in:
@@ -1,18 +1,56 @@
|
||||
using Ghost.Shader;
|
||||
using Ghost.Shader.Compiler;
|
||||
using Ghost.Shader.Generator;
|
||||
using Misaki.HighPerformance.Mathematics;
|
||||
using System.Numerics;
|
||||
|
||||
ShaderStructGenerator.GenerateHLSL([typeof(TestStruct), typeof(TestEnum), typeof(TestEnumFlags)], PackingRules.Exact, "C:/Users/Misaki/Downloads/Archive/Test.cs.hlsl");
|
||||
|
||||
return;
|
||||
|
||||
var source = File.ReadAllText("F:/csharp/GhostEngine/Ghost.Graphics/test.gshader");
|
||||
|
||||
var source = File.ReadAllText("F:\\csharp\\GhostEngine\\Ghost.Graphics\\test.ghostshader");
|
||||
var lexer = new Lexer(source);
|
||||
|
||||
//foreach (var token in lexer.Tokenize())
|
||||
//{
|
||||
// Console.WriteLine($"{token.type} : '{token.lexeme}' at line {token.line}");
|
||||
//}
|
||||
|
||||
var stream = new TokenStream(lexer.Tokenize().ToArray());
|
||||
var stream = new TokenStream(lexer.Tokenize());
|
||||
var shaderInfo = ShaderCompiler.ParseShaders(stream);
|
||||
var model = ShaderCompiler.SemanticAnalysis(shaderInfo[0], out var errors);
|
||||
|
||||
foreach (var error in errors)
|
||||
{
|
||||
Console.WriteLine(error);
|
||||
return;
|
||||
}
|
||||
|
||||
if (model == null)
|
||||
{
|
||||
Console.WriteLine("Failed to compile shader due to errors.");
|
||||
return;
|
||||
}
|
||||
|
||||
var descriptor = ShaderCompiler.ResolveShader(model);
|
||||
ShaderCompiler.CompileShader(descriptor, "C:/Users/Misaki/Downloads/Archive");
|
||||
|
||||
Console.WriteLine("Shader compiled successfully:");
|
||||
|
||||
|
||||
public struct TestStruct
|
||||
{
|
||||
public int A;
|
||||
public float B;
|
||||
public Vector3 C;
|
||||
public float3x4 D;
|
||||
}
|
||||
|
||||
public enum TestEnum
|
||||
{
|
||||
First,
|
||||
Second,
|
||||
Third
|
||||
}
|
||||
|
||||
public enum TestEnumFlags
|
||||
{
|
||||
None = 0,
|
||||
First = 1 << 0,
|
||||
Second = 1 << 1,
|
||||
Third = 1 << 2,
|
||||
}
|
||||
Reference in New Issue
Block a user