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

wined3d: Store the usage in struct wined3d_bo_gl.

parent 0638d50b
...@@ -200,7 +200,6 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf ...@@ -200,7 +200,6 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
struct wined3d_context_gl *context_gl) struct wined3d_context_gl *context_gl)
{ {
const struct wined3d_gl_info *gl_info = context_gl->gl_info; const struct wined3d_gl_info *gl_info = context_gl->gl_info;
GLenum gl_usage = GL_STATIC_DRAW;
struct wined3d_bo_gl *bo; struct wined3d_bo_gl *bo;
GLenum error; GLenum error;
...@@ -223,6 +222,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf ...@@ -223,6 +222,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
bo = &buffer_gl->bo; bo = &buffer_gl->bo;
GL_EXTCALL(glGenBuffers(1, &bo->id)); GL_EXTCALL(glGenBuffers(1, &bo->id));
bo->binding = wined3d_buffer_gl_binding_from_bind_flags(gl_info, buffer_gl->b.resource.bind_flags); bo->binding = wined3d_buffer_gl_binding_from_bind_flags(gl_info, buffer_gl->b.resource.bind_flags);
bo->usage = GL_STATIC_DRAW;
buffer_gl->b.buffer_object = (uintptr_t)bo; buffer_gl->b.buffer_object = (uintptr_t)bo;
error = gl_info->gl_ops.gl.p_glGetError(); error = gl_info->gl_ops.gl.p_glGetError();
if (!bo->id || error != GL_NO_ERROR) if (!bo->id || error != GL_NO_ERROR)
...@@ -242,7 +242,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf ...@@ -242,7 +242,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
if (buffer_gl->b.resource.usage & WINED3DUSAGE_DYNAMIC) if (buffer_gl->b.resource.usage & WINED3DUSAGE_DYNAMIC)
{ {
TRACE("Buffer has WINED3DUSAGE_DYNAMIC set.\n"); TRACE("Buffer has WINED3DUSAGE_DYNAMIC set.\n");
gl_usage = GL_STREAM_DRAW_ARB; bo->usage = GL_STREAM_DRAW_ARB;
if (gl_info->supported[APPLE_FLUSH_BUFFER_RANGE]) if (gl_info->supported[APPLE_FLUSH_BUFFER_RANGE])
{ {
...@@ -254,7 +254,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf ...@@ -254,7 +254,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
/* No setup is needed here for GL_ARB_map_buffer_range. */ /* No setup is needed here for GL_ARB_map_buffer_range. */
} }
GL_EXTCALL(glBufferData(bo->binding, buffer_gl->b.resource.size, NULL, gl_usage)); GL_EXTCALL(glBufferData(bo->binding, buffer_gl->b.resource.size, NULL, bo->usage));
error = gl_info->gl_ops.gl.p_glGetError(); error = gl_info->gl_ops.gl.p_glGetError();
if (error != GL_NO_ERROR) if (error != GL_NO_ERROR)
{ {
...@@ -262,7 +262,6 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf ...@@ -262,7 +262,6 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
goto fail; goto fail;
} }
buffer_gl->buffer_object_usage = gl_usage;
buffer_invalidate_bo_range(&buffer_gl->b, 0, 0); buffer_invalidate_bo_range(&buffer_gl->b, 0, 0);
return TRUE; return TRUE;
...@@ -799,8 +798,7 @@ static void wined3d_buffer_gl_sync_apple(struct wined3d_buffer_gl *buffer_gl, ...@@ -799,8 +798,7 @@ static void wined3d_buffer_gl_sync_apple(struct wined3d_buffer_gl *buffer_gl,
{ {
wined3d_buffer_gl_bind(buffer_gl, context_gl); wined3d_buffer_gl_bind(buffer_gl, context_gl);
GL_EXTCALL(glBufferData(buffer_gl->bo.binding, buffer_gl->b.resource.size, GL_EXTCALL(glBufferData(buffer_gl->bo.binding, buffer_gl->b.resource.size, NULL, buffer_gl->bo.usage));
NULL, buffer_gl->buffer_object_usage));
checkGLcall("glBufferData"); checkGLcall("glBufferData");
return; return;
} }
......
...@@ -1926,8 +1926,9 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur ...@@ -1926,8 +1926,9 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur
GL_EXTCALL(glGenBuffers(1, &bo->id)); GL_EXTCALL(glGenBuffers(1, &bo->id));
bo->binding = GL_PIXEL_UNPACK_BUFFER; bo->binding = GL_PIXEL_UNPACK_BUFFER;
bo->usage = GL_STREAM_DRAW;
GL_EXTCALL(glBindBuffer(bo->binding, bo->id)); GL_EXTCALL(glBindBuffer(bo->binding, bo->id));
GL_EXTCALL(glBufferData(bo->binding, sub_resource->size, NULL, GL_STREAM_DRAW)); GL_EXTCALL(glBufferData(bo->binding, sub_resource->size, NULL, bo->usage));
GL_EXTCALL(glBindBuffer(bo->binding, 0)); GL_EXTCALL(glBindBuffer(bo->binding, 0));
checkGLcall("Create buffer object"); checkGLcall("Create buffer object");
......
...@@ -1417,8 +1417,9 @@ static void wined3d_unordered_access_view_gl_cs_init(void *object) ...@@ -1417,8 +1417,9 @@ static void wined3d_unordered_access_view_gl_cs_init(void *object)
GL_EXTCALL(glGenBuffers(1, &bo->id)); GL_EXTCALL(glGenBuffers(1, &bo->id));
bo->binding = GL_ATOMIC_COUNTER_BUFFER; bo->binding = GL_ATOMIC_COUNTER_BUFFER;
bo->usage = GL_STATIC_DRAW;
GL_EXTCALL(glBindBuffer(bo->binding, bo->id)); GL_EXTCALL(glBindBuffer(bo->binding, bo->id));
GL_EXTCALL(glBufferData(bo->binding, sizeof(initial_value), &initial_value, GL_STATIC_DRAW)); GL_EXTCALL(glBufferData(bo->binding, sizeof(initial_value), &initial_value, bo->usage));
checkGLcall("create atomic counter buffer"); checkGLcall("create atomic counter buffer");
view_gl->v.counter_bo = (uintptr_t)bo; view_gl->v.counter_bo = (uintptr_t)bo;
} }
......
...@@ -1539,6 +1539,7 @@ struct wined3d_bo_gl ...@@ -1539,6 +1539,7 @@ struct wined3d_bo_gl
{ {
GLuint id; GLuint id;
GLenum binding; GLenum binding;
GLenum usage;
}; };
static inline GLuint wined3d_bo_gl_id(uintptr_t bo) static inline GLuint wined3d_bo_gl_id(uintptr_t bo)
...@@ -4825,7 +4826,6 @@ struct wined3d_buffer_gl ...@@ -4825,7 +4826,6 @@ struct wined3d_buffer_gl
struct wined3d_buffer b; struct wined3d_buffer b;
struct wined3d_bo_gl bo; struct wined3d_bo_gl bo;
GLenum buffer_object_usage;
}; };
static inline struct wined3d_buffer_gl *wined3d_buffer_gl(struct wined3d_buffer *buffer) static inline struct wined3d_buffer_gl *wined3d_buffer_gl(struct wined3d_buffer *buffer)
......
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