diff options
author | kbr <[email protected]> | 2005-12-29 21:20:33 +0000 |
---|---|---|
committer | kbr <[email protected]> | 2005-12-29 21:20:33 +0000 |
commit | 1629d823445c88b7a23ad904cdae6c60a6e2563e (patch) | |
tree | 230203d87158a629aa06445ed7f32f7c6040a38e | |
parent | 7b23145c1cc0345ee193840f19da1b1a6bcc56f2 (diff) |
Fixed problem in resetting of AL and ALC proc address tables -- neededgluegen-branch-1-0
to reset ALC proc address table earlier (as epilogue to alcOpenDevice,
for example) -- may want to do it even earlier given that there are no
per-context or per-device function pointers yet
git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/branches/gluegen-branch-1-0@99 03bf7f67-59de-4072-a415-9a990d468a3f
-rwxr-xr-x | make/joal-alc.cfg | 7 | ||||
-rwxr-xr-x | src/java/net/java/games/joal/impl/ALProcAddressLookup.java | 41 |
2 files changed, 34 insertions, 14 deletions
diff --git a/make/joal-alc.cfg b/make/joal-alc.cfg index 1166a5a..cdc24bb 100755 --- a/make/joal-alc.cfg +++ b/make/joal-alc.cfg @@ -49,8 +49,9 @@ SkipProcAddressGen alcOpenDevice SkipProcAddressGen alcCreateContext SkipProcAddressGen alcMakeContextCurrent -# Need an epilogue on alcMakeContextCurrent to set up the proc address -# tables the first time -JavaEpilogue alcMakeContextCurrent ALProcAddressLookup.resetProcAddressTables(); +# Need an epilogue on alcOpenDevice and alcMakeContextCurrent to set +# up the proc address tables the first time +JavaEpilogue alcOpenDevice ALProcAddressLookup.resetALCProcAddressTable(); +JavaEpilogue alcMakeContextCurrent ALProcAddressLookup.resetALProcAddressTable(); IncludeAs CustomCCode joal-common-CustomCCode.c diff --git a/src/java/net/java/games/joal/impl/ALProcAddressLookup.java b/src/java/net/java/games/joal/impl/ALProcAddressLookup.java index d73c8a6..5291587 100755 --- a/src/java/net/java/games/joal/impl/ALProcAddressLookup.java +++ b/src/java/net/java/games/joal/impl/ALProcAddressLookup.java @@ -40,24 +40,43 @@ import com.sun.gluegen.runtime.*; public class ALProcAddressLookup { private static final ALProcAddressTable alTable = new ALProcAddressTable(); + private static volatile boolean alTableInitialized = false; private static final ALCProcAddressTable alcTable = new ALCProcAddressTable(); - private static volatile boolean initialized = false; + private static volatile boolean alcTableInitialized = false; - public static void resetProcAddressTables() { - if (!initialized) { + public static void resetALProcAddressTable() { + if (!alTableInitialized) { synchronized (ALProcAddressLookup.class) { - if (!initialized) { + if (!alTableInitialized) { // At some point this may require an OpenAL context to be - // current as we will actually use alGetProcAddress / - // alcGetProcAddress. Since these routines are currently - // broken and there are no per-context function pointers - // anyway we could actually do this work anywhere. We should - // also in theory have per-ALcontext ALProcAddressTables and - // per-ALdevice ALCProcAddressTables. + // current as we will actually use alGetProcAddress. Since + // this routine is currently broken and there are no + // per-context function pointers anyway we could actually do + // this work anywhere. We should also in theory have + // per-ALcontext ALProcAddressTables and per-ALCdevice + // ALCProcAddressTables. ALImpl impl = (ALImpl) ALFactory.getAL(); ProcAddressHelper.resetProcAddressTable(alTable, impl); + alTableInitialized = true; + } + } + } + } + + public static void resetALCProcAddressTable() { + if (!alcTableInitialized) { + synchronized (ALProcAddressLookup.class) { + if (!alcTableInitialized) { + // At some point this may require an OpenAL device to be + // created as we will actually use alcGetProcAddress. Since + // this routine is currently broken and there are no + // per-device function pointers anyway we could actually do + // this work anywhere. We should also in theory have + // per-ALcontext ALProcAddressTables and per-ALCdevice + // ALCProcAddressTables. + ALImpl impl = (ALImpl) ALFactory.getAL(); ProcAddressHelper.resetProcAddressTable(alcTable, impl); - initialized = true; + alcTableInitialized = true; } } } |