wined3d: Source and destination formats should match in IWineD3DDeviceImpl_UpdateSurface().

This commit is contained in:
Henri Verbeet 2010-03-30 11:24:45 +02:00 committed by Alexandre Julliard
parent 0eae42ddc6
commit 88a2decc49
1 changed files with 9 additions and 17 deletions

View File

@ -5194,6 +5194,12 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
return WINED3DERR_INVALIDCALL;
}
if (srcFormat != destFormat)
{
WARN("Source and destination surfaces should have the same format.\n");
return WINED3DERR_INVALIDCALL;
}
/* This call loads the opengl surface directly, instead of copying the surface to the
* destination's sysmem copy. If surface conversion is needed, use BltFast instead to
* copy in sysmem and use regular surface loading.
@ -5206,14 +5212,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
pSourceSurface, pSourceRect, 0);
}
if (destFormat == WINED3DFMT_UNKNOWN) {
TRACE("(%p) : Converting destination surface from WINED3DFMT_UNKNOWN to the source format\n", This);
IWineD3DSurface_SetFormat(pDestinationSurface, srcFormat);
/* Get the update surface description */
IWineD3DSurface_GetDesc(pDestinationSurface, &winedesc);
}
context = context_acquire(This, NULL, CTXUSAGE_RESOURCELOAD);
ENTER_GL();
@ -5292,15 +5290,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
/* FIXME: The easy way to do this is to lock the destination, and copy the bits across. */
FIXME("Updating part of a compressed texture is not supported.\n");
}
if (destFormat != srcFormat)
{
FIXME("Updating mixed format compressed textures is not supported.\n");
}
else
{
GL_EXTCALL(glCompressedTexImage2DARB(dst_impl->texture_target, dst_impl->texture_level,
dst_format_desc->glInternal, srcWidth, srcHeight, 0, destSize, data));
}
GL_EXTCALL(glCompressedTexImage2DARB(dst_impl->texture_target, dst_impl->texture_level,
dst_format_desc->glInternal, srcWidth, srcHeight, 0, destSize, data));
}
checkGLcall("glCompressedTexSubImage2DARB");
}