[Mesa-dev] [PATCH 09/22] glsl: Lower array indexing to conditional-select instead of conditional-assign

Ian Romanick idr at freedesktop.org
Thu Sep 21 14:34:22 UTC 2017


From: "\"Ian Romanick\"" <idr at freedesktop.org>

From: Ian Romanick <ian.d.romanick at intel.com>

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
 src/compiler/glsl/lower_variable_index_to_cond_assign.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
index 6fe4fe6..bfe6242 100644
--- a/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
+++ b/src/compiler/glsl/lower_variable_index_to_cond_assign.cpp
@@ -208,8 +208,8 @@ struct assignment_generator
        * array dereference.
        */
       ir_assignment *const assignment = (is_write)
-         ? assign(element, this->var, condition, write_mask)
-         : assign(this->var, element, condition);
+         ? assign(element, csel(condition, this->var, element), write_mask)
+         : assign(this->var, csel(condition, element, this->var));
 
       body.emit(assignment);
    }
-- 
2.9.5



More information about the mesa-dev mailing list