mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 13: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);
|
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<StringView, Buffer> _strToBuf ~ delete:append _;
|
||||||
Dictionary<int, Buffer> _idxToBuf ~ delete _;
|
Dictionary<int, Buffer> _idxToBuf ~ delete:append _;
|
||||||
|
|
||||||
//[AllowAppend]
|
[AllowAppend]
|
||||||
public this()
|
public this()
|
||||||
{
|
{
|
||||||
/*List<BufferEntry> buffers = append .();
|
let buffers = append List<BufferEntry>();
|
||||||
Dictionary<StringView, Buffer> strToBuf = append .();
|
let strToBuf = append Dictionary<StringView, Buffer>();
|
||||||
Dictionary<int, Buffer> idxToBuf = append .();
|
let idxToBuf = append Dictionary<int, Buffer>();
|
||||||
|
|
||||||
_buffers = buffers;
|
_buffers = buffers;
|
||||||
_strToBuf = strToBuf;
|
_strToBuf = strToBuf;
|
||||||
_idxToBuf = idxToBuf;
|
_idxToBuf = idxToBuf;
|
||||||
*/
|
|
||||||
|
|
||||||
_buffers = new .();
|
|
||||||
_strToBuf = new .();
|
|
||||||
_idxToBuf = new .();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public ~this()
|
public ~this()
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace GlitchyEngine.Renderer
|
|||||||
{
|
{
|
||||||
public class PixelShader : Shader
|
public class PixelShader : Shader
|
||||||
{
|
{
|
||||||
|
[AllowAppend]
|
||||||
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
||||||
: base(context, source, entryPoint, macros) { }
|
: base(context, source, entryPoint, macros) { }
|
||||||
|
|
||||||
|
|||||||
@@ -23,15 +23,18 @@ namespace GlitchyEngine.Renderer
|
|||||||
{
|
{
|
||||||
protected GraphicsContext _context;
|
protected GraphicsContext _context;
|
||||||
|
|
||||||
protected BufferCollection _buffers ~ delete _;
|
protected BufferCollection _buffers ~ delete:append _;
|
||||||
|
|
||||||
public GraphicsContext Context => _context;
|
public GraphicsContext Context => _context;
|
||||||
|
|
||||||
public BufferCollection Buffers => _buffers;
|
public BufferCollection Buffers => _buffers;
|
||||||
|
|
||||||
|
[AllowAppend]
|
||||||
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
||||||
{
|
{
|
||||||
_buffers = new BufferCollection();
|
let buffers = append BufferCollection();
|
||||||
|
_buffers = buffers;
|
||||||
|
|
||||||
_context = context;
|
_context = context;
|
||||||
CompileFromSource(source, entryPoint);
|
CompileFromSource(source, entryPoint);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ namespace GlitchyEngine.Renderer
|
|||||||
{
|
{
|
||||||
public class VertexShader : Shader
|
public class VertexShader : Shader
|
||||||
{
|
{
|
||||||
|
[AllowAppend]
|
||||||
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
public this(GraphicsContext context, String source, String entryPoint, ShaderDefine[] macros = null)
|
||||||
: base(context, source, entryPoint, macros) { }
|
: base(context, source, entryPoint, macros) { }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user