Commit b8eb171b authored by Stefan Dösinger's avatar Stefan Dösinger Committed by Alexandre Julliard

wined3d: Explicitly pass the state information to buffer_internal_preload.

parent d8c43aab
......@@ -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);
}
......
......@@ -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);
}
......
......@@ -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
{
......
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