From 3d9e96f3bc34029c93ceb3fd3f9674d2c69e414d Mon Sep 17 00:00:00 2001 From: Roderick Colenbrander Date: Sat, 5 Aug 2006 00:11:17 +0200 Subject: [PATCH] wined3d: Volume textures fix. --- dlls/wined3d/directx.c | 11 +++++++++-- dlls/wined3d/volume.c | 34 +++++++++++++++++++--------------- include/wine/wined3d_gl.h | 18 ++++++++++++++++++ 3 files changed, 46 insertions(+), 17 deletions(-) diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index f621d86abb7..04cd41dd8a5 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -680,6 +680,9 @@ BOOL IWineD3DImpl_FillGLCaps(IWineD3D *iface, Display* display) { } else if (strcmp(ThisExtn, "GL_EXT_stencil_wrap") == 0) { TRACE_(d3d_caps)(" FOUND: EXT Stencil wrap support\n"); gl_info->supported[EXT_STENCIL_WRAP] = TRUE; + } else if (strcmp(ThisExtn, "GL_EXT_texture3D") == 0) { + TRACE_(d3d_caps)(" FOUND: EXT_texture3D support\n"); + gl_info->supported[EXT_TEXTURE3D] = TRUE; } else if (strcmp(ThisExtn, "GL_EXT_texture_compression_s3tc") == 0) { TRACE_(d3d_caps)(" FOUND: EXT Texture S3TC compression support\n"); gl_info->supported[EXT_TEXTURE_COMPRESSION_S3TC] = TRUE; @@ -1803,13 +1806,17 @@ static HRESULT WINAPI IWineD3DImpl_GetDeviceCaps(IWineD3D *iface, UINT Adapter, *pCaps->TextureCaps = WINED3DPTEXTURECAPS_ALPHA | WINED3DPTEXTURECAPS_ALPHAPALETTE | WINED3DPTEXTURECAPS_BORDER | - WINED3DPTEXTURECAPS_VOLUMEMAP | WINED3DPTEXTURECAPS_MIPMAP | WINED3DPTEXTURECAPS_PROJECTED | WINED3DPTEXTURECAPS_PERSPECTIVE | - WINED3DPTEXTURECAPS_VOLUMEMAP_POW2 | WINED3DPTEXTURECAPS_NONPOW2CONDITIONAL; + if( GL_SUPPORT(EXT_TEXTURE3D)) { + *pCaps->TextureCaps |= WINED3DPTEXTURECAPS_VOLUMEMAP | + WINED3DPTEXTURECAPS_MIPVOLUMEMAP | + WINED3DPTEXTURECAPS_VOLUMEMAP_POW2; + } + if (GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { *pCaps->TextureCaps |= WINED3DPTEXTURECAPS_CUBEMAP | WINED3DPTEXTURECAPS_MIPCUBEMAP | diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 82a1d870d60..5a10b13c55d 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -24,7 +24,7 @@ #include "wined3d_private.h" WINE_DEFAULT_DEBUG_CHANNEL(d3d); -#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->wineD3DDevice)->wineD3D))->gl_info +#define GLINFO_LOCATION ((IWineD3DImpl *)(((IWineD3DDeviceImpl *)This->resource.wineD3DDevice)->wineD3D))->gl_info /* ******************************************* IWineD3DVolume IUnknown parts follow @@ -285,18 +285,19 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, GLen IWineD3DVolumeImpl *This = (IWineD3DVolumeImpl *)iface; const PixelFormatDesc *formatEntry = getFormatDescEntry(This->resource.format); - TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n", - GL_TEXTURE_3D, - gl_level, - formatEntry->glInternal, - This->currentDesc.Width, - This->currentDesc.Height, - This->currentDesc.Depth, - 0, - formatEntry->glFormat, - formatEntry->glType, - This->resource.allocatedMemory); - glTexImage3D(GL_TEXTURE_3D, + if(GL_SUPPORT(EXT_TEXTURE3D)) { + TRACE("Calling glTexImage3D %x level=%d, intfmt=%x, w=%d, h=%d,d=%d, 0=%d, glFmt=%x, glType=%x, Mem=%p\n", + GL_TEXTURE_3D, + gl_level, + formatEntry->glInternal, + This->currentDesc.Width, + This->currentDesc.Height, + This->currentDesc.Depth, + 0, + formatEntry->glFormat, + formatEntry->glType, + This->resource.allocatedMemory); + GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, gl_level, formatEntry->glInternal, This->currentDesc.Width, @@ -305,8 +306,11 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, GLen 0, formatEntry->glFormat, formatEntry->glType, - This->resource.allocatedMemory); - checkGLcall("glTexImage3D"); + This->resource.allocatedMemory)); + checkGLcall("glTexImage3D"); + } else + WARN("This OpenGL implementation doesn't support 3D textures\n"); + return WINED3D_OK; } diff --git a/include/wine/wined3d_gl.h b/include/wine/wined3d_gl.h index d9b075c1995..923ca4a141c 100644 --- a/include/wine/wined3d_gl.h +++ b/include/wine/wined3d_gl.h @@ -350,6 +350,20 @@ typedef void (APIENTRY * PGLFNGLCOLORTABLEEXTPROC) (GLenum target, GLenum intern #endif typedef void (APIENTRY * PGLFNGLPOINTPARAMETERFEXTPROC) (GLenum pname, GLfloat param); typedef void (APIENTRY * PGLFNGLPOINTPARAMETERFVEXTPROC) (GLenum pname, const GLfloat *params); +/* GL_EXT_texture3D */ +#ifndef GL_EXT_texture3D +#define GL_PACK_SKIP_IMAGES_EXT 0x806B +#define GL_PACK_IMAGE_HEIGHT_EXT 0x806C +#define GL_UNPACK_SKIP_IMAGES_EXT 0x806D +#define GL_UNPACK_IMAGE_HEIGHT_EXT 0x806E +#define GL_TEXTURE_3D_EXT 0x806F +#define GL_PROXY_TEXTURE_3D_EXT 0x8070 +#define GL_TEXTURE_DEPTH_EXT 0x8071 +#define GL_TEXTURE_WRAP_R_EXT 0x8072 +#define GL_MAX_3D_TEXTURE_SIZE_EXT 0x8073 +#endif +typedef void (APIENTRY * PGLFNGLTEXIMAGE3DEXTPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels); +typedef void (APIENTRY * PGLFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels); /* GL_EXT_texture_env_combine */ #ifndef GL_EXT_texture_env_combine #define GL_EXT_texture_env_combine 1 @@ -1373,6 +1387,7 @@ typedef enum _GL_SupportedExt { EXT_SECONDARY_COLOR, EXT_STENCIL_TWO_SIDE, EXT_STENCIL_WRAP, + EXT_TEXTURE3D, EXT_TEXTURE_COMPRESSION_S3TC, EXT_TEXTURE_FILTER_ANISOTROPIC, EXT_TEXTURE_LOD, @@ -1482,6 +1497,9 @@ typedef enum _GL_SupportedExt { USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FEXTPROC, glSecondaryColor3fEXT); \ USE_GL_FUNC(PGLFNGLSECONDARYCOLOR3FVEXTPROC, glSecondaryColor3fvEXT); \ USE_GL_FUNC(PGLFNGLSECONDARYCOLORPOINTEREXTPROC, glSecondaryColorPointerEXT); \ + /* GL_EXT_texture3D */ \ + USE_GL_FUNC(PGLFNGLTEXIMAGE3DEXTPROC, glTexImage3DEXT); \ + USE_GL_FUNC(PGLFNGLTEXSUBIMAGE3DEXTPROC, glTexSubImage3DEXT); \ /* GL_ARB_vertex_program */ \ USE_GL_FUNC(PGLFNGENPROGRAMSARBPROC, glGenProgramsARB); \ USE_GL_FUNC(PGLFNBINDPROGRAMARBPROC, glBindProgramARB); \ -- 2.11.4.GIT