From 826be9ee109909e7c41d5bed2fb62fe4e74d4d05 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Sun, 18 Nov 2018 22:09:16 +0330 Subject: [PATCH] wined3d: Make "driver private" formats always mappable. Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- 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 56690091df3..0b40253c58b 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 05fbafbfb35..30a35c7d425 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 05f210f6fd5..ee3754f1c5d 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 a0abe6a0c2e..aa68799535e 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 2d2f712d66d..f739e5f79c1 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 {