Commit c6cd7a77 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Properly handle the offset for compressed surfaces in IWineD3DDeviceImpl_UpdateSurface().

parent 0ee57cf1
......@@ -5902,17 +5902,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
if(pSourceRect != NULL && pSourceRect->top != 0){
offset += pSourceRect->top * srcSurfaceWidth * pSrcSurface->bytesPerPixel;
}
TRACE("(%p) glTexSubImage2D, Level %d, left %d, top %d, width %d, height %d , ftm %d, type %d, memory %p\n"
,This
,glDescription->level
,destLeft
,destTop
,srcWidth
,srcHeight
,glDescription->glFormat
,glDescription->glType
,IWineD3DSurface_GetData(pSourceSurface)
);
TRACE("(%p) glTexSubImage2D, level %d, left %d, top %d, width %d, height %d, fmt %#x, type %#x, memory %p+%#x\n",
This, glDescription->level, destLeft, destTop, srcWidth, srcHeight, glDescription->glFormat,
glDescription->glType, IWineD3DSurface_GetData(pSourceSurface), offset);
/* Sanity check */
if (IWineD3DSurface_GetData(pSourceSurface) == NULL) {
......@@ -5945,6 +5937,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
}
} else { /* Full width, so just write out the whole texture */
const unsigned char* data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
if (WINED3DFMT_DXT1 == destFormat ||
WINED3DFMT_DXT2 == destFormat ||
......@@ -5958,14 +5951,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
} if (destFormat != srcFormat) {
FIXME("Updating mixed format compressed texture is not curretly support\n");
} else {
GL_EXTCALL(glCompressedTexImage2DARB)(glDescription->target,
glDescription->level,
glDescription->glFormatInternal,
srcWidth,
srcHeight,
0,
destSize,
IWineD3DSurface_GetData(pSourceSurface));
GL_EXTCALL(glCompressedTexImage2DARB(glDescription->target, glDescription->level,
glDescription->glFormatInternal, srcWidth, srcHeight, 0, destSize, data));
}
} else {
FIXME("Attempting to update a DXT compressed texture without hardware support\n");
......@@ -5973,17 +5960,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
} else {
const unsigned char* data =((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
glTexSubImage2D(glDescription->target
,glDescription->level
,destLeft
,destTop
,srcWidth
,srcHeight
,glDescription->glFormat
,glDescription->glType
,data
);
glTexSubImage2D(glDescription->target, glDescription->level, destLeft, destTop,
srcWidth, srcHeight, glDescription->glFormat, glDescription->glType, data);
}
}
checkGLcall("glTexSubImage2D");
......
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