mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Added RefCounting, added ConstantBuffers
This commit is contained in:
@@ -2,24 +2,34 @@ using System;
|
||||
|
||||
namespace GlitchyEngine.Renderer
|
||||
{
|
||||
public class Effect
|
||||
public class Effect : RefCounted
|
||||
{
|
||||
protected GraphicsContext _context;
|
||||
internal VertexShader _vs;
|
||||
internal PixelShader _ps;
|
||||
internal VertexShader _vs ~ _?.ReleaseRef();
|
||||
internal PixelShader _ps ~ _?.ReleaseRef();
|
||||
|
||||
public GraphicsContext Context => _context;
|
||||
|
||||
public VertexShader VertexShader
|
||||
{
|
||||
get => _vs;
|
||||
set => _vs = value;
|
||||
set
|
||||
{
|
||||
_vs?.ReleaseRef();
|
||||
_vs = value;
|
||||
_vs?.AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
public PixelShader PixelShader
|
||||
{
|
||||
get => _ps;
|
||||
set => _ps = value;
|
||||
set
|
||||
{
|
||||
_ps?.ReleaseRef();
|
||||
_ps = value;
|
||||
_ps?.AddRef();
|
||||
}
|
||||
}
|
||||
|
||||
public void Bind(GraphicsContext context)
|
||||
@@ -27,5 +37,18 @@ namespace GlitchyEngine.Renderer
|
||||
context.SetVertexShader(_vs);
|
||||
context.SetPixelShader(_ps);
|
||||
}
|
||||
|
||||
[Obsolete("Will be removed in the future", false)]
|
||||
public this()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public this(String vsPath, String vsEntry, String psPath, String psEntry)
|
||||
{
|
||||
Compile(vsPath, vsEntry, psPath, psEntry);
|
||||
}
|
||||
|
||||
protected extern void Compile(String vsPath, String vsEntry, String psPath, String psEntry);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user