Added Backbuffer to Swapchain + RenderCommand API changes

This commit is contained in:
Simon Lübeß
2021-10-15 22:40:42 +02:00
parent 90e654b750
commit ffafa380ea
14 changed files with 228 additions and 129 deletions
+58 -5
View File
@@ -2,22 +2,75 @@ namespace GlitchyEngine.Renderer
{
public class SwapChain
{
private GraphicsContext _context;
private bool _changed;
private uint32 _width, _height;
private Viewport _backBufferViewport;
public extern GraphicsContext Context {get;}
private DepthStencilFormat _depthStencilFormat = .None;
public RenderTarget2D _backBuffer ~ _?.ReleaseRef();
public GraphicsContext Context => _context;
/**
* Gets or Sets the backbuffers width.
* @remarks @ApplyChanges() needs to be called in order to apply the ganges.
* @remarks @ApplyChanges() needs to be called in order to apply the changes.
*/
public extern uint32 Width {get; set;}
public uint32 Width
{
get => _width;
set
{
if(_width == value)
return;
_width = value;
_changed = true;
}
}
/**
* Gets or Sets the backbuffers height.
* @remarks @ApplyChanges() needs to be called in order to apply the ganges.
* @remarks @ApplyChanges() needs to be called in order to apply the changes.
*/
public extern uint32 Height {get; set;}
public uint32 Height
{
get => _height;
set
{
if(_height == value)
return;
_height = value;
_changed = true;
}
}
public Viewport BackbufferViewport => _backBufferViewport;
/**
* Gets or Sets the format of the depth stencil buffer.
* If set to DepthStencilFormat.None DepthStencilTarget will be null.
* @remarks @ApplyChanges() needs to be called in order to apply the changes.
*/
public DepthStencilFormat DepthStencilFormat
{
get => _depthStencilFormat;
set
{
if(_depthStencilFormat == value)
return;
_depthStencilFormat = value;
_changed = true;
}
}
public RenderTarget2D BackBuffer => _backBuffer;
public extern void Init();