Mesa (7.10): i965/fs: Fix linear gl_Color interpolation on pre-gen6 hardware.
Kenneth Graunke
kwg at kemper.freedesktop.org
Sun Apr 3 03:12:25 UTC 2011
Module: Mesa
Branch: 7.10
Commit: 73f7453318633f2c5685c10f7bebce91e6e1868f
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=73f7453318633f2c5685c10f7bebce91e6e1868f
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sat Mar 26 22:04:23 2011 -0700
i965/fs: Fix linear gl_Color interpolation on pre-gen6 hardware.
Civilization 4's shaders make heavy use of gl_Color and don't use
perspective interpolation. This resulted in rivers, units, trees, and
so on being rendered almost entirely white. This is a regression
compared to the old fragment shader backend.
Found by inspection (comparing the old and new FS backend code).
References: https://bugs.freedesktop.org/show_bug.cgi?id=32949
(cherry-picked from commit 0c8beb0ab5e72a9d2ecaad51db16a7d5291e120b)
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index 12ac7a4..524dfaa 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -532,8 +532,10 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
continue;
}
- if (c->key.flat_shade && (location == FRAG_ATTRIB_COL0 ||
- location == FRAG_ATTRIB_COL1)) {
+ bool is_gl_Color =
+ location == FRAG_ATTRIB_COL0 || location == FRAG_ATTRIB_COL1;
+
+ if (c->key.flat_shade && is_gl_Color) {
/* Constant interpolation (flat shading) case. The SF has
* handed us defined values in only the constant offset
* field of the setup reg.
@@ -556,7 +558,7 @@ fs_visitor::emit_general_interpolation(ir_variable *ir)
attr.reg_offset++;
}
- if (intel->gen < 6) {
+ if (intel->gen < 6 && !(is_gl_Color && c->key.linear_color)) {
attr.reg_offset -= type->vector_elements;
for (unsigned int c = 0; c < type->vector_elements; c++) {
emit(fs_inst(BRW_OPCODE_MUL,
More information about the mesa-commit
mailing list