mirror of
https://github.com/aharabada/glitchy-engine-beef.git
synced 2026-09-05 21:01:52 +00:00
Use static D3D11 device and context
This commit is contained in:
@@ -1,6 +1,10 @@
|
||||
#if GE_D3D11
|
||||
|
||||
using GlitchyEngine.Math;
|
||||
using GlitchyEngine.Platform.DX11;
|
||||
|
||||
using internal GlitchyEngine.Renderer;
|
||||
using internal GlitchyEngine.Platform.DX11;
|
||||
|
||||
namespace GlitchyEngine.Renderer
|
||||
{
|
||||
@@ -8,12 +12,12 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
extension RendererAPI
|
||||
{
|
||||
private GraphicsContext _context;
|
||||
private GraphicsContext _context ~ _?.ReleaseRef();
|
||||
|
||||
public GraphicsContext Context
|
||||
{
|
||||
get => _context;
|
||||
set => _context = value;
|
||||
set => SetReference!(_context, value);
|
||||
}
|
||||
|
||||
public static override API Api => .D3D11;
|
||||
@@ -30,12 +34,12 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
public override void Clear(DepthStencilTarget target, float depthValue, uint8 stencilValue, DepthStencilClearFlag clearFlags)
|
||||
{
|
||||
_context.nativeContext.ClearDepthStencilView(target.nativeView, (.)clearFlags, depthValue, stencilValue);
|
||||
NativeContext.ClearDepthStencilView(target.nativeView, (.)clearFlags, depthValue, stencilValue);
|
||||
}
|
||||
|
||||
public override void Clear(RenderTarget2D renderTarget, float depthValue, uint8 stencilValue, DepthStencilClearFlag clearFlags)
|
||||
{
|
||||
_context.nativeContext.ClearDepthStencilView(renderTarget._depthStenilTarget.nativeView, (.)clearFlags, depthValue, stencilValue);
|
||||
NativeContext.ClearDepthStencilView(renderTarget._depthStenilTarget.nativeView, (.)clearFlags, depthValue, stencilValue);
|
||||
}
|
||||
|
||||
public override void DrawIndexed(GeometryBinding geometry)
|
||||
@@ -48,7 +52,7 @@ namespace GlitchyEngine.Renderer
|
||||
|
||||
public override void DrawIndexedInstanced(GeometryBinding geometry)
|
||||
{
|
||||
_context.nativeContext.DrawIndexedInstanced(geometry.IndexCount, geometry.InstanceCount, geometry.IndexByteOffset, 0, 0);
|
||||
NativeContext.DrawIndexedInstanced(geometry.IndexCount, geometry.InstanceCount, geometry.IndexByteOffset, 0, 0);
|
||||
}
|
||||
|
||||
public override void SetViewport(Viewport viewport)
|
||||
@@ -57,3 +61,5 @@ namespace GlitchyEngine.Renderer
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user