From f84619789ea044f1bf4894f3073279a81bc22ec9 Mon Sep 17 00:00:00 2001 From: phil Date: Mon, 5 Dec 2016 22:01:24 +1300 Subject: SimpleShaderAppearance mutability checking improved before rebuild --- .../jogamp/java3d/utils/shader/SimpleShaderAppearance.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java b/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java index 8ef0bd1..a2f7f25 100644 --- a/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java +++ b/src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java @@ -371,8 +371,18 @@ public class SimpleShaderAppearance extends ShaderAppearance if (buildBasedOnAttributes) { // we only rebuild if we are not yet live or the right capabilities have been set - if ((!this.isLive() && !this.isCompiled()) || (this.getCapability(ALLOW_MATERIAL_READ) - && this.getCapability(ALLOW_TEXTURE_UNIT_STATE_READ) && this.getCapability(ALLOW_TEXTURE_READ))) + if ( + // first check is that the appearance is not live/compiled or if it is the various parts can be got at + ((!this.isLive() && !this.isCompiled()) // appearance is not live/compiled + || (this.getCapability(ALLOW_MATERIAL_READ)// + && this.getCapability(ALLOW_TEXTURE_UNIT_STATE_READ) // + && this.getCapability(ALLOW_TEXTURE_READ)// + && this.getCapability(ALLOW_POLYGON_ATTRIBUTES_READ)))// + // second part of check is that each component can be live/compiled elsewhere so need checking separately + && (this.getPolygonAttributes() == null // no poly attributes + || (!this.getPolygonAttributes().isLive() && !this.getPolygonAttributes().isCompiled()) // poly attributes are not yet live + || this.getPolygonAttributes().getCapability(PolygonAttributes.ALLOW_MODE_READ))//poly attributes are live but can be read + ) { boolean hasTexture = this.getTexture() != null || this.getTextureUnitCount() > 0; if (this.getTextureUnitCount() > 0) -- cgit v1.2.3