Commit 3faa9e92 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Pass a wined3d_context_gl structure to context_bind_bo().

parent 0781596c
......@@ -135,7 +135,9 @@ void wined3d_buffer_invalidate_location(struct wined3d_buffer *buffer, DWORD loc
/* Context activation is done by the caller. */
static void wined3d_buffer_gl_bind(struct wined3d_buffer_gl *buffer_gl, struct wined3d_context *context)
{
context_bind_bo(context, buffer_gl->buffer_type_hint, buffer_gl->buffer_object);
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
wined3d_context_gl_bind_bo(context_gl, buffer_gl->buffer_type_hint, buffer_gl->buffer_object);
}
/* Context activation is done by the caller. */
......
......@@ -2514,12 +2514,12 @@ void wined3d_context_gl_active_texture(struct wined3d_context_gl *context_gl,
context_gl->active_texture = unit;
}
void context_bind_bo(struct wined3d_context *context, GLenum binding, GLuint name)
void wined3d_context_gl_bind_bo(struct wined3d_context_gl *context_gl, GLenum binding, GLuint name)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_gl_info *gl_info = context_gl->c.gl_info;
if (binding == GL_ELEMENT_ARRAY_BUFFER)
context_invalidate_state(context, STATE_INDEXBUFFER);
context_invalidate_state(&context_gl->c, STATE_INDEXBUFFER);
GL_EXTCALL(glBindBuffer(binding, name));
}
......@@ -2591,6 +2591,7 @@ void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl, GLen
void *context_map_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, size_t size, GLenum binding, DWORD flags)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info;
BYTE *memory;
......@@ -2598,7 +2599,7 @@ void *context_map_bo_address(struct wined3d_context *context,
return data->addr;
gl_info = context->gl_info;
context_bind_bo(context, binding, data->buffer_object);
wined3d_context_gl_bind_bo(context_gl, binding, data->buffer_object);
if (gl_info->supported[ARB_MAP_BUFFER_RANGE])
{
......@@ -2611,7 +2612,7 @@ void *context_map_bo_address(struct wined3d_context *context,
memory += (INT_PTR)data->addr;
}
context_bind_bo(context, binding, 0);
wined3d_context_gl_bind_bo(context_gl, binding, 0);
checkGLcall("Map buffer object");
return memory;
......@@ -2620,15 +2621,16 @@ void *context_map_bo_address(struct wined3d_context *context,
void context_unmap_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *data, GLenum binding)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info;
if (!data->buffer_object)
return;
gl_info = context->gl_info;
context_bind_bo(context, binding, data->buffer_object);
wined3d_context_gl_bind_bo(context_gl, binding, data->buffer_object);
GL_EXTCALL(glUnmapBuffer(binding));
context_bind_bo(context, binding, 0);
wined3d_context_gl_bind_bo(context_gl, binding, 0);
checkGLcall("Unmap buffer object");
}
......@@ -2636,6 +2638,7 @@ void context_copy_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *dst, GLenum dst_binding,
const struct wined3d_bo_address *src, GLenum src_binding, size_t size)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info;
BYTE *dst_ptr, *src_ptr;
......@@ -2664,13 +2667,13 @@ void context_copy_bo_address(struct wined3d_context *context,
}
else if (!dst->buffer_object && src->buffer_object)
{
context_bind_bo(context, src_binding, src->buffer_object);
wined3d_context_gl_bind_bo(context_gl, src_binding, src->buffer_object);
GL_EXTCALL(glGetBufferSubData(src_binding, (GLintptr)src->addr, size, dst->addr));
checkGLcall("buffer download");
}
else if (dst->buffer_object && !src->buffer_object)
{
context_bind_bo(context, dst_binding, dst->buffer_object);
wined3d_context_gl_bind_bo(context_gl, dst_binding, dst->buffer_object);
GL_EXTCALL(glBufferSubData(dst_binding, (GLintptr)dst->addr, size, src->addr));
checkGLcall("buffer upload");
}
......
......@@ -1034,6 +1034,7 @@ void wined3d_unordered_access_view_invalidate_location(struct wined3d_unordered_
void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_view *view,
const struct wined3d_uvec4 *clear_value, struct wined3d_context *context)
{
struct wined3d_context_gl *context_gl = wined3d_context_gl(context);
const struct wined3d_gl_info *gl_info = context->gl_info;
const struct wined3d_format_gl *format;
struct wined3d_buffer_gl *buffer_gl;
......@@ -1067,7 +1068,7 @@ void wined3d_unordered_access_view_clear_uint(struct wined3d_unordered_access_vi
wined3d_unordered_access_view_invalidate_location(view, ~WINED3D_LOCATION_BUFFER);
get_buffer_view_range(&buffer_gl->b, &view->desc, &format->f, &offset, &size);
context_bind_bo(context, buffer_gl->buffer_type_hint, buffer_gl->buffer_object);
wined3d_context_gl_bind_bo(context_gl, buffer_gl->buffer_type_hint, buffer_gl->buffer_object);
GL_EXTCALL(glClearBufferSubData(buffer_gl->buffer_type_hint, format->internal,
offset, size, format->format, format->type, clear_value));
checkGLcall("clear unordered access view");
......
......@@ -2081,6 +2081,7 @@ void wined3d_context_gl_apply_fbo_state_blit(struct wined3d_context_gl *context_
struct wined3d_resource *ds, unsigned int ds_sub_resource_idx, DWORD location) DECLSPEC_HIDDEN;
void wined3d_context_gl_apply_ffp_blit_state(struct wined3d_context_gl *context_gl,
const struct wined3d_device *device) DECLSPEC_HIDDEN;
void wined3d_context_gl_bind_bo(struct wined3d_context_gl *context_gl, GLenum binding, GLuint name) DECLSPEC_HIDDEN;
void wined3d_context_gl_bind_texture(struct wined3d_context_gl *context_gl,
GLenum target, GLuint name) DECLSPEC_HIDDEN;
void wined3d_context_gl_check_fbo_status(const struct wined3d_context_gl *context_gl, GLenum target) DECLSPEC_HIDDEN;
......@@ -2237,7 +2238,6 @@ void wined3d_raw_blitter_create(struct wined3d_blitter **next,
BOOL wined3d_clip_blit(const RECT *clip_rect, RECT *clipped, RECT *other) DECLSPEC_HIDDEN;
void context_bind_bo(struct wined3d_context *context, GLenum binding, GLuint name) DECLSPEC_HIDDEN;
void context_bind_dummy_textures(const struct wined3d_context *context) DECLSPEC_HIDDEN;
void context_copy_bo_address(struct wined3d_context *context,
const struct wined3d_bo_address *dst, GLenum dst_binding,
......
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