Replace Magick.NET with stb_image; refactor asset pipeline
- Switched image loading/saving from Magick.NET to native stb_image (Ghost.StbI), removing Magick.NET dependency. - Added Ghost.StbI project with native DLL, P/Invoke bindings, and wrapper. - Refactored TextureAssetHandler and TextureProcessor for stb_image, memory-mapped IO, and HDR/16-bit support. - Split IAssetHandler into IImportableAssetHandler and IPackableAssetHandler; updated interfaces to use FileStream. - Added shader and mesh asset handlers (GraphicsShaderAssetHandler, ComputeShaderAssetHandler, FBXAssetHandler). - Improved asset registry/catalog path handling and naming consistency. - Updated asset import pipeline to use new interfaces and trigger engine reimport. - Enhanced UI toolbar button styles and EditPage layout. - Added StbIBindingTest, DisableRuntimeMarshalling, and native wrapper attributes. - Updated wrapper generator for regex derivesFrom; added stbi.json config. - Removed Magick.NET reference; added Ghost.StbI and Ghost.Ufbx references. - Miscellaneous bugfixes and code cleanup.
This commit is contained in:
@@ -18,7 +18,7 @@ public struct DSLShaderError
|
||||
}
|
||||
}
|
||||
|
||||
internal static class DSLShaderCompiler
|
||||
public static class DSLShaderCompiler
|
||||
{
|
||||
private static PipelineState MeragePipeline(PipelineSemantic? semantic, PipelineState parent)
|
||||
{
|
||||
@@ -141,21 +141,27 @@ internal static class DSLShaderCompiler
|
||||
|
||||
var descriptor = new GraphicsShaderDescriptor
|
||||
{
|
||||
name = semantics.name,
|
||||
propertyBufferSize = propertyInfo.size,
|
||||
Name = semantics.name,
|
||||
PropertyBufferSize = propertyInfo.size,
|
||||
|
||||
shaderModel = semantics.shaderModel,
|
||||
passes = passes
|
||||
ShaderModel = semantics.shaderModel,
|
||||
Passes = passes
|
||||
};
|
||||
|
||||
for (var i = 0; i < descriptor.passes.Length; i++)
|
||||
for (var i = 0; i < descriptor.Passes.Length; i++)
|
||||
{
|
||||
descriptor.passes[i].shader = descriptor;
|
||||
descriptor.Passes[i].shader = descriptor;
|
||||
}
|
||||
|
||||
return descriptor;
|
||||
}
|
||||
|
||||
public static Result<GraphicsShaderDescriptor> CompileGraphicsShader(Stream stream)
|
||||
{
|
||||
using var reader = new StreamReader(stream);
|
||||
return CompileGraphicsShader(reader.ReadToEnd());
|
||||
}
|
||||
|
||||
public static Result<GraphicsShaderDescriptor> CompileGraphicsShader(string shaderPath)
|
||||
{
|
||||
try
|
||||
@@ -163,7 +169,8 @@ internal static class DSLShaderCompiler
|
||||
var source = File.ReadAllText(shaderPath);
|
||||
|
||||
// Use ANTLR4 parser
|
||||
var shaderModels = AntlrShaderCompiler.ParseShaders(source, out var parseErrors);
|
||||
var parseErrors = new List<DSLShaderError>();
|
||||
var shaderModels = AntlrShaderCompiler.ParseShaders(source, parseErrors);
|
||||
|
||||
if (parseErrors.Count != 0)
|
||||
{
|
||||
@@ -209,13 +216,20 @@ internal static class DSLShaderCompiler
|
||||
}
|
||||
}
|
||||
|
||||
public static Result<ComputeShaderDescriptor> CompileComputeShader(Stream stream)
|
||||
{
|
||||
using var reader = new StreamReader(stream);
|
||||
return CompileComputeShader(reader.ReadToEnd());
|
||||
}
|
||||
|
||||
public static Result<ComputeShaderDescriptor> CompileComputeShader(string shaderPath)
|
||||
{
|
||||
try
|
||||
{
|
||||
var source = File.ReadAllText(shaderPath);
|
||||
|
||||
var shaderModels = AntlrShaderCompiler.ParseComputeShaders(source, out var parseErrors);
|
||||
var parseErrors = new List<DSLShaderError>();
|
||||
var shaderModels = AntlrShaderCompiler.ParseComputeShaders(source, parseErrors);
|
||||
|
||||
if (parseErrors.Count != 0)
|
||||
{
|
||||
@@ -281,12 +295,12 @@ internal static class DSLShaderCompiler
|
||||
|
||||
return new ComputeShaderDescriptor
|
||||
{
|
||||
name = semantics.name,
|
||||
propertyBufferSize = propertyInfo.size,
|
||||
shaderModel = semantics.shaderModel,
|
||||
shaderCodes = shaderCodes,
|
||||
defines = semantics.defines?.ToArray() ?? Array.Empty<string>(),
|
||||
keywords = semantics.keywords?.ToArray() ?? Array.Empty<KeywordsGroup>()
|
||||
Name = semantics.name,
|
||||
PropertyBufferSize = propertyInfo.size,
|
||||
ShaderModel = semantics.shaderModel,
|
||||
ShaderCodes = shaderCodes,
|
||||
Defines = semantics.defines?.ToArray() ?? Array.Empty<string>(),
|
||||
Keywords = semantics.keywords?.ToArray() ?? Array.Empty<KeywordsGroup>()
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,10 +7,8 @@ namespace Ghost.DSL.ShaderParser;
|
||||
|
||||
public class AntlrShaderCompiler
|
||||
{
|
||||
public static List<GraphicsShaderModel> ParseShaders(string source, out List<DSLShaderError> errors)
|
||||
public static List<GraphicsShaderModel> ParseShaders(string source, List<DSLShaderError> errors)
|
||||
{
|
||||
errors = new List<DSLShaderError>();
|
||||
|
||||
try
|
||||
{
|
||||
var inputStream = new AntlrInputStream(source);
|
||||
@@ -53,7 +51,7 @@ public class AntlrShaderCompiler
|
||||
}
|
||||
}
|
||||
|
||||
public static List<ComputeShaderModel> ParseComputeShaders(string source, out List<DSLShaderError> errors)
|
||||
public static List<ComputeShaderModel> ParseComputeShaders(string source, List<DSLShaderError> errors)
|
||||
{
|
||||
errors = new List<DSLShaderError>();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user