Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

[Impeller] GLES backend: Map the viewport and scissor rect to GL framebuffer coords #33706

Merged
merged 1 commit into from
May 31, 2022

Conversation

bdero
Copy link
Member

@bdero bdero commented May 31, 2022

The viewport and scissor are specified in framebuffer space. We're standardizing around Metal framebuffer coords (top left origin), and so we need to convert the viewport/scissor to GL framebuffer coords (bottom left origin) to achieve like behavior across backends.

This fixes the clipping problem visible in the imgui backend on GLES.

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

LGTM on the fix. But I think the render target size should be the same as the color attachment size in the pass data. We could probably get away with not needing an extra capture.

@@ -501,9 +508,11 @@ bool RenderPassGLES::EncodeCommands(
}

return reactor_->AddOperation([pass_data, transients_allocator,
commands = commands_](const auto& reactor) {
commands = commands_,
target_size = GetRenderTargetSize()](
Copy link
Member

Choose a reason for hiding this comment

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

Isn't this the same as pass_data->color_attachments size? I don't think there is a need to add another capture.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, good point. Done.

@bdero bdero force-pushed the bdero/gles-viewport-coords branch from a30892a to 4080253 Compare May 31, 2022 08:51
@bdero bdero merged commit 714935e into flutter:main May 31, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 31, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 31, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 31, 2022
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 31, 2022
houhuayong pushed a commit to houhuayong/engine that referenced this pull request Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants