diff options
author | Chien Yang <[email protected]> | 2006-10-11 23:47:10 +0000 |
---|---|---|
committer | Chien Yang <[email protected]> | 2006-10-11 23:47:10 +0000 |
commit | e60078c34fa46c8d6f6cd9577118d8c4c9f4d0ab (patch) | |
tree | 3e77165b248307d32e488d2d1415facae6f1a547 /src/native/d3d | |
parent | 1bd8ec8fd2cdb98ef9da7bf9eddfc4855d323a98 (diff) |
1) Fixed an exception in clear background.
2) Clean up unwanted d3d code.
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@718 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native/d3d')
-rw-r--r-- | src/native/d3d/Canvas3D.cpp | 26 | ||||
-rw-r--r-- | src/native/d3d/D3dCtx.cpp | 5 | ||||
-rw-r--r-- | src/native/d3d/D3dImageComponent.cpp | 171 | ||||
-rw-r--r-- | src/native/d3d/D3dImageComponent.hpp | 53 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.cpp | 37 | ||||
-rw-r--r-- | src/native/d3d/D3dUtil.hpp | 4 | ||||
-rw-r--r-- | src/native/d3d/StdAfx.h | 1 | ||||
-rw-r--r-- | src/native/d3d/build-windows-amd64-vc.xml | 4 | ||||
-rw-r--r-- | src/native/d3d/build-windows-i586-vc.xml | 4 |
9 files changed, 12 insertions, 293 deletions
diff --git a/src/native/d3d/Canvas3D.cpp b/src/native/d3d/Canvas3D.cpp index ba9c918..6988d57 100644 --- a/src/native/d3d/Canvas3D.cpp +++ b/src/native/d3d/Canvas3D.cpp @@ -348,7 +348,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_clear( } extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_NativePipeline_textureFill( +void JNICALL Java_javax_media_j3d_NativePipeline_textureFillBackground( JNIEnv *env, jobject obj, jlong ctx, @@ -362,9 +362,9 @@ void JNICALL Java_javax_media_j3d_NativePipeline_textureFill( jfloat mapMaxY) { GetDevice(); - /* printf("Canvas3D.textureFill()\n"); */ - /* TODO : Implement textureFill() */ - printf("[Java3D] D3D : textureFill is not implemented yet.\n"); + /* printf("Canvas3D.textureFillBackground()\n"); */ + /* TODO : Implement textureFillBackground() */ + printf("[Java3D] D3D : textureFillBackground is not implemented yet.\n"); } @@ -1128,24 +1128,6 @@ void JNICALL Java_javax_media_j3d_NativePipeline_cleanupRenderer( freePointerList(); } -extern "C" JNIEXPORT -void JNICALL Java_javax_media_j3d_NativePipeline_freeD3DSurface( - JNIEnv *env, - jobject obj, - jobject image, - jint hashCode) - -{ - /* - lockImage(); - D3dImageComponent::remove(&RasterList, hashCode); - unlockImage(); - lockBackground(); - D3dImageComponent::remove(&BackgroundImageList, hashCode); - unlockBackground(); - */ -} - extern "C" JNIEXPORT void JNICALL Java_javax_media_j3d_NativePipeline_beginScene( diff --git a/src/native/d3d/D3dCtx.cpp b/src/native/d3d/D3dCtx.cpp index 8ad3b2f..f48b24c 100644 --- a/src/native/d3d/D3dCtx.cpp +++ b/src/native/d3d/D3dCtx.cpp @@ -349,10 +349,7 @@ VOID D3dCtx::releaseVB() VOID D3dCtx::release() { - /* - D3dImageComponent::removeAll(&BackgroundImageList); - D3dImageComponent::removeAll(&RasterList); - */ + releaseTexture(); SafeFree(bindTextureId); bindTextureIdLen = 0; diff --git a/src/native/d3d/D3dImageComponent.cpp b/src/native/d3d/D3dImageComponent.cpp deleted file mode 100644 index 6ae5ef1..0000000 --- a/src/native/d3d/D3dImageComponent.cpp +++ /dev/null @@ -1,171 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - * - * Use is subject to license terms. - * - * $Revision$ - * $Date$ - * $State$ - */ - -#include "StdAfx.h" - -D3dImageComponent::D3dImageComponent() -{ - init(); -} - - -D3dImageComponent::D3dImageComponent(D3dCtx *_ctx, - int _hashCode, - LPDIRECT3DTEXTURE9 _surf) -{ - ctx = _ctx; - hashCode = _hashCode; - surf = _surf; - next = NULL; -} - -D3dImageComponent::~D3dImageComponent() -{ - if ((ctx != NULL) && (surf != NULL)) { - ctx->freeResource(surf); - } -} - -VOID D3dImageComponent::init() -{ - next = NULL; - surf = NULL; - hashCode = 0; - ctx = NULL; -} - -D3dImageComponent* D3dImageComponent::add(D3dImageComponent *list, - D3dCtx *ctx, - int hashCode, - LPDIRECT3DTEXTURE9 surf) -{ - D3dImageComponent *p = list->next; - - D3dImageComponent *ic = new D3dImageComponent(ctx, hashCode, surf); - - if (ic == NULL) { - return NULL; - } - list->next = ic; - ic->next = p; - return ic; -} - -D3dImageComponent* D3dImageComponent::find(D3dImageComponent *list, - D3dCtx *ctx, - int hashCode) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - while (p != NULL) { - if ((p->ctx == ctx) && - (p->hashCode == hashCode)) { - return p; - } - p = p->next; - } - return NULL; -} - - -VOID D3dImageComponent::remove(D3dImageComponent *list, - D3dCtx *ctx, int hashCode) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if ((p->ctx == ctx) && - (p->hashCode == hashCode)) { - q->next = p->next; - delete p; - break; - } - q = p; - p = p->next; - - } -} - - -VOID D3dImageComponent::remove(D3dImageComponent *list, - int hashCode) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if (p->hashCode == hashCode) { - q->next = p->next; - delete p; - // continue for image in another ctx - p = q->next; - } else { - q = p; - p = p->next; - } - } -} - -VOID D3dImageComponent::remove(D3dImageComponent *list, - D3dCtx *ctx) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if (p->ctx == ctx) { - q->next = p->next; - delete p; - p = q->next; - // continue for other images - } else { - q = p; - p = p->next; - } - } -} - -VOID D3dImageComponent::remove(D3dImageComponent *list, - D3dImageComponent *ic) -{ - // skip the first dummy node - D3dImageComponent *p = list->next; - D3dImageComponent *q = list; - - while (p != NULL) { - if (p == ic) { - q->next = p->next; - delete p; - break; - } - q = p; - p = p->next; - } -} - -VOID D3dImageComponent::removeAll(D3dImageComponent *list) -{ - // skip the first dummy node - D3dImageComponent *q, *p = list->next; - - list->next = NULL; - - while (p != NULL) { - q = p->next; - delete p; - p = q; - } -} diff --git a/src/native/d3d/D3dImageComponent.hpp b/src/native/d3d/D3dImageComponent.hpp deleted file mode 100644 index 8226d30..0000000 --- a/src/native/d3d/D3dImageComponent.hpp +++ /dev/null @@ -1,53 +0,0 @@ -/* - * $RCSfile$ - * - * Copyright (c) 2006 Sun Microsystems, Inc. All rights reserved. - * - * Use is subject to license terms. - * - * $Revision$ - * $Date$ - * $State$ - */ - -#if !defined(D3DIMAGECOMPONENT_H) -#define D3DIMAGECOMPONENT_H - -#include "StdAfx.h" - -class D3dImageComponent { -public: - - LPDIRECT3DTEXTURE9 surf; - D3dCtx *ctx; - int hashCode; - D3dImageComponent *next; - - D3dImageComponent(); - - D3dImageComponent(D3dCtx *ctx, int hashCode, - LPDIRECT3DTEXTURE9 surf); - - ~D3dImageComponent(); - - VOID init(); - - static D3dImageComponent* find(D3dImageComponent *list, - D3dCtx *ctx, int hashCode); - - static D3dImageComponent* add(D3dImageComponent *list, - D3dCtx *ctx, int hashCode, - LPDIRECT3DTEXTURE9 surf); - - static VOID remove(D3dImageComponent *list, D3dCtx *ctx, int hashCode); - static VOID remove(D3dImageComponent *list, D3dCtx *ctx); - static VOID remove(D3dImageComponent *list, int hashCode); - static VOID remove(D3dImageComponent *list, D3dImageComponent *ic); - static VOID removeAll(D3dImageComponent *list); -}; - -/* - extern D3dImageComponent RasterList; - extern D3dImageComponent BackgroundImageList; -*/ -#endif diff --git a/src/native/d3d/D3dUtil.cpp b/src/native/d3d/D3dUtil.cpp index 12ff9d6..8700e65 100644 --- a/src/native/d3d/D3dUtil.cpp +++ b/src/native/d3d/D3dUtil.cpp @@ -13,10 +13,7 @@ #include "StdAfx.h" HANDLE hSema = CreateSemaphore(NULL, 1, 1, "Java3d_Ctx"); -HANDLE imageSema = CreateSemaphore(NULL, 1, 1, - "Java3d_ImageComponent2DLock"); -HANDLE backgroundSema = CreateSemaphore(NULL, 1, 1, - "Java3d_ImageBackgroundLock"); + HANDLE geometrySema = CreateSemaphore(NULL, 1, 1, "Java3d_GeometryArrayLock"); HANDLE surfaceListSema = CreateSemaphore(NULL, 1, 1, "Java3d_SurfaceListLock"); @@ -624,6 +621,8 @@ void getTexWidthHeight(D3dDeviceInfo *deviceInfo, *height = texHeight; } + +/* TODO : Need to modify to handle more format ---- Chien */ D3DFORMAT getTexFormat(jint internalFormat) { switch (internalFormat) { @@ -688,36 +687,6 @@ inline VOID unlockSurfaceList() } } -inline VOID lockBackground() -{ - if (backgroundSema != NULL) { - WaitForSingleObject(backgroundSema, INFINITE); - } -} - -inline VOID unlockBackground() -{ - if (backgroundSema != NULL) { - ReleaseSemaphore(backgroundSema, 1, NULL); - } -} - -inline VOID lockImage() -{ - if (imageSema != NULL) { - WaitForSingleObject(imageSema, INFINITE); - } -} - -inline VOID unlockImage() -{ - if (imageSema != NULL) { - ReleaseSemaphore(imageSema, 1, NULL); - } -} - - - inline VOID lockGeometry() { if (geometrySema != NULL) { diff --git a/src/native/d3d/D3dUtil.hpp b/src/native/d3d/D3dUtil.hpp index c0961a4..7e7ea44 100644 --- a/src/native/d3d/D3dUtil.hpp +++ b/src/native/d3d/D3dUtil.hpp @@ -131,10 +131,6 @@ extern OSVERSIONINFO osvi; // OS info extern D3dCtx* findCtx(HWND hwnd); extern VOID lock(); extern VOID unlock(); -extern VOID lockImage(); -extern VOID unlockImage(); -extern VOID lockBackground(); -extern VOID unlockBackground(); extern VOID lockGeometry(); extern VOID unlockGeometry(); extern VOID lockSurfaceList(); diff --git a/src/native/d3d/StdAfx.h b/src/native/d3d/StdAfx.h index c914ee1..8707d11 100644 --- a/src/native/d3d/StdAfx.h +++ b/src/native/d3d/StdAfx.h @@ -68,6 +68,5 @@ using namespace std ; #include "D3dUtil.hpp" #include "D3dVertexBuffer.hpp" #include "D3dDisplayList.hpp" -#include "D3dImageComponent.hpp" #endif diff --git a/src/native/d3d/build-windows-amd64-vc.xml b/src/native/d3d/build-windows-amd64-vc.xml index 7182711..b1fa917 100644 --- a/src/native/d3d/build-windows-amd64-vc.xml +++ b/src/native/d3d/build-windows-amd64-vc.xml @@ -36,13 +36,13 @@ <!-- Compile the c source files--> <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="cl"> - <arg line="-Ox -O2 -Ob2 -Os -Oi -GT -GL /nologo -wd4996 -I"${javaInclude}" -I"${javaWin32Include}" -I"${src}/native/ogl" -I"${javahCoreTarget}" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "J3DDX90PORT_EXPORTS" /D "WIN32" /D "D3D" /D "J3D_BUILDVERTICES" /D "NVIDIA_DEBUG" /FD /EHsc /MT /Fp"J3dDX90Port.pch" /W2 /c /TP "${oglsrc}/DrawingSurfaceObjectAWT.c" "${oglsrc}/MasterControl.c" "${d3dsrc}/D3dVertexBuffer.cpp" "${d3dsrc}/D3dDisplayList.cpp" "${d3dsrc}/D3dDriverInfo.cpp" "${d3dsrc}/D3dDeviceInfo.cpp" "${d3dsrc}/D3dCtx.cpp" "${d3dsrc}/D3dUtil.cpp" "${d3dsrc}/D3dImageComponent.cpp" "${d3dsrc}/GeometryArrayRetained.cpp" "${d3dsrc}/Canvas3D.cpp" "${d3dsrc}/GraphicsContext3D.cpp" "${d3dsrc}/Attributes.cpp" "${d3dsrc}/Lights.cpp" "${d3dsrc}/NativeConfigTemplate3D.cpp" "/> + <arg line="-Ox -O2 -Ob2 -Os -Oi -GT -GL /nologo -wd4996 -I"${javaInclude}" -I"${javaWin32Include}" -I"${src}/native/ogl" -I"${javahCoreTarget}" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "J3DDX90PORT_EXPORTS" /D "WIN32" /D "D3D" /D "J3D_BUILDVERTICES" /D "NVIDIA_DEBUG" /FD /EHsc /MT /Fp"J3dDX90Port.pch" /W2 /c /TP "${oglsrc}/DrawingSurfaceObjectAWT.c" "${oglsrc}/MasterControl.c" "${d3dsrc}/D3dVertexBuffer.cpp" "${d3dsrc}/D3dDisplayList.cpp" "${d3dsrc}/D3dDriverInfo.cpp" "${d3dsrc}/D3dDeviceInfo.cpp" "${d3dsrc}/D3dCtx.cpp" "${d3dsrc}/D3dUtil.cpp" "${d3dsrc}/GeometryArrayRetained.cpp" "${d3dsrc}/Canvas3D.cpp" "${d3dsrc}/GraphicsContext3D.cpp" "${d3dsrc}/Attributes.cpp" "${d3dsrc}/Lights.cpp" "${d3dsrc}/NativeConfigTemplate3D.cpp" "/> </exec> <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="link"> - <arg line="/OUT:"j3dcore-d3d.dll" /nologo -DLL -DELAYLOAD:jawt.dll -IMPLIB:"j3dcore-d3d.lib" -LTCG /ignore:4089 ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib Attributes.obj Canvas3D.obj D3dCtx.obj D3dDeviceInfo.obj D3dDisplayList.obj D3dDriverInfo.obj D3dImageComponent.obj D3dUtil.obj D3dVertexBuffer.obj DrawingSurfaceObjectAWT.obj GeometryArrayRetained.obj GraphicsContext3D.obj Lights.obj MasterControl.obj NativeConfigTemplate3D.obj ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib -LIBPATH:"${java.home}\..\lib" jawt.lib"/> + <arg line="/OUT:"j3dcore-d3d.dll" /nologo -DLL -DELAYLOAD:jawt.dll -IMPLIB:"j3dcore-d3d.lib" -LTCG /ignore:4089 ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib Attributes.obj Canvas3D.obj D3dCtx.obj D3dDeviceInfo.obj D3dDisplayList.obj D3dDriverInfo.obj D3dUtil.obj D3dVertexBuffer.obj DrawingSurfaceObjectAWT.obj GeometryArrayRetained.obj GraphicsContext3D.obj Lights.obj MasterControl.obj NativeConfigTemplate3D.obj ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib -LIBPATH:"${java.home}\..\lib" jawt.lib"/> </exec> <!-- Copy the copyright library file --> diff --git a/src/native/d3d/build-windows-i586-vc.xml b/src/native/d3d/build-windows-i586-vc.xml index f432e0b..78d1a4b 100644 --- a/src/native/d3d/build-windows-i586-vc.xml +++ b/src/native/d3d/build-windows-i586-vc.xml @@ -36,13 +36,13 @@ <!-- Compile the c source files--> <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="cl"> - <arg line="-Ox -Og -O2 -Ob2 -Os -Oi -GT -GL /nologo -I"${javaInclude}" -I"${javaWin32Include}" -I"${src}/native/ogl" -I"${javahCoreTarget}" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "J3DDX90PORT_EXPORTS" /D "WIN32" /D "D3D" /D "J3D_BUILDVERTICES" /D "NVIDIA_DEBUG" /FD /EHsc /MT /Fp"J3dDX90Port.pch" /W2 /c /TP "${oglsrc}/DrawingSurfaceObjectAWT.c" "${oglsrc}/MasterControl.c" "${d3dsrc}/D3dVertexBuffer.cpp" "${d3dsrc}/D3dDisplayList.cpp" "${d3dsrc}/D3dDriverInfo.cpp" "${d3dsrc}/D3dDeviceInfo.cpp" "${d3dsrc}/D3dCtx.cpp" "${d3dsrc}/D3dUtil.cpp" "${d3dsrc}/D3dImageComponent.cpp" "${d3dsrc}/GeometryArrayRetained.cpp" "${d3dsrc}/Canvas3D.cpp" "${d3dsrc}/GraphicsContext3D.cpp" "${d3dsrc}/Attributes.cpp" "${d3dsrc}/Lights.cpp" "${d3dsrc}/NativeConfigTemplate3D.cpp" "/> + <arg line="-Ox -Og -O2 -Ob2 -Os -Oi -GT -GL /nologo -I"${javaInclude}" -I"${javaWin32Include}" -I"${src}/native/ogl" -I"${javahCoreTarget}" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "J3DDX90PORT_EXPORTS" /D "WIN32" /D "D3D" /D "J3D_BUILDVERTICES" /D "NVIDIA_DEBUG" /FD /EHsc /MT /Fp"J3dDX90Port.pch" /W2 /c /TP "${oglsrc}/DrawingSurfaceObjectAWT.c" "${oglsrc}/MasterControl.c" "${d3dsrc}/D3dVertexBuffer.cpp" "${d3dsrc}/D3dDisplayList.cpp" "${d3dsrc}/D3dDriverInfo.cpp" "${d3dsrc}/D3dDeviceInfo.cpp" "${d3dsrc}/D3dCtx.cpp" "${d3dsrc}/D3dUtil.cpp" "${d3dsrc}/GeometryArrayRetained.cpp" "${d3dsrc}/Canvas3D.cpp" "${d3dsrc}/GraphicsContext3D.cpp" "${d3dsrc}/Attributes.cpp" "${d3dsrc}/Lights.cpp" "${d3dsrc}/NativeConfigTemplate3D.cpp" "/> </exec> <!-- Create the library file--> <exec dir="${build}/${platform}/${bldType}/native/d3d/objs" executable="link"> - <arg line="/OUT:"j3dcore-d3d.dll" /nologo -DLL -DELAYLOAD:jawt.dll -IMPLIB:"j3dcore-d3d.lib" -MACHINE:X86 -LTCG /ignore:4089 ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib Attributes.obj Canvas3D.obj D3dCtx.obj D3dDeviceInfo.obj D3dDisplayList.obj D3dDriverInfo.obj D3dImageComponent.obj D3dUtil.obj D3dVertexBuffer.obj DrawingSurfaceObjectAWT.obj GeometryArrayRetained.obj GraphicsContext3D.obj Lights.obj MasterControl.obj NativeConfigTemplate3D.obj ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib -LIBPATH:"${java.home}\..\lib" jawt.lib"/> + <arg line="/OUT:"j3dcore-d3d.dll" /nologo -DLL -DELAYLOAD:jawt.dll -IMPLIB:"j3dcore-d3d.lib" -MACHINE:X86 -LTCG /ignore:4089 ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib DelayImp.lib Attributes.obj Canvas3D.obj D3dCtx.obj D3dDeviceInfo.obj D3dDisplayList.obj D3dDriverInfo.obj D3dUtil.obj D3dVertexBuffer.obj DrawingSurfaceObjectAWT.obj GeometryArrayRetained.obj GraphicsContext3D.obj Lights.obj MasterControl.obj NativeConfigTemplate3D.obj ddraw.lib d3d9.lib d3dx9.lib dxerr9.lib dxguid.lib dinput.lib dinput8.lib delayimp.lib WinStrm.lib -LIBPATH:"${java.home}\..\lib" jawt.lib"/> </exec> <!-- Copy the copyright library file --> |