Module: wine Branch: master Commit: 191db92fd59073242600c90cb58e5cf27ebda325 URL: http://source.winehq.org/git/wine.git/?a=commit;h=191db92fd59073242600c90cb5...
Author: Henri Verbeet hverbeet@codeweavers.com Date: Wed Oct 24 21:23:35 2012 +0200
ddraw: Move the mipmap desc fixup code to ddraw_surface_create_texture() from device_parent_create_texture_surface().
---
dlls/ddraw/ddraw.c | 41 ----------------------------------------- dlls/ddraw/surface.c | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+), 41 deletions(-)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index fa1beff..014ad27 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -5218,47 +5218,6 @@ static HRESULT CDECL device_parent_create_texture_surface(struct wined3d_device_
desc.dwWidth = width; desc.dwHeight = height; - if (level) - desc.ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL; - else - desc.ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL; - - if (desc.ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) - { - desc.ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES; - - switch (face) - { - case WINED3D_CUBEMAP_FACE_POSITIVE_X: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX; - break; - - case WINED3D_CUBEMAP_FACE_NEGATIVE_X: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; - break; - - case WINED3D_CUBEMAP_FACE_POSITIVE_Y: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY; - break; - - case WINED3D_CUBEMAP_FACE_NEGATIVE_Y: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY; - break; - - case WINED3D_CUBEMAP_FACE_POSITIVE_Z: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ; - break; - - case WINED3D_CUBEMAP_FACE_NEGATIVE_Z: - desc.ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ; - break; - - default: - ERR("Unexpected cube face.\n"); - return DDERR_INVALIDPARAMS; - } - - }
/* FIXME: Validate that format, usage, pool, etc. really make sense. */ if (FAILED(hr = ddraw_create_surface(ddraw, &desc, &ddraw_surface, tex_root->version))) diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 51bd876..1c548a5 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -5592,6 +5592,7 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface) struct wined3d_resource *resource; enum wined3d_format_id format; UINT layers, levels, i, j; + DDSURFACEDESC2 *mip_desc; enum wined3d_pool pool; HRESULT hr;
@@ -5638,6 +5639,41 @@ HRESULT ddraw_surface_create_texture(struct ddraw_surface *surface) if (mip == surface) continue;
+ mip_desc = &mip->surface_desc; + + if (j) + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_MIPMAPSUBLEVEL; + else + mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_MIPMAPSUBLEVEL; + + if (mip_desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) + { + mip_desc->ddsCaps.dwCaps2 &= ~DDSCAPS2_CUBEMAP_ALLFACES; + + switch (i) + { + case WINED3D_CUBEMAP_FACE_POSITIVE_X: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEX; + break; + case WINED3D_CUBEMAP_FACE_NEGATIVE_X: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEX; + break; + case WINED3D_CUBEMAP_FACE_POSITIVE_Y: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEY; + break; + case WINED3D_CUBEMAP_FACE_NEGATIVE_Y: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEY; + break; + case WINED3D_CUBEMAP_FACE_POSITIVE_Z: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_POSITIVEZ; + break; + case WINED3D_CUBEMAP_FACE_NEGATIVE_Z: + mip_desc->ddsCaps.dwCaps2 |= DDSCAPS2_CUBEMAP_NEGATIVEZ; + break; + } + + } + *attach = mip; attach = &mip->complex_array[0]; }