[PATCH 5/5] wined3d: Explicitly pass the state information to buffer_internal_preload
Stefan Dösinger
stefan at codeweavers.com
Wed Sep 11 04:31:21 CDT 2013
---
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 80c5507..ce7e08b 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -732,7 +732,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;
@@ -767,12 +768,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))
fixup_flags |= WINED3D_BUFFER_FIXUP_USE_SHADER;
if (context->gl_info->supported[ARB_VERTEX_ARRAY_BGRA])
fixup_flags |= WINED3D_BUFFER_FIXUP_SUPPORT_D3DCOLOR;
@@ -938,7 +940,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 afe13ec..49945b6 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
{
--
1.8.1.5
More information about the wine-patches
mailing list