Skip to content

fix(texture): only emit MSAA resolve attachment when sample_count > 1 - #1052

Merged
not-fl3 merged 1 commit into
not-fl3:masterfrom
benface:fix-msaa-resolve-guard
Jun 15, 2026
Merged

fix(texture): only emit MSAA resolve attachment when sample_count > 1#1052
not-fl3 merged 1 commit into
not-fl3:masterfrom
benface:fix-msaa-resolve-guard

Conversation

@benface

@benface benface commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

render_target_ex was calling new_render_pass_mrt with resolve_img: Some(...) whenever params.sample_count != 0. Because RenderTargetParams::default().sample_count == 1, that branch fires for plain render_target(w, h) calls too — generating a multisample-resolve attachment for what is conceptually a single-sample target.

This was masked on backends that accept a no-op resolve, but the Metal backend rightly rejects it: the multisample-resolve store action requires the color attachment's texture sampleCount to be > 1. With miniquad's Metal new_render_pass_mrt resolve_img path now wired (not-fl3/miniquad#638), Metal validation fires on the first render_target() of any macroquad app:

RenderPass Descriptor Validation
MTLRenderPassAttachmentDescriptor resolveTexture must have storeAction of MTLStoreActionMultisampleResolve...
texture sampleCount is 1, but must be > 1 when using a resolveTexture

Gate the resolve allocation on sample_count > 1 so plain render_target() produces a single-attachment pass on every backend.

`render_target_ex` was calling `new_render_pass_mrt` with
`resolve_img: Some(...)` whenever `params.sample_count != 0`. Because
`RenderTargetParams::default().sample_count == 1`, that branch fired
for plain `render_target(w, h)` calls too — generating a resolve
attachment for what is conceptually a single-sample target.

This was masked on backends that accept a no-op resolve, but the Metal
backend rightly rejects it: the multisample-resolve store action
requires the color attachment's texture sampleCount to be > 1.

Gate the resolve allocation on `sample_count > 1` so plain
`render_target()` produces a single-attachment pass on every backend.
@benface
benface force-pushed the fix-msaa-resolve-guard branch from 5b7a330 to f6c8f04 Compare June 13, 2026 15:05
@not-fl3

not-fl3 commented Jun 15, 2026

Copy link
Copy Markdown
Owner

Thanks for PR!

@not-fl3
not-fl3 merged commit 92279a7 into not-fl3:master Jun 15, 2026
6 checks passed
@benface
benface deleted the fix-msaa-resolve-guard branch July 23, 2026 19:41
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

Successfully merging this pull request may close these issues.

2 participants