Skip to content

Fix ContrastAdjustment and CrossHatch with multisampled input - #3062

Merged
riccardobl merged 1 commit into
jMonkeyEngine:masterfrom
8Keep:codex/pr-msaa-filter-sampling
Nov 10, 2026
Merged

riccardobl merged 1 commit into
jMonkeyEngine:masterfrom
8Keep:codex/pr-msaa-filter-sampling

Conversation

@8Keep

@8Keep 8Keep commented Nov 9, 2026

Copy link
Copy Markdown
Contributor

Enable FPP multisampling with filters.setNumSamples(4) and add either ContrastAdjustmentFilter or CrossHatchFilter. On desktop OpenGL, FPP supplies a multisample texture, but these two materials declare an ordinary 2D sampler. ContrastAdjustment also bypasses the shared multisample sampling helper.

On the tested NVIDIA driver, ContrastAdjustment renders black and CrossHatch shows only its pattern, losing the scene. Incorrect sampler/texture combinations have undefined output, so other drivers can look different and may be fine.

Use RESOLVE_MS in both materials and getColor() in the contrast shader, matching the existing multisample-aware filters. The existing GLES resolve fallback is unchanged.

Filter Before After
ContrastAdjustment Black output Scene restored
CrossHatch Pattern without scene Scene with hatching

The native regression checks compiled sampler types and single-sample/MSAA framebuffer output for both filters. It fails on upstream and passes on OpenGL and ANGLE.

With FPP multisampling enabled, these filters declare a regular 2D
sampler for a multisample texture. On our desktop GL reproduction,
ContrastAdjustment renders black and CrossHatch loses the scene.

Use the shared RESOLVE_MS define in both materials and sample contrast
through getColor(), as the other multisample-aware filters do. Leave
the existing GLES resolve fallback unchanged.

Check compiled sampler types and compare single-sample/MSAA framebuffer
output for both filters. The native regression fails on upstream and
passes on desktop OpenGL and ANGLE with this patch.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T13:37:37.513988Z 82dccad PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@jaime-jmebot jaime-jmebot 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.

Hi, thanks for putting this fix together. The changes address the two filters’ multisample mismatch cleanly: both materials now enable the shared resolve path, and ContrastAdjustment samples through getColor() just like the existing multisample-aware filters. That keeps single-sample behavior on the regular sampler while selecting the multisample sampler when needed, without changing the GLES fallback.

I also reviewed the regression test, which checks both the compiled sampler type and rendered output with single-sample and multisampled filter input. The CI runs are green, including the OpenGL and ANGLE screenshot-test jobs. This looks like a focused fix with useful coverage for the reported failure mode. Thanks for tackling it!

@riccardobl

Copy link
Copy Markdown
Member

Thanks!

@riccardobl
riccardobl merged commit b29a8ca into jMonkeyEngine:master Nov 10, 2026
13 checks passed
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.

3 participants