From 1bd8ec8fd2cdb98ef9da7bf9eddfc4855d323a98 Mon Sep 17 00:00:00 2001 From: Kevin Rushforth Date: Wed, 11 Oct 2006 23:38:14 +0000 Subject: Fixed issue 351: Need a new mechanism to free D3D surface git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@717 ba19aa83-45c5-6ac9-afd3-db810772062c --- .../share/javax/media/j3d/GraphicsContext3D.java | 6 ---- .../javax/media/j3d/ImageComponent2DRetained.java | 35 +--------------------- .../javax/media/j3d/ImageComponent3DRetained.java | 4 --- .../share/javax/media/j3d/NativePipeline.java | 10 ------- .../share/javax/media/j3d/NoopPipeline.java | 12 -------- src/classes/share/javax/media/j3d/Pipeline.java | 10 ------- 6 files changed, 1 insertion(+), 76 deletions(-) (limited to 'src/classes/share') diff --git a/src/classes/share/javax/media/j3d/GraphicsContext3D.java b/src/classes/share/javax/media/j3d/GraphicsContext3D.java index 8bfd972..9df496b 100644 --- a/src/classes/share/javax/media/j3d/GraphicsContext3D.java +++ b/src/classes/share/javax/media/j3d/GraphicsContext3D.java @@ -683,15 +683,9 @@ public class GraphicsContext3D extends Object { if (this.background != null) { bg = (BackgroundRetained)this.background.retained; bg.setInImmCtx(false); - if (bg.image != null) { - bg.image.freeSurface(); - } } bg = (BackgroundRetained)background.retained; bg.setInImmCtx(true); - if (bg.image != null) { - bg.image.freeSurface(); - } this.background = background; } diff --git a/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java b/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java index b754b36..4e2d13b 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java +++ b/src/classes/share/javax/media/j3d/ImageComponent2DRetained.java @@ -23,11 +23,7 @@ import java.awt.color.ColorSpace; class ImageComponent2DRetained extends ImageComponentRetained { - // used in D3D to map object to surface pointer - int hashId; - ImageComponent2DRetained() { - hashId = hashCode(); } /** @@ -85,8 +81,6 @@ class ImageComponent2DRetained extends ImageComponentRetained { geomLock.unLock(); if (source.isLive()) { - freeSurface(); - // send a IMAGE_CHANGED message in order to // notify all the users of the change sendMessage(IMAGE_CHANGED, null); @@ -164,8 +158,6 @@ class ImageComponent2DRetained extends ImageComponentRetained { geomLock.unLock(); if (source.isLive()) { - freeSurface(); - // send a IMAGE_CHANGED message in order to // notify all the users of the change sendMessage(IMAGE_CHANGED, null); @@ -210,9 +202,6 @@ class ImageComponent2DRetained extends ImageComponentRetained { if (source.isLive()) { - // XXXX: check whether this is needed - freeSurface(); - // send a SUBIMAGE_CHANGED message in order to // notify all the users of the change @@ -310,10 +299,7 @@ class ImageComponent2DRetained extends ImageComponentRetained { if (source.isLive()) { - //XXXX: check whether this is needed - freeSurface(); - - // send a SUBIMAGE_CHANGED message in order to + // send a SUBIMAGE_CHANGED message in order to // notify all the users of the change ImageComponentUpdateInfo info; @@ -361,25 +347,6 @@ class ImageComponent2DRetained extends ImageComponentRetained { void clearLive(int refCount) { super.clearLive(refCount); - if (this.refCount <= 0) { - freeSurface(); - } } - void freeSurface() { - if (VirtualUniverse.mc.isD3D()) { - Pipeline.getPipeline().freeD3DSurface(this, hashId); - } - } - - // TODO KCR ISSUE 121 : REPLACE THIS WITH A WEAK REFERENCE OR OTHER SCHEME - // Issue 121 : Stop using finalize() to clean up state - // Use similar approach as in handling ogl Texture resource cleanup. -// protected void finalize() { -// System.err.println("finalize: " + this); -//// // For Pure immediate mode, there is no clearLive so -//// // surface will free when JVM do GC -//// freeSurface(); -// } - } diff --git a/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java b/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java index 468536c..f5e21ad 100644 --- a/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java +++ b/src/classes/share/javax/media/j3d/ImageComponent3DRetained.java @@ -76,8 +76,6 @@ class ImageComponent3DRetained extends ImageComponentRetained { geomLock.unLock(); if (source.isLive()) { - // freeSurface(); - // send a IMAGE_CHANGED message in order to // notify all the users of the change sendMessage(IMAGE_CHANGED, null); @@ -150,8 +148,6 @@ class ImageComponent3DRetained extends ImageComponentRetained { geomLock.unLock(); if (source.isLive()) { - // freeSurface(); - // send a IMAGE_CHANGED message in order to // notify all the users of the change sendMessage(IMAGE_CHANGED, null); diff --git a/src/classes/share/javax/media/j3d/NativePipeline.java b/src/classes/share/javax/media/j3d/NativePipeline.java index 1a3288f..0eeffc9 100644 --- a/src/classes/share/javax/media/j3d/NativePipeline.java +++ b/src/classes/share/javax/media/j3d/NativePipeline.java @@ -1764,16 +1764,6 @@ class NativePipeline extends Pipeline { } - // --------------------------------------------------------------------- - - // - // ImageComponent2DRetained methods - // - - // free d3d surface referred to by id - native void freeD3DSurface(ImageComponent2DRetained image, int hashId); - - // --------------------------------------------------------------------- // diff --git a/src/classes/share/javax/media/j3d/NoopPipeline.java b/src/classes/share/javax/media/j3d/NoopPipeline.java index 09e7b04..03303d9 100644 --- a/src/classes/share/javax/media/j3d/NoopPipeline.java +++ b/src/classes/share/javax/media/j3d/NoopPipeline.java @@ -703,18 +703,6 @@ class NoopPipeline extends Pipeline { } - // --------------------------------------------------------------------- - - // - // ImageComponent2DRetained methods - // - - // free d3d surface referred to by id - void freeD3DSurface(ImageComponent2DRetained image, int hashId) { - } - - - // --------------------------------------------------------------------- // diff --git a/src/classes/share/javax/media/j3d/Pipeline.java b/src/classes/share/javax/media/j3d/Pipeline.java index d06532a..4df8fdb 100644 --- a/src/classes/share/javax/media/j3d/Pipeline.java +++ b/src/classes/share/javax/media/j3d/Pipeline.java @@ -708,16 +708,6 @@ abstract class Pipeline { abstract ShaderError useGLSLShaderProgram(Context ctx, ShaderProgramId shaderProgramId); - // --------------------------------------------------------------------- - - // - // ImageComponent2DRetained methods - // - - // free d3d surface referred to by id - abstract void freeD3DSurface(ImageComponent2DRetained image, int hashId); - - // --------------------------------------------------------------------- // -- cgit v1.2.3