Add support for bigger UBOs, fix sRGB regression, small improvement to the 2D copy engine
This commit is contained in:
parent
b7613dd4b8
commit
7412b5fbcb
6 changed files with 57 additions and 16 deletions
12
Ryujinx.Graphics/Gal/OpenGL/OGLLimit.cs
Normal file
12
Ryujinx.Graphics/Gal/OpenGL/OGLLimit.cs
Normal file
|
@ -0,0 +1,12 @@
|
|||
using OpenTK.Graphics.OpenGL;
|
||||
using System;
|
||||
|
||||
namespace Ryujinx.Graphics.Gal.OpenGL
|
||||
{
|
||||
static class OGLLimit
|
||||
{
|
||||
private static Lazy<int> s_MaxUboSize = new Lazy<int>(() => GL.GetInteger(GetPName.MaxUniformBlockSize));
|
||||
|
||||
public static int MaxUboSize => s_MaxUboSize.Value;
|
||||
}
|
||||
}
|
|
@ -77,17 +77,23 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
private GalPipelineState Old;
|
||||
|
||||
private OGLConstBuffer Buffer;
|
||||
private OGLRasterizer Rasterizer;
|
||||
private OGLShader Shader;
|
||||
private OGLConstBuffer Buffer;
|
||||
private OGLRenderTarget RenderTarget;
|
||||
private OGLRasterizer Rasterizer;
|
||||
private OGLShader Shader;
|
||||
|
||||
private int VaoHandle;
|
||||
|
||||
public OGLPipeline(OGLConstBuffer Buffer, OGLRasterizer Rasterizer, OGLShader Shader)
|
||||
public OGLPipeline(
|
||||
OGLConstBuffer Buffer,
|
||||
OGLRenderTarget RenderTarget,
|
||||
OGLRasterizer Rasterizer,
|
||||
OGLShader Shader)
|
||||
{
|
||||
this.Buffer = Buffer;
|
||||
this.Rasterizer = Rasterizer;
|
||||
this.Shader = Shader;
|
||||
this.Buffer = Buffer;
|
||||
this.RenderTarget = RenderTarget;
|
||||
this.Rasterizer = Rasterizer;
|
||||
this.Shader = Shader;
|
||||
|
||||
//These values match OpenGL's defaults
|
||||
Old = new GalPipelineState
|
||||
|
@ -144,6 +150,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
if (New.FramebufferSrgb != Old.FramebufferSrgb)
|
||||
{
|
||||
Enable(EnableCap.FramebufferSrgb, New.FramebufferSrgb);
|
||||
|
||||
RenderTarget.FramebufferSrgb = New.FramebufferSrgb;
|
||||
}
|
||||
|
||||
if (New.FlipX != Old.FlipX || New.FlipY != Old.FlipY || New.Instance != Old.Instance)
|
||||
|
|
|
@ -90,6 +90,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
private int CopyPBO;
|
||||
|
||||
public bool FramebufferSrgb { get; set; }
|
||||
|
||||
public OGLRenderTarget(OGLTexture Texture)
|
||||
{
|
||||
Attachments = new FrameBufferAttachments();
|
||||
|
@ -363,11 +365,24 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
GL.Clear(ClearBufferMask.ColorBufferBit);
|
||||
|
||||
GL.Disable(EnableCap.FramebufferSrgb);
|
||||
|
||||
GL.BlitFramebuffer(
|
||||
SrcX0, SrcY0, SrcX1, SrcY1,
|
||||
DstX0, DstY0, DstX1, DstY1,
|
||||
SrcX0,
|
||||
SrcY0,
|
||||
SrcX1,
|
||||
SrcY1,
|
||||
DstX0,
|
||||
DstY0,
|
||||
DstX1,
|
||||
DstY1,
|
||||
ClearBufferMask.ColorBufferBit,
|
||||
BlitFramebufferFilter.Linear);
|
||||
|
||||
if (FramebufferSrgb)
|
||||
{
|
||||
GL.Enable(EnableCap.FramebufferSrgb);
|
||||
}
|
||||
}
|
||||
|
||||
public void Copy(
|
||||
|
|
|
@ -31,7 +31,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
Shader = new OGLShader(Buffer as OGLConstBuffer);
|
||||
|
||||
Pipeline = new OGLPipeline(Buffer as OGLConstBuffer, Rasterizer as OGLRasterizer, Shader as OGLShader);
|
||||
Pipeline = new OGLPipeline(Buffer as OGLConstBuffer, RenderTarget as OGLRenderTarget, Rasterizer as OGLRasterizer, Shader as OGLShader);
|
||||
|
||||
ActionsQueue = new ConcurrentQueue<Action>();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using Ryujinx.Graphics.Gal.OpenGL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
|
@ -16,8 +17,6 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
public const int VertexIdAttr = 0x2fc;
|
||||
public const int FaceAttr = 0x3fc;
|
||||
|
||||
public const int MaxUboSize = 1024;
|
||||
|
||||
public const int GlPositionVec4Index = 7;
|
||||
|
||||
public const int PositionOutAttrLocation = 15;
|
||||
|
@ -51,6 +50,8 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
public const string SsyStackName = "ssy_stack";
|
||||
public const string SsyCursorName = "ssy_cursor";
|
||||
|
||||
public static int MaxUboSize => OGLLimit.MaxUboSize / 16;
|
||||
|
||||
private string[] StagePrefixes = new string[] { "vp", "tcp", "tep", "gp", "fp" };
|
||||
|
||||
private string StagePrefix;
|
||||
|
@ -98,8 +99,7 @@ namespace Ryujinx.Graphics.Gal.Shader
|
|||
m_Preds = new Dictionary<int, ShaderDeclInfo>();
|
||||
}
|
||||
|
||||
public GlslDecl(ShaderIrBlock[] Blocks, GalShaderType ShaderType, ShaderHeader Header)
|
||||
: this(ShaderType)
|
||||
public GlslDecl(ShaderIrBlock[] Blocks, GalShaderType ShaderType, ShaderHeader Header) : this(ShaderType)
|
||||
{
|
||||
StagePrefix = StagePrefixes[(int)ShaderType] + "_";
|
||||
|
||||
|
|
|
@ -61,6 +61,9 @@ namespace Ryujinx.Graphics
|
|||
int DstBlitW = ReadRegister(NvGpuEngine2dReg.BlitDstW);
|
||||
int DstBlitH = ReadRegister(NvGpuEngine2dReg.BlitDstH);
|
||||
|
||||
int BlitDuDx = ReadRegister(NvGpuEngine2dReg.BlitDuDxInt);
|
||||
int BlitDvDy = ReadRegister(NvGpuEngine2dReg.BlitDvDyInt);
|
||||
|
||||
int SrcBlitX = ReadRegister(NvGpuEngine2dReg.BlitSrcXInt);
|
||||
int SrcBlitY = ReadRegister(NvGpuEngine2dReg.BlitSrcYInt);
|
||||
|
||||
|
@ -99,13 +102,16 @@ namespace Ryujinx.Graphics
|
|||
Gpu.ResourceManager.SendTexture(Vmm, SrcKey, SrcTexture);
|
||||
Gpu.ResourceManager.SendTexture(Vmm, DstKey, DstTexture);
|
||||
|
||||
int SrcBlitX2 = SrcBlitX + DstBlitW * BlitDuDx;
|
||||
int SrcBlitY2 = SrcBlitY + DstBlitH * BlitDvDy;
|
||||
|
||||
Gpu.Renderer.RenderTarget.Copy(
|
||||
SrcKey,
|
||||
DstKey,
|
||||
SrcBlitX,
|
||||
SrcBlitY,
|
||||
SrcBlitX + DstBlitW,
|
||||
SrcBlitY + DstBlitH,
|
||||
SrcBlitX2,
|
||||
SrcBlitY2,
|
||||
DstBlitX,
|
||||
DstBlitY,
|
||||
DstBlitX + DstBlitW,
|
||||
|
|
Loading…
Add table
Reference in a new issue