From b0316e419c4c79754feebeeaa0a992bca31e5c03 Mon Sep 17 00:00:00 2001 From: Kirill Vainer Date: Sat, 9 Sep 2017 13:30:06 -0400 Subject: [PATCH] Avoid RGB111110F in filters unless its actually supported --- jme3-core/src/main/java/com/jme3/post/Filter.java | 7 ++----- .../java/com/jme3/post/FilterPostProcessor.java | 14 +++++++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/jme3-core/src/main/java/com/jme3/post/Filter.java b/jme3-core/src/main/java/com/jme3/post/Filter.java index b162ed511..ff1f71017 100644 --- a/jme3-core/src/main/java/com/jme3/post/Filter.java +++ b/jme3-core/src/main/java/com/jme3/post/Filter.java @@ -213,13 +213,10 @@ public abstract class Filter implements Savable { } /** - * returns the default pass texture format - * default is {@link Format#RGB111110F} - * - * @return + * returns the default pass texture format. */ protected Format getDefaultPassTextureFormat() { - return Format.RGB111110F; + return processor.getDefaultPassTextureFormat(); } /** diff --git a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java index 7ccbbe5ae..14539c53d 100644 --- a/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java +++ b/jme3-core/src/main/java/com/jme3/post/FilterPostProcessor.java @@ -143,9 +143,13 @@ public class FilterPostProcessor implements SceneProcessor, Savable { fsQuad = new Picture("filter full screen quad"); fsQuad.setWidth(1); fsQuad.setHeight(1); - - if (fbFormat == Format.RGB111110F && !renderer.getCaps().contains(Caps.PackedFloatTexture)) { - fbFormat = Format.RGB8; + + if (!renderer.getCaps().contains(Caps.PackedFloatTexture)) { + if (!renderer.getCaps().contains(Caps.FloatTexture)) { + fbFormat = Format.RGB8; + } else { + fbFormat = Format.RGB16F; + } } Camera cam = vp.getCamera(); @@ -161,6 +165,10 @@ public class FilterPostProcessor implements SceneProcessor, Savable { reshape(vp, cam.getWidth(), cam.getHeight()); } + public Format getDefaultPassTextureFormat() { + return fbFormat; + } + /** * init the given filter * @param filter