2018-06-23 17:39:25 -07:00
|
|
|
using System;
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
{
|
|
|
|
public class OGLRenderer : IGalRenderer
|
|
|
|
{
|
2018-08-09 21:09:40 -07:00
|
|
|
public IGalConstBuffer Buffer { get; private set; }
|
2018-06-23 17:39:25 -07:00
|
|
|
|
2018-09-08 10:51:50 -07:00
|
|
|
public IGalRenderTarget RenderTarget { get; private set; }
|
2018-06-23 17:39:25 -07:00
|
|
|
|
|
|
|
public IGalRasterizer Rasterizer { get; private set; }
|
|
|
|
|
|
|
|
public IGalShader Shader { get; private set; }
|
|
|
|
|
2018-08-09 21:09:40 -07:00
|
|
|
public IGalPipeline Pipeline { get; private set; }
|
|
|
|
|
2018-06-23 17:39:25 -07:00
|
|
|
public IGalTexture Texture { get; private set; }
|
|
|
|
|
|
|
|
private ConcurrentQueue<Action> ActionsQueue;
|
|
|
|
|
|
|
|
public OGLRenderer()
|
|
|
|
{
|
2018-08-09 21:09:40 -07:00
|
|
|
Buffer = new OGLConstBuffer();
|
2018-06-23 17:39:25 -07:00
|
|
|
|
2018-08-19 18:25:26 -07:00
|
|
|
Texture = new OGLTexture();
|
|
|
|
|
2018-09-08 10:51:50 -07:00
|
|
|
RenderTarget = new OGLRenderTarget(Texture as OGLTexture);
|
2018-06-23 17:39:25 -07:00
|
|
|
|
|
|
|
Rasterizer = new OGLRasterizer();
|
|
|
|
|
2018-08-09 21:09:40 -07:00
|
|
|
Shader = new OGLShader(Buffer as OGLConstBuffer);
|
|
|
|
|
2018-11-28 15:09:44 -08:00
|
|
|
Pipeline = new OGLPipeline(
|
|
|
|
Buffer as OGLConstBuffer,
|
|
|
|
RenderTarget as OGLRenderTarget,
|
|
|
|
Rasterizer as OGLRasterizer,
|
|
|
|
Shader as OGLShader);
|
2018-06-23 17:39:25 -07:00
|
|
|
|
|
|
|
ActionsQueue = new ConcurrentQueue<Action>();
|
|
|
|
}
|
|
|
|
|
|
|
|
public void QueueAction(Action ActionMthd)
|
|
|
|
{
|
|
|
|
ActionsQueue.Enqueue(ActionMthd);
|
|
|
|
}
|
|
|
|
|
|
|
|
public void RunActions()
|
|
|
|
{
|
|
|
|
int Count = ActionsQueue.Count;
|
|
|
|
|
|
|
|
while (Count-- > 0 && ActionsQueue.TryDequeue(out Action RenderAction))
|
|
|
|
{
|
|
|
|
RenderAction();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|