Mesa (10.3): i965: Handle ir_binop_ubo_load in boolean expression code.

Emil Velikov evelikov at kemper.freedesktop.org
Tue Sep 9 21:05:33 UTC 2014


Module: Mesa
Branch: 10.3
Commit: a318e2f383b3c02448cb4e0a7493343bcc47e793
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=a318e2f383b3c02448cb4e0a7493343bcc47e793

Author: Kenneth Graunke <kenneth at whitecape.org>
Date:   Thu Sep  4 00:18:45 2014 -0700

i965: Handle ir_binop_ubo_load in boolean expression code.

UBO loads can be boolean-valued expressions, too, so we need to handle
them in emit_bool_to_cond_code() and emit_if_gen6().

However, unlike most expressions, it doesn't make sense to evaluate
their operands, then do something with the results.  We just want to
evaluate the UBO load as a whole---which performs the read from
memory---then load the boolean result into the flag register.

Instead of adding code to handle it, we can simply bypass the
ir_expression handling, and fall through to the default code, which will
do exactly that.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=83468
Signed-off-by: Kenneth Graunke <kenneth at whitecape.org>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Cc: mesa-stable at lists.freedesktop.org
(cherry picked from commit a20cc2796f5d55e49956ac0bc5d61ca027eec7f9)

---

 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp   |    4 ++--
 src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 4ce72e0..602ec1c 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -2238,7 +2238,7 @@ fs_visitor::emit_bool_to_cond_code(ir_rvalue *ir)
 {
    ir_expression *expr = ir->as_expression();
 
-   if (!expr) {
+   if (!expr || expr->operation == ir_binop_ubo_load) {
       ir->accept(this);
 
       fs_inst *inst = emit(AND(reg_null_d, this->result, fs_reg(1)));
@@ -2366,7 +2366,7 @@ fs_visitor::emit_if_gen6(ir_if *ir)
 {
    ir_expression *expr = ir->condition->as_expression();
 
-   if (expr) {
+   if (expr && expr->operation != ir_binop_ubo_load) {
       fs_reg op[3];
       fs_inst *inst;
       fs_reg temp;
diff --git a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
index 9bd32a3..bb00050 100644
--- a/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp
@@ -776,7 +776,7 @@ vec4_visitor::emit_bool_to_cond_code(ir_rvalue *ir,
 
    *predicate = BRW_PREDICATE_NORMAL;
 
-   if (expr) {
+   if (expr && expr->operation != ir_binop_ubo_load) {
       src_reg op[3];
       vec4_instruction *inst;
 
@@ -897,7 +897,7 @@ vec4_visitor::emit_if_gen6(ir_if *ir)
 {
    ir_expression *expr = ir->condition->as_expression();
 
-   if (expr) {
+   if (expr && expr->operation != ir_binop_ubo_load) {
       src_reg op[3];
       dst_reg temp;
 




More information about the mesa-commit mailing list