summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Whitwell <keith@tungstengraphics.com>2006-05-23 09:34:09 +0000
committerKeith Whitwell <keith@tungstengraphics.com>2006-05-23 09:34:09 +0000
commitdbb2f30ad3b83146b8473f95921170246f38cb4d (patch)
tree89406773638c97892831e7310050c8ba9cd8012f
parent9c84dfe1566a71471c97b50d2453707264b1cca6 (diff)
Fix culling calculations for FBOs
-rw-r--r--src/mesa/drivers/dri/i915/i915_state.c5
-rw-r--r--src/mesa/drivers/dri/i915/intel_buffers.c8
2 files changed, 12 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i915/i915_state.c b/src/mesa/drivers/dri/i915/i915_state.c
index d50d2f31ce3..37513fff526 100644
--- a/src/mesa/drivers/dri/i915/i915_state.c
+++ b/src/mesa/drivers/dri/i915/i915_state.c
@@ -395,7 +395,8 @@ static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
GLuint mode;
if (INTEL_DEBUG&DEBUG_DRI)
- fprintf(stderr, "%s\n", __FUNCTION__);
+ fprintf(stderr, "%s %d\n", __FUNCTION__,
+ ctx->DrawBuffer ? ctx->DrawBuffer->Name : 0);
if (!ctx->Polygon.CullFlag) {
mode = S4_CULLMODE_NONE;
@@ -403,6 +404,8 @@ static void i915CullFaceFrontFace(GLcontext *ctx, GLenum unused)
else if (ctx->Polygon.CullFaceMode != GL_FRONT_AND_BACK) {
mode = S4_CULLMODE_CW;
+ if (ctx->DrawBuffer && ctx->DrawBuffer->Name != 0)
+ mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
if (ctx->Polygon.CullFaceMode == GL_FRONT)
mode ^= (S4_CULLMODE_CW ^ S4_CULLMODE_CCW);
if (ctx->Polygon.FrontFace != GL_CCW)
diff --git a/src/mesa/drivers/dri/i915/intel_buffers.c b/src/mesa/drivers/dri/i915/intel_buffers.c
index 523a6354cfb..85ac4180790 100644
--- a/src/mesa/drivers/dri/i915/intel_buffers.c
+++ b/src/mesa/drivers/dri/i915/intel_buffers.c
@@ -615,6 +615,14 @@ intel_draw_buffer(GLcontext *ctx, struct gl_framebuffer *fb)
colorRegion = (irb && irb->region) ? irb->region : NULL;
}
+ /* Update culling direction which changes depending on the
+ * orientation of the buffer:
+ */
+ if (ctx->Driver.FrontFace)
+ ctx->Driver.FrontFace(ctx, ctx->Polygon.FrontFace);
+ else
+ ctx->NewState |= _NEW_POLYGON;
+
if (!colorRegion) {
FALLBACK( intel, INTEL_FALLBACK_DRAW_BUFFER, GL_TRUE );
}