Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>tags/10.6-branchpoint
@@ -141,11 +141,44 @@ static void st_glFinish(struct gl_context *ctx) | |||
} | |||
void st_init_flush_functions(struct dd_function_table *functions) | |||
/** | |||
* Query information about GPU resets observed by this context | |||
* | |||
* Called via \c dd_function_table::GetGraphicsResetStatus. | |||
*/ | |||
static GLenum | |||
st_get_graphics_reset_status(struct gl_context *ctx) | |||
{ | |||
struct st_context *st = st_context(ctx); | |||
enum pipe_reset_status status; | |||
status = st->pipe->get_device_reset_status(st->pipe); | |||
switch (status) { | |||
case PIPE_NO_RESET: | |||
return GL_NO_ERROR; | |||
case PIPE_GUILTY_CONTEXT_RESET: | |||
return GL_GUILTY_CONTEXT_RESET_ARB; | |||
case PIPE_INNOCENT_CONTEXT_RESET: | |||
return GL_INNOCENT_CONTEXT_RESET_ARB; | |||
case PIPE_UNKNOWN_CONTEXT_RESET: | |||
return GL_UNKNOWN_CONTEXT_RESET_ARB; | |||
default: | |||
assert(0); | |||
return GL_NO_ERROR; | |||
} | |||
} | |||
void st_init_flush_functions(struct pipe_screen *screen, | |||
struct dd_function_table *functions) | |||
{ | |||
functions->Flush = st_glFlush; | |||
functions->Finish = st_glFinish; | |||
if (screen->get_param(screen, PIPE_CAP_DEVICE_RESET_STATUS_QUERY)) | |||
functions->GetGraphicsResetStatus = st_get_graphics_reset_status; | |||
/* Windows opengl32.dll calls glFinish prior to every swapbuffers. | |||
* This is unnecessary and degrades performance. Luckily we have some | |||
* scope to work around this, as the externally-visible behaviour of |
@@ -37,7 +37,8 @@ struct pipe_fence_handle; | |||
struct st_context; | |||
extern void | |||
st_init_flush_functions(struct dd_function_table *functions); | |||
st_init_flush_functions(struct pipe_screen *screen, | |||
struct dd_function_table *functions); | |||
extern void | |||
st_flush(struct st_context *st, |
@@ -321,7 +321,7 @@ struct st_context *st_create_context(gl_api api, struct pipe_context *pipe, | |||
struct st_context *st; | |||
memset(&funcs, 0, sizeof(funcs)); | |||
st_init_driver_functions(&funcs); | |||
st_init_driver_functions(pipe->screen, &funcs); | |||
ctx = _mesa_create_context(api, visual, shareCtx, &funcs); | |||
if (!ctx) { | |||
@@ -401,7 +401,8 @@ void st_destroy_context( struct st_context *st ) | |||
} | |||
void st_init_driver_functions(struct dd_function_table *functions) | |||
void st_init_driver_functions(struct pipe_screen *screen, | |||
struct dd_function_table *functions) | |||
{ | |||
_mesa_init_shader_object_functions(functions); | |||
_mesa_init_sampler_object_functions(functions); | |||
@@ -429,7 +430,7 @@ void st_init_driver_functions(struct dd_function_table *functions) | |||
st_init_readpixels_functions(functions); | |||
st_init_texture_functions(functions); | |||
st_init_texture_barrier_functions(functions); | |||
st_init_flush_functions(functions); | |||
st_init_flush_functions(screen, functions); | |||
st_init_string_functions(functions); | |||
st_init_viewport_functions(functions); | |||
@@ -237,7 +237,8 @@ struct st_framebuffer | |||
}; | |||
extern void st_init_driver_functions(struct dd_function_table *functions); | |||
extern void st_init_driver_functions(struct pipe_screen *screen, | |||
struct dd_function_table *functions); | |||
void st_invalidate_state(struct gl_context * ctx, GLuint new_state); | |||