Mesa (mesa_7_4_branch): i965: fix render to FBO/texture orientation bugs

Ian Romanick idr at kemper.freedesktop.org
Wed May 13 21:17:31 UTC 2009


Module: Mesa
Branch: mesa_7_4_branch
Commit: ec863602f2f8567958ad187dcb567a2752dd4f46
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ec863602f2f8567958ad187dcb567a2752dd4f46

Author: Brian Paul <brianp at vmware.com>
Date:   Thu Jan 29 11:07:14 2009 -0700

i965: fix render to FBO/texture orientation bugs

Anytime we're not rendering to the default/window FBO, need to invert
rendering, not just when rendering to a texture.  Otherwise, if a FBO
consists of a mix of textures and renderbuffers the up/down orientation
was inconsistant.

Fixes shadowtex.c bad rendering.
(cherry picked from commit ba367f68ccacf255f78ac0c8dd066e64bbb1e5c2)

---

 src/mesa/drivers/dri/i965/brw_sf_state.c |   13 +++++++------
 1 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_sf_state.c b/src/mesa/drivers/dri/i965/brw_sf_state.c
index e22d080..0ca6e3d 100644
--- a/src/mesa/drivers/dri/i965/brw_sf_state.c
+++ b/src/mesa/drivers/dri/i965/brw_sf_state.c
@@ -43,10 +43,11 @@ static void upload_sf_vp(struct brw_context *brw)
    const GLfloat depth_scale = 1.0F / ctx->DrawBuffer->_DepthMaxF;
    struct brw_sf_viewport sfv;
    GLfloat y_scale, y_bias;
+   const GLboolean render_to_fbo = (ctx->DrawBuffer->Name != 0);
 
    memset(&sfv, 0, sizeof(sfv));
 
-   if (intel_rendering_to_texture(ctx)) {
+   if (render_to_fbo) {
       y_scale = 1.0;
       y_bias = 0;
    }
@@ -75,7 +76,7 @@ static void upload_sf_vp(struct brw_context *brw)
     * Note that the hardware's coordinates are inclusive, while Mesa's min is
     * inclusive but max is exclusive.
     */
-   if (intel_rendering_to_texture(ctx)) {
+   if (render_to_fbo) {
       /* texmemory: Y=0=bottom */
       sfv.scissor.xmin = ctx->DrawBuffer->_Xmin;
       sfv.scissor.xmax = ctx->DrawBuffer->_Xmax - 1;
@@ -114,7 +115,7 @@ struct brw_sf_unit_key {
    GLboolean scissor, line_smooth, point_sprite, point_attenuated;
    float line_width;
    float point_size;
-   GLboolean render_to_texture;
+   GLboolean render_to_fbo;
 };
 
 static void
@@ -147,7 +148,7 @@ sf_unit_populate_key(struct brw_context *brw, struct brw_sf_unit_key *key)
    key->point_size = ctx->Point.Size;
    key->point_attenuated = ctx->Point._Attenuated;
 
-   key->render_to_texture = intel_rendering_to_texture(&brw->intel.ctx);
+   key->render_to_fbo = brw->intel.ctx.DrawBuffer->Name != 0;
 }
 
 static dri_bo *
@@ -194,10 +195,10 @@ sf_unit_create_from_key(struct brw_context *brw, struct brw_sf_unit_key *key,
    else
       sf.sf5.front_winding = BRW_FRONTWINDING_CW;
 
-   /* The viewport is inverted for rendering to texture, and that inverts
+   /* The viewport is inverted for rendering to a FBO, and that inverts
     * polygon front/back orientation.
     */
-   sf.sf5.front_winding ^= key->render_to_texture;
+   sf.sf5.front_winding ^= key->render_to_fbo;
 
    switch (key->cull_face) {
    case GL_FRONT:




More information about the mesa-commit mailing list