diff --git a/GlitchyEditor/resources/Shaders/ACES.hlsl.ass b/GlitchyEditor/resources/Shaders/ACES.hlsl.ass deleted file mode 100644 index 7c6562f..0000000 --- a/GlitchyEditor/resources/Shaders/ACES.hlsl.ass +++ /dev/null @@ -1,11 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = null, - AssetHandle = 5221334043827499251 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/ClearUInt.hlsl b/GlitchyEditor/resources/Shaders/ClearUInt.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/ClearUInt.hlsl rename to GlitchyEditor/resources/Shaders/ClearUInt.fx diff --git a/GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.hlsl.ass b/GlitchyEditor/resources/Shaders/ClearUInt.fx.ass similarity index 85% rename from GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.hlsl.ass rename to GlitchyEditor/resources/Shaders/ClearUInt.fx.ass index e4696e9..131e21f 100644 --- a/GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.hlsl.ass +++ b/GlitchyEditor/resources/Shaders/ClearUInt.fx.ass @@ -9,5 +9,5 @@ ExporterConfig = { _compression = .None }, - AssetHandle = 5246795156071151642 + AssetHandle = 3971197750817239312 } \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/GammaCorrect.hlsl b/GlitchyEditor/resources/Shaders/GammaCorrect.fx similarity index 91% rename from GlitchyEditor/resources/Shaders/GammaCorrect.hlsl rename to GlitchyEditor/resources/Shaders/GammaCorrect.fx index 7c19dfd..9a4b909 100644 --- a/GlitchyEditor/resources/Shaders/GammaCorrect.hlsl +++ b/GlitchyEditor/resources/Shaders/GammaCorrect.fx @@ -1,3 +1,5 @@ +// TODO: General pipeline for post processing effects + Texture2D Texture : register(t0); SamplerState TextureSampler : register(s0); diff --git a/GlitchyEditor/resources/Shaders/ClearUInt.hlsl.ass b/GlitchyEditor/resources/Shaders/GammaCorrect.fx.ass similarity index 85% rename from GlitchyEditor/resources/Shaders/ClearUInt.hlsl.ass rename to GlitchyEditor/resources/Shaders/GammaCorrect.fx.ass index af7e98f..dffb1a0 100644 --- a/GlitchyEditor/resources/Shaders/ClearUInt.hlsl.ass +++ b/GlitchyEditor/resources/Shaders/GammaCorrect.fx.ass @@ -9,5 +9,5 @@ ExporterConfig = { _compression = .None }, - AssetHandle = 8512375832990505152 + AssetHandle = 315199643377983302 } \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/GlitchyEngine.hlsl.ass b/GlitchyEditor/resources/Shaders/GlitchyEngine.hlsl.ass deleted file mode 100644 index 03f296d..0000000 --- a/GlitchyEditor/resources/Shaders/GlitchyEngine.hlsl.ass +++ /dev/null @@ -1,11 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = null, - AssetHandle = 9285471614459748654 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/GlitchyEngine2D.hlsl.ass b/GlitchyEditor/resources/Shaders/GlitchyEngine2D.hlsl.ass deleted file mode 100644 index cad2e67..0000000 --- a/GlitchyEditor/resources/Shaders/GlitchyEngine2D.hlsl.ass +++ /dev/null @@ -1,11 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = null, - AssetHandle = 9184910549692735900 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/LightingFunctions.hlsl.ass b/GlitchyEditor/resources/Shaders/LightingFunctions.hlsl.ass deleted file mode 100644 index 7d231ab..0000000 --- a/GlitchyEditor/resources/Shaders/LightingFunctions.hlsl.ass +++ /dev/null @@ -1,11 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = null, - AssetHandle = 1287916870077203420 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/PBR.hlsl.ass b/GlitchyEditor/resources/Shaders/PBR.hlsl.ass deleted file mode 100644 index 4dcd336..0000000 --- a/GlitchyEditor/resources/Shaders/PBR.hlsl.ass +++ /dev/null @@ -1,11 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = null, - AssetHandle = 9019615224633186177 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.hlsl b/GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.hlsl rename to GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.fx diff --git a/GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.fx.ass b/GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.fx.ass new file mode 100644 index 0000000..c883cfc --- /dev/null +++ b/GlitchyEditor/resources/Shaders/RenderTargetGroupViewer.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 17953005509950866729 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/ShaderHelpers.hlsl.ass b/GlitchyEditor/resources/Shaders/ShaderHelpers.hlsl.ass deleted file mode 100644 index 928d30a..0000000 --- a/GlitchyEditor/resources/Shaders/ShaderHelpers.hlsl.ass +++ /dev/null @@ -1,11 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = null, - AssetHandle = 10014069858860408945 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/SimpleTonemapping.hlsl b/GlitchyEditor/resources/Shaders/SimpleTonemapping.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/SimpleTonemapping.hlsl rename to GlitchyEditor/resources/Shaders/SimpleTonemapping.fx diff --git a/GlitchyEditor/resources/Shaders/SimpleTonemapping.fx.ass b/GlitchyEditor/resources/Shaders/SimpleTonemapping.fx.ass new file mode 100644 index 0000000..011734a --- /dev/null +++ b/GlitchyEditor/resources/Shaders/SimpleTonemapping.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 16539769359681819317 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/circlebatch.hlsl b/GlitchyEditor/resources/Shaders/circlebatch.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/circlebatch.hlsl rename to GlitchyEditor/resources/Shaders/circlebatch.fx diff --git a/GlitchyEditor/resources/Shaders/circlebatch.fx.ass b/GlitchyEditor/resources/Shaders/circlebatch.fx.ass new file mode 100644 index 0000000..66bf1ed --- /dev/null +++ b/GlitchyEditor/resources/Shaders/circlebatch.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 15706760057808399494 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/circlebatch.hlsl.ass b/GlitchyEditor/resources/Shaders/circlebatch.hlsl.ass deleted file mode 100644 index e74625a..0000000 --- a/GlitchyEditor/resources/Shaders/circlebatch.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 4179932137221776017 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/lineShader.hlsl b/GlitchyEditor/resources/Shaders/lineShader.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/lineShader.hlsl rename to GlitchyEditor/resources/Shaders/lineShader.fx diff --git a/GlitchyEditor/resources/Shaders/lineShader.fx.ass b/GlitchyEditor/resources/Shaders/lineShader.fx.ass new file mode 100644 index 0000000..083fa38 --- /dev/null +++ b/GlitchyEditor/resources/Shaders/lineShader.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 10636491756936205086 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/lineShader.hlsl.ass b/GlitchyEditor/resources/Shaders/lineShader.hlsl.ass deleted file mode 100644 index 4efbec5..0000000 --- a/GlitchyEditor/resources/Shaders/lineShader.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 8912920142436784175 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/linebatch.hlsl b/GlitchyEditor/resources/Shaders/linebatch.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/linebatch.hlsl rename to GlitchyEditor/resources/Shaders/linebatch.fx diff --git a/GlitchyEditor/resources/Shaders/SimpleTonemapping.hlsl.ass b/GlitchyEditor/resources/Shaders/linebatch.fx.ass similarity index 85% rename from GlitchyEditor/resources/Shaders/SimpleTonemapping.hlsl.ass rename to GlitchyEditor/resources/Shaders/linebatch.fx.ass index fe8a7eb..504b374 100644 --- a/GlitchyEditor/resources/Shaders/SimpleTonemapping.hlsl.ass +++ b/GlitchyEditor/resources/Shaders/linebatch.fx.ass @@ -9,5 +9,5 @@ ExporterConfig = { _compression = .None }, - AssetHandle = 6905134680069212587 + AssetHandle = 5888610203248969416 } \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/linebatch.hlsl.ass b/GlitchyEditor/resources/Shaders/linebatch.hlsl.ass deleted file mode 100644 index 2ba60d8..0000000 --- a/GlitchyEditor/resources/Shaders/linebatch.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 18151489828256118978 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/msdfShader.hlsl b/GlitchyEditor/resources/Shaders/msdfShader.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/msdfShader.hlsl rename to GlitchyEditor/resources/Shaders/msdfShader.fx diff --git a/GlitchyEditor/resources/Shaders/GammaCorrect.hlsl.ass b/GlitchyEditor/resources/Shaders/msdfShader.fx.ass similarity index 85% rename from GlitchyEditor/resources/Shaders/GammaCorrect.hlsl.ass rename to GlitchyEditor/resources/Shaders/msdfShader.fx.ass index c257f97..fda4145 100644 --- a/GlitchyEditor/resources/Shaders/GammaCorrect.hlsl.ass +++ b/GlitchyEditor/resources/Shaders/msdfShader.fx.ass @@ -9,5 +9,5 @@ ExporterConfig = { _compression = .None }, - AssetHandle = 4332390465159443321 + AssetHandle = 9062891433306436746 } \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/msdfShader.hlsl.ass b/GlitchyEditor/resources/Shaders/msdfShader.hlsl.ass deleted file mode 100644 index e7d92b6..0000000 --- a/GlitchyEditor/resources/Shaders/msdfShader.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 8655864411897316846 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/myEffect.hlsl b/GlitchyEditor/resources/Shaders/myEffect.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/myEffect.hlsl rename to GlitchyEditor/resources/Shaders/myEffect.fx diff --git a/GlitchyEditor/resources/Shaders/myEffect.fx.ass b/GlitchyEditor/resources/Shaders/myEffect.fx.ass new file mode 100644 index 0000000..34ca86f --- /dev/null +++ b/GlitchyEditor/resources/Shaders/myEffect.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 2172704887168568810 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/myEffect.hlsl.ass b/GlitchyEditor/resources/Shaders/myEffect.hlsl.ass deleted file mode 100644 index 58a7d93..0000000 --- a/GlitchyEditor/resources/Shaders/myEffect.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 8873320878521542705 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/simpleLight.hlsl b/GlitchyEditor/resources/Shaders/simpleLight.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/simpleLight.hlsl rename to GlitchyEditor/resources/Shaders/simpleLight.fx diff --git a/GlitchyEditor/resources/Shaders/simpleLight.fx.ass b/GlitchyEditor/resources/Shaders/simpleLight.fx.ass new file mode 100644 index 0000000..788cc2a --- /dev/null +++ b/GlitchyEditor/resources/Shaders/simpleLight.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 1519310858892551656 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/simpleLight.hlsl.ass b/GlitchyEditor/resources/Shaders/simpleLight.hlsl.ass deleted file mode 100644 index 78e09ff..0000000 --- a/GlitchyEditor/resources/Shaders/simpleLight.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 14993433232700867484 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/spritebatch.hlsl b/GlitchyEditor/resources/Shaders/spritebatch.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/spritebatch.hlsl rename to GlitchyEditor/resources/Shaders/spritebatch.fx diff --git a/GlitchyEditor/resources/Shaders/spritebatch.fx.ass b/GlitchyEditor/resources/Shaders/spritebatch.fx.ass new file mode 100644 index 0000000..ba7aa84 --- /dev/null +++ b/GlitchyEditor/resources/Shaders/spritebatch.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 7757902626263730438 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/spritebatch.hlsl.ass b/GlitchyEditor/resources/Shaders/spritebatch.hlsl.ass deleted file mode 100644 index 7a1cca2..0000000 --- a/GlitchyEditor/resources/Shaders/spritebatch.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 9671561114069837759 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/textureViewerShader.hlsl b/GlitchyEditor/resources/Shaders/textureViewerShader.fx similarity index 100% rename from GlitchyEditor/resources/Shaders/textureViewerShader.hlsl rename to GlitchyEditor/resources/Shaders/textureViewerShader.fx diff --git a/GlitchyEditor/resources/Shaders/textureViewerShader.fx.ass b/GlitchyEditor/resources/Shaders/textureViewerShader.fx.ass new file mode 100644 index 0000000..ea9b662 --- /dev/null +++ b/GlitchyEditor/resources/Shaders/textureViewerShader.fx.ass @@ -0,0 +1,13 @@ +{ + AssetLoader = null, + Config = null, + Importer = "ShaderImporter", + ImporterConfig = null, + Processor = null, + ProcessorConfig = null, + Exporter = null, + ExporterConfig = { + _compression = .None + }, + AssetHandle = 8094944104856236365 +} \ No newline at end of file diff --git a/GlitchyEditor/resources/Shaders/textureViewerShader.hlsl.ass b/GlitchyEditor/resources/Shaders/textureViewerShader.hlsl.ass deleted file mode 100644 index 331ee16..0000000 --- a/GlitchyEditor/resources/Shaders/textureViewerShader.hlsl.ass +++ /dev/null @@ -1,13 +0,0 @@ -{ - AssetLoader = null, - Config = null, - Importer = "ShaderImporter", - ImporterConfig = null, - Processor = null, - ProcessorConfig = null, - Exporter = null, - ExporterConfig = { - _compression = .None - }, - AssetHandle = 13990953346248142933 -} \ No newline at end of file diff --git a/GlitchyEditor/resources/Textures/EditorIcons.dds b/GlitchyEditor/resources/Textures/EditorIcons.dds index f6c3fb1..8d3a23a 100644 Binary files a/GlitchyEditor/resources/Textures/EditorIcons.dds and b/GlitchyEditor/resources/Textures/EditorIcons.dds differ diff --git a/GlitchyEditor/resources/Textures/EditorIcons.psd b/GlitchyEditor/resources/Textures/EditorIcons.psd index cd95b1d..bd55d98 100644 Binary files a/GlitchyEditor/resources/Textures/EditorIcons.psd and b/GlitchyEditor/resources/Textures/EditorIcons.psd differ diff --git a/GlitchyEditor/src/Assets/AssetThumbnailManager.bf b/GlitchyEditor/src/Assets/AssetThumbnailManager.bf index 742fee3..c7f5ea3 100644 --- a/GlitchyEditor/src/Assets/AssetThumbnailManager.bf +++ b/GlitchyEditor/src/Assets/AssetThumbnailManager.bf @@ -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; } diff --git a/GlitchyEditor/src/Assets/Importers/ShaderImporter.bf b/GlitchyEditor/src/Assets/Importers/ShaderImporter.bf index 763e569..e07ea23 100644 --- a/GlitchyEditor/src/Assets/Importers/ShaderImporter.bf +++ b/GlitchyEditor/src/Assets/Importers/ShaderImporter.bf @@ -28,7 +28,7 @@ class ShaderImporterConfig : AssetImporterConfig class ShaderImporter : IAssetImporter { - private static readonly List _fileExtensions = new .(){".hlsl"} ~ delete _; + private static readonly List _fileExtensions = new .(){".fx"} ~ delete _; public static List FileExtensions => _fileExtensions; diff --git a/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf b/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf index 34dfa78..03f335a 100644 --- a/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf +++ b/GlitchyEditor/src/Assets/Processors/ShaderCompiler.bf @@ -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; } } diff --git a/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf b/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf index 39b8c76..a8c0224 100644 --- a/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf +++ b/GlitchyEditor/src/Assets/Processors/ShaderProcessor.bf @@ -121,10 +121,17 @@ class ShaderProcessor : IAssetProcessor // Name in Shader -> Name in Engine Dictionary 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)); diff --git a/GlitchyEditor/src/EditWindows/AssetViewer.bf b/GlitchyEditor/src/EditWindows/AssetViewer.bf index 137b398..f3b3b2a 100644 --- a/GlitchyEditor/src/EditWindows/AssetViewer.bf +++ b/GlitchyEditor/src/EditWindows/AssetViewer.bf @@ -178,8 +178,8 @@ class TextureViewer public this() { - _effect = Content.LoadAsset("Resources/Shaders/textureViewerShader.hlsl", null, true); - AssetHandle effect = Content.LoadAsset("Resources/Shaders/RenderTargetGroupViewer.hlsl", null, true); + _effect = Content.LoadAsset("Resources/Shaders/textureViewerShader.fx", null, true); + AssetHandle effect = Content.LoadAsset("Resources/Shaders/RenderTargetGroupViewer.fx", null, true); _renderTargetMaterial = new Material(effect); diff --git a/GlitchyEditor/src/EditorIcons.bf b/GlitchyEditor/src/EditorIcons.bf index f2217fc..e94959b 100644 --- a/GlitchyEditor/src/EditorIcons.bf +++ b/GlitchyEditor/src/EditorIcons.bf @@ -28,11 +28,12 @@ namespace GlitchyEditor public SubTexture2D File_Scene ~ _.ReleaseRef(); public SubTexture2D File_Material ~ _.ReleaseRef(); public SubTexture2D File_CSharpScript ~ _.ReleaseRef(); - public SubTexture2D File_Shader ~ _.ReleaseRef(); + public SubTexture2D File_Effect ~ _.ReleaseRef(); public SubTexture2D Entity_Visible ~ _.ReleaseRef(); public SubTexture2D Entity_Hidden ~ _.ReleaseRef(); public SubTexture2D Icon_Save ~ _.ReleaseRef(); public SubTexture2D Icon_ContextMenu ~ _.ReleaseRef(); + public SubTexture2D File_Hlsl ~ _.ReleaseRef(); public static EditorIcons Instance => _editorIcons; @@ -66,11 +67,12 @@ namespace GlitchyEditor File_Scene = GetNextGridTexture(ref pen, iconSize); File_Material = GetNextGridTexture(ref pen, iconSize); File_CSharpScript = GetNextGridTexture(ref pen, iconSize); - File_Shader = GetNextGridTexture(ref pen, iconSize); + File_Effect = GetNextGridTexture(ref pen, iconSize); Entity_Visible = GetNextGridTexture(ref pen, iconSize); Entity_Hidden = GetNextGridTexture(ref pen, iconSize); Icon_Save = GetNextGridTexture(ref pen, iconSize); Icon_ContextMenu = GetNextGridTexture(ref pen, iconSize); + File_Hlsl = GetNextGridTexture(ref pen, iconSize); } public ~this() diff --git a/GlitchyEditor/src/EditorLayer.bf b/GlitchyEditor/src/EditorLayer.bf index 5efd213..751afa2 100644 --- a/GlitchyEditor/src/EditorLayer.bf +++ b/GlitchyEditor/src/EditorLayer.bf @@ -175,6 +175,22 @@ namespace GlitchyEditor SaveScene(newScene, path); } }, _editorIcons.File_Scene)); + + Editor.Instance.ContentBrowserWindow.RegisterAssetCreator(new AssetCreator("Shader File", "New Shader", ".hlsl", new (path) => + { + // TODO! + }, _editorIcons.File_Hlsl)); + + Editor.Instance.ContentBrowserWindow.RegisterAssetCreator(new AssetCreator("2D Effect", "New Effect", ".fx", new (path) => + { + // TODO! + }, _editorIcons.File_Effect)); + + // TODO: 3D Effect Lit, 3D Effect unlit, etc. + /*Editor.Instance.ContentBrowserWindow.RegisterAssetCreator(new AssetCreator("3D Effect", "New Effect", ".fx", new (path) => + { + // TODO! + }, _editorIcons.File_Effect));*/ Editor.Instance.ContentBrowserWindow.RegisterAssetCreator(new AssetCreator("Material", "New Material", ".mat", new (path) => { diff --git a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RendererAPI.bf b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RendererAPI.bf index 77e019b..a70d1c0 100644 --- a/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RendererAPI.bf +++ b/GlitchyEngine/src/Platform/DX11/Renderer/Dx11RendererAPI.bf @@ -31,7 +31,7 @@ namespace GlitchyEngine.Renderer { Debug.Profiler.ProfileFunction!(); - _clearUintFx = Content.LoadAsset("Resources/Shaders/ClearUInt.hlsl", null, true); + _clearUintFx = Content.LoadAsset("Resources/Shaders/ClearUInt.fx", null, true); BlendStateDescription desc =.Default; desc.RenderTarget[0].BlendEnable = false; _nonblendingState = new BlendState(desc); diff --git a/GlitchyEngine/src/Renderer/Renderer.bf b/GlitchyEngine/src/Renderer/Renderer.bf index 6d0a6f7..1fd994a 100644 --- a/GlitchyEngine/src/Renderer/Renderer.bf +++ b/GlitchyEngine/src/Renderer/Renderer.bf @@ -150,8 +150,6 @@ namespace GlitchyEngine.Renderer { Debug.Profiler.ProfileFunction!(); - //LineEffect = Content.LoadAsset("Shaders\\lineShader.hlsl"); - LineGeometry = new GeometryBinding(); LineGeometry.SetPrimitiveTopology(.LineList); @@ -180,8 +178,8 @@ namespace GlitchyEngine.Renderer static void InitDeferredRenderer() { - TestFullscreenEffect = Content.LoadAsset("Resources/Shaders/simpleLight.hlsl", null, true); - s_tonemappingEffect = Content.LoadAsset("Resources/Shaders/SimpleTonemapping.hlsl", null, true); + TestFullscreenEffect = Content.LoadAsset("Resources/Shaders/simpleLight.fx", null, true); + s_tonemappingEffect = Content.LoadAsset("Resources/Shaders/SimpleTonemapping.fx", null, true); _gBuffer = new GBuffer(); BlendStateDescription gBufferBlendDesc = .Default; diff --git a/GlitchyEngine/src/Renderer/Renderer2D.bf b/GlitchyEngine/src/Renderer/Renderer2D.bf index b0598d2..b8af70a 100644 --- a/GlitchyEngine/src/Renderer/Renderer2D.bf +++ b/GlitchyEngine/src/Renderer/Renderer2D.bf @@ -187,10 +187,10 @@ namespace GlitchyEngine.Renderer { Debug.Profiler.ProfileFunction!(); - s_quadBatchEffect = Content.LoadAsset("Resources/Shaders/spritebatch.hlsl", null, true); + s_quadBatchEffect = Content.LoadAsset("Resources/Shaders/spritebatch.fx", null, true); s_quadBatchMaterial = new Material(s_quadBatchEffect); - s_circleBatchEffect = Content.LoadAsset("Resources/Shaders/circlebatch.hlsl", null, true); - s_lineBatchEffect = Content.LoadAsset("Resources/Shaders/linebatch.hlsl", null, true); + s_circleBatchEffect = Content.LoadAsset("Resources/Shaders/circlebatch.fx", null, true); + s_lineBatchEffect = Content.LoadAsset("Resources/Shaders/linebatch.fx", null, true); } private static void InitGeometry() diff --git a/GlitchyEngine/src/Renderer/Text/FontRenderer.bf b/GlitchyEngine/src/Renderer/Text/FontRenderer.bf index c9b7701..ecab908 100644 --- a/GlitchyEngine/src/Renderer/Text/FontRenderer.bf +++ b/GlitchyEngine/src/Renderer/Text/FontRenderer.bf @@ -33,7 +33,7 @@ namespace GlitchyEngine.Renderer.Text InitFreetype(); // TODO: We might get away with a non blocking load here, but not for now! - _msdfEffect = Content.LoadAsset("Resources/Shaders/msdfShader.hlsl", null, true); + _msdfEffect = Content.LoadAsset("Resources/Shaders/msdfShader.fx", null, true); _msdfMaterial = new Material(_msdfEffect); s_isInitialized = true; diff --git a/GlitchyEngine/src/World/SceneRenderer.bf b/GlitchyEngine/src/World/SceneRenderer.bf index 3800184..7c7ccee 100644 --- a/GlitchyEngine/src/World/SceneRenderer.bf +++ b/GlitchyEngine/src/World/SceneRenderer.bf @@ -47,7 +47,7 @@ class SceneRenderer }); _cameraTarget.[Friend]Identifier = "Camera Target"; - _gammaCorrectEffect = Content.LoadAsset("Resources/Shaders/GammaCorrect.hlsl", null, true); + _gammaCorrectEffect = Content.LoadAsset("Resources/Shaders/GammaCorrect.fx", null, true); } /// Sets the size of the viewport into which the scene will be rendered.