summaryrefslogtreecommitdiffstats
path: root/src/jogl/classes/jogamp/opengl/util/av
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-05-20 01:02:27 +0200
committerSven Gothel <[email protected]>2014-05-20 01:02:27 +0200
commitcca2782818bec79f63a5da1719b11e15244dbea2 (patch)
tree880a492c63dbf1a75f36c4f0e39c75bf0a2e0976 /src/jogl/classes/jogamp/opengl/util/av
parentd73a4a37bd4a376fc712ecc03332b8cf8821d134 (diff)
Bug 801: Refine commit 9a15aad0e5388a4b927e44d3d2ce136f32474bc2 cache TextureSequence's fragment shader hash-code
Adding TextureSequence.getTextureFragmentShaderHashCode() allowing to use a cached hash-code (performance, interface usability). Implemented in GLMediaPlayerImpl and ImageSequence.
Diffstat (limited to 'src/jogl/classes/jogamp/opengl/util/av')
-rw-r--r--src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
index 49c3c2a13..a6d5e8e2a 100644
--- a/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
+++ b/src/jogl/classes/jogamp/opengl/util/av/GLMediaPlayerImpl.java
@@ -86,6 +86,7 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
protected int textureType;
protected int texUnit;
+ private int textureFragmentShaderHashCode;
protected int[] texMinMagFilter = { GL.GL_NEAREST, GL.GL_NEAREST };
protected int[] texWrapST = { GL.GL_CLAMP_TO_EDGE, GL.GL_CLAMP_TO_EDGE };
@@ -281,6 +282,19 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
}
@Override
+ public final int getTextureFragmentShaderHashCode() {
+ if( !isTextureAvailable() ) {
+ textureFragmentShaderHashCode = 0;
+ return 0;
+ } else if( 0 == textureFragmentShaderHashCode ) {
+ int hash = 31 + getTextureLookupFragmentShaderImpl().hashCode();
+ hash = ((hash << 5) - hash) + getTextureSampler2DType().hashCode();
+ textureFragmentShaderHashCode = hash;
+ }
+ return textureFragmentShaderHashCode;
+ }
+
+ @Override
public final int getDecodedFrameCount() { return decodedFrameCount; }
@Override
@@ -1354,6 +1368,9 @@ public abstract class GLMediaPlayerImpl implements GLMediaPlayer {
event_mask = addStateEventMask(event_mask, newState);
if( 0 != event_mask ) {
state = newState;
+ if( !isTextureAvailable() ) {
+ textureFragmentShaderHashCode = 0;
+ }
attributesUpdated( event_mask );
}
}