wined3d: Store the usage in struct wined3d_bo_gl.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Matteo Bruni <mbruni@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
0638d50b22
commit
db42859977
|
@ -200,7 +200,6 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
|
|||
struct wined3d_context_gl *context_gl)
|
||||
{
|
||||
const struct wined3d_gl_info *gl_info = context_gl->gl_info;
|
||||
GLenum gl_usage = GL_STATIC_DRAW;
|
||||
struct wined3d_bo_gl *bo;
|
||||
GLenum error;
|
||||
|
||||
|
@ -223,6 +222,7 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
|
|||
bo = &buffer_gl->bo;
|
||||
GL_EXTCALL(glGenBuffers(1, &bo->id));
|
||||
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;
|
||||
error = gl_info->gl_ops.gl.p_glGetError();
|
||||
if (!bo->id || error != GL_NO_ERROR)
|
||||
|
@ -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)
|
||||
{
|
||||
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])
|
||||
{
|
||||
|
@ -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. */
|
||||
}
|
||||
|
||||
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();
|
||||
if (error != GL_NO_ERROR)
|
||||
{
|
||||
|
@ -262,7 +262,6 @@ static BOOL wined3d_buffer_gl_create_buffer_object(struct wined3d_buffer_gl *buf
|
|||
goto fail;
|
||||
}
|
||||
|
||||
buffer_gl->buffer_object_usage = gl_usage;
|
||||
buffer_invalidate_bo_range(&buffer_gl->b, 0, 0);
|
||||
|
||||
return TRUE;
|
||||
|
@ -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);
|
||||
|
||||
GL_EXTCALL(glBufferData(buffer_gl->bo.binding, buffer_gl->b.resource.size,
|
||||
NULL, buffer_gl->buffer_object_usage));
|
||||
GL_EXTCALL(glBufferData(buffer_gl->bo.binding, buffer_gl->b.resource.size, NULL, buffer_gl->bo.usage));
|
||||
checkGLcall("glBufferData");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1926,8 +1926,9 @@ static void wined3d_texture_prepare_buffer_object(struct wined3d_texture *textur
|
|||
|
||||
GL_EXTCALL(glGenBuffers(1, &bo->id));
|
||||
bo->binding = GL_PIXEL_UNPACK_BUFFER;
|
||||
bo->usage = GL_STREAM_DRAW;
|
||||
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));
|
||||
checkGLcall("Create buffer object");
|
||||
|
||||
|
|
|
@ -1417,8 +1417,9 @@ static void wined3d_unordered_access_view_gl_cs_init(void *object)
|
|||
|
||||
GL_EXTCALL(glGenBuffers(1, &bo->id));
|
||||
bo->binding = GL_ATOMIC_COUNTER_BUFFER;
|
||||
bo->usage = GL_STATIC_DRAW;
|
||||
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");
|
||||
view_gl->v.counter_bo = (uintptr_t)bo;
|
||||
}
|
||||
|
|
|
@ -1539,6 +1539,7 @@ struct wined3d_bo_gl
|
|||
{
|
||||
GLuint id;
|
||||
GLenum binding;
|
||||
GLenum usage;
|
||||
};
|
||||
|
||||
static inline GLuint wined3d_bo_gl_id(uintptr_t bo)
|
||||
|
@ -4825,7 +4826,6 @@ struct wined3d_buffer_gl
|
|||
struct wined3d_buffer b;
|
||||
|
||||
struct wined3d_bo_gl bo;
|
||||
GLenum buffer_object_usage;
|
||||
};
|
||||
|
||||
static inline struct wined3d_buffer_gl *wined3d_buffer_gl(struct wined3d_buffer *buffer)
|
||||
|
|
Loading…
Reference in New Issue