wined3d: Pass the context to the main buffer preload function.

This commit is contained in:
Stefan Dösinger 2013-09-09 15:15:37 +02:00 committed by Alexandre Julliard
parent 87f931dc64
commit cd203b38a6
4 changed files with 13 additions and 9 deletions

View File

@ -730,13 +730,13 @@ static void buffer_direct_upload(struct wined3d_buffer *This, const struct wined
checkGLcall("glUnmapBufferARB");
}
void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
/* Context activation is done by the caller. */
void buffer_internal_preload(struct wined3d_buffer *buffer, struct wined3d_context *context)
{
DWORD flags = buffer->flags & (WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD);
struct wined3d_device *device = buffer->resource.device;
UINT start = 0, end = 0, len = 0, vertices;
const struct wined3d_gl_info *gl_info;
struct wined3d_context *context;
BOOL decl_changed = FALSE;
unsigned int i, j;
BYTE *data;
@ -756,9 +756,7 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
/* TODO: Make converting independent from VBOs */
if (buffer->flags & WINED3D_BUFFER_CREATEBO)
{
context = context_acquire(device, NULL);
buffer_create_buffer_object(buffer, context);
context_release(context);
buffer->flags &= ~WINED3D_BUFFER_CREATEBO;
}
else
@ -867,14 +865,11 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
return;
}
context = context_acquire(device, NULL);
buffer_direct_upload(buffer, context->gl_info, flags);
context_release(context);
return;
}
context = context_acquire(device, NULL);
gl_info = context->gl_info;
if(!(buffer->flags & WINED3D_BUFFER_DOUBLEBUFFER))
@ -927,6 +922,13 @@ void CDECL wined3d_buffer_preload(struct wined3d_buffer *buffer)
}
HeapFree(GetProcessHeap(), 0, data);
}
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);
context_release(context);
}

View File

@ -2372,7 +2372,7 @@ BOOL context_apply_draw_state(struct wined3d_context *context, struct wined3d_de
if (state->index_buffer)
{
if (device->stream_info.all_vbo)
wined3d_buffer_preload(state->index_buffer);
buffer_internal_preload(state->index_buffer, context);
else
buffer_get_sysmem(state->index_buffer, context);
}

View File

@ -288,7 +288,7 @@ static void device_stream_info_from_declaration(struct wined3d_device *device, s
element = &stream_info->elements[i];
buffer = state->streams[element->stream_idx].buffer;
wined3d_buffer_preload(buffer);
buffer_internal_preload(buffer, context);
/* If the preload dropped the buffer object, update the stream info. */
if (buffer->buffer_object != element->data.buffer_object)

View File

@ -2523,6 +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;
struct wined3d_rendertarget_view
{