mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Shaders and BufferCollection now use append allocation
This commit is contained in:
@@ -7,26 +7,21 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
typealias BufferEntry = (String Name, int Index, Buffer Buffer, bool OwnsBuffer);
|
||||
|
||||
List<BufferEntry> _buffers ~ delete _;
|
||||
List<BufferEntry> _buffers ~ delete:append _;
|
||||
|
||||
Dictionary<StringView, Buffer> _strToBuf ~ delete _;
|
||||
Dictionary<int, Buffer> _idxToBuf ~ delete _;
|
||||
Dictionary<StringView, Buffer> _strToBuf ~ delete:append _;
|
||||
Dictionary<int, Buffer> _idxToBuf ~ delete:append _;
|
||||
|
||||
//[AllowAppend]
|
||||
[AllowAppend]
|
||||
public this()
|
||||
{
|
||||
/*List<BufferEntry> buffers = append .();
|
||||
Dictionary<StringView, Buffer> strToBuf = append .();
|
||||
Dictionary<int, Buffer> idxToBuf = append .();
|
||||
let buffers = append List<BufferEntry>();
|
||||
let strToBuf = append Dictionary<StringView, Buffer>();
|
||||
let idxToBuf = append Dictionary<int, Buffer>();
|
||||
|
||||
_buffers = buffers;
|
||||
_strToBuf = strToBuf;
|
||||
_idxToBuf = idxToBuf;
|
||||
*/
|
||||
|
||||
_buffers = new .();
|
||||
_strToBuf = new .();
|
||||
_idxToBuf = new .();
|
||||
}
|
||||
|
||||
public ~this()
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
public class PixelShader : Shader
|
||||
{
|
||||
[AllowAppend]
|
||||
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(context, source, entryPoint, macros) { }
|
||||
|
||||
|
||||
@@ -23,15 +23,18 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
protected GraphicsContext _context;
|
||||
|
||||
protected BufferCollection _buffers ~ delete _;
|
||||
protected BufferCollection _buffers ~ delete:append _;
|
||||
|
||||
public GraphicsContext Context => _context;
|
||||
|
||||
public BufferCollection Buffers => _buffers;
|
||||
|
||||
[AllowAppend]
|
||||
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
||||
{
|
||||
_buffers = new BufferCollection();
|
||||
let buffers = append BufferCollection();
|
||||
_buffers = buffers;
|
||||
|
||||
_context = context;
|
||||
CompileFromSource(source, entryPoint);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace GlitchyEngine.Renderer
|
||||
{
|
||||
public class VertexShader : Shader
|
||||
{
|
||||
[AllowAppend]
|
||||
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
||||
: base(context, source, entryPoint, macros) { }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user