wined3d: Make sure all texture levels are allocated in surface_prepare_texture().

This fixes a regression introduced by commit
af7dfcd378.
This commit is contained in:
Henri Verbeet 2010-04-22 18:55:58 +02:00 committed by Alexandre Julliard
parent 958b523707
commit 9308c5499f
1 changed files with 27 additions and 1 deletions

View File

@ -1563,7 +1563,8 @@ static void read_from_framebuffer_texture(IWineD3DSurfaceImpl *This, BOOL srgb)
}
/* Context activation is done by the caller. */
void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
static void surface_prepare_texture_internal(IWineD3DSurfaceImpl *surface,
const struct wined3d_gl_info *gl_info, BOOL srgb)
{
DWORD alloc_flag = srgb ? SFLAG_SRGBALLOCATED : SFLAG_ALLOCATED;
CONVERT_TYPES convert;
@ -1580,6 +1581,31 @@ void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_
surface->Flags |= alloc_flag;
}
/* Context activation is done by the caller. */
void surface_prepare_texture(IWineD3DSurfaceImpl *surface, const struct wined3d_gl_info *gl_info, BOOL srgb)
{
IWineD3DBaseTextureImpl *texture;
if (SUCCEEDED(IWineD3DSurface_GetContainer((IWineD3DSurface *)surface,
&IID_IWineD3DBaseTexture, (void **)&texture)))
{
UINT sub_count = texture->baseTexture.level_count * texture->baseTexture.layer_count;
UINT i;
TRACE("surface %p is a subresource of texture %p.\n", surface, texture);
for (i = 0; i < sub_count; ++i)
{
IWineD3DSurfaceImpl *s = (IWineD3DSurfaceImpl *)texture->baseTexture.sub_resources[i];
surface_prepare_texture_internal(s, gl_info, srgb);
}
IWineD3DBaseTexture_Release((IWineD3DBaseTexture *)texture);
}
surface_prepare_texture_internal(surface, gl_info, srgb);
}
static void surface_prepare_system_memory(IWineD3DSurfaceImpl *This)
{
IWineD3DDeviceImpl *device = This->resource.device;