Henri Verbeet : wined3d: Make "driver private" formats always mappable.
Alexandre Julliard
julliard at winehq.org
Mon Nov 19 15:59:38 CST 2018
Module: wine
Branch: master
Commit: 826be9ee109909e7c41d5bed2fb62fe4e74d4d05
URL: https://source.winehq.org/git/wine.git/?a=commit;h=826be9ee109909e7c41d5bed2fb62fe4e74d4d05
Author: Henri Verbeet <hverbeet at codeweavers.com>
Date: Sun Nov 18 22:27:16 2018 +0330
wined3d: Make "driver private" formats always mappable.
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3d8/tests/device.c | 6 ++----
dlls/wined3d/resource.c | 2 ++
dlls/wined3d/texture.c | 2 +-
dlls/wined3d/utils.c | 6 ++++--
dlls/wined3d/wined3d_private.h | 1 +
5 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c
index 5669009..0b40253 100644
--- a/dlls/d3d8/tests/device.c
+++ b/dlls/d3d8/tests/device.c
@@ -9045,11 +9045,9 @@ static void test_resource_access(void)
expected_hr = D3D_OK;
else
expected_hr = D3DERR_INVALIDCALL;
- todo_wine_if(j == 1 && surface_types[i].type != SURFACE_IMAGE)
- ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
+ ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
hr = IDirect3DSurface8_UnlockRect(surface);
- todo_wine_if((expected_hr != D3D_OK && surface_types[i].type == SURFACE_2D)
- || (j == 1 && surface_types[i].type == SURFACE_CUBE))
+ todo_wine_if(expected_hr != D3D_OK && surface_types[i].type == SURFACE_2D)
ok(hr == expected_hr, "Test %s %u: Got unexpected hr %#x.\n", surface_types[i].name, j, hr);
if (SUCCEEDED(IDirect3DSurface8_GetContainer(surface, &IID_IDirect3DBaseTexture8, (void **)&texture)))
diff --git a/dlls/wined3d/resource.c b/dlls/wined3d/resource.c
index 05fbafb..30a35c7 100644
--- a/dlls/wined3d/resource.c
+++ b/dlls/wined3d/resource.c
@@ -186,6 +186,8 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
resource->multisample_quality = multisample_quality;
resource->usage = usage;
resource->bind_flags = bind_flags;
+ if (resource->format_flags & WINED3DFMT_FLAG_MAPPABLE)
+ access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
resource->access = access;
resource->width = width;
resource->height = height;
diff --git a/dlls/wined3d/texture.c b/dlls/wined3d/texture.c
index 05f210f..ee3754f 100644
--- a/dlls/wined3d/texture.c
+++ b/dlls/wined3d/texture.c
@@ -3012,7 +3012,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
return hr;
}
wined3d_resource_update_draw_binding(&texture->resource);
- if ((flags & WINED3D_TEXTURE_CREATE_MAPPABLE) || desc->format == WINED3DFMT_D16_LOCKABLE)
+ if (flags & WINED3D_TEXTURE_CREATE_MAPPABLE)
texture->resource.access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
texture->texture_ops = texture_ops;
diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c
index a0abe6a..aa68799 100644
--- a/dlls/wined3d/utils.c
+++ b/dlls/wined3d/utils.c
@@ -328,8 +328,10 @@ struct wined3d_format_base_flags
* resource size. */
static const struct wined3d_format_base_flags format_base_flags[] =
{
- {WINED3DFMT_ATI1N, WINED3DFMT_FLAG_BROKEN_PITCH},
- {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_BROKEN_PITCH},
+ {WINED3DFMT_ATI1N, WINED3DFMT_FLAG_MAPPABLE | WINED3DFMT_FLAG_BROKEN_PITCH},
+ {WINED3DFMT_ATI2N, WINED3DFMT_FLAG_MAPPABLE | WINED3DFMT_FLAG_BROKEN_PITCH},
+ {WINED3DFMT_D16_LOCKABLE, WINED3DFMT_FLAG_MAPPABLE},
+ {WINED3DFMT_INTZ, WINED3DFMT_FLAG_MAPPABLE},
{WINED3DFMT_R11G11B10_FLOAT, WINED3DFMT_FLAG_FLOAT},
{WINED3DFMT_D32_FLOAT, WINED3DFMT_FLAG_FLOAT},
{WINED3DFMT_S8_UINT_D24_FLOAT, WINED3DFMT_FLAG_FLOAT},
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 2d2f712..f739e5f 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -4401,6 +4401,7 @@ extern enum wined3d_format_id pixelformat_for_depth(DWORD depth) DECLSPEC_HIDDEN
#define WINED3DFMT_FLAG_NORMALISED 0x00800000
#define WINED3DFMT_FLAG_VERTEX_ATTRIBUTE 0x01000000
#define WINED3DFMT_FLAG_BLIT 0x02000000
+#define WINED3DFMT_FLAG_MAPPABLE 0x04000000
struct wined3d_rational
{
More information about the wine-cvs
mailing list