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

wined3d: Add support for partial updates of compressed surfaces to…

wined3d: Add support for partial updates of compressed surfaces to IWineD3DDeviceImpl_UpdateSurface().
parent 941c7da0
...@@ -5262,21 +5262,45 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, ...@@ -5262,21 +5262,45 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface,
ENTER_GL(); ENTER_GL();
/* TODO: Cube and volume support */ /* TODO: Cube and volume support */
if(rowoffset != 0){ if (rowoffset) /* Not a whole row so we have to do it a line at a time. */
/* not a whole row so we have to do it a line at a time */ {
int j; if (dst_format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
{
const unsigned char *data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface));
UINT row_length = (srcWidth / src_format_desc->block_width) * src_format_desc->block_byte_count;
UINT row_count = srcHeight / src_format_desc->block_height;
UINT src_pitch = IWineD3DSurface_GetPitch(pSourceSurface);
UINT y = destTop;
UINT row;
/* hopefully using pointer addition will be quicker than using a point + j * rowoffset */ data += (pSourceRect->top / src_format_desc->block_height) * src_pitch;
const unsigned char* data =((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset; data += (pSourceRect->left / src_format_desc->block_width) * src_format_desc->block_byte_count;
for (j = destTop; j < (srcHeight + destTop); ++j) for (row = 0; row < row_count; ++row)
{ {
glTexSubImage2D(dst_impl->texture_target, dst_impl->texture_level, destLeft, j, GL_EXTCALL(glCompressedTexSubImage2DARB(dst_impl->texture_target, dst_impl->texture_level,
srcWidth, 1, dst_format_desc->glFormat, dst_format_desc->glType,data); destLeft, y, srcWidth, src_format_desc->block_height,
data += rowoffset; dst_format_desc->glInternal, row_length, data));
y += src_format_desc->block_height;
data += src_pitch;
}
checkGLcall("glCompressedTexSubImage2DARB");
} }
else
{
const unsigned char *data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
unsigned int j;
} else { /* Full width, so just write out the whole texture */ for (j = destTop; j < (srcHeight + destTop); ++j)
{
glTexSubImage2D(dst_impl->texture_target, dst_impl->texture_level, destLeft, j,
srcWidth, 1, dst_format_desc->glFormat, dst_format_desc->glType,data);
data += rowoffset;
}
}
}
else /* Full width, so just write out the whole texture. */
{
const unsigned char* data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset; const unsigned char* data = ((const unsigned char *)IWineD3DSurface_GetData(pSourceSurface)) + offset;
if (dst_format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED) if (dst_format_desc->Flags & WINED3DFMT_FLAG_COMPRESSED)
......
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