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

SDL_RenderClear inconsistency with ClipRect #2177

Closed
SDLBugzilla opened this issue Feb 11, 2021 · 0 comments
Closed

SDL_RenderClear inconsistency with ClipRect #2177

SDLBugzilla opened this issue Feb 11, 2021 · 0 comments

Comments

@SDLBugzilla
Copy link
Collaborator

This bug report was migrated from our old Bugzilla tracker.

These attachments are available in the static archive:

Reported in version: HG 2.0
Reported for operating system, platform: All, All

Comments on the original bug report:

On 2016-05-26 16:00:37 +0000, Simon Hug wrote:

Created attachment 2465
Test case for SDL_RenderClear and ClipRect.

The description of the SDL_RenderClear function in the SDL_render.h header says the following:

"This function clears the entire rendering target, ignoring the viewport."

The word "entire" implies that the clipping rectangle set with SDL_RenderSetClipRect also gets ignored. This is left somewhat ambiguous if only the viewport is mentioned. Minor thing, but let's see what the implementations actually do.

The software renderer ignores the clipping rectangle when clearing. It even has a comment on this: /* By definition the clear ignores the clip rect */

Most other render drivers (opengl, opengles, opengles2, direct3d, and psp [I assume. Can't test it.]) use the scissor test for the ClipRect and don't disable it when clearing. Clearing will only happen within the clipping rectangle for these drivers.

An exception is direct3d11 which uses a clear function that ignores the scissor test.

Attached is a test case that shows a green window when the ClipRect is ignored or a green square on a blue background when ClipRect affects the clearing. The lower half of the window is a target texture or red if unsupported.

On 2016-06-16 11:37:29 +0000, Simon Hug wrote:

Created attachment 2497
Patch that disables the scissor test for various renderers when they clear the render target.

The attached patch changes the code around the clear operation of the opengl, opengles, opengles2, and direct3d renderers to disable and re-enable the scissor test if clipping is active. It also resolves the ambiguity in the comment of SDL_RenderClear in the SDL_render.h header by clearly stating that the clear rectangle gets ignored.

On 2016-10-01 18:46:52 +0000, Sam Lantinga wrote:

Fixed, thanks!
https://hg.libsdl.org/SDL/rev/d78b187845d6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant