Mesa (glsl-to-tgsi): glsl_to_tgsi: use a more specific condition for gl_FragDepth hack in generating assignments
Bryan Cain
bryanc at kemper.freedesktop.org
Sat Jun 25 01:48:21 UTC 2011
Module: Mesa
Branch: glsl-to-tgsi
Commit: be2232be4c0f80421f577afe3a24eb7f44215c0a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=be2232be4c0f80421f577afe3a24eb7f44215c0a
Author: Bryan Cain <bryancain3 at gmail.com>
Date: Fri Jun 24 20:37:53 2011 -0500
glsl_to_tgsi: use a more specific condition for gl_FragDepth hack in generating assignments
This reduces the number of instructions in the fragment shader of
glsl-fs-atan-2 from 174 to 146 with EmitNoIfs enabled.
---
src/mesa/state_tracker/st_glsl_to_tgsi.cpp | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
index d47364f..5f22f70 100644
--- a/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
+++ b/src/mesa/state_tracker/st_glsl_to_tgsi.cpp
@@ -1841,7 +1841,8 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
if (ir->write_mask == 0) {
assert(!ir->lhs->type->is_scalar() && !ir->lhs->type->is_vector());
l.writemask = WRITEMASK_XYZW;
- } else if (ir->lhs->type->is_scalar()) {
+ } else if (ir->lhs->type->is_scalar() &&
+ ir->lhs->variable_referenced()->mode == ir_var_out) {
/* FINISHME: This hack makes writing to gl_FragDepth, which lives in the
* FINISHME: W component of fragment shader output zero, work correctly.
*/
@@ -1851,7 +1852,6 @@ glsl_to_tgsi_visitor::visit(ir_assignment *ir)
int first_enabled_chan = 0;
int rhs_chan = 0;
- assert(ir->lhs->type->is_vector());
l.writemask = ir->write_mask;
for (int i = 0; i < 4; i++) {
More information about the mesa-commit
mailing list