Skip to content

fix regression that disabled custom fpp color format in some platforms - #2623

Merged
yaRnMcDonuts merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:ffpformat
Feb 28, 2026
Merged

fix regression that disabled custom fpp color format in some platforms#2623
yaRnMcDonuts merged 2 commits into
jMonkeyEngine:masterfrom
riccardobl:ffpformat

Conversation

@riccardobl

Copy link
Copy Markdown
Member

Fixes the issue reported here

@yaRnMcDonuts yaRnMcDonuts added this to the v3.10.0 milestone Feb 21, 2026
Comment thread jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java Outdated
@capdevon

capdevon commented Feb 24, 2026

Copy link
Copy Markdown
Contributor

It might also be worth adding a validation step to ensure that the framebuffer format selected by the user is actually supported by the renderer.

Given this addition, we may also want to consider whether fbFormat should be serialized, so that the chosen format can be preserved across saves and restores.

        if (fbFormat == null) {
            // Determine optimal framebuffer format based on renderer capabilities
            fbFormat = getDefaultFrameBufferFormat(renderer);
        } else {
            // User requested a specific format → verify GPU support
            if (!isFormatSupported(fbFormat, renderer)) {
                Format fallback = getDefaultFrameBufferFormat(renderer);
                logger.warning("Requested framebuffer format " + fbFormat +
                        " not supported. Falling back to " + fallback);
                fbFormat = fallback;
            }
        }
    private Format getDefaultFrameBufferFormat(Renderer renderer) {
        Collection<Caps> caps = renderer.getCaps();
        if (caps.contains(Caps.PackedFloatTexture)) {
            return Format.RGB111110F;
        } else if (caps.contains(Caps.FloatColorBufferRGB)) {
            return Format.RGB16F;
        } else if (caps.contains(Caps.FloatColorBufferRGBA)) {
            return Format.RGBA16F;
        } else {
            return Format.RGB8;
        }
    }

    private boolean isFormatSupported(Format format, Renderer renderer) {
        Collection<Caps> caps = renderer.getCaps();
        switch (format) {
            case RGB111110F:
                return caps.contains(Caps.PackedFloatTexture);
            case RGB16F:
                return caps.contains(Caps.FloatColorBufferRGB);
            case RGBA16F:
                return caps.contains(Caps.FloatColorBufferRGBA);
            case RGB8:
                return true;
            default:
                return false;
        }
    }

@riccardobl

@riccardobl

Copy link
Copy Markdown
Member Author

Yes, for serialization. However, I suggest that we avoid verifying whether the format is supported when set manually.
If a developer is setting this low-level value, it likely means they have a specific need for a particular format. Changing it, even with a warning, could make debugging more difficult. The developer can perform the necessary validation on their side if needed.

@codex128 codex128 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.

Looks good. Thanks!

@yaRnMcDonuts
yaRnMcDonuts merged commit d438369 into jMonkeyEngine:master Feb 28, 2026
17 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.

4 participants