Workaround beef bug

This commit is contained in:
Simon Lübeß
2021-01-01 14:47:49 +01:00
parent e021da8e0b
commit 3c58e20787
2 changed files with 18 additions and 11 deletions
+15 -9
View File
@@ -7,31 +7,37 @@ namespace GlitchyEngine.Renderer
{ {
typealias BufferEntry = (String Name, int Index, Buffer Buffer, bool OwnsBuffer); typealias BufferEntry = (String Name, int Index, Buffer Buffer, bool OwnsBuffer);
List<BufferEntry> _buffers ~ delete:append _; List<BufferEntry> _buffers ~ DeleteBufferEntries!(_);
Dictionary<StringView, Buffer> _strToBuf ~ delete:append _; Dictionary<StringView, Buffer> _strToBuf ~ delete _; //delete:append _;
Dictionary<int, Buffer> _idxToBuf ~ delete:append _; Dictionary<int, Buffer> _idxToBuf ~ delete _; //delete:append _;
[AllowAppend] [AllowAppend]
public this() public this()
{ {
let buffers = append List<BufferEntry>(); // Todo: append allocate as soon as it's fixed
let strToBuf = append Dictionary<StringView, Buffer>(); let buffers = new List<BufferEntry>();
let idxToBuf = append Dictionary<int, Buffer>(); let strToBuf = new Dictionary<StringView, Buffer>();
let idxToBuf = new Dictionary<int, Buffer>();
_buffers = buffers; _buffers = buffers;
_strToBuf = strToBuf; _strToBuf = strToBuf;
_idxToBuf = idxToBuf; _idxToBuf = idxToBuf;
} }
public ~this() mixin DeleteBufferEntries(List<BufferEntry> entries)
{ {
for(let entry in _buffers) if(entries == null)
return;
for(let entry in entries)
{ {
delete entry.Name; delete entry.Name;
if(entry.OwnsBuffer) if(entry.OwnsBuffer)
delete entry.Buffer; delete entry.Buffer;
} }
delete entries;
} }
public Buffer this[int idx] => _idxToBuf[idx]; public Buffer this[int idx] => _idxToBuf[idx];
+3 -2
View File
@@ -23,7 +23,7 @@ namespace GlitchyEngine.Renderer
{ {
protected GraphicsContext _context; protected GraphicsContext _context;
protected BufferCollection _buffers ~ delete:append _; protected BufferCollection _buffers ~ delete _;//:append _;
public GraphicsContext Context => _context; public GraphicsContext Context => _context;
@@ -32,7 +32,8 @@ namespace GlitchyEngine.Renderer
[AllowAppend] [AllowAppend]
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null) public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
{ {
let buffers = append BufferCollection(); // Todo: append as soon as it's fixed.
let buffers = new BufferCollection();
_buffers = buffers; _buffers = buffers;
_context = context; _context = context;