Created attachment 105711 [details]
Use bool from UBO as if-statement condition
The attached shader causes the following assertion failure:
shader_runner: brw_vec4_visitor.cpp:856: void brw::vec4_visitor::emit_bool_to_cond_code(ir_rvalue*, brw_predicate*): Assertion `!"not reached"' failed.
I have only tested on a fairly stale version of my gles3conform-v5 branch, so this issue may not exist in 10.3 or master branches. If I don't submit a bug, I'll forget about it...
Changing the line
if (b1 == true)
causes it to not assert.
Created attachment 105714 [details]
Use bool from UBO as if-statement condition (in FS)
Yeah, we need to handle ir_unop_ubo_load in that switch statement. In both backends.
Created attachment 105715 [details]
Use bool for UBO as if-statement condition (in FS, v2)
Whoops, that FS test had the wrong result. Here's a better one.
Patches on the mailing list:
The last one should fix it. It may or may not depend on the second. The first is just a bug fix while I was in the area :)
Author: Kenneth Graunke <email@example.com>
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.
Signed-off-by: Kenneth Graunke <firstname.lastname@example.org>
Reviewed-by: Matt Turner <email@example.com>
Commit a318e2f3 on 10.3 branch.