Commit e536f998 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Set the buffer.c GLINFO_LOCATION to *gl_info.

parent db0784e1
......@@ -29,7 +29,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d);
#define GLINFO_LOCATION This->resource.device->adapter->gl_info
#define GLINFO_LOCATION (*gl_info)
#define VB_MAXDECLCHANGES 100 /* After that number of decl changes we stop converting */
#define VB_RESETDECLCHANGE 1000 /* Reset the decl changecount after that number of draws */
......@@ -98,7 +98,7 @@ static inline BOOL buffer_is_fully_dirty(struct wined3d_buffer *This)
}
/* Context activation is done by the caller */
static void delete_gl_buffer(struct wined3d_buffer *This)
static void delete_gl_buffer(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info)
{
if(!This->buffer_object) return;
......@@ -226,7 +226,7 @@ static void buffer_create_buffer_object(struct wined3d_buffer *This)
fail:
/* Clean up all vbo init, but continue because we can work without a vbo :-) */
ERR("Failed to create a vertex buffer object. Continuing, but performance issues may occur\n");
delete_gl_buffer(This);
delete_gl_buffer(This, gl_info);
buffer_clear_dirty_areas(This);
}
......@@ -552,7 +552,7 @@ static BOOL buffer_find_decl(struct wined3d_buffer *This)
}
/* Context activation is done by the caller. */
static void buffer_check_buffer_object_size(struct wined3d_buffer *This)
static void buffer_check_buffer_object_size(struct wined3d_buffer *This, const struct wined3d_gl_info *gl_info)
{
UINT size = This->conversion_stride ?
This->conversion_stride * (This->resource.size / This->stride) : This->resource.size;
......@@ -675,6 +675,8 @@ static ULONG STDMETHODCALLTYPE buffer_AddRef(IWineD3DBuffer *iface)
/* Context activation is done by the caller. */
BYTE *buffer_get_sysmem(struct wined3d_buffer *This)
{
const struct wined3d_gl_info *gl_info = &This->resource.device->adapter->gl_info;
/* AllocatedMemory exists if the buffer is double buffered or has no buffer object at all */
if(This->resource.allocatedMemory) return This->resource.allocatedMemory;
......@@ -709,7 +711,7 @@ static void STDMETHODCALLTYPE buffer_UnLoad(IWineD3DBuffer *iface)
This->flags &= ~WINED3D_BUFFER_DOUBLEBUFFER;
}
delete_gl_buffer(This);
delete_gl_buffer(This, context->gl_info);
This->flags |= WINED3D_BUFFER_CREATEBO; /* Recreate the buffer object next load */
buffer_clear_dirty_areas(This);
......@@ -926,6 +928,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
struct wined3d_buffer *This = (struct wined3d_buffer *)iface;
IWineD3DDeviceImpl *device = This->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;
......@@ -936,6 +939,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
This->flags &= ~(WINED3D_BUFFER_NOSYNC | WINED3D_BUFFER_DISCARD);
context = context_acquire(device, NULL);
gl_info = context->gl_info;
if (!This->buffer_object)
{
......@@ -993,7 +997,7 @@ static void STDMETHODCALLTYPE buffer_PreLoad(IWineD3DBuffer *iface)
IWineD3DDeviceImpl_MarkStateDirty(device, STATE_STREAMSRC);
goto end;
}
buffer_check_buffer_object_size(This);
buffer_check_buffer_object_size(This, gl_info);
/* The declaration changed, reload the whole buffer */
WARN("Reloading buffer because of decl change\n");
......
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