Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #8084: DesktopGL GraphicsDevice.ScissorRectangle Fix #8284

Merged
merged 3 commits into from May 18, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 7 additions & 0 deletions MonoGame.Framework/Platform/SDL/SDLGameWindow.cs
Expand Up @@ -299,10 +299,17 @@ public void ClientResize(int width, int height)
_game.GraphicsDevice.PresentationParameters.BackBufferHeight == height) {
return;
}

Viewport prevViewport = _game.GraphicsDevice.Viewport;
Rectangle prevScissorRect = _game.GraphicsDevice.ScissorRectangle;

_game.GraphicsDevice.PresentationParameters.BackBufferWidth = width;
_game.GraphicsDevice.PresentationParameters.BackBufferHeight = height;
_game.GraphicsDevice.Viewport = new Viewport(0, 0, width, height);

if (_game.GraphicsDevice.RasterizerState.ScissorTestEnable && prevScissorRect == prevViewport.Bounds)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A question, if the check is only on the PREVIOUS viewport bounds (and not the updated version in lines 306-308), then why is this change AFTER the viewport update?

  1. If the Scissor check is based on the PREVIOUS viewport bounds, then this condition should be moved to line 305.
  2. If the Scissor check is AFTER the update to the viewport bounds, should this not be validating against the NEW and not the previous bounds?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking over it, it should have been at line 305 as you stated. Just pushed an update.

_game.GraphicsDevice.ScissorRectangle = new Rectangle(0, 0, width, height);

Sdl.Window.GetSize(Handle, out _width, out _height);

OnClientSizeChanged();
Expand Down