Shaders and BufferCollection now use append allocation

This commit is contained in:
Simon Lübeß
2020-12-31 13:19:27 +01:00
parent ebb5d94c1f
commit e021da8e0b
4 changed files with 14 additions and 14 deletions
+7 -12
View File
@@ -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) { }
+5 -2
View File
@@ -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) { }