Mesa (glsl2): glsl2: Put side effects of the RHS of logic_or in the right branch.
Eric Anholt
anholt at kemper.freedesktop.org
Thu Jul 22 23:35:04 UTC 2010
Module: Mesa
Branch: glsl2
Commit: a0879b9dd438d78635f047cdd5ed4c72bc831b60
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a0879b9dd438d78635f047cdd5ed4c72bc831b60
Author: Eric Anholt <eric at anholt.net>
Date: Thu Jul 22 16:30:41 2010 -0700
glsl2: Put side effects of the RHS of logic_or in the right branch.
Kind of missing the point to only do the side effects if the LHS
evaluates as true.
Fixes:
glsl1-|| operator, short-circuit
---
src/glsl/ast_to_hir.cpp | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
index c03206f..98ea789 100644
--- a/src/glsl/ast_to_hir.cpp
+++ b/src/glsl/ast_to_hir.cpp
@@ -898,7 +898,7 @@ ast_expression::hir(exec_list *instructions,
ir_if *const stmt = new(ctx) ir_if(op[0]);
instructions->push_tail(stmt);
- op[1] = this->subexpressions[1]->hir(&stmt->then_instructions, state);
+ op[1] = this->subexpressions[1]->hir(&stmt->else_instructions, state);
if (!op[1]->type->is_boolean() || !op[1]->type->is_scalar()) {
YYLTYPE loc = this->subexpressions[1]->get_location();
More information about the mesa-commit
mailing list