simplify IGL 1: Combine Clear and SetClearColor, remove support for non-color buffers (not supported by GDI+, never actually used)
This commit is contained in:
parent
978c396b82
commit
64abeddc2b
|
@ -19,14 +19,9 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
EDispMethod DispMethodEnum { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Clears the specified buffer parts
|
||||
/// Clears the color buffer with the specified color
|
||||
/// </summary>
|
||||
void Clear(ClearBufferMask mask);
|
||||
|
||||
/// <summary>
|
||||
/// Sets the current clear color
|
||||
/// </summary>
|
||||
void SetClearColor(Color color);
|
||||
void ClearColor(Color color);
|
||||
|
||||
/// <summary>
|
||||
/// compile a fragment shader. This is the simplified method. A more complex method may be added later which will accept multiple sources and preprocessor definitions independently
|
||||
|
@ -88,11 +83,6 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// </summary>
|
||||
void SetPipelineUniform(PipelineUniform uniform, bool value);
|
||||
|
||||
/// <summary>
|
||||
/// Binds array data for use with the currently-bound pipeline's VertexLayout
|
||||
/// </summary>
|
||||
void BindArrayData(IntPtr pData);
|
||||
|
||||
/// <summary>
|
||||
/// Begins a rendering scene; use before doing any draw calls, as per normal
|
||||
/// </summary>
|
||||
|
@ -103,6 +93,11 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
/// </summary>
|
||||
void EndScene();
|
||||
|
||||
/// <summary>
|
||||
/// Binds array data for use with the currently-bound pipeline's VertexLayout
|
||||
/// </summary>
|
||||
void BindArrayData(IntPtr pData);
|
||||
|
||||
/// <summary>
|
||||
/// Draws based on the currently set pipeline, VertexLayout and ArrayData.
|
||||
/// Count is the VERT COUNT not the primitive count
|
||||
|
|
|
@ -26,14 +26,8 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
MyBufferedGraphicsContext.Dispose();
|
||||
}
|
||||
|
||||
public void Clear(ClearBufferMask mask)
|
||||
{
|
||||
var g = GetCurrentGraphics();
|
||||
if ((mask & ClearBufferMask.ColorBufferBit) != 0)
|
||||
{
|
||||
g.Clear(_currentClearColor);
|
||||
}
|
||||
}
|
||||
public void ClearColor(Color color)
|
||||
=> GetCurrentGraphics().Clear(color);
|
||||
|
||||
public string API => "GDIPLUS";
|
||||
|
||||
|
@ -43,13 +37,6 @@ namespace BizHawk.Bizware.BizwareGL
|
|||
return null;
|
||||
}
|
||||
|
||||
private Color _currentClearColor = Color.Transparent;
|
||||
|
||||
public void SetClearColor(Color color)
|
||||
{
|
||||
_currentClearColor = color;
|
||||
}
|
||||
|
||||
public void BindArrayData(IntPtr pData)
|
||||
{
|
||||
}
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
using System;
|
||||
|
||||
namespace BizHawk.Bizware.BizwareGL
|
||||
{
|
||||
[Flags]
|
||||
public enum ClearBufferMask
|
||||
{
|
||||
None = 0x0000,
|
||||
DepthBufferBit = 0x0100,
|
||||
AccumBufferBit = 0x0200,
|
||||
StencilBufferBit = 0x0400,
|
||||
ColorBufferBit = 0x4000,
|
||||
CoverageBufferBitNv = 0x8000,
|
||||
}
|
||||
}
|
|
@ -182,17 +182,8 @@ namespace BizHawk.Bizware.Graphics
|
|||
}
|
||||
}
|
||||
|
||||
public void Clear(ClearBufferMask mask)
|
||||
{
|
||||
var flags = ClearFlags.None;
|
||||
if ((mask & ClearBufferMask.ColorBufferBit) != 0) flags |= ClearFlags.Target;
|
||||
if ((mask & ClearBufferMask.DepthBufferBit) != 0) flags |= ClearFlags.ZBuffer;
|
||||
if ((mask & ClearBufferMask.StencilBufferBit) != 0) flags |= ClearFlags.Stencil;
|
||||
_device.Clear(flags, _clearColor, 0.0f, 0);
|
||||
}
|
||||
|
||||
public void SetClearColor(Color color)
|
||||
=> _clearColor = color.ToSharpDXColor();
|
||||
public void ClearColor(Color color)
|
||||
=> _device.Clear(ClearFlags.Target, color.ToSharpDXColor(), 0.0f, 0);
|
||||
|
||||
public IBlendState CreateBlendState(
|
||||
BlendingFactorSrc colorSource,
|
||||
|
|
|
@ -19,7 +19,6 @@ using BizHawk.Common;
|
|||
|
||||
using Silk.NET.OpenGL.Legacy;
|
||||
|
||||
using BizClearBufferMask = BizHawk.Bizware.BizwareGL.ClearBufferMask;
|
||||
using BizPrimitiveType = BizHawk.Bizware.BizwareGL.PrimitiveType;
|
||||
|
||||
using BizShader = BizHawk.Bizware.BizwareGL.Shader;
|
||||
|
@ -27,7 +26,6 @@ using BizShader = BizHawk.Bizware.BizwareGL.Shader;
|
|||
using BizTextureMagFilter = BizHawk.Bizware.BizwareGL.TextureMagFilter;
|
||||
using BizTextureMinFilter = BizHawk.Bizware.BizwareGL.TextureMinFilter;
|
||||
|
||||
using GLClearBufferMask = Silk.NET.OpenGL.Legacy.ClearBufferMask;
|
||||
using GLPrimitiveType = Silk.NET.OpenGL.Legacy.PrimitiveType;
|
||||
using GLVertexAttribPointerType = Silk.NET.OpenGL.Legacy.VertexAttribPointerType;
|
||||
|
||||
|
@ -77,14 +75,10 @@ namespace BizHawk.Bizware.Graphics
|
|||
GL.Dispose();
|
||||
}
|
||||
|
||||
public void Clear(BizClearBufferMask mask)
|
||||
{
|
||||
GL.Clear((GLClearBufferMask)mask); // these are the same enum
|
||||
}
|
||||
|
||||
public void SetClearColor(Color color)
|
||||
public void ClearColor(Color color)
|
||||
{
|
||||
GL.ClearColor(color);
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||
}
|
||||
|
||||
public IGraphicsControl Internal_CreateGraphicsControl()
|
||||
|
|
|
@ -910,8 +910,7 @@ namespace BizHawk.Client.Common
|
|||
ActivateGraphicsControlContext();
|
||||
_gl.BeginScene();
|
||||
_gl.BindRenderTarget(null);
|
||||
_gl.SetClearColor(Color.Black);
|
||||
_gl.Clear(ClearBufferMask.ColorBufferBit);
|
||||
_gl.ClearColor(Color.Black);
|
||||
_gl.EndScene();
|
||||
SwapBuffersOfGraphicsControl();
|
||||
}
|
||||
|
|
|
@ -395,8 +395,7 @@ namespace BizHawk.Client.Common.Filters
|
|||
#endif
|
||||
|
||||
// TODO: this could be more efficient (draw only in gap)
|
||||
FilterProgram.GL.SetClearColor(Color.Black);
|
||||
FilterProgram.GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||
FilterProgram.GL.ClearColor(Color.Black);
|
||||
|
||||
FilterProgram.GuiRenderer.Begin(outputSize);
|
||||
FilterProgram.GuiRenderer.SetBlendState(FilterProgram.GL.BlendNoneCopy);
|
||||
|
@ -662,8 +661,7 @@ namespace BizHawk.Client.Common.Filters
|
|||
return;
|
||||
}
|
||||
|
||||
FilterProgram.GL.SetClearColor(Color.FromArgb(BackgroundColor));
|
||||
FilterProgram.GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||
FilterProgram.GL.ClearColor(Color.FromArgb(BackgroundColor));
|
||||
|
||||
FilterProgram.GuiRenderer.Begin(OutputSize.Width, OutputSize.Height);
|
||||
FilterProgram.GuiRenderer.SetBlendState(FilterProgram.GL.BlendNoneCopy);
|
||||
|
|
Loading…
Reference in New Issue