Skip to content

[Flutter GPU] Expose the maximum render target size - #196640

Merged
auto-submit[bot] merged 4 commits into
flutter:masterfrom
spydon:flutter-gpu-max-render-target-size
Nov 23, 2026
Merged

auto-submit[bot] merged 4 commits into
flutter:masterfrom
spydon:flutter-gpu-max-render-target-size

Conversation

@spydon

@spydon spydon commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Adds GpuContext.maxRenderTargetWidth and GpuContext.maxRenderTargetHeight, which report the smaller of Capabilities::GetMaximumRenderPassAttachmentSize() and Allocator::GetMaxTextureSizeSupported(), so the size is both attachable and creatable:

  • Vulkan: maxFramebufferWidth and maxFramebufferHeight, bounded by maxImageDimension2D.
  • OpenGL ES: GL_MAX_TEXTURE_SIZE.
  • Metal: the feature set table's maximum texture size.

OpenGL ES only guarantees 2048, so an app that renders into large textures (an atlas, for example) has no way to know how far it can go, and has to hard-code a conservative size or find out by failing.

Both getters share one native, InternalFlutterGpu_Context_GetMaximumRenderTargetSize, which takes the dimension, as the compute getters do.

Testing

testing/dart/gpu_test.dart gets a test that checks both sizes are at least 2048, then creates a texture as wide as maxRenderTargetWidth and renders a pass into it. On Linux it passes with flutter_tester (Vulkan, SwiftShader) and flutter_tester_opengles, which both report 8192 x 8192.

Fixes #196642

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Adds GpuContext.maxRenderTargetWidth and maxRenderTargetHeight, from
Capabilities::GetMaximumRenderPassAttachmentSize: maxFramebufferWidth and
maxFramebufferHeight on Vulkan, GL_MAX_TEXTURE_SIZE on OpenGL ES, and the
feature set table's maximum texture size on Metal. OpenGL ES only guarantees
2048, so apps that render into large textures had to hard-code a size.
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. flutter-gpu team-fluttergpu Owned by Flutter GPU team labels Nov 15, 2026
@github-project-automation github-project-automation Bot moved this to 🤔 Needs Triage in Flutter GPU Nov 15, 2026
@spydon
spydon marked this pull request as ready for review November 15, 2026 20:36

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds support for retrieving the maximum render target width and height from the GPU context, exposing these limits in Dart and adding a test to verify they report usable sizes. The review feedback suggests guarding against negative dimensions when casting signed impeller::ISize values to uint32_t in the C++ implementation, and expanding the test coverage to also validate rendering with a maximum height texture.

Comment thread engine/src/flutter/lib/gpu/context.cc Resolved
@bdero bdero moved this from 🤔 Needs Triage to 💡 Features in Flutter GPU Nov 16, 2026

@bdero bdero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for this, the API shape and naming look right to me. One change I'd like before landing, the reported size should also respect the texture creation limit (inline). The rest are small wording nits. Agreed that the negative-value guard isn't needed.

Comment thread engine/src/flutter/lib/gpu/context.cc Resolved
Comment on lines +107 to +108
/// The widest texture, in pixels, that a render pass can attach (see
/// [ColorAttachment.texture] and [DepthStencilAttachment.texture]).

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

On GLES a render-target-only depth/stencil texture (and MSAA color without implicit resolve) is a renderbuffer, so it is bounded by GL_MAX_RENDERBUFFER_SIZE rather than GL_MAX_TEXTURE_SIZE. CapabilitiesGLES already reads that and GL_MAX_VIEWPORT_DIMS but GetMaximumRenderPassAttachmentSize ignores both. Fine as a follow-up in Impeller, but worth a TODO since this doc names DepthStencilAttachment.texture.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sounds good, I can do the follow-up once this has merged (since you can't stack branches when you're on a fork).

@gaaclarke
gaaclarke self-requested a review November 16, 2026 21:57
@spydon
spydon requested a review from bdero November 16, 2026 22:16
@gaaclarke
gaaclarke removed their request for review November 17, 2026 00:12
@bdero bdero added the CICD Run CI/CD label Nov 17, 2026

@bdero bdero left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@andywolff andywolff left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM too, thanks

