aboutsummaryrefslogtreecommitdiffstats
path: root/src/native
diff options
context:
space:
mode:
authorChien Yang <[email protected]>2007-03-22 04:33:38 +0000
committerChien Yang <[email protected]>2007-03-22 04:33:38 +0000
commit2eb98ec71dd26765a179b0005898bf63991be0b3 (patch)
tree22de2a56d3710192300f0f45d36f39c73e96e2f9 /src/native
parent9327277a80d538abf0fe638065a22b16be9be8bd (diff)
D3D : Added hardware mipmap support for Texture3D and TextureCubeMap.
git-svn-id: https://svn.java.net/svn/j3d-core~svn/trunk@800 ba19aa83-45c5-6ac9-afd3-db810772062c
Diffstat (limited to 'src/native')
-rw-r--r--src/native/d3d/Attributes.cpp12
-rw-r--r--src/native/d3d/D3dUtil.cpp21
-rw-r--r--src/native/d3d/D3dUtil.hpp6
3 files changed, 25 insertions, 14 deletions
diff --git a/src/native/d3d/Attributes.cpp b/src/native/d3d/Attributes.cpp
index 9540aac..e98697f 100644
--- a/src/native/d3d/Attributes.cpp
+++ b/src/native/d3d/Attributes.cpp
@@ -2534,9 +2534,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DImage(
jint dataType,
jobject data,
jboolean useAutoMipMap)
-{
- /* Note: useAutoMipMap is not use instead numLevel will be use for d3d pipe */
-
+{
GetDevice();
if (d3dCtx->deviceInfo->maxTextureDepth <= 0) {
@@ -2577,7 +2575,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTexture3DImage(
if (surf == NULL) {
surf = createVolumeTexture(d3dCtx, numLevels, textureFormat,
- width, height, depth);
+ width, height, depth, useAutoMipMap);
if (surf == NULL) {
return;
}
@@ -2947,9 +2945,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapImage(
jint dataType,
jobject data,
jboolean useAutoMipMap)
-{
- /* Note: useAutoMipMap is not use instead numLevel will be use for d3d pipe */
-
+{
GetDevice();
if (d3dCtx->texUnitStage >= d3dCtx->bindTextureIdLen) {
@@ -2987,7 +2983,7 @@ void JNICALL Java_javax_media_j3d_NativePipeline_updateTextureCubeMapImage(
if (surf == NULL) {
// Need to create surface
surf = createCubeMapTexture(d3dCtx, numLevels, textureFormat,
- width, height);
+ width, height, useAutoMipMap);
if (surf == NULL) {
return;
}
diff --git a/src/native/d3d/D3dUtil.cpp b/src/native/d3d/D3dUtil.cpp
index 0cc0057..f7cc160 100644
--- a/src/native/d3d/D3dUtil.cpp
+++ b/src/native/d3d/D3dUtil.cpp
@@ -804,12 +804,15 @@ LPDIRECT3DVOLUMETEXTURE9 createVolumeTexture(D3dCtx *d3dCtx,
jint textureFormat,
jint width,
jint height,
- jint depth)
+ jint depth,
+ jboolean useAutoMipMap)
+
{
LPDIRECT3DVOLUMETEXTURE9 pTexture;
int texWidth, texHeight, texDepth;
D3DFORMAT format;
HRESULT hr;
+ DWORD usage = 0;
LPDIRECT3DDEVICE9 pDevice = d3dCtx->pDevice;
D3dDeviceInfo *deviceInfo = d3dCtx->deviceInfo;
@@ -822,6 +825,10 @@ LPDIRECT3DVOLUMETEXTURE9 createVolumeTexture(D3dCtx *d3dCtx,
numLevels = 1;
}
+ if (useAutoMipMap) {
+ usage |= D3DUSAGE_AUTOGENMIPMAP;
+ }
+
// Found a texture bigger than width/height
if (deviceInfo->texturePow2Only) {
for (texWidth=1; width > texWidth; texWidth <<= 1);
@@ -878,7 +885,7 @@ LPDIRECT3DVOLUMETEXTURE9 createVolumeTexture(D3dCtx *d3dCtx,
// If format not support, the utility function will adjust the
// calling parameters automatically
hr = D3DXCreateVolumeTexture(d3dCtx->pDevice, texWidth, texHeight,
- texDepth, numLevels, 0, format, D3DPOOL_MANAGED,
+ texDepth, numLevels, usage, format, D3DPOOL_MANAGED,
&pTexture);
if (FAILED(hr)) {
@@ -11948,11 +11955,13 @@ LPDIRECT3DCUBETEXTURE9 createCubeMapTexture(D3dCtx *d3dCtx,
jint numLevels,
jint textureFormat,
jint width,
- jint height)
+ jint height,
+ jboolean useAutoMipMap)
{
LPDIRECT3DCUBETEXTURE9 pTexture;
D3DFORMAT format;
HRESULT hr;
+ DWORD usage = 0;
LPDIRECT3DDEVICE9 pDevice = d3dCtx->pDevice;
D3dDeviceInfo *deviceInfo = d3dCtx->deviceInfo;
@@ -11964,10 +11973,14 @@ LPDIRECT3DCUBETEXTURE9 createCubeMapTexture(D3dCtx *d3dCtx,
getTexWidthHeight(deviceInfo, &width, &height);
format = getTexFormat(textureFormat);
+ if (useAutoMipMap) {
+ usage |= D3DUSAGE_AUTOGENMIPMAP;
+ }
+
// If format not support, the utility function will adjust the
// calling parameters automatically
hr = D3DXCreateCubeTexture(d3dCtx->pDevice, width,
- numLevels, 0, format, D3DPOOL_MANAGED,
+ numLevels, usage, format, D3DPOOL_MANAGED,
&pTexture);
if (FAILED(hr)) {
diff --git a/src/native/d3d/D3dUtil.hpp b/src/native/d3d/D3dUtil.hpp
index b1a7560..8a00287 100644
--- a/src/native/d3d/D3dUtil.hpp
+++ b/src/native/d3d/D3dUtil.hpp
@@ -154,14 +154,16 @@ extern LPDIRECT3DVOLUMETEXTURE9 createVolumeTexture(D3dCtx *d3dCtx,
jint internalFormat,
jint width,
jint height,
- jint depth);
+ jint depth,
+ jboolean useAutoMipMap);
extern LPDIRECT3DCUBETEXTURE9 createCubeMapTexture(D3dCtx *d3dCtx,
jint numLevels,
jint internalFormat,
jint width,
- jint height);
+ jint height,
+ jboolean useAutoMipMap);
extern void copyDataToSurface(jint format,