aboutsummaryrefslogtreecommitdiffstats
path: root/make/config
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2014-01-15 18:50:23 +0100
committerSven Gothel <[email protected]>2014-01-15 18:50:23 +0100
commitd0acb35b6568eaf592bb3d5011619eae5c8bc592 (patch)
tree9e9e40458f3c3882b7a778625872dcfe3503282e /make/config
parent30bd30d6563041b71f40e4c336e636768ae26f9d (diff)
Bug 942 - Review GLBuffer[State|Size]Tracker: Add synchronized access to shared bufferSizeTracker
Diffstat (limited to 'make/config')
-rw-r--r--make/config/jogl/gl-common.cfg3
-rw-r--r--make/config/jogl/gl-gl4bc.cfg3
-rw-r--r--make/config/jogl/gl-impl-CustomJavaCode-common.java66
3 files changed, 41 insertions, 31 deletions
diff --git a/make/config/jogl/gl-common.cfg b/make/config/jogl/gl-common.cfg
index b84115445..e9996c64b 100644
--- a/make/config/jogl/gl-common.cfg
+++ b/make/config/jogl/gl-common.cfg
@@ -557,7 +557,8 @@ JavaEpilogue glPushClientAttrib bufferStateTracker.clearBufferObjectState();
JavaEpilogue glPushClientAttrib glStateTracker.pushAttrib(mask);
JavaEpilogue glPopClientAttrib bufferStateTracker.clearBufferObjectState();
JavaEpilogue glPopClientAttrib glStateTracker.popAttrib();
-JavaEpilogue glBufferData bufferSizeTracker.setBufferSize(bufferStateTracker, {0}, this, {1});
+JavaPrologue glBufferData synchronized(bufferSizeTracker) {
+JavaEpilogue glBufferData bufferSizeTracker.setBufferSize(bufferStateTracker, {0}, this, {1}); }
BufferObjectKind Array glColorPointer
BufferObjectKind Array glEdgeFlagPointer
diff --git a/make/config/jogl/gl-gl4bc.cfg b/make/config/jogl/gl-gl4bc.cfg
index c3a392c52..48ecb7378 100644
--- a/make/config/jogl/gl-gl4bc.cfg
+++ b/make/config/jogl/gl-gl4bc.cfg
@@ -59,7 +59,8 @@ Include gl2_es2-CustomJavaCode.cfg
# can only be computed by calling another routine
ManuallyImplement glMapNamedBufferEXT
ForceProcAddressGen glMapNamedBufferEXT
-JavaEpilogue glNamedBufferDataEXT bufferSizeTracker.setDirectStateBufferSize({0}, this, {1});
+JavaPrologue glNamedBufferDataEXT synchronized(bufferSizeTracker) {
+JavaEpilogue glNamedBufferDataEXT bufferSizeTracker.setDirectStateBufferSize({0}, this, {1}); }
# Manuall implement glDebugMessageCallback* using the proc address resolver
ForceProcAddressGen glDebugMessageCallback
diff --git a/make/config/jogl/gl-impl-CustomJavaCode-common.java b/make/config/jogl/gl-impl-CustomJavaCode-common.java
index b8da61065..4b1fc0977 100644
--- a/make/config/jogl/gl-impl-CustomJavaCode-common.java
+++ b/make/config/jogl/gl-impl-CustomJavaCode-common.java
@@ -11,7 +11,9 @@
@Override
public final long glGetBufferSize(int buffer) {
- return bufferSizeTracker.getDirectStateBufferSize(buffer, this);
+ synchronized(bufferSizeTracker) {
+ return bufferSizeTracker.getDirectStateBufferSize(buffer, this);
+ }
}
@Override
@@ -135,32 +137,35 @@
if (glProcAddress == 0) {
throw new GLException("Method \""+(useRange?"glMapBufferRange":"glMapBuffer")+"\" not available");
}
- final long sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this);
- if (0 == sz) {
- return null;
- }
- if( !useRange ) {
- length = sz;
- offset = 0;
- } else {
- if( length + offset > sz ) {
- throw new GLException("Out of range: offset "+offset+" + length "+length+" > size "+sz);
- }
- if( 0 > length || 0 > offset ) {
- throw new GLException("Invalid values: offset "+offset+", length "+length);
- }
- if( 0 == length ) {
+ final long addr, sz;
+ synchronized(bufferSizeTracker) {
+ sz = bufferSizeTracker.getBufferSize(bufferStateTracker, target, this);
+ if (0 == sz) {
return null;
- }
+ }
+ if( !useRange ) {
+ length = sz;
+ offset = 0;
+ } else {
+ if( length + offset > sz ) {
+ throw new GLException("Out of range: offset "+offset+" + length "+length+" > size "+sz);
+ }
+ if( 0 > length || 0 > offset ) {
+ throw new GLException("Invalid values: offset "+offset+", length "+length);
+ }
+ if( 0 == length ) {
+ return null;
+ }
+ }
+ addr = useRange ? dispatch_glMapBufferRange(target, offset, length, access, glProcAddress) :
+ dispatch_glMapBuffer(target, access, glProcAddress);
}
- final long addr = useRange ? dispatch_glMapBufferRange(target, offset, length, access, glProcAddress) :
- dispatch_glMapBuffer(target, access, glProcAddress);
if (0 == addr) {
return null;
}
- ByteBuffer buffer;
- MemoryObject memObj0 = new MemoryObject(addr, length); // object and key
- MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0);
+ final ByteBuffer buffer;
+ final MemoryObject memObj0 = new MemoryObject(addr, length); // object and key
+ final MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0);
if(memObj0 == memObj1) {
// just added ..
if(null != memObj0.getBuffer()) {
@@ -188,17 +193,20 @@
if (glProcAddress == 0) {
throw new GLException("Method \"glMapNamedBufferEXT\" not available");
}
- final long sz = bufferSizeTracker.getDirectStateBufferSize(bufferName, this);
- if (0 == sz) {
- return null;
+ final long addr, sz;
+ synchronized(bufferSizeTracker) {
+ sz = bufferSizeTracker.getDirectStateBufferSize(bufferName, this);
+ if (0 == sz) {
+ return null;
+ }
+ addr = dispatch_glMapNamedBufferEXT(bufferName, access, glProcAddress);
}
- final long addr = dispatch_glMapNamedBufferEXT(bufferName, access, glProcAddress);
if (0 == addr) {
return null;
}
- ByteBuffer buffer;
- MemoryObject memObj0 = new MemoryObject(addr, sz); // object and key
- MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0);
+ final ByteBuffer buffer;
+ final MemoryObject memObj0 = new MemoryObject(addr, sz); // object and key
+ final MemoryObject memObj1 = MemoryObject.getOrAddSafe(arbMemCache, memObj0);
if(memObj0 == memObj1) {
// just added ..
if(null != memObj0.getBuffer()) {