Commit 191db92f authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

ddraw: Move the mipmap desc fixup code to ddraw_surface_create_texture() from…

ddraw: Move the mipmap desc fixup code to ddraw_surface_create_texture() from device_parent_create_texture_surface().
parent f5df7986
......@@ -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)))
......
......@@ -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];
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment