0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-23 11:35:47 +00:00

[GPU] Set frame buffer texture size to window size

This commit is contained in:
gdkchan 2018-04-14 01:31:27 -03:00
parent 7dd14a4f3a
commit 494e6dfa1e
2 changed files with 16 additions and 4 deletions

View file

@ -55,6 +55,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
private ShaderProgram Shader; private ShaderProgram Shader;
private Rect Viewport; private Rect Viewport;
private Rect Window;
private bool IsInitialized; private bool IsInitialized;
@ -77,6 +78,11 @@ namespace Ryujinx.Graphics.Gal.OpenGL
public void Create(long Tag, int Width, int Height) public void Create(long Tag, int Width, int Height)
{ {
//TODO: We should either use the original frame buffer size,
//or just remove the Width/Height arguments.
Width = Window.Width;
Height = Window.Height;
if (Fbs.TryGetValue(Tag, out FrameBuffer Fb)) if (Fbs.TryGetValue(Tag, out FrameBuffer Fb))
{ {
if (Fb.Width != Width || if (Fb.Width != Width ||
@ -119,6 +125,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.DrawBuffer(DrawBufferMode.ColorAttachment0); GL.DrawBuffer(DrawBufferMode.ColorAttachment0);
GL.Viewport(0, 0, Width, Height);
Fbs.Add(Tag, Fb); Fbs.Add(Tag, Fb);
} }
@ -207,6 +215,8 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.Uniform2(WindowSizeUniformLocation, new Vector2(Width, Height)); GL.Uniform2(WindowSizeUniformLocation, new Vector2(Width, Height));
GL.UseProgram(CurrentProgram); GL.UseProgram(CurrentProgram);
Window = new Rect(0, 0, Width, Height);
} }
public void SetViewport(int X, int Y, int Width, int Height) public void SetViewport(int X, int Y, int Width, int Height)
@ -234,7 +244,7 @@ namespace Ryujinx.Graphics.Gal.OpenGL
GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0); GL.BindFramebuffer(FramebufferTarget.Framebuffer, 0);
GL.Viewport(0, 0, 1280, 720); SetViewport(Window);
GL.Clear( GL.Clear(
ClearBufferMask.ColorBufferBit | ClearBufferMask.ColorBufferBit |
@ -255,10 +265,12 @@ namespace Ryujinx.Graphics.Gal.OpenGL
{ {
GL.Enable(EnableCap.Blend); GL.Enable(EnableCap.Blend);
} }
//GL.Viewport(0, 0, 1280, 720);
} }
} }
private void SetViewport() private void SetViewport(Rect Viewport)
{ {
GL.Viewport( GL.Viewport(
Viewport.X, Viewport.X,

View file

@ -38,6 +38,8 @@ namespace Ryujinx
protected override void OnLoad(EventArgs e) protected override void OnLoad(EventArgs e)
{ {
VSync = VSyncMode.On; VSync = VSyncMode.On;
Renderer.SetWindowSize(Width, Height);
} }
protected override void OnUpdateFrame(FrameEventArgs e) protected override void OnUpdateFrame(FrameEventArgs e)
@ -173,8 +175,6 @@ namespace Ryujinx
{ {
Ns.Statistics.StartSystemFrame(); Ns.Statistics.StartSystemFrame();
GL.Viewport(0, 0, Width, Height);
Title = $"Ryujinx Screen - (Vsync: {VSync} - FPS: {Ns.Statistics.SystemFrameRate:0} - Guest FPS: " + Title = $"Ryujinx Screen - (Vsync: {VSync} - FPS: {Ns.Statistics.SystemFrameRate:0} - Guest FPS: " +
$"{Ns.Statistics.GameFrameRate:0})"; $"{Ns.Statistics.GameFrameRate:0})";