2018-06-24 02:39:25 +02:00
|
|
|
using System;
|
|
|
|
using System.Collections.Concurrent;
|
|
|
|
|
|
|
|
namespace Ryujinx.Graphics.Gal.OpenGL
|
|
|
|
{
|
|
|
|
public class OGLRenderer : IGalRenderer
|
|
|
|
{
|
2018-08-10 06:09:40 +02:00
|
|
|
public IGalConstBuffer Buffer { get; private set; }
|
2018-06-24 02:39:25 +02:00
|
|
|
|
2018-09-08 19:51:50 +02:00
|
|
|
public IGalRenderTarget RenderTarget { get; private set; }
|
2018-06-24 02:39:25 +02:00
|
|
|
|
|
|
|
public IGalRasterizer Rasterizer { get; private set; }
|
|
|
|
|
|
|
|
public IGalShader Shader { get; private set; }
|
|
|
|
|
2018-08-10 06:09:40 +02:00
|
|
|
public IGalPipeline Pipeline { get; private set; }
|
|
|
|
|
2018-06-24 02:39:25 +02:00
|
|
|
public IGalTexture Texture { get; private set; }
|
|
|
|
|
|
|
|
private ConcurrentQueue<Action> ActionsQueue;
|
|
|
|
|
|
|
|
public OGLRenderer()
|
|
|
|
{
|
2018-08-10 06:09:40 +02:00
|
|
|
Buffer = new OGLConstBuffer();
|
2018-06-24 02:39:25 +02:00
|
|
|
|
2018-08-20 03:25:26 +02:00
|
|
|
Texture = new OGLTexture();
|
|
|
|
|
2018-09-08 19:51:50 +02:00
|
|
|
RenderTarget = new OGLRenderTarget(Texture as OGLTexture);
|
2018-06-24 02:39:25 +02:00
|
|
|
|
|
|
|
Rasterizer = new OGLRasterizer();
|
|
|
|
|
2018-08-10 06:09:40 +02:00
|
|
|
Shader = new OGLShader(Buffer as OGLConstBuffer);
|
|
|
|
|
2018-11-29 00:09:44 +01:00
|
|
|
Pipeline = new OGLPipeline(
|
|
|
|
Buffer as OGLConstBuffer,
|
|
|
|
RenderTarget as OGLRenderTarget,
|
|
|
|
Rasterizer as OGLRasterizer,
|
|
|
|
Shader as OGLShader);
|
2018-06-24 02:39:25 +02: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();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|