Module: wine Branch: master Commit: b8eb171b6bd4f930aee265af981223fd7a557b52 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b8eb171b6bd4f930aee265af98...
Author: Stefan Dösinger stefan@codeweavers.com Date: Thu Sep 12 12:23:30 2013 +0200
wined3d: Explicitly pass the state information to buffer_internal_preload.
---
dlls/wined3d/buffer.c | 12 +++++++----- dlls/wined3d/context.c | 4 ++-- dlls/wined3d/wined3d_private.h | 4 ++-- 3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c index 84fe45a..2deb7d2 100644 --- a/dlls/wined3d/buffer.c +++ b/dlls/wined3d/buffer.c @@ -728,7 +728,8 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined }
/* Context activation is done by the caller. */ -void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context) +void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, + const struct wined3d_state *state) { DWORD flags = buffer->flags & (WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD); struct wined3d_device *device = buffer->resource.device; @@ -763,12 +764,13 @@ void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_conte } }
- /* Reading the declaration makes only sense if the stateblock is finalized and the buffer bound to a stream */ - if (device->isInDraw && buffer->resource.bind_count > 0) + /* Reading the declaration makes only sense if we have valid state information + * (i.e., if this function is called during draws). */ + if (state) { DWORD fixup_flags = 0;
- if (!use_vs(&device->state)) + if (!use_vs(state)) { if (!context->gl_info->supported[ARB_VERTEX_ARRAY_BGRA]) fixup_flags |= WINED3D_BUFFER_FIXUP_D3DCOLOR; @@ -935,7 +937,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer) { struct wined3d_context *context; context = context_acquire(buffer->resource.device, NULL); - buffer_internal_preload(buffer, context); + buffer_internal_preload(buffer, context, NULL); context_release(context); }
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index f870700..af3addc 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -2498,7 +2498,7 @@ void context_stream_info_from_declaration(struct wined3d_context *context,
element = &stream_info->elements[i]; buffer = state->streams[element->stream_idx].buffer; - buffer_internal_preload(buffer, context); + buffer_internal_preload(buffer, context, state);
/* If the preload dropped the buffer object, update the stream info. */ if (buffer->buffer_object != element->data.buffer_object) @@ -2583,7 +2583,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de if (state->index_buffer) { if (context->stream_info.all_vbo) - buffer_internal_preload(state->index_buffer, context); + buffer_internal_preload(state->index_buffer, context, state); else buffer_get_sysmem(state->index_buffer, context); } diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index a1b7238..a30db57 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2525,8 +2525,8 @@ static inline struct wined3d_buffer *buffer_from_resource(struct wined3d_resourc void buffer_get_memory(struct wined3d_buffer *buffer, struct wined3d_context *context, struct wined3d_bo_address *data) DECLSPEC_HIDDEN; BYTE *buffer_get_sysmem(struct wined3d_buffer *This, struct wined3d_context *context) DECLSPEC_HIDDEN; -void buffer_internal_preload(struct wined3d_buffer *buffer, - struct wined3d_context *context) DECLSPEC_HIDDEN; +void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context, + const struct wined3d_state *state) DECLSPEC_HIDDEN;
struct wined3d_rendertarget_view {