From 2adef553f2549e30b4a1894e7f9077ac339ea61c Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Thu, 13 Nov 2008 18:32:44 -0800 Subject: i915: Don't overwrite i915's Viewport function from generic code. Instead, have i965 and i915 both call the generic function from their Viewport. --- src/mesa/drivers/dri/i915/intel_state.c | 2 ++ src/mesa/drivers/dri/i965/brw_context.c | 2 ++ src/mesa/drivers/dri/intel/intel_context.c | 8 +++++--- src/mesa/drivers/dri/intel/intel_context.h | 3 +++ 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'src/mesa') diff --git a/src/mesa/drivers/dri/i915/intel_state.c b/src/mesa/drivers/dri/i915/intel_state.c index 09aa62da36..4aa43e5f3a 100644 --- a/src/mesa/drivers/dri/i915/intel_state.c +++ b/src/mesa/drivers/dri/i915/intel_state.c @@ -267,6 +267,8 @@ intelViewport(GLcontext * ctx, GLint x, GLint y, GLsizei width, GLsizei height) { intelCalcViewport(ctx); + + intel_viewport(ctx, x, y, width, height); } static void diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index e2bc08a6cb..1d6ac2cea6 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -71,6 +71,8 @@ static void brwInitDriverFunctions( struct dd_function_table *functions ) brwInitFragProgFuncs( functions ); brwInitProgFuncs( functions ); brw_init_queryobj_functions(functions); + + functions->Viewport = intel_viewport; } diff --git a/src/mesa/drivers/dri/intel/intel_context.c b/src/mesa/drivers/dri/intel/intel_context.c index 9ac18e6960..6c625b428c 100644 --- a/src/mesa/drivers/dri/intel/intel_context.c +++ b/src/mesa/drivers/dri/intel/intel_context.c @@ -317,11 +317,13 @@ intel_update_renderbuffers(__DRIcontext *context, __DRIdrawable *drawable) driUpdateFramebufferSize(&intel->ctx, drawable); } -static void +void intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) { struct intel_context *intel = intel_context(ctx); __DRIcontext *driContext = intel->driContext; + void (*old_viewport)(GLcontext *ctx, GLint x, GLint y, + GLsizei w, GLsizei h); if (!driContext->driScreenPriv->dri2.enabled) return; @@ -330,11 +332,12 @@ intel_viewport(GLcontext *ctx, GLint x, GLint y, GLsizei w, GLsizei h) if (driContext->driDrawablePriv != driContext->driReadablePriv) intel_update_renderbuffers(driContext, driContext->driReadablePriv); + old_viewport = ctx->Driver.Viewport; ctx->Driver.Viewport = NULL; intel->driDrawable = driContext->driDrawablePriv; intelWindowMoved(intel); intel_draw_buffer(ctx, intel->ctx.DrawBuffer); - ctx->Driver.Viewport = intel_viewport; + ctx->Driver.Viewport = old_viewport; } /** @@ -544,7 +547,6 @@ intelInitDriverFunctions(struct dd_function_table *functions) functions->Finish = intelFinish; functions->GetString = intelGetString; functions->UpdateState = intelInvalidateState; - functions->Viewport = intel_viewport; functions->CopyColorTable = _swrast_CopyColorTable; functions->CopyColorSubTable = _swrast_CopyColorSubTable; diff --git a/src/mesa/drivers/dri/intel/intel_context.h b/src/mesa/drivers/dri/intel/intel_context.h index 3938af4c72..60028f090a 100644 --- a/src/mesa/drivers/dri/intel/intel_context.h +++ b/src/mesa/drivers/dri/intel/intel_context.h @@ -495,6 +495,9 @@ 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); -- cgit v1.2.3