i915tex: Recalculate viewport related hardware state in intelWindowMoved().
authorMichel Dänzer <michel@tungstengraphics.com>
Thu, 7 Dec 2006 10:03:48 +0000 (11:03 +0100)
committerMichel Dänzer <michel@tungstengraphics.com>
Thu, 7 Dec 2006 10:03:48 +0000 (11:03 +0100)
This fixes vertically displaced rendering with some apps like Google Earth.

Simplify other parts of the function somewhat.

src/mesa/drivers/dri/i915tex/intel_buffers.c

index a6b32986233109187803718ca287f98602d42423..1ded0b5417fe05c18265deb70cf1f2a9c0e4696f 100644 (file)
@@ -36,6 +36,7 @@
 #include "intel_batchbuffer.h"
 #include "context.h"
 #include "utils.h"
+#include "drirenderbuffer.h"
 #include "framebuffer.h"
 #include "swrast/swrast.h"
 #include "vblank.h"
@@ -183,6 +184,8 @@ void
 intelWindowMoved(struct intel_context *intel)
 {
    GLcontext *ctx = &intel->ctx;
+   __DRIdrawablePrivate *dPriv = intel->driDrawable;
+   GLframebuffer *drawFb = (GLframebuffer *) dPriv->driverPrivate;
 
    if (!intel->ctx.DrawBuffer) {
       /* when would this happen? -BP */
@@ -194,7 +197,7 @@ intelWindowMoved(struct intel_context *intel)
    }
    else {
       /* drawing to a window */
-      switch (intel->ctx.DrawBuffer->_ColorDrawBufferMask[0]) {
+      switch (drawFb->_ColorDrawBufferMask[0]) {
       case BUFFER_BIT_FRONT_LEFT:
          intelSetFrontClipRects(intel);
          break;
@@ -207,14 +210,11 @@ intelWindowMoved(struct intel_context *intel)
       }
    }
 
-   /* this update Mesa's notion of window size */
-   if (ctx->WinSysDrawBuffer) {
-      _mesa_resize_framebuffer(ctx, ctx->WinSysDrawBuffer,
-                               intel->driDrawable->w, intel->driDrawable->h);
-   }
+   /* Update Mesa's notion of window size */
+   driUpdateFramebufferSize(ctx, dPriv);
+   drawFb->Initialized = GL_TRUE; /* XXX remove someday */
 
-   if (intel->intelScreen->driScrnPriv->ddxMinor >= 7 && intel->driDrawable) {
-      __DRIdrawablePrivate *dPriv = intel->driDrawable;
+   if (intel->intelScreen->driScrnPriv->ddxMinor >= 7) {
       drmI830Sarea *sarea = intel->sarea;
       drm_clip_rect_t drw_rect = { .x1 = dPriv->x, .x2 = dPriv->x + dPriv->w,
                                   .y1 = dPriv->y, .y2 = dPriv->y + dPriv->h };
@@ -245,6 +245,9 @@ intelWindowMoved(struct intel_context *intel)
    /* Update hardware scissor */
    ctx->Driver.Scissor(ctx, ctx->Scissor.X, ctx->Scissor.Y,
                        ctx->Scissor.Width, ctx->Scissor.Height);
+
+   /* Re-calculate viewport related state */
+   ctx->Driver.DepthRange( ctx, ctx->Viewport.Near, ctx->Viewport.Far );
 }