@gaaclarke gaaclarke added the autosubmit Merge PR when tree becomes green via auto submit App label Nov 21, 2026
@flutter-dashboard flutter-dashboard Bot removed the CICD Run CI/CD label Nov 21, 2026
@auto-submit auto-submit Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 21, 2026
@auto-submit

auto-submit Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

autosubmit label was removed for flutter/flutter/196640, because - The status or check suite Google testing has failed. Please fix the issues identified (or deflake) before re-applying this label.

@gaaclarke gaaclarke added CICD Run CI/CD autosubmit Merge PR when tree becomes green via auto submit App labels Nov 23, 2026
@auto-submit
auto-submit Bot added this pull request to the merge queue Nov 23, 2026
Merged via the queue into flutter:master with commit 2981953 Nov 23, 2026
26 checks passed
@github-project-automation github-project-automation Bot moved this from 💡 Features to ✅ Done in Flutter GPU Nov 23, 2026
@flutter-dashboard flutter-dashboard Bot removed the autosubmit Merge PR when tree becomes green via auto submit App label Nov 23, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Nov 24, 2026
flutter/flutter@98744d3...b75c5b3

2026-11-24 [email protected] Roll Skia from 89e364b13f05 to 2140958ee284 (3 revisions) (flutter/flutter#197287)
2026-11-24 [email protected] Roll Skia from f82f3efc0461 to 89e364b13f05 (6 revisions) (flutter/flutter#197284)
2026-11-24 [email protected] Roll Dart SDK from 10aef26c73f5 to 87f515c52de9 (1 revision) (flutter/flutter#197279)
2026-11-24 [email protected] iOS: Drive platform view tests through IOSExternalViewEmbedder (flutter/flutter#197263)
2026-11-24 [email protected] Fix null check crash in flushSemantics from a stale ancestor geometry cache (flutter/flutter#192724)
2026-11-24 [email protected] [Impeller] Fix Windows build with MSVC 14.52: std::modf is [[nodiscard]] (flutter/flutter#193413)
2026-11-24 [email protected] [web] Preserve fill rules from path operations (flutter/flutter#195971)
2026-11-24 [email protected] Regenerate tool_test_durations.json (flutter/flutter#197261)
2026-11-24 [email protected] Roll Skia from 694af434cadd to f82f3efc0461 (4 revisions) (flutter/flutter#197258)
2026-11-24 [email protected] Increase number of 'Linux tool_integration_tests' subshards (flutter/flutter#197262)
2026-11-24 [email protected] Run tool_integration_tests app tests in one subshard instead of all of them (flutter/flutter#197264)
2026-11-24 [email protected] [flutter_tools] Pass featureFlags in localizations_test.dart (flutter/flutter#197269)
2026-11-23 [email protected] Fix Orca flat review in Linux accessibility (flutter/flutter#196338)
2026-11-23 [email protected] [flutter tools] Pass --client-id=flutter-analyze to the analysis server (flutter/flutter#197227)
2026-11-23 [email protected] [Flutter GPU] Expose the maximum render target size (flutter/flutter#196640)
2026-11-23 [email protected] iOS: Don't clear raster thread state in platform views reset (flutter/flutter#197025)
2026-11-23 [email protected] iOS: Composite platform views from layers in tests (flutter/flutter#197021)
2026-11-23 [email protected] [flutter_tools] Harden extension diagnostics models and RPC failure handling (flutter/flutter#196233)
2026-11-23 [email protected] [flutter_tools] Support standalone UI packages in gen-l10n (flutter/flutter#194500)
2026-11-23 [email protected] [flutter_tools] Consolidate ToolDependencies.bootstrap builders and require extension managers (flutter/flutter#196388)
2026-11-23 [email protected] Roll Skia from 31b19bdc8195 to 694af434cadd (2 revisions) (flutter/flutter#197239)
2026-11-23 [email protected] Roll Dart SDK from df632229552e to 10aef26c73f5 (1 revision) (flutter/flutter#197234)
2026-11-23 [email protected] [macOS] Fix back buffer cache returning a wrong-size surface (Impeller null deref in Canvas::SetupRenderPass) (flutter/flutter#192522)
2026-11-23 [email protected] Add Settings::frame_built_callback for UI frame build timings (flutter/flutter#197213)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages
Please CC [email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Packages: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. flutter-gpu team-fluttergpu Owned by Flutter GPU team

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

[Flutter GPU] Expose the maximum render target size on GpuContext

4 participants