[PATCH 5/5] wined3d: Explicitly pass the state information to buffer_internal_preload
Stefan Dösinger
stefan at codeweavers.com
Mon Sep 9 05:56:20 CDT 2013
---
dlls/wined3d/buffer.c | 17 +++++++++--------
dlls/wined3d/context.c | 4 ++--
dlls/wined3d/wined3d_private.h | 4 ++--
3 files changed, 13 insertions(+), 12 deletions(-)
diff --git a/dlls/wined3d/buffer.c b/dlls/wined3d/buffer.c
index 27a8602..17e7cca 100644
--- a/dlls/wined3d/buffer.c
+++ b/dlls/wined3d/buffer.c
@@ -310,11 +310,10 @@ static BOOL buffer_check_attribute(struct wined3d_buffer *This, const struct win
return ret;
}
-static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_context *context)
+static BOOL buffer_find_decl(struct wined3d_buffer *This, const struct wined3d_context *context,
+ const struct wined3d_state *state)
{
- struct wined3d_device *device = This->resource.device;
const struct wined3d_stream_info *si = &context->stream_info;
- const struct wined3d_state *state = &device->state; /* FIXME */
BOOL support_d3dcolor = context->gl_info->supported[ARB_VERTEX_ARRAY_BGRA];
BOOL support_xyzrhw = context->d3d_info->xyzrhw;
UINT stride_this_run = 0;
@@ -730,7 +729,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;
@@ -765,10 +765,11 @@ 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)
{
- decl_changed = buffer_find_decl(buffer, context);
+ decl_changed = buffer_find_decl(buffer, context, state);
buffer->flags |= WINED3D_BUFFER_HASDESC;
}
@@ -927,7 +928,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 d4714cc..daaed4c 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 f7ded75..9419243 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -2523,8 +2523,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