2018-06-24 01:39:25 +01:00
|
|
|
using System;
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
{
|
|
|
|
public class OGLRenderer : IGalRenderer
|
|
|
|
{
|
2018-08-10 05:09:40 +01:00
|
|
|
public IGalConstBuffer Buffer { get; private set; }
|
2018-06-24 01:39:25 +01:00
|
|
|
|
|
|
|
public IGalFrameBuffer FrameBuffer { get; private set; }
|
|
|
|
|
|
|
|
public IGalRasterizer Rasterizer { get; private set; }
|
|
|
|
|
|
|
|
public IGalShader Shader { get; private set; }
|
|
|
|
|
2018-08-10 05:09:40 +01:00
|
|
|
public IGalPipeline Pipeline { get; private set; }
|
|
|
|
|
2018-06-24 01:39:25 +01:00
|
|
|
public IGalTexture Texture { get; private set; }
|
|
|
|
|
|
|
|
private ConcurrentQueue<Action> ActionsQueue;
|
|
|
|
|
|
|
|
public OGLRenderer()
|
|
|
|
{
|
2018-08-10 05:09:40 +01:00
|
|
|
Buffer = new OGLConstBuffer();
|
2018-06-24 01:39:25 +01:00
|
|
|
|
|
|
|
FrameBuffer = new OGLFrameBuffer();
|
|
|
|
|
|
|
|
Rasterizer = new OGLRasterizer();
|
|
|
|
|
2018-08-10 05:09:40 +01:00
|
|
|
Shader = new OGLShader(Buffer as OGLConstBuffer);
|
|
|
|
|
|
|
|
Pipeline = new OGLPipeline(Buffer as OGLConstBuffer, Rasterizer as OGLRasterizer, Shader as OGLShader);
|
2018-06-24 01:39:25 +01:00
|
|
|
|
|
|
|
Texture = new OGLTexture();
|
|
|
|
|
|
|
|
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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|