=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: wined3d: Locking partial blocks is not allowed in DEFAULT pool resources.
Alexandre Julliard
julliard at winehq.org
Thu Nov 3 13:10:14 CDT 2011
Module: wine
Branch: master
Commit: 9b0adb406dda4a1796e8207f1f3206e0d2784ddb
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b0adb406dda4a1796e8207f1f3206e0d2784ddb
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Thu Oct 13 23:35:38 2011 +0200
wined3d: Locking partial blocks is not allowed in DEFAULT pool resources.
---
dlls/wined3d/surface.c | 29 ++++++++++++++++++++++++++---
1 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 1492071..f75593d 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -6,7 +6,7 @@
* Copyright 2002-2003 Raphael Junqueira
* Copyright 2004 Christian Costa
* Copyright 2005 Oliver Stieber
- * Copyright 2006-2008 Stefan Dösinger for CodeWeavers
+ * Copyright 2006-2011 Stefan Dösinger for CodeWeavers
* Copyright 2007-2008 Henri Verbeet
* Copyright 2006-2008 Roderick Colenbrander
* Copyright 2009-2011 Henri Verbeet for CodeWeavers
@@ -3782,6 +3782,8 @@ HRESULT CDECL wined3d_surface_unmap(struct wined3d_surface *surface)
HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
WINED3DLOCKED_RECT *locked_rect, const RECT *rect, DWORD flags)
{
+ const struct wined3d_format *format = surface->resource.format;
+
TRACE("surface %p, locked_rect %p, rect %s, flags %#x.\n",
surface, locked_rect, wine_dbgstr_rect(rect), flags);
@@ -3790,6 +3792,29 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
WARN("Surface is already mapped.\n");
return WINED3DERR_INVALIDCALL;
}
+ if ((format->flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED
+ && rect && (rect->left || rect->top
+ || rect->right != surface->resource.width
+ || rect->bottom != surface->resource.height))
+ {
+ UINT width_mask = format->block_width - 1;
+ UINT height_mask = format->block_height - 1;
+
+ if ((rect->left & width_mask) || (rect->right & width_mask)
+ || (rect->top & height_mask) || (rect->bottom & height_mask))
+ {
+ switch (surface->resource.pool)
+ {
+ case WINED3DPOOL_DEFAULT:
+ WARN("Partial block lock with WINED3DPOOL_DEFAULT\n");
+ return WINED3DERR_INVALIDCALL;
+
+ default:
+ FIXME("Partial block lock with %s\n", debug_d3dpool(surface->resource.pool));
+ }
+ }
+ }
+
surface->flags |= SFLAG_LOCKED;
if (!(surface->flags & SFLAG_LOCKABLE))
@@ -3809,8 +3834,6 @@ HRESULT CDECL wined3d_surface_map(struct wined3d_surface *surface,
}
else
{
- const struct wined3d_format *format = surface->resource.format;
-
if ((format->flags & (WINED3DFMT_FLAG_COMPRESSED | WINED3DFMT_FLAG_BROKEN_PITCH)) == WINED3DFMT_FLAG_COMPRESSED)
{
/* Compressed textures are block based, so calculate the offset of
More information about the wine-cvs
mailing list