Skip to content

[Impeller] Refuse a Vulkan render target with no color attachment - #192536

Draft
dzolotov wants to merge 1 commit into
flutter:masterfrom
pleiondev:fix/vulkan-render-pass-null-color-attachment-main
Draft

dzolotov wants to merge 1 commit into
flutter:masterfrom
pleiondev:fix/vulkan-render-pass-null-color-attachment-main

Conversation

@dzolotov

@dzolotov dzolotov commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

RenderTarget::IsValid() states that a render target must have a color
attachment at index zero, and RenderPassMTL checks it in its constructor.
RenderPassVK did not: it read color attachment zero — which
GetColorAttachment(0) hands back default-constructed, with a null texture,
when the target has none — and dereferenced that texture while working out the
pass's sample count.

A depth-only render target is how an application reaches this from
flutter_gpu; a shadow map is the ordinary case. On Metal such a target produces
Failed to begin RenderPass, which Dart can catch; on Vulkan the process died
with SIGSEGV inside libflutter, with nothing reported to Dart.

This adds the same check the Metal backend makes, so the two backends refuse
the target the same way.

Where it was verified. At engine revision
5f77625673248ee5846fbcaf5d3e1a3878386fd7 — the one the 3.47.0 SDK ships —
because that is the engine the crashing device runs. No commit between that
revision and main touches either file, so the change applies to main
unchanged; CI is what checks it there.

Verification. The added test, RenderPassVK.RefusesATargetWithNoColorAttachment,
segfaults on the unpatched engine and passes with the change
(out/host_debug/impeller_unittests --gtest_filter='RenderPassVK.*', 3/3). On
device — Samsung Galaxy A55, Android 16, Impeller Vulkan — a Flutter app that
begins such a pass is killed before the change and receives
Exception: Failed to begin RenderPass after it, matching macOS/Metal.

Fixes #192535

Pre-launch Checklist

@github-actions

Copy link
Copy Markdown

This pull request targets the main branch, but the primary branch for this repository is master.

Please change the base branch of this pull request to master.

See: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/changing-the-base-branch-of-a-pull-request

@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. e: impeller Impeller rendering backend issues and features requests labels Sep 10, 2026
@google-cla

google-cla Bot commented Sep 10, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@dzolotov
dzolotov changed the base branch from main to master September 10, 2026 13:10
`RenderTarget::IsValid()` states that a render target must have a color
attachment at index zero, and `RenderPassMTL` checks it in its constructor.
`RenderPassVK` did not. It read color attachment zero — which
`GetColorAttachment(0)` hands back default-constructed, with a null texture,
when the target has none — and dereferenced that texture while working out the
pass's sample count.

A depth-only render target is how an application reaches this: a shadow map
drawn through flutter_gpu is the ordinary case. On Metal the same program gets
`Failed to begin RenderPass` and can carry on; on Vulkan the process died with
SIGSEGV inside libflutter, with nothing reported to Dart and nothing for the
caller to catch.

This adds the same check the Metal backend makes, so both refuse such a target
the same way, and a regression test that crashes without it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

e: impeller Impeller rendering backend issues and features requests engine flutter/engine related. See also e: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Impeller/flutter_gpu] A render target with only a depth attachment crashes on Vulkan; Metal throws

1 participant