summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Paul <brianp@vmware.com>2009-01-29 11:07:14 -0700
committerIan Romanick <ian.d.romanick@intel.com>2009-05-13 14:13:46 -0700
commitec863602f2f8567958ad187dcb567a2752dd4f46 (patch)
tree3e2ad2772789f7ed0bd3bca3e7a74b6d93879540
parent2ff47b80f50deecc468c6baa34506a4718c38637 (diff)
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)
-rw-r--r--src/mesa/drivers/dri/i965/brw_sf_state.c13
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 e22d08099f4..0ca6e3d5af2 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: