mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Separate handling for hlsl and fx files
This commit is contained in:
@@ -18,14 +18,15 @@ class AssetThumbnailManager
|
||||
if (assetNode.Path.EndsWith(".scene"))
|
||||
return _icons.File_Scene;
|
||||
|
||||
if (assetNode.Path.EndsWith(".mat"))
|
||||
return _icons.File_Material;
|
||||
|
||||
if (assetNode.Path.EndsWith(".cs"))
|
||||
return _icons.File_CSharpScript;
|
||||
|
||||
if (assetNode.Path.EndsWith(".hlsl"))
|
||||
return _icons.File_Shader;
|
||||
return _icons.File_Hlsl;
|
||||
if (assetNode.Path.EndsWith(".fx"))
|
||||
return _icons.File_Effect;
|
||||
if (assetNode.Path.EndsWith(".mat"))
|
||||
return _icons.File_Material;
|
||||
|
||||
return _icons.File;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class ShaderImporterConfig : AssetImporterConfig
|
||||
|
||||
class ShaderImporter : IAssetImporter
|
||||
{
|
||||
private static readonly List<StringView> _fileExtensions = new .(){".hlsl"} ~ delete _;
|
||||
private static readonly List<StringView> _fileExtensions = new .(){".fx"} ~ delete _;
|
||||
|
||||
public static List<StringView> FileExtensions => _fileExtensions;
|
||||
|
||||
|
||||
@@ -201,6 +201,7 @@ extension ShaderCompiler
|
||||
{
|
||||
StringView str = StringView((char8*)errorBlob.GetBufferPointer(), (int)errorBlob.GetBufferSize());
|
||||
Log.EngineLogger.Error($"Failed to compile Shader: Error Code({(int)result}): {result} | Error Message: {str}");
|
||||
return .Err;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -121,10 +121,17 @@ class ShaderProcessor : IAssetProcessor
|
||||
// Name in Shader -> Name in Engine
|
||||
Dictionary<StringView, StringView> engineBuffers = scope .();
|
||||
|
||||
ProcessedShader processedShader = null;
|
||||
|
||||
defer
|
||||
{
|
||||
ClearDictionaryAndDeleteValues!(variables);
|
||||
ClearAndDeleteItems!(bufferNames);
|
||||
|
||||
if (@return case .Err)
|
||||
{
|
||||
delete processedShader;
|
||||
}
|
||||
}
|
||||
|
||||
String code = new String(importedShader.HlslCode);
|
||||
@@ -138,7 +145,7 @@ class ShaderProcessor : IAssetProcessor
|
||||
return .Ok;
|
||||
}
|
||||
|
||||
ProcessedShader processedShader = new ProcessedShader(new AssetIdentifier(importedShader.AssetIdentifier), config.AssetHandle);
|
||||
processedShader = new ProcessedShader(new AssetIdentifier(importedShader.AssetIdentifier), config.AssetHandle);
|
||||
|
||||
Try!(CompileAndReflect(vsName, psName, importedShader, code, processedShader));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user