From db2993faa0211b60efd46016de5d07110cb9777a Mon Sep 17 00:00:00 2001 From: Kristian Høgsberg Date: Tue, 11 May 2010 10:23:34 -0400 Subject: intel: Drop viewport hack when we can --- src/mesa/drivers/dri/intel/intel_context.c | 11 ++++++++++- src/mesa/drivers/dri/intel/intel_context.h | 5 ++--- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'src/mesa/drivers/dri/intel') diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 62ae637dc61..7d83e52f640 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -438,12 +438,15 @@ intel_prepare_render(struct intel_context *intel) intel->front_buffer_dirty = GL_TRUE; } -void +static void intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = intel->driContext; + if (intel->saved_viewport) + intel->saved_viewport(ctx, x, y, w, h); + if (!intel->using_dri2_swapbuffers && !intel->meta.internal_viewport_call && ctx->DrawBuffer->Name == 0) { dri2InvalidateDrawable(driContext->driDrawablePriv); @@ -608,6 +611,12 @@ intelInitContext(struct intel_context *intel, if (intelScreen->bufmgr == NULL) return GL_FALSE; + /* Can't rely on invalidate events, fall back to glViewport hack */ + if (!driContextPriv->driScreenPriv->dri2.useInvalidate) { + intel->saved_viewport = functions->Viewport; + functions->Viewport = intel_viewport; + } + if (!_mesa_initialize_context_for_api(&intel->ctx, api, mesaVis, shareCtx, functions, (void *) intel)) { printf("%s: failed to init mesa context\n", __FUNCTION__); diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 7bc5aa5d9b1..db244e58729 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -243,6 +243,8 @@ struct intel_context __DRIcontext *driContext; struct intel_screen *intelScreen; + void (*saved_viewport)(GLcontext * ctx, + GLint x, GLint y, GLsizei width, GLsizei height); /** * Configuration cache @@ -446,9 +448,6 @@ extern int intel_translate_stencil_op(GLenum op); extern int intel_translate_blend_factor(GLenum factor); extern int intel_translate_logic_op(GLenum opcode); -void intel_viewport(GLcontext * ctx, GLint x, GLint y, - GLsizei width, GLsizei height); - void intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable); void intel_prepare_render(struct intel_context *intel); -- cgit v1.2.3