Code cleanup
This commit is contained in:
parent
7acfc95254
commit
6e48aa253c
4 changed files with 20 additions and 29 deletions
|
@ -1,7 +1,6 @@
|
|||
using OpenTK;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Ryujinx.Graphics.Gal.OpenGL
|
||||
{
|
||||
|
@ -56,12 +55,17 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
private int CropRight;
|
||||
private int CropBottom;
|
||||
|
||||
//This framebuffer is used to attach guest rendertargets,
|
||||
//think of it as a dummy OpenGL VAO
|
||||
private int DummyFrameBuffer;
|
||||
|
||||
//These framebuffers are used to blit images
|
||||
private int SrcFb;
|
||||
private int DstFb;
|
||||
|
||||
//Holds current attachments, used to avoid unnecesary calls to OpenGL
|
||||
private int[] ColorAttachments;
|
||||
|
||||
private int DepthAttachment;
|
||||
private int StencilAttachment;
|
||||
|
||||
|
@ -92,20 +96,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
Attach(ref ColorAttachments[Attachment], 0, FramebufferAttachment.ColorAttachment0 + Attachment);
|
||||
}
|
||||
|
||||
private void Attach(ref int OldHandle, int NewHandle, FramebufferAttachment FbAttachment)
|
||||
{
|
||||
if (OldHandle != NewHandle)
|
||||
{
|
||||
GL.FramebufferTexture(
|
||||
FramebufferTarget.DrawFramebuffer,
|
||||
FbAttachment,
|
||||
NewHandle,
|
||||
0);
|
||||
|
||||
OldHandle = NewHandle;
|
||||
}
|
||||
}
|
||||
|
||||
public void BindZeta(long Key)
|
||||
{
|
||||
|
@ -436,6 +426,20 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
GL.DrawBuffers(8, DrawBuffers);
|
||||
}
|
||||
|
||||
private void Attach(ref int OldHandle, int NewHandle, FramebufferAttachment FbAttachment)
|
||||
{
|
||||
if (OldHandle != NewHandle)
|
||||
{
|
||||
GL.FramebufferTexture(
|
||||
FramebufferTarget.DrawFramebuffer,
|
||||
FbAttachment,
|
||||
NewHandle,
|
||||
0);
|
||||
|
||||
OldHandle = NewHandle;
|
||||
}
|
||||
}
|
||||
|
||||
private void CopyTextures(
|
||||
int SrcX0,
|
||||
int SrcY0,
|
||||
|
|
|
@ -72,8 +72,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
|
||||
(PixelInternalFormat InternalFormat, PixelFormat Format, PixelType Type) = OGLEnumConverter.GetImageFormat(Image.Format);
|
||||
|
||||
GL.GetError();
|
||||
|
||||
GL.TexImage2D(
|
||||
TextureTarget.Texture2D,
|
||||
Level,
|
||||
|
@ -84,11 +82,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
Format,
|
||||
Type,
|
||||
Data);
|
||||
|
||||
if (GL.GetError() != ErrorCode.NoError)
|
||||
{
|
||||
throw new InvalidOperationException($"{InternalFormat} {Format} {Type}");
|
||||
}
|
||||
}
|
||||
|
||||
int SwizzleR = (int)OGLEnumConverter.GetTextureSwizzle(Image.XSource);
|
||||
|
|
|
@ -89,8 +89,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
const int Level = 0;
|
||||
const int Border = 0;
|
||||
|
||||
GL.GetError();
|
||||
|
||||
GL.TexImage2D(
|
||||
TextureTarget.Texture2D,
|
||||
Level,
|
||||
|
@ -102,11 +100,6 @@ namespace Ryujinx.Graphics.Gal.OpenGL
|
|||
PixelType,
|
||||
IntPtr.Zero);
|
||||
|
||||
if (GL.GetError() != ErrorCode.NoError)
|
||||
{
|
||||
throw new InvalidOperationException($"{InternalFormat} {PixelFormat} {PixelType}");
|
||||
}
|
||||
|
||||
if (Initialized)
|
||||
{
|
||||
GL.BindBuffer(BufferTarget.PixelPackBuffer, 0);
|
||||
|
|
|
@ -102,6 +102,7 @@ namespace Ryujinx.HLE.Gpu.Engines
|
|||
SetAlphaBlending(State);
|
||||
SetPrimitiveRestart(State);
|
||||
|
||||
//Enabling multiple framebuffer attachments cause graphics reggresions
|
||||
SetFrameBuffer(Vmm, 0);
|
||||
SetZeta(Vmm);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue