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