wined3d: Fix volume texture creation error handling.
Henri Verbeet
hverbeet at codeweavers.com
Tue Jan 13 03:31:57 CST 2009
---
dlls/wined3d/device.c | 39 +++++++++++++++++++++++----------------
1 files changed, 23 insertions(+), 16 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 2b10c2b..7243fb0 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -989,6 +989,29 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
return WINED3DERR_INVALIDCALL;
}
+ /* Calculate levels for mip mapping */
+ if (Usage & WINED3DUSAGE_AUTOGENMIPMAP)
+ {
+ if (!GL_SUPPORT(SGIS_GENERATE_MIPMAP))
+ {
+ WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ if (Levels > 1)
+ {
+ WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n");
+ return WINED3DERR_INVALIDCALL;
+ }
+
+ Levels = 1;
+ }
+ else if (!Levels)
+ {
+ Levels = wined3d_log2i(max(max(Width, Height), Depth)) + 1;
+ TRACE("Calculated levels = %d\n", Levels);
+ }
+
object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object));
if (!object)
{
@@ -1030,22 +1053,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVolumeTexture(IWineD3DDevice *ifa
object->baseTexture.magLookup = magLookup_noFilter;
}
- /* Calculate levels for mip mapping */
- if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) {
- if(!GL_SUPPORT(SGIS_GENERATE_MIPMAP)) {
- WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n");
- return WINED3DERR_INVALIDCALL;
- }
- if(Levels > 1) {
- WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n");
- return WINED3DERR_INVALIDCALL;
- }
- object->baseTexture.levels = 1;
- } else if (Levels == 0) {
- object->baseTexture.levels = wined3d_log2i(max(max(Width, Height), Depth)) + 1;
- TRACE("Calculated levels = %d\n", object->baseTexture.levels);
- }
-
/* Generate all the surfaces */
tmpW = Width;
tmpH = Height;
--
1.6.0.6
--------------060503020301030808090504--
More information about the wine-patches
mailing list