Commit a6ffab3b authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Rename WINED3DLOCK_* to WINED3D_MAP_*.

parent 60ff5906
......@@ -219,13 +219,13 @@ static HRESULT WINAPI d3d_vertex_buffer7_Lock(IDirect3DVertexBuffer7 *iface,
* nosyslock: Not applicable
*/
if (!(flags & DDLOCK_WAIT))
wined3d_flags |= WINED3DLOCK_DONOTWAIT;
wined3d_flags |= WINED3D_MAP_DONOTWAIT;
if (flags & DDLOCK_READONLY)
wined3d_flags |= WINED3DLOCK_READONLY;
wined3d_flags |= WINED3D_MAP_READONLY;
if (flags & DDLOCK_NOOVERWRITE)
wined3d_flags |= WINED3DLOCK_NOOVERWRITE;
wined3d_flags |= WINED3D_MAP_NOOVERWRITE;
if (flags & DDLOCK_DISCARDCONTENTS)
wined3d_flags |= WINED3DLOCK_DISCARD;
wined3d_flags |= WINED3D_MAP_DISCARD;
wined3d_mutex_lock();
if (data_size)
......
......@@ -604,9 +604,11 @@ static void buffer_sync_apple(struct wined3d_buffer *This, DWORD flags, const st
enum wined3d_event_query_result ret;
/* No fencing needs to be done if the app promises not to overwrite
* existing data */
if(flags & WINED3DLOCK_NOOVERWRITE) return;
if(flags & WINED3DLOCK_DISCARD)
* existing data. */
if (flags & WINED3D_MAP_NOOVERWRITE)
return;
if (flags & WINED3D_MAP_DISCARD)
{
ENTER_GL();
GL_EXTCALL(glBufferDataARB(This->buffer_type_hint, This->resource.size, NULL, This->buffer_object_usage));
......@@ -698,8 +700,10 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
if (This->flags & WINED3D_BUFFER_APPLESYNC)
{
DWORD syncflags = 0;
if (flags & WINED3D_BUFFER_DISCARD) syncflags |= WINED3DLOCK_DISCARD;
if (flags & WINED3D_BUFFER_NOSYNC) syncflags |= WINED3DLOCK_NOOVERWRITE;
if (flags & WINED3D_BUFFER_DISCARD)
syncflags |= WINED3D_MAP_DISCARD;
if (flags & WINED3D_BUFFER_NOSYNC)
syncflags |= WINED3D_MAP_NOOVERWRITE;
LEAVE_GL();
buffer_sync_apple(This, syncflags, gl_info);
ENTER_GL();
......@@ -948,29 +952,31 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
static DWORD buffer_sanitize_flags(const struct wined3d_buffer *buffer, DWORD flags)
{
/* Not all flags make sense together, but Windows never returns an error. Catch the
* cases that could cause issues */
if(flags & WINED3DLOCK_READONLY)
/* Not all flags make sense together, but Windows never returns an error.
* Catch the cases that could cause issues. */
if (flags & WINED3D_MAP_READONLY)
{
if(flags & WINED3DLOCK_DISCARD)
if (flags & WINED3D_MAP_DISCARD)
{
WARN("WINED3DLOCK_READONLY combined with WINED3DLOCK_DISCARD, ignoring flags\n");
WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_DISCARD, ignoring flags.\n");
return 0;
}
if(flags & WINED3DLOCK_NOOVERWRITE)
if (flags & WINED3D_MAP_NOOVERWRITE)
{
WARN("WINED3DLOCK_READONLY combined with WINED3DLOCK_NOOVERWRITE, ignoring flags\n");
WARN("WINED3D_MAP_READONLY combined with WINED3D_MAP_NOOVERWRITE, ignoring flags.\n");
return 0;
}
}
else if((flags & (WINED3DLOCK_DISCARD | WINED3DLOCK_NOOVERWRITE)) == (WINED3DLOCK_DISCARD | WINED3DLOCK_NOOVERWRITE))
else if ((flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
== (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE))
{
WARN("WINED3DLOCK_DISCARD and WINED3DLOCK_NOOVERWRITE used together, ignoring\n");
WARN("WINED3D_MAP_DISCARD and WINED3D_MAP_NOOVERWRITE used together, ignoring.\n");
return 0;
}
else if (flags & (WINED3DLOCK_DISCARD | WINED3DLOCK_NOOVERWRITE) && !(buffer->resource.usage & WINED3DUSAGE_DYNAMIC))
else if (flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)
&& !(buffer->resource.usage & WINED3DUSAGE_DYNAMIC))
{
WARN("DISCARD or NOOVERWRITE lock on non-dynamic buffer, ignoring\n");
WARN("DISCARD or NOOVERWRITE map on non-dynamic buffer, ignoring.\n");
return 0;
}
......@@ -981,14 +987,14 @@ static GLbitfield buffer_gl_map_flags(DWORD d3d_flags)
{
GLbitfield ret = 0;
if (!(d3d_flags & WINED3DLOCK_READONLY))
if (!(d3d_flags & WINED3D_MAP_READONLY))
ret |= GL_MAP_WRITE_BIT | GL_MAP_FLUSH_EXPLICIT_BIT;
if (!(d3d_flags & (WINED3DLOCK_DISCARD | WINED3DLOCK_NOOVERWRITE)))
if (!(d3d_flags & (WINED3D_MAP_DISCARD | WINED3D_MAP_NOOVERWRITE)))
ret |= GL_MAP_READ_BIT;
if (d3d_flags & WINED3DLOCK_DISCARD)
if (d3d_flags & WINED3D_MAP_DISCARD)
ret |= GL_MAP_INVALIDATE_BUFFER_BIT;
if (d3d_flags & WINED3DLOCK_NOOVERWRITE)
if (d3d_flags & WINED3D_MAP_NOOVERWRITE)
ret |= GL_MAP_UNSYNCHRONIZED_BIT;
return ret;
......@@ -1009,9 +1015,9 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
TRACE("buffer %p, offset %u, size %u, data %p, flags %#x\n", buffer, offset, size, data, flags);
flags = buffer_sanitize_flags(buffer, flags);
if (!(flags & WINED3DLOCK_READONLY))
if (!(flags & WINED3D_MAP_READONLY))
{
if (flags & WINED3DLOCK_DISCARD)
if (flags & WINED3D_MAP_DISCARD)
{
/* DISCARD invalidates the entire buffer, regardless of the
* specified offset and size. Some applications also depend on the
......@@ -1105,17 +1111,17 @@ HRESULT CDECL wined3d_buffer_map(struct wined3d_buffer *buffer, UINT offset, UIN
{
if (dirty)
{
if (buffer->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3DLOCK_NOOVERWRITE))
if (buffer->flags & WINED3D_BUFFER_NOSYNC && !(flags & WINED3D_MAP_NOOVERWRITE))
{
buffer->flags &= ~WINED3D_BUFFER_NOSYNC;
}
}
else if(flags & WINED3DLOCK_NOOVERWRITE)
else if(flags & WINED3D_MAP_NOOVERWRITE)
{
buffer->flags |= WINED3D_BUFFER_NOSYNC;
}
if (flags & WINED3DLOCK_DISCARD)
if (flags & WINED3D_MAP_DISCARD)
{
buffer->flags |= WINED3D_BUFFER_DISCARD;
}
......
......@@ -4210,10 +4210,9 @@ static HRESULT device_update_volume(struct wined3d_device *device,
/* TODO: Implement direct loading into the gl volume instead of using
* memcpy and dirtification to improve loading performance. */
hr = wined3d_volume_map(src_volume, &src, NULL, WINED3DLOCK_READONLY);
if (FAILED(hr)) return hr;
hr = wined3d_volume_map(dst_volume, &dst, NULL, WINED3DLOCK_DISCARD);
if (FAILED(hr))
if (FAILED(hr = wined3d_volume_map(src_volume, &src, NULL, WINED3D_MAP_READONLY)))
return hr;
if (FAILED(hr = wined3d_volume_map(dst_volume, &dst, NULL, WINED3D_MAP_DISCARD)))
{
wined3d_volume_unmap(src_volume);
return hr;
......@@ -4911,7 +4910,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
* instead. */
device->cursorWidth = cursor_image->resource.width;
device->cursorHeight = cursor_image->resource.height;
if (SUCCEEDED(wined3d_surface_map(cursor_image, &map_desc, NULL, WINED3DLOCK_READONLY)))
if (SUCCEEDED(wined3d_surface_map(cursor_image, &map_desc, NULL, WINED3D_MAP_READONLY)))
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
const struct wined3d_format *format = wined3d_get_format(gl_info, WINED3DFMT_B8G8R8A8_UNORM);
......@@ -4981,7 +4980,7 @@ HRESULT CDECL wined3d_device_set_cursor_properties(struct wined3d_device *device
maskBits = HeapAlloc(GetProcessHeap(), 0, mask_size);
memset(maskBits, 0xff, mask_size);
wined3d_surface_map(cursor_image, &map_desc, NULL,
WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY);
WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY);
TRACE("width: %u height: %u.\n", cursor_image->resource.width, cursor_image->resource.height);
cursorInfo.fIcon = FALSE;
......
......@@ -887,9 +887,9 @@ static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD
TRACE("surface %p, rect %s, flags %#x.\n",
surface, wine_dbgstr_rect(rect), flags);
if (flags & WINED3DLOCK_DISCARD)
if (flags & WINED3D_MAP_DISCARD)
{
TRACE("WINED3DLOCK_DISCARD flag passed, marking SYSMEM as up to date.\n");
TRACE("WINED3D_MAP_DISCARD flag passed, marking SYSMEM as up to date.\n");
surface_prepare_system_memory(surface);
surface_modify_location(surface, SFLAG_INSYSMEM, TRUE);
}
......@@ -933,7 +933,7 @@ static void surface_map(struct wined3d_surface *surface, const RECT *rect, DWORD
context_release(context);
}
if (!(flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)))
if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
{
if (!rect)
surface_add_dirty_rect(surface, NULL);
......@@ -3746,15 +3746,13 @@ static struct wined3d_surface *surface_convert_format(struct wined3d_surface *so
memset(&src_map, 0, sizeof(src_map));
memset(&dst_map, 0, sizeof(dst_map));
hr = wined3d_surface_map(source, &src_map, NULL, WINED3DLOCK_READONLY);
if (FAILED(hr))
if (FAILED(hr = wined3d_surface_map(source, &src_map, NULL, WINED3D_MAP_READONLY)))
{
ERR("Failed to lock the source surface.\n");
wined3d_surface_decref(ret);
return NULL;
}
hr = wined3d_surface_map(ret, &dst_map, NULL, WINED3DLOCK_READONLY);
if (FAILED(hr))
if (FAILED(hr = wined3d_surface_map(ret, &dst_map, NULL, WINED3D_MAP_READONLY)))
{
ERR("Failed to lock the destination surface.\n");
wined3d_surface_unmap(source);
......@@ -6637,7 +6635,7 @@ static HRESULT surface_cpu_blt(struct wined3d_surface *dst_surface, const RECT *
goto release;
}
}
wined3d_surface_map(src_surface, &src_map, NULL, WINED3DLOCK_READONLY);
wined3d_surface_map(src_surface, &src_map, NULL, WINED3D_MAP_READONLY);
src_format = src_surface->resource.format;
}
else
......
......@@ -226,7 +226,7 @@ HRESULT CDECL wined3d_volume_map(struct wined3d_volume *volume,
volume->lockedBox.back = box->back;
}
if (!(flags & (WINED3DLOCK_NO_DIRTY_UPDATE | WINED3DLOCK_READONLY)))
if (!(flags & (WINED3D_MAP_NO_DIRTY_UPDATE | WINED3D_MAP_READONLY)))
{
volume_add_dirty_box(volume, &volume->lockedBox);
wined3d_texture_set_dirty(volume->container, TRUE);
......
......@@ -827,12 +827,12 @@ enum wined3d_sysval_semantic
#define WINED3DUSAGE_QUERY_WRAPANDMIP 0x00200000
#define WINED3DUSAGE_QUERY_MASK 0x003f8000
#define WINED3DLOCK_READONLY 0x0010
#define WINED3DLOCK_NOSYSLOCK 0x0800
#define WINED3DLOCK_NOOVERWRITE 0x1000
#define WINED3DLOCK_DISCARD 0x2000
#define WINED3DLOCK_DONOTWAIT 0x4000
#define WINED3DLOCK_NO_DIRTY_UPDATE 0x8000
#define WINED3D_MAP_READONLY 0x0010
#define WINED3D_MAP_NOSYSLOCK 0x0800
#define WINED3D_MAP_NOOVERWRITE 0x1000
#define WINED3D_MAP_DISCARD 0x2000
#define WINED3D_MAP_DONOTWAIT 0x4000
#define WINED3D_MAP_NO_DIRTY_UPDATE 0x8000
#define WINED3DPRESENT_RATE_DEFAULT 0x00000000
......
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