diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 6aa58cd59d3..e9cd3de1297 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -952,6 +952,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa UINT tmpH; UINT tmpD; const GlPixelFormatDesc *glDesc; + getFormatDescEntry(Format, &GLINFO_LOCATION, &glDesc); /* TODO: It should only be possible to create textures for formats @@ -960,6 +961,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa WARN("(%p) : Texture cannot be created with a format of WINED3DFMT_UNKNOWN\n", This); return WINED3DERR_INVALIDCALL; } + if(!GL_SUPPORT(EXT_TEXTURE3D)) { + WARN("(%p) : Texture cannot be created - no volume texture support\n", This); + return WINED3DERR_INVALIDCALL; + } D3DCREATERESOURCEOBJECTINSTANCE(object, VolumeTexture, WINED3DRTYPE_VOLUMETEXTURE, 0); D3DINITIALIZEBASETEXTURE(object->baseTexture); @@ -1041,6 +1046,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolume(IWineD3DDevice *iface, IWineD3DVolumeImpl *object; /** NOTE: impl ref allowed since this is a create function **/ const StaticPixelFormatDesc *formatDesc = getFormatDescEntry(Format, NULL, NULL); + if(!GL_SUPPORT(EXT_TEXTURE3D)) { + WARN("(%p) : Volume cannot be created - no volume texture support\n", This); + return WINED3DERR_INVALIDCALL; + } + D3DCREATERESOURCEOBJECTINSTANCE(object, Volume, WINED3DRTYPE_VOLUME, ((Width * formatDesc->bpp) * Height * Depth)) TRACE("(%p) : W(%d) H(%d) D(%d), Usage(%d), Fmt(%u,%s), Pool(%s)\n", This, Width, Height, diff --git a/dlls/wined3d/volume.c b/dlls/wined3d/volume.c index 425a45ed7c8..a70a3519eef 100644 --- a/dlls/wined3d/volume.c +++ b/dlls/wined3d/volume.c @@ -270,9 +270,18 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int TRACE("(%p) : level %u, format %s (0x%08x)\n", This, gl_level, debug_d3dformat(format), format); - 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, + 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, + glDesc->glInternal, + This->currentDesc.Width, + This->currentDesc.Height, + This->currentDesc.Depth, + 0, + glDesc->glFormat, + glDesc->glType, + This->resource.allocatedMemory); + GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, gl_level, glDesc->glInternal, This->currentDesc.Width, @@ -281,20 +290,8 @@ static HRESULT WINAPI IWineD3DVolumeImpl_LoadTexture(IWineD3DVolume *iface, int 0, glDesc->glFormat, glDesc->glType, - This->resource.allocatedMemory); - GL_EXTCALL(glTexImage3DEXT(GL_TEXTURE_3D, - gl_level, - glDesc->glInternal, - This->currentDesc.Width, - This->currentDesc.Height, - This->currentDesc.Depth, - 0, - glDesc->glFormat, - glDesc->glType, - This->resource.allocatedMemory)); - checkGLcall("glTexImage3D"); - } else - WARN("This OpenGL implementation doesn't support 3D textures\n"); + This->resource.allocatedMemory)); + checkGLcall("glTexImage3D"); /* When adding code releasing This->resource.allocatedMemory to save data keep in mind that * GL_UNPACK_CLIENT_STORAGE_APPLE is enabled by default if supported(GL_APPLE_client_storage).