wined3d: Introduce wined3d_buffer_get_memory().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-10-20 12:50:57 +02:00 committed by Alexandre Julliard
parent 4e7ef680e3
commit 2e15ae85a1
3 changed files with 28 additions and 4 deletions

View File

@ -611,7 +611,7 @@ BYTE *wined3d_buffer_load_sysmem(struct wined3d_buffer *buffer, struct wined3d_c
}
/* Context activation is done by the caller. */
void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
static void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
struct wined3d_bo_address *data)
{
data->buffer_object = buffer->buffer_object;
@ -635,6 +635,30 @@ void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *co
}
}
void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
struct wined3d_bo_address *data, DWORD locations)
{
TRACE("buffer %p, data %p, locations %s.\n",
buffer, data, wined3d_debug_location(locations));
if (locations & WINED3D_LOCATION_BUFFER)
{
data->buffer_object = buffer->buffer_object;
data->addr = NULL;
return;
}
if (locations & WINED3D_LOCATION_SYSMEM)
{
data->buffer_object = 0;
data->addr = buffer->resource.heap_memory;
return;
}
ERR("Unexpected locations %s.\n", wined3d_debug_location(locations));
data->buffer_object = 0;
data->addr = NULL;
}
static void buffer_unload(struct wined3d_resource *resource)
{
struct wined3d_buffer *buffer = buffer_from_resource(resource);

View File

@ -3201,7 +3201,7 @@ static void context_update_stream_info(struct wined3d_context *context, const st
else
{
wined3d_buffer_load(buffer, context, state);
buffer_get_memory(buffer, context, &data);
wined3d_buffer_get_memory(buffer, &data, buffer->locations);
element->data.buffer_object = data.buffer_object;
element->data.addr += (ULONG_PTR)data.addr;
}

View File

@ -3179,9 +3179,9 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc
return CONTAINING_RECORD(resource, struct wined3d_buffer, resource);
}
void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context,
struct wined3d_bo_address *data) DECLSPEC_HIDDEN;
void buffer_mark_used(struct wined3d_buffer *buffer) DECLSPEC_HIDDEN;
void wined3d_buffer_get_memory(struct wined3d_buffer *buffer,
struct wined3d_bo_address *data, DWORD locations) DECLSPEC_HIDDEN;
void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD location) DECLSPEC_HIDDEN;
void wined3d_buffer_load(struct wined3d_buffer *buffer, struct wined3d_context *context,
const struct wined3d_state *state) DECLSPEC_HIDDEN;