wined3d: Split WINED3D_RESOURCE_ACCESS_MAP into WINED3D_RESOURCE_ACCESS_MAP_R and WINED3D_RESOURCE_ACCESS_MAP_W.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-02-18 21:38:35 +03:30 committed by Alexandre Julliard
parent acc0f49aae
commit 6ca15e9c13
20 changed files with 70 additions and 54 deletions

View File

@ -8199,28 +8199,26 @@ static void check_buffer_cpu_access_(unsigned int line, ID3D10Buffer *buffer,
expected_hr = cpu_read ? S_OK : E_INVALIDARG;
hr = ID3D10Buffer_Map(buffer, D3D10_MAP_READ, 0, &data);
todo_wine_if(expected_hr != S_OK && cpu_access)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for READ.\n", hr);
if (SUCCEEDED(hr))
ID3D10Buffer_Unmap(buffer);
expected_hr = !dynamic && cpu_write ? S_OK : E_INVALIDARG;
hr = ID3D10Buffer_Map(buffer, D3D10_MAP_WRITE, 0, &data);
todo_wine_if(expected_hr != S_OK && cpu_access)
todo_wine_if(dynamic && cpu_write)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for WRITE.\n", hr);
if (SUCCEEDED(hr))
ID3D10Buffer_Unmap(buffer);
expected_hr = cpu_read && cpu_write ? S_OK : E_INVALIDARG;
hr = ID3D10Buffer_Map(buffer, D3D10_MAP_READ_WRITE, 0, &data);
todo_wine_if(expected_hr != S_OK && cpu_access)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for READ_WRITE.\n", hr);
if (SUCCEEDED(hr))
ID3D10Buffer_Unmap(buffer);
expected_hr = dynamic ? S_OK : E_INVALIDARG;
hr = ID3D10Buffer_Map(buffer, D3D10_MAP_WRITE_DISCARD, 0, &data);
todo_wine_if(expected_hr != S_OK && cpu_access)
todo_wine_if(!dynamic && cpu_write)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for WRITE_DISCARD.\n", hr);
if (SUCCEEDED(hr))
ID3D10Buffer_Unmap(buffer);
@ -8254,28 +8252,26 @@ static void check_texture_cpu_access_(unsigned int line, ID3D10Texture2D *textur
expected_hr = cpu_read ? S_OK : E_INVALIDARG;
hr = ID3D10Texture2D_Map(texture, 0, D3D10_MAP_READ, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for READ.\n", hr);
if (SUCCEEDED(hr))
ID3D10Texture2D_Unmap(texture, 0);
expected_hr = !dynamic && cpu_write ? S_OK : E_INVALIDARG;
hr = ID3D10Texture2D_Map(texture, 0, D3D10_MAP_WRITE, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
todo_wine_if(dynamic && cpu_write)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for WRITE.\n", hr);
if (SUCCEEDED(hr))
ID3D10Texture2D_Unmap(texture, 0);
expected_hr = cpu_read && cpu_write ? S_OK : E_INVALIDARG;
hr = ID3D10Texture2D_Map(texture, 0, D3D10_MAP_READ_WRITE, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for READ_WRITE.\n", hr);
if (SUCCEEDED(hr))
ID3D10Texture2D_Unmap(texture, 0);
expected_hr = dynamic ? S_OK : E_INVALIDARG;
hr = ID3D10Texture2D_Map(texture, 0, D3D10_MAP_WRITE_DISCARD, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
todo_wine_if(!dynamic && cpu_write)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for WRITE_DISCARD.\n", hr);
if (SUCCEEDED(hr))
ID3D10Texture2D_Unmap(texture, 0);

View File

@ -11029,7 +11029,6 @@ static void check_resource_cpu_access_(unsigned int line, ID3D11DeviceContext *c
expected_hr = cpu_read ? S_OK : E_INVALIDARG;
hr = ID3D11DeviceContext_Map(context, resource, 0, D3D11_MAP_READ, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for READ.\n", hr);
if (SUCCEEDED(hr))
ID3D11DeviceContext_Unmap(context, resource, 0);
@ -11037,21 +11036,20 @@ static void check_resource_cpu_access_(unsigned int line, ID3D11DeviceContext *c
/* WRITE_DISCARD and WRITE_NO_OVERWRITE are the only allowed options for dynamic resources. */
expected_hr = !dynamic && cpu_write ? S_OK : E_INVALIDARG;
hr = ID3D11DeviceContext_Map(context, resource, 0, D3D11_MAP_WRITE, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
todo_wine_if(dynamic && cpu_write)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for WRITE.\n", hr);
if (SUCCEEDED(hr))
ID3D11DeviceContext_Unmap(context, resource, 0);
expected_hr = cpu_read && cpu_write ? S_OK : E_INVALIDARG;
hr = ID3D11DeviceContext_Map(context, resource, 0, D3D11_MAP_READ_WRITE, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for READ_WRITE.\n", hr);
if (SUCCEEDED(hr))
ID3D11DeviceContext_Unmap(context, resource, 0);
expected_hr = dynamic ? S_OK : E_INVALIDARG;
hr = ID3D11DeviceContext_Map(context, resource, 0, D3D11_MAP_WRITE_DISCARD, 0, &map_desc);
todo_wine_if(expected_hr != S_OK && cpu_access)
todo_wine_if(!dynamic && cpu_write)
ok_(__FILE__, line)(hr == expected_hr, "Got hr %#x for WRITE_DISCARD.\n", hr);
if (SUCCEEDED(hr))
ID3D11DeviceContext_Unmap(context, resource, 0);

View File

@ -801,12 +801,12 @@ unsigned int wined3d_access_from_d3d11(D3D11_USAGE usage, UINT cpu_access)
unsigned int access;
access = usage == D3D11_USAGE_STAGING ? WINED3D_RESOURCE_ACCESS_CPU : WINED3D_RESOURCE_ACCESS_GPU;
if (cpu_access)
{
if (~cpu_access & (D3D11_CPU_ACCESS_WRITE | D3D11_CPU_ACCESS_READ))
FIXME("Ignoring CPU access flags %#x.\n", cpu_access);
access |= WINED3D_RESOURCE_ACCESS_MAP;
}
if (cpu_access & D3D11_CPU_ACCESS_WRITE)
access |= WINED3D_RESOURCE_ACCESS_MAP_W;
if (cpu_access & D3D11_CPU_ACCESS_READ)
access |= WINED3D_RESOURCE_ACCESS_MAP_R;
if (cpu_access &= ~(D3D11_CPU_ACCESS_WRITE | D3D11_CPU_ACCESS_READ))
FIXME("Unhandled CPU access flags %#x.\n", cpu_access);
return access;
}

View File

@ -289,7 +289,8 @@ HRESULT vertexbuffer_init(struct d3d8_vertexbuffer *buffer, struct d3d8_device *
desc.byte_width = size;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
@ -577,7 +578,8 @@ HRESULT indexbuffer_init(struct d3d8_indexbuffer *buffer, struct d3d8_device *de
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;

View File

@ -304,13 +304,14 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
{
case D3DPOOL_DEFAULT:
if (usage & D3DUSAGE_DYNAMIC)
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
return WINED3D_RESOURCE_ACCESS_GPU;
case D3DPOOL_MANAGED:
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
case D3DPOOL_SYSTEMMEM:
case D3DPOOL_SCRATCH:
return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
default:
return 0;
}

View File

@ -1077,7 +1077,8 @@ static HRESULT d3d8_device_create_surface(struct d3d8_device *device, UINT width
desc.usage = usage & WINED3DUSAGE_MASK;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width;
desc.height = height;
desc.depth = 1;
@ -2170,7 +2171,7 @@ static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UIN
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
@ -2265,7 +2266,7 @@ static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;

View File

@ -1110,7 +1110,8 @@ HRESULT texture_init(struct d3d8_texture *texture, struct d3d8_device *device,
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width;
desc.height = height;
desc.depth = 1;
@ -1157,7 +1158,8 @@ HRESULT cubetexture_init(struct d3d8_texture *texture, struct d3d8_device *devic
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = edge_length;
desc.height = edge_length;
desc.depth = 1;

View File

@ -290,7 +290,8 @@ HRESULT vertexbuffer_init(struct d3d9_vertexbuffer *buffer, struct d3d9_device *
desc.byte_width = size;
desc.usage = usage & WINED3DUSAGE_MASK;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
@ -576,7 +577,8 @@ HRESULT indexbuffer_init(struct d3d9_indexbuffer *buffer, struct d3d9_device *de
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;

View File

@ -321,13 +321,14 @@ static inline unsigned int wined3daccess_from_d3dpool(D3DPOOL pool, unsigned int
{
case D3DPOOL_DEFAULT:
if (usage & D3DUSAGE_DYNAMIC)
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
return WINED3D_RESOURCE_ACCESS_GPU;
case D3DPOOL_MANAGED:
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
case D3DPOOL_SYSTEMMEM:
case D3DPOOL_SCRATCH:
return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
return WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
default:
return 0;
}

View File

@ -1348,7 +1348,8 @@ static HRESULT d3d9_device_create_surface(struct d3d9_device *device, UINT width
desc.usage = usage & WINED3DUSAGE_MASK;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width;
desc.height = height;
desc.depth = 1;
@ -2675,7 +2676,7 @@ static HRESULT d3d9_device_prepare_vertex_buffer(struct d3d9_device *device, UIN
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
@ -2780,7 +2781,7 @@ static HRESULT d3d9_device_prepare_index_buffer(struct d3d9_device *device, UINT
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;

View File

@ -1314,7 +1314,8 @@ HRESULT texture_init(struct d3d9_texture *texture, struct d3d9_device *device,
desc.usage |= WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = width;
desc.height = height;
desc.depth = 1;
@ -1385,7 +1386,8 @@ HRESULT cubetexture_init(struct d3d9_texture *texture, struct d3d9_device *devic
desc.usage |= WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_TEXTURE;
if (pool == D3DPOOL_SCRATCH)
desc.usage |= WINED3DUSAGE_SCRATCH;
desc.access = wined3daccess_from_d3dpool(pool, usage) | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = wined3daccess_from_d3dpool(pool, usage)
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = edge_length;
desc.height = edge_length;
desc.depth = 1;

View File

@ -3471,7 +3471,7 @@ static HRESULT d3d_device_prepare_vertex_buffer(struct d3d_device *device, UINT
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
@ -3663,7 +3663,7 @@ static HRESULT d3d_device_prepare_index_buffer(struct d3d_device *device, UINT m
desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;

View File

@ -131,7 +131,8 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
desc.byte_width = new_size * sizeof(*indices);
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
@ -621,7 +622,7 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
desc.byte_width = new_size * sizeof(D3DVERTEX);
desc.usage = 0;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;
@ -631,7 +632,7 @@ static HRESULT WINAPI d3d_execute_buffer_SetExecuteData(IDirect3DExecuteBuffer *
desc.byte_width = new_size * sizeof(D3DTLVERTEX);
desc.usage = WINED3DUSAGE_STATICDECL;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
if (FAILED(hr = wined3d_buffer_create(buffer->d3ddev->wined3d_device, &desc,
NULL, NULL, &ddraw_null_wined3d_parent_ops, &dst_buffer)))

View File

@ -6012,7 +6012,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
wined3d_desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
wined3d_desc.multisample_quality = 0;
wined3d_desc.usage = 0;
wined3d_desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
wined3d_desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
wined3d_desc.width = desc->dwWidth;
wined3d_desc.height = desc->dwHeight;
wined3d_desc.depth = 1;
@ -6101,7 +6101,8 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
if (desc->ddsCaps.dwCaps & DDSCAPS_SYSTEMMEMORY)
{
wined3d_desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
wined3d_desc.access = WINED3D_RESOURCE_ACCESS_CPU
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
}
else
{
@ -6115,7 +6116,7 @@ HRESULT ddraw_surface_create(struct ddraw *ddraw, const DDSURFACEDESC2 *surface_
if (desc->ddsCaps.dwCaps2 & (DDSCAPS2_TEXTUREMANAGE | DDSCAPS2_D3DTEXTUREMANAGE))
{
wined3d_desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_CPU
| WINED3D_RESOURCE_ACCESS_MAP;
| WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
/* Managed textures have the system memory flag set. */
desc->ddsCaps.dwCaps |= DDSCAPS_SYSTEMMEMORY;
}

View File

@ -125,9 +125,9 @@ static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer
desc.usage |= WINED3DUSAGE_DYNAMIC;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
if (buffer->Caps & D3DVBCAPS_SYSTEMMEMORY)
desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
else
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0;
desc.structure_byte_stride = 0;

View File

@ -349,9 +349,15 @@ HRESULT CDECL wined3d_resource_map(struct wined3d_resource *resource, unsigned i
return E_INVALIDARG;
}
if (!(resource->access & WINED3D_RESOURCE_ACCESS_MAP))
if ((flags & WINED3D_MAP_READ) && !(resource->access & WINED3D_RESOURCE_ACCESS_MAP_R))
{
WARN("Resource is not mappable.\n");
WARN("Resource does not have MAP_R access.\n");
return E_INVALIDARG;
}
if ((flags & WINED3D_MAP_WRITE) && !(resource->access & WINED3D_RESOURCE_ACCESS_MAP_W))
{
WARN("Resource does not have MAP_W access.\n");
return E_INVALIDARG;
}

View File

@ -1330,7 +1330,7 @@ static struct wined3d_texture *surface_convert_format(struct wined3d_texture *sr
desc.multisample_type = WINED3D_MULTISAMPLE_NONE;
desc.multisample_quality = 0;
desc.usage = WINED3DUSAGE_SCRATCH | WINED3DUSAGE_PRIVATE;
desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP;
desc.access = WINED3D_RESOURCE_ACCESS_CPU | WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.width = wined3d_texture_get_level_width(src_texture, texture_level);
desc.height = wined3d_texture_get_level_height(src_texture, texture_level);
desc.depth = 1;

View File

@ -369,7 +369,7 @@ static HRESULT wined3d_texture_init(struct wined3d_texture *texture, const struc
}
wined3d_resource_update_draw_binding(&texture->resource);
if ((flags & WINED3D_TEXTURE_CREATE_MAPPABLE) || desc->format == WINED3DFMT_D16_LOCKABLE)
texture->resource.access |= WINED3D_RESOURCE_ACCESS_MAP;
texture->resource.access |= WINED3D_RESOURCE_ACCESS_MAP_R | WINED3D_RESOURCE_ACCESS_MAP_W;
texture->texture_ops = texture_ops;

View File

@ -4156,7 +4156,8 @@ const char *wined3d_debug_resource_access(DWORD access)
#define ACCESS_TO_STR(x) if (access & x) { strcat(buf, " | "#x); access &= ~x; }
ACCESS_TO_STR(WINED3D_RESOURCE_ACCESS_GPU);
ACCESS_TO_STR(WINED3D_RESOURCE_ACCESS_CPU);
ACCESS_TO_STR(WINED3D_RESOURCE_ACCESS_MAP);
ACCESS_TO_STR(WINED3D_RESOURCE_ACCESS_MAP_R);
ACCESS_TO_STR(WINED3D_RESOURCE_ACCESS_MAP_W);
#undef ACCESS_TO_STR
if (access)
FIXME("Unrecognised access flag(s) %#x.\n", access);

View File

@ -52,7 +52,8 @@
#define WINED3D_RESOURCE_ACCESS_GPU 0x1u
#define WINED3D_RESOURCE_ACCESS_CPU 0x2u
#define WINED3D_RESOURCE_ACCESS_MAP 0x4u
#define WINED3D_RESOURCE_ACCESS_MAP_R 0x4u
#define WINED3D_RESOURCE_ACCESS_MAP_W 0x8u
enum wined3d_light_type
{