Commit ac4f768e authored by Matteo Bruni's avatar Matteo Bruni Committed by Alexandre Julliard

wined3d: Replace WINED3DUSAGE_WRITEONLY with resource access flags.

Always allow read and write mapping of ddraw buffers: test_vb_writeonly() depends on that. Signed-off-by: 's avatarMatteo Bruni <mbruni@codeweavers.com> Signed-off-by: 's avatarHenri Verbeet <hverbeet@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 10061d59
...@@ -2383,7 +2383,7 @@ static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UIN ...@@ -2383,7 +2383,7 @@ static HRESULT d3d8_device_prepare_vertex_buffer(struct d3d8_device *device, UIN
TRACE("Growing vertex buffer to %u bytes\n", size); TRACE("Growing vertex buffer to %u bytes\n", size);
desc.byte_width = size; desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY; desc.usage = WINED3DUSAGE_DYNAMIC;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER; desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0; desc.misc_flags = 0;
...@@ -2478,7 +2478,7 @@ static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT ...@@ -2478,7 +2478,7 @@ static HRESULT d3d8_device_prepare_index_buffer(struct d3d8_device *device, UINT
TRACE("Growing index buffer to %u bytes\n", size); TRACE("Growing index buffer to %u bytes\n", size);
desc.byte_width = size; desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL; desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER; desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0; desc.misc_flags = 0;
......
...@@ -2854,7 +2854,7 @@ static HRESULT d3d9_device_prepare_vertex_buffer(struct d3d9_device *device, UIN ...@@ -2854,7 +2854,7 @@ static HRESULT d3d9_device_prepare_vertex_buffer(struct d3d9_device *device, UIN
TRACE("Growing vertex buffer to %u bytes.\n", size); TRACE("Growing vertex buffer to %u bytes.\n", size);
desc.byte_width = size; desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY; desc.usage = WINED3DUSAGE_DYNAMIC;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER; desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0; desc.misc_flags = 0;
...@@ -2959,7 +2959,7 @@ static HRESULT d3d9_device_prepare_index_buffer(struct d3d9_device *device, UINT ...@@ -2959,7 +2959,7 @@ static HRESULT d3d9_device_prepare_index_buffer(struct d3d9_device *device, UINT
TRACE("Growing index buffer to %u bytes.\n", size); TRACE("Growing index buffer to %u bytes.\n", size);
desc.byte_width = size; desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL; desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER; desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0; desc.misc_flags = 0;
......
...@@ -3469,7 +3469,7 @@ static HRESULT d3d_device_prepare_vertex_buffer(struct d3d_device *device, UINT ...@@ -3469,7 +3469,7 @@ static HRESULT d3d_device_prepare_vertex_buffer(struct d3d_device *device, UINT
TRACE("Growing vertex buffer to %u bytes\n", size); TRACE("Growing vertex buffer to %u bytes\n", size);
desc.byte_width = size; desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY; desc.usage = WINED3DUSAGE_DYNAMIC;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER; desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0; desc.misc_flags = 0;
...@@ -3661,7 +3661,7 @@ static HRESULT d3d_device_prepare_index_buffer(struct d3d_device *device, UINT m ...@@ -3661,7 +3661,7 @@ static HRESULT d3d_device_prepare_index_buffer(struct d3d_device *device, UINT m
TRACE("Growing index buffer to %u bytes\n", size); TRACE("Growing index buffer to %u bytes\n", size);
desc.byte_width = size; desc.byte_width = size;
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL; desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER; desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0; desc.misc_flags = 0;
......
...@@ -129,7 +129,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer, ...@@ -129,7 +129,7 @@ HRESULT d3d_execute_buffer_execute(struct d3d_execute_buffer *buffer,
struct wined3d_buffer_desc desc; struct wined3d_buffer_desc desc;
desc.byte_width = new_size * sizeof(*indices); desc.byte_width = new_size * sizeof(*indices);
desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY | WINED3DUSAGE_STATICDECL; desc.usage = WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_STATICDECL;
desc.bind_flags = WINED3D_BIND_INDEX_BUFFER; desc.bind_flags = WINED3D_BIND_INDEX_BUFFER;
desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W; desc.access = WINED3D_RESOURCE_ACCESS_GPU | WINED3D_RESOURCE_ACCESS_MAP_W;
desc.misc_flags = 0; desc.misc_flags = 0;
......
...@@ -119,8 +119,6 @@ static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer ...@@ -119,8 +119,6 @@ static HRESULT d3d_vertex_buffer_create_wined3d_buffer(struct d3d_vertex_buffer
desc.byte_width = buffer->size; desc.byte_width = buffer->size;
desc.usage = WINED3DUSAGE_STATICDECL; desc.usage = WINED3DUSAGE_STATICDECL;
if (buffer->Caps & D3DVBCAPS_WRITEONLY)
desc.usage |= WINED3DUSAGE_WRITEONLY;
if (dynamic) if (dynamic)
desc.usage |= WINED3DUSAGE_DYNAMIC; desc.usage |= WINED3DUSAGE_DYNAMIC;
desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER; desc.bind_flags = WINED3D_BIND_VERTEX_BUFFER;
......
...@@ -28,10 +28,9 @@ ...@@ -28,10 +28,9 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d); WINE_DEFAULT_DEBUG_CHANNEL(d3d);
WINE_DECLARE_DEBUG_CHANNEL(d3d_perf); WINE_DECLARE_DEBUG_CHANNEL(d3d_perf);
static void resource_check_usage(DWORD usage) static void resource_check_usage(DWORD usage, unsigned int access)
{ {
static const DWORD handled = WINED3DUSAGE_WRITEONLY static const DWORD handled = WINED3DUSAGE_DYNAMIC
| WINED3DUSAGE_DYNAMIC
| WINED3DUSAGE_STATICDECL | WINED3DUSAGE_STATICDECL
| WINED3DUSAGE_OVERLAY | WINED3DUSAGE_OVERLAY
| WINED3DUSAGE_SCRATCH | WINED3DUSAGE_SCRATCH
...@@ -39,7 +38,7 @@ static void resource_check_usage(DWORD usage) ...@@ -39,7 +38,7 @@ static void resource_check_usage(DWORD usage)
| WINED3DUSAGE_LEGACY_CUBEMAP | WINED3DUSAGE_LEGACY_CUBEMAP
| ~WINED3DUSAGE_MASK; | ~WINED3DUSAGE_MASK;
/* WINED3DUSAGE_WRITEONLY is supposed to result in write-combined mappings /* Write-only CPU access is supposed to result in write-combined mappings
* being returned. OpenGL doesn't give us explicit control over that, but * being returned. OpenGL doesn't give us explicit control over that, but
* the hints and access flags we set for typical access patterns on * the hints and access flags we set for typical access patterns on
* dynamic resources should in theory have the same effect on the OpenGL * dynamic resources should in theory have the same effect on the OpenGL
...@@ -47,8 +46,8 @@ static void resource_check_usage(DWORD usage) ...@@ -47,8 +46,8 @@ static void resource_check_usage(DWORD usage)
if (usage & ~handled) if (usage & ~handled)
FIXME("Unhandled usage flags %#x.\n", usage & ~handled); FIXME("Unhandled usage flags %#x.\n", usage & ~handled);
if ((usage & (WINED3DUSAGE_DYNAMIC | WINED3DUSAGE_WRITEONLY)) == WINED3DUSAGE_DYNAMIC) if (usage & WINED3DUSAGE_DYNAMIC && access & WINED3D_RESOURCE_ACCESS_MAP_R)
WARN_(d3d_perf)("WINED3DUSAGE_DYNAMIC used without WINED3DUSAGE_WRITEONLY.\n"); WARN_(d3d_perf)("WINED3DUSAGE_DYNAMIC used with WINED3D_RESOURCE_ACCESS_MAP_R.\n");
} }
HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device, HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *device,
...@@ -82,7 +81,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device * ...@@ -82,7 +81,7 @@ HRESULT resource_init(struct wined3d_resource *resource, struct wined3d_device *
{WINED3D_RTYPE_TEXTURE_3D, 0, WINED3D_GL_RES_TYPE_TEX_3D}, {WINED3D_RTYPE_TEXTURE_3D, 0, WINED3D_GL_RES_TYPE_TEX_3D},
}; };
resource_check_usage(usage); resource_check_usage(usage, access);
if (usage & WINED3DUSAGE_SCRATCH && access & WINED3D_RESOURCE_ACCESS_GPU) if (usage & WINED3DUSAGE_SCRATCH && access & WINED3D_RESOURCE_ACCESS_GPU)
{ {
......
...@@ -4515,7 +4515,6 @@ const char *debug_d3dusage(DWORD usage) ...@@ -4515,7 +4515,6 @@ const char *debug_d3dusage(DWORD usage)
init_debug_buffer(&buffer, "0"); init_debug_buffer(&buffer, "0");
#define WINED3DUSAGE_TO_STR(x) if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; } #define WINED3DUSAGE_TO_STR(x) if (usage & x) { debug_append(&buffer, #x, " | "); usage &= ~x; }
WINED3DUSAGE_TO_STR(WINED3DUSAGE_WRITEONLY);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_SOFTWAREPROCESSING); WINED3DUSAGE_TO_STR(WINED3DUSAGE_SOFTWAREPROCESSING);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_DONOTCLIP); WINED3DUSAGE_TO_STR(WINED3DUSAGE_DONOTCLIP);
WINED3DUSAGE_TO_STR(WINED3DUSAGE_POINTS); WINED3DUSAGE_TO_STR(WINED3DUSAGE_POINTS);
......
...@@ -914,7 +914,6 @@ enum wined3d_shader_type ...@@ -914,7 +914,6 @@ enum wined3d_shader_type
#define WINED3D_BIND_DEPTH_STENCIL 0x00000040 #define WINED3D_BIND_DEPTH_STENCIL 0x00000040
#define WINED3D_BIND_UNORDERED_ACCESS 0x00000080 #define WINED3D_BIND_UNORDERED_ACCESS 0x00000080
#define WINED3DUSAGE_WRITEONLY 0x00000008
#define WINED3DUSAGE_SOFTWAREPROCESSING 0x00000010 #define WINED3DUSAGE_SOFTWAREPROCESSING 0x00000010
#define WINED3DUSAGE_DONOTCLIP 0x00000020 #define WINED3DUSAGE_DONOTCLIP 0x00000020
#define WINED3DUSAGE_POINTS 0x00000040 #define WINED3DUSAGE_POINTS 0x00000040
...@@ -926,7 +925,7 @@ enum wined3d_shader_type ...@@ -926,7 +925,7 @@ enum wined3d_shader_type
#define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE 0x00002000 #define WINED3DUSAGE_RESTRICT_SHARED_RESOURCE 0x00002000
#define WINED3DUSAGE_DMAP 0x00004000 #define WINED3DUSAGE_DMAP 0x00004000
#define WINED3DUSAGE_TEXTAPI 0x10000000 #define WINED3DUSAGE_TEXTAPI 0x10000000
#define WINED3DUSAGE_MASK 0x10007bf8 #define WINED3DUSAGE_MASK 0x10007bf0
#define WINED3DUSAGE_SCRATCH 0x00400000 #define WINED3DUSAGE_SCRATCH 0x00400000
#define WINED3DUSAGE_PRIVATE 0x00800000 #define WINED3DUSAGE_PRIVATE 0x00800000
......
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