mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Shader #include + Remved unused Dx11Effect
This commit is contained in:
@@ -169,7 +169,7 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
ProcessFile(filename, fileContent, vsName, psName);
|
||||
|
||||
Compile(fileContent, vsName, psName);
|
||||
Compile(fileContent, filename, vsName, psName);
|
||||
|
||||
MergeResources();
|
||||
|
||||
@@ -268,15 +268,15 @@ namespace GlitchyEngine.Renderer
|
||||
ps.ReleaseRef();
|
||||
}
|
||||
|
||||
private void Compile(String fileContent, String vsEntry, String psEntry)
|
||||
private void Compile(String fileContent, String fileName, String vsEntry, String psEntry)
|
||||
{
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
// TODO: vsEntry and psEntry could be empty (which is a valid case.)
|
||||
let vs = new VertexShader(fileContent, vsEntry);
|
||||
let vs = new VertexShader(fileContent, (StringView)fileName, vsEntry);
|
||||
VertexShader = vs;
|
||||
vs.ReleaseRef();
|
||||
let ps = new PixelShader(fileContent, psEntry);
|
||||
let ps = new PixelShader(fileContent, (StringView)fileName, psEntry);
|
||||
PixelShader = ps;
|
||||
ps.ReleaseRef();
|
||||
}
|
||||
@@ -349,7 +349,7 @@ namespace GlitchyEngine.Renderer
|
||||
fileContent.Remove(effectIndex, lineEndIndex - effectIndex);
|
||||
}
|
||||
|
||||
protected extern void Compile(String vsPath, String vsEntry, String psPath, String psEntry);
|
||||
//protected extern void Compile(String code, String fileName, String vsEntry, String psEntry);
|
||||
|
||||
private void MergeResources()
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace GlitchyEngine.Renderer
|
||||
public class PixelShader : Shader
|
||||
{
|
||||
[AllowAppend]
|
||||
public this(String source, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(source, entryPoint, macros) { }
|
||||
public this(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(code, fileName, entryPoint, macros) { }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace GlitchyEngine.Renderer
|
||||
public ShaderTextureCollection Textures => _textures;
|
||||
|
||||
[AllowAppend]
|
||||
public this(String source, String entryPoint, ShaderDefine[] macros = null)
|
||||
public this(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null)
|
||||
{
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
@@ -39,7 +39,7 @@ namespace GlitchyEngine.Renderer
|
||||
_buffers = new BufferCollection();
|
||||
_textures = new ShaderTextureCollection();
|
||||
|
||||
CompileFromSource(source, entryPoint);
|
||||
CompileFromSource(code, fileName, entryPoint);
|
||||
}
|
||||
|
||||
public ~this()
|
||||
@@ -52,15 +52,14 @@ namespace GlitchyEngine.Renderer
|
||||
Debug.Profiler.ProfileResourceFunction!();
|
||||
|
||||
String fileContent = new String();
|
||||
|
||||
File.ReadAllText(fileName, fileContent, true);
|
||||
T shader = new T(fileContent, entryPoint, macros);
|
||||
T shader = new T(fileContent, (StringView)fileName, entryPoint, macros);
|
||||
|
||||
delete fileContent;
|
||||
|
||||
shader
|
||||
}
|
||||
|
||||
public abstract void CompileFromSource(String code, String entryPoint, ShaderDefine[] macros = null);
|
||||
public abstract void CompileFromSource(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ namespace GlitchyEngine.Renderer
|
||||
public class VertexShader : Shader
|
||||
{
|
||||
[AllowAppend]
|
||||
public this(String source, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(source, entryPoint, macros) { }
|
||||
public this(StringView code, StringView? fileName, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(code, fileName, entryPoint, macros) { }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user