summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphil <[email protected]>2016-12-05 22:01:24 +1300
committerphil <[email protected]>2016-12-05 22:01:24 +1300
commitf84619789ea044f1bf4894f3073279a81bc22ec9 (patch)
treea9e0adc8609bab1d2172a5959d769dd11b923f69
parent9a1a70d5cc6cde8167597e8c030a0d98f0bb3e07 (diff)
SimpleShaderAppearance mutability checking improved before rebuild
-rw-r--r--src/main/java/org/jogamp/java3d/utils/shader/SimpleShaderAppearance.java14
1 files changed, 12 insertions, 2 deletions
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)