wined3d: Refuse to create volumes and volume textures if not supported.

This commit is contained in:
Stefan Dösinger 2007-10-26 13:44:16 +02:00 committed by Alexandre Julliard
parent 45ebea1f47
commit c2b6cbf014
2 changed files with 24 additions and 17 deletions

View File

@ -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,

View File

@ -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).