In truth this part is actually just ddraw_surface_create() refactoring, but it came about while working on SetSurfaceDesc()...
From: Zebediah Figura zfigura@codeweavers.com
"is_complex_root" is somewhat misleading, given that it is TRUE for surfaces with no attached surfaces. --- dlls/ddraw/ddraw_private.h | 2 +- dlls/ddraw/surface.c | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index 09e8133350b..e3fac63a38f 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -206,7 +206,7 @@ struct ddraw_surface /* You can't traverse the tree upwards. Only a flag for Surface::Release because it's needed there, * but no pointer to prevent temptations to traverse it in the wrong direction. */ - unsigned int is_complex_root : 1; + unsigned int is_root : 1; unsigned int is_lost : 1; unsigned int sysmem_fallback : 1;
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index a7b3261fbdf..d7a3abc997a 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -579,7 +579,7 @@ static void ddraw_surface_cleanup(struct ddraw_surface *surface)
surf = surface->complex_array[i]; surface->complex_array[i] = NULL; - if (!surf->is_complex_root) + if (!surf->is_root) { struct ddraw_texture *texture = wined3d_texture_get_parent(surf->wined3d_texture); struct wined3d_device *wined3d_device = texture->wined3d_device; @@ -629,7 +629,7 @@ static ULONG ddraw_surface_release_iface(struct ddraw_surface *This)
/* Complex attached surfaces are destroyed implicitly when the root is released */ wined3d_mutex_lock(); - if(!This->is_complex_root) + if (!This->is_root) { WARN("(%p) Attempt to destroy a surface that is not a complex root\n", This); wined3d_mutex_unlock(); @@ -2628,7 +2628,7 @@ static HRESULT WINAPI ddraw_surface7_GetPriority(IDirectDrawSurface7 *iface, DWO WARN("Called on offscreenplain surface, returning DDERR_INVALIDOBJECT.\n"); hr = DDERR_INVALIDOBJECT; } - else if (!(surface->surface_desc.ddsCaps.dwCaps2 & managed) || !surface->is_complex_root) + else if (!(surface->surface_desc.ddsCaps.dwCaps2 & managed) || !surface->is_root) { WARN("Called on non-managed texture or non-root surface, returning DDERR_INVALIDPARAMS.\n"); hr = DDERR_INVALIDPARAMS; @@ -5001,7 +5001,7 @@ static HRESULT ddraw_surface_set_color_key(struct ddraw_surface *surface, DWORD } }
- if (surface->is_complex_root) + if (surface->is_root) hr = ddraw_surface_set_wined3d_textures_colour_key(surface, flags, color_key ? (struct wined3d_color_key *)&fixed_color_key : NULL);
@@ -6641,7 +6641,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
root = wined3d_texture_get_sub_resource_parent(wined3d_texture, 0);
- root->is_complex_root = TRUE; + root->is_root = TRUE; root->sysmem_fallback = sysmem_fallback; texture->root = root; wined3d_device_incref(texture->wined3d_device = ddraw->wined3d_device);
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 18 ------------------ 1 file changed, 18 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index d7a3abc997a..9cccf89ceb5 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -4664,22 +4664,6 @@ static HRESULT WINAPI ddraw_surface1_SetClipper(IDirectDrawSurface *iface, IDire return ddraw_surface7_SetClipper(&surface->IDirectDrawSurface7_iface, clipper); }
-/***************************************************************************** - * IDirectDrawSurface7::SetSurfaceDesc - * - * Sets the surface description. It can override the pixel format, the surface - * memory, ... - * It's not really tested. - * - * Params: - * DDSD: Pointer to the new surface description to set - * Flags: Some flags - * - * Returns: - * DD_OK on success - * DDERR_INVALIDPARAMS if DDSD is NULL - * - *****************************************************************************/ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, DDSURFACEDESC2 *DDSD, DWORD Flags) { struct ddraw_surface *surface = impl_from_IDirectDrawSurface7(iface); @@ -4709,8 +4693,6 @@ static HRESULT WINAPI ddraw_surface7_SetSurfaceDesc(IDirectDrawSurface7 *iface, return DDERR_INVALIDSURFACETYPE; }
- /* Tests show that only LPSURFACE and PIXELFORMAT can be set, and LPSURFACE is required - * for PIXELFORMAT to work */ if (DDSD->dwFlags & ~allowed_flags) { WARN("Invalid flags %#lx set, returning DDERR_INVALIDPARAMS\n", DDSD->dwFlags);
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 9cccf89ceb5..7b7d7e3ec3f 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6049,8 +6049,9 @@ static bool need_draw_texture(unsigned int draw_bind_flags, const struct wined3d return true; }
-static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, unsigned int layers, - unsigned int levels, struct ddraw_texture *texture, struct wined3d_texture **wined3d_texture) +static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, + unsigned int layers, unsigned int levels, struct ddraw_texture *texture, + bool sysmem_fallback, struct wined3d_texture **wined3d_texture) { struct wined3d_device *wined3d_device = ddraw->wined3d_device; const DDSURFACEDESC2 *desc = &texture->surface_desc; @@ -6172,6 +6173,13 @@ static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, unsigne return hr; }
+ for (i = 0; i < layers * levels; ++i) + { + struct ddraw_surface *surface = wined3d_texture_get_sub_resource_parent(*wined3d_texture, i); + + surface->sysmem_fallback = sysmem_fallback; + } + wined3d_texture_decref(*wined3d_texture);
TRACE("Surface %p, created draw_texture %p, wined3d_texture %p.\n", @@ -6614,7 +6622,8 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) layers = 6;
- if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw, layers, levels, texture, &wined3d_texture))) + if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw, layers, levels, + texture, sysmem_fallback, &wined3d_texture))) { WARN("Failed to create wined3d texture, hr %#lx.\n", hr); heap_free(texture); @@ -6624,7 +6633,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ root = wined3d_texture_get_sub_resource_parent(wined3d_texture, 0);
root->is_root = TRUE; - root->sysmem_fallback = sysmem_fallback; texture->root = root; wined3d_device_incref(texture->wined3d_device = ddraw->wined3d_device);
@@ -6648,7 +6656,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ for (j = 0; j < levels; ++j) { mip = wined3d_texture_get_sub_resource_parent(wined3d_texture, i * levels + j); - mip->sysmem_fallback = sysmem_fallback; mip_desc = &mip->surface_desc; if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP) mip_desc->u2.dwMipMapCount = levels - j; @@ -6739,7 +6746,8 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ desc->ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; desc->u5.dwBackBufferCount = 0;
- if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw, 1, 1, texture, &wined3d_texture))) + if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw, 1, 1, + texture, sysmem_fallback, &wined3d_texture))) { heap_free(texture); hr = hr_ddraw_from_wined3d(hr); @@ -6747,7 +6755,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ }
last = wined3d_texture_get_sub_resource_parent(wined3d_texture, 0); - last->sysmem_fallback = sysmem_fallback; texture->root = last; wined3d_device_incref(texture->wined3d_device = ddraw->wined3d_device);
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 116 ++++++++++++++++++------------------------- 1 file changed, 49 insertions(+), 67 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 7b7d7e3ec3f..60902a2d24c 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6051,13 +6051,13 @@ static bool need_draw_texture(unsigned int draw_bind_flags, const struct wined3d
static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, unsigned int layers, unsigned int levels, struct ddraw_texture *texture, - bool sysmem_fallback, struct wined3d_texture **wined3d_texture) + bool sysmem_fallback, bool reserve_memory, struct wined3d_texture **wined3d_texture) { struct wined3d_device *wined3d_device = ddraw->wined3d_device; const DDSURFACEDESC2 *desc = &texture->surface_desc; struct wined3d_texture *draw_texture = NULL; struct wined3d_resource_desc wined3d_desc; - struct ddraw_surface *parent; + struct ddraw_surface *parent, *root; unsigned int bind_flags; unsigned int pitch = 0; unsigned int i; @@ -6135,16 +6135,7 @@ static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, if (FAILED(hr = wined3d_texture_create(wined3d_device, &wined3d_desc, layers, levels, WINED3D_TEXTURE_CREATE_GET_DC_LENIENT, NULL, NULL, &ddraw_null_wined3d_parent_ops, wined3d_texture))) - { - parent = wined3d_texture_get_sub_resource_parent(draw_texture, 0); - if (texture->version == 7) - IDirectDrawSurface7_Release(&parent->IDirectDrawSurface7_iface); - else if (texture->version == 4) - IDirectDrawSurface4_Release(&parent->IDirectDrawSurface4_iface); - else - IDirectDrawSurface_Release(&parent->IDirectDrawSurface_iface); - return hr; - } + goto fail;
wined3d_resource_set_parent(wined3d_texture_get_resource(*wined3d_texture), texture); for (i = 0; i < layers * levels; ++i) @@ -6170,9 +6161,27 @@ static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, WINED3D_MULTISAMPLE_NONE, 0, desc->lpSurface, pitch))) { ERR("Failed to set surface memory, hr %#lx.\n", hr); - return hr; + goto fail; }
+ root = wined3d_texture_get_sub_resource_parent(*wined3d_texture, 0); + texture->root = root; + + wined3d_device_incref(texture->wined3d_device = ddraw->wined3d_device); + + if (desc->dwFlags & DDSD_CKDESTOVERLAY) + ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_DESTOVERLAY, + (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay); + if (desc->dwFlags & DDSD_CKDESTBLT) + ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_DESTBLT, + (struct wined3d_color_key *)&desc->ddckCKDestBlt); + if (desc->dwFlags & DDSD_CKSRCOVERLAY) + ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_SRCOVERLAY, + (struct wined3d_color_key *)&desc->ddckCKSrcOverlay); + if (desc->dwFlags & DDSD_CKSRCBLT) + ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_SRCBLT, + (struct wined3d_color_key *)&desc->ddckCKSrcBlt); + for (i = 0; i < layers * levels; ++i) { struct ddraw_surface *surface = wined3d_texture_get_sub_resource_parent(*wined3d_texture, i); @@ -6182,9 +6191,24 @@ static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw,
wined3d_texture_decref(*wined3d_texture);
- TRACE("Surface %p, created draw_texture %p, wined3d_texture %p.\n", - wined3d_texture_get_sub_resource_parent(*wined3d_texture, 0), draw_texture, *wined3d_texture); + if (reserve_memory && FAILED(hr = ddraw_surface_reserve_memory(*wined3d_texture, 1))) + { + hr = hr_ddraw_from_wined3d(hr); + goto fail; + } + + TRACE("Surface %p, created draw_texture %p, wined3d_texture %p.\n", root, draw_texture, *wined3d_texture); return D3D_OK; + +fail: + parent = wined3d_texture_get_sub_resource_parent(draw_texture, 0); + if (texture->version == 7) + IDirectDrawSurface7_Release(&parent->IDirectDrawSurface7_iface); + else if (texture->version == 4) + IDirectDrawSurface4_Release(&parent->IDirectDrawSurface4_iface); + else + IDirectDrawSurface_Release(&parent->IDirectDrawSurface_iface); + return hr; }
HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, @@ -6199,7 +6223,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ struct ddraw_texture *texture; BOOL sysmem_fallback = FALSE; unsigned int layers = 1; - BOOL reserve_memory; + bool reserve_memory; UINT levels, i, j; HRESULT hr;
@@ -6622,32 +6646,20 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ if (desc->ddsCaps.dwCaps2 & DDSCAPS2_CUBEMAP) layers = 6;
+ reserve_memory = !(desc->dwFlags & DDSD_LPSURFACE) + && desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY + && wined3d_display_mode_format.u1.dwRGBBitCount <= 16; + if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw, layers, levels, - texture, sysmem_fallback, &wined3d_texture))) + texture, sysmem_fallback, reserve_memory, &wined3d_texture))) { WARN("Failed to create wined3d texture, hr %#lx.\n", hr); heap_free(texture); return hr_ddraw_from_wined3d(hr); }
- root = wined3d_texture_get_sub_resource_parent(wined3d_texture, 0); - + root = texture->root; root->is_root = TRUE; - texture->root = root; - wined3d_device_incref(texture->wined3d_device = ddraw->wined3d_device); - - if (desc->dwFlags & DDSD_CKDESTOVERLAY) - ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_DESTOVERLAY, - (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay); - if (desc->dwFlags & DDSD_CKDESTBLT) - ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_DESTBLT, - (struct wined3d_color_key *)&desc->ddckCKDestBlt); - if (desc->dwFlags & DDSD_CKSRCOVERLAY) - ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_SRCOVERLAY, - (struct wined3d_color_key *)&desc->ddckCKSrcOverlay); - if (desc->dwFlags & DDSD_CKSRCBLT) - ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_SRCBLT, - (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
for (i = 0; i < layers; ++i) { @@ -6709,16 +6721,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ } }
- reserve_memory = !(desc->dwFlags & DDSD_LPSURFACE) - && desc->ddsCaps.dwCaps & DDSCAPS_VIDEOMEMORY - && wined3d_display_mode_format.u1.dwRGBBitCount <= 16; - - if (reserve_memory && FAILED(hr = ddraw_surface_reserve_memory(wined3d_texture, layers * levels))) - { - ERR("Failed to reserve surface memory, hr %#lx.\n", hr); - goto fail; - } - if (desc->dwFlags & DDSD_BACKBUFFERCOUNT) { unsigned int count = desc->u5.dwBackBufferCount; @@ -6747,35 +6749,15 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ desc->u5.dwBackBufferCount = 0;
if (FAILED(hr = ddraw_surface_create_wined3d_texture(ddraw, 1, 1, - texture, sysmem_fallback, &wined3d_texture))) + texture, sysmem_fallback, reserve_memory, &wined3d_texture))) { heap_free(texture); hr = hr_ddraw_from_wined3d(hr); goto fail; }
- last = wined3d_texture_get_sub_resource_parent(wined3d_texture, 0); - texture->root = last; - wined3d_device_incref(texture->wined3d_device = ddraw->wined3d_device); - - if (desc->dwFlags & DDSD_CKDESTOVERLAY) - wined3d_texture_set_color_key(wined3d_texture, DDCKEY_DESTOVERLAY, - (struct wined3d_color_key *)&desc->u3.ddckCKDestOverlay); - if (desc->dwFlags & DDSD_CKDESTBLT) - wined3d_texture_set_color_key(wined3d_texture, DDCKEY_DESTBLT, - (struct wined3d_color_key *)&desc->ddckCKDestBlt); - if (desc->dwFlags & DDSD_CKSRCOVERLAY) - wined3d_texture_set_color_key(wined3d_texture, DDCKEY_SRCOVERLAY, - (struct wined3d_color_key *)&desc->ddckCKSrcOverlay); - if (desc->dwFlags & DDSD_CKSRCBLT) - wined3d_texture_set_color_key(wined3d_texture, DDCKEY_SRCBLT, - (struct wined3d_color_key *)&desc->ddckCKSrcBlt); - - if (reserve_memory && FAILED(hr = ddraw_surface_reserve_memory(wined3d_texture, 1))) - { - hr = hr_ddraw_from_wined3d(hr); - goto fail; - } + last = texture->root; + *attach = last; attach = &last->complex_array[0]; }
From: Zebediah Figura zfigura@codeweavers.com
--- dlls/ddraw/surface.c | 143 +++++++++++++++++++++---------------------- 1 file changed, 71 insertions(+), 72 deletions(-)
diff --git a/dlls/ddraw/surface.c b/dlls/ddraw/surface.c index 60902a2d24c..fc713bc9b82 100644 --- a/dlls/ddraw/surface.c +++ b/dlls/ddraw/surface.c @@ -6060,7 +6060,7 @@ static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, struct ddraw_surface *parent, *root; unsigned int bind_flags; unsigned int pitch = 0; - unsigned int i; + unsigned int i, j; HRESULT hr;
wined3d_resource_desc_from_ddraw(ddraw, &wined3d_desc, desc); @@ -6167,6 +6167,73 @@ static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, root = wined3d_texture_get_sub_resource_parent(*wined3d_texture, 0); texture->root = root;
+ for (i = 0; i < layers; ++i) + { + struct ddraw_surface **attach = &root->complex_array[layers - 1 - i]; + + for (j = 0; j < levels; ++j) + { + struct wined3d_sub_resource_desc wined3d_mip_desc; + unsigned int sub_resource_idx = i * levels + j; + struct ddraw_surface *mip; + DDSURFACEDESC2 *mip_desc; + + mip = wined3d_texture_get_sub_resource_parent(*wined3d_texture, sub_resource_idx); + + mip->sysmem_fallback = sysmem_fallback; + mip_desc = &mip->surface_desc; + if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP) + mip_desc->u2.dwMipMapCount = levels - j; + + if (j) + { + wined3d_texture_get_sub_resource_desc(*wined3d_texture, sub_resource_idx, &wined3d_mip_desc); + mip_desc->dwWidth = wined3d_mip_desc.width; + mip_desc->dwHeight = wined3d_mip_desc.height; + + 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; + } + + } + + if (mip == root) + continue; + + *attach = mip; + attach = &mip->complex_array[0]; + } + } + wined3d_device_incref(texture->wined3d_device = ddraw->wined3d_device);
if (desc->dwFlags & DDSD_CKDESTOVERLAY) @@ -6182,13 +6249,6 @@ static HRESULT ddraw_surface_create_wined3d_texture(struct ddraw *ddraw, ddraw_surface_set_wined3d_textures_colour_key(root, DDCKEY_SRCBLT, (struct wined3d_color_key *)&desc->ddckCKSrcBlt);
- for (i = 0; i < layers * levels; ++i) - { - struct ddraw_surface *surface = wined3d_texture_get_sub_resource_parent(*wined3d_texture, i); - - surface->sysmem_fallback = sysmem_fallback; - } - wined3d_texture_decref(*wined3d_texture);
if (reserve_memory && FAILED(hr = ddraw_surface_reserve_memory(*wined3d_texture, 1))) @@ -6214,17 +6274,16 @@ fail: HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_desc, struct ddraw_surface **surface, IUnknown *outer_unknown, unsigned int version) { - struct wined3d_sub_resource_desc wined3d_mip_desc; - struct ddraw_surface *root, *mip, **attach; DDPIXELFORMAT wined3d_display_mode_format; struct wined3d_texture *wined3d_texture; + struct ddraw_surface *root, **attach; struct wined3d_display_mode mode; - DDSURFACEDESC2 *desc, *mip_desc; struct ddraw_texture *texture; BOOL sysmem_fallback = FALSE; unsigned int layers = 1; + DDSURFACEDESC2 *desc; bool reserve_memory; - UINT levels, i, j; + UINT levels, i; HRESULT hr;
TRACE("ddraw %p, surface_desc %p, surface %p, outer_unknown %p, version %u.\n", @@ -6661,66 +6720,6 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_ root = texture->root; root->is_root = TRUE;
- for (i = 0; i < layers; ++i) - { - attach = &root->complex_array[layers - 1 - i]; - - for (j = 0; j < levels; ++j) - { - mip = wined3d_texture_get_sub_resource_parent(wined3d_texture, i * levels + j); - mip_desc = &mip->surface_desc; - if (desc->ddsCaps.dwCaps & DDSCAPS_MIPMAP) - mip_desc->u2.dwMipMapCount = levels - j; - - if (j) - { - wined3d_texture_get_sub_resource_desc(wined3d_texture, i * levels + j, &wined3d_mip_desc); - mip_desc->dwWidth = wined3d_mip_desc.width; - mip_desc->dwHeight = wined3d_mip_desc.height; - - 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; - } - - } - - if (mip == root) - continue; - - *attach = mip; - attach = &mip->complex_array[0]; - } - } - if (desc->dwFlags & DDSD_BACKBUFFERCOUNT) { unsigned int count = desc->u5.dwBackBufferCount;
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=130386
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/ddraw/surface.c:6049 error: patch failed: dlls/ddraw/surface.c:6051 error: patch failed: dlls/ddraw/surface.c:6060 Task: Patch failed to apply
=== debian11b (build log) ===
error: patch failed: dlls/ddraw/surface.c:6049 error: patch failed: dlls/ddraw/surface.c:6051 error: patch failed: dlls/ddraw/surface.c:6060 Task: Patch failed to apply
Seems I submitted the patch before Marvin had a chance to update its Wine tree; that compile failure can be ignored.
This merge request was approved by Jan Sikorski.