Comparison operations using 16-bit sources produce 16-bit results
(0xFFFF/0x0000) instead of (0xFFFFFFF/0x00000000).

Signed-off-by: Topi Pohjolainen <topi.pohjolai...@intel.com>
---
 src/intel/compiler/brw_fs_nir.cpp | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/intel/compiler/brw_fs_nir.cpp 
b/src/intel/compiler/brw_fs_nir.cpp
index c455fa4e27..baa84b0f3c 100644
--- a/src/intel/compiler/brw_fs_nir.cpp
+++ b/src/intel/compiler/brw_fs_nir.cpp
@@ -396,10 +396,15 @@ fs_visitor::nir_emit_cf_list(exec_list *list)
 void
 fs_visitor::nir_emit_if(nir_if *if_stmt)
 {
+   const fs_reg src = get_nir_src(if_stmt->condition);
+   fs_inst *inst;
+
    /* first, put the condition into f0 */
-   fs_inst *inst = bld.MOV(bld.null_reg_d(),
-                            retype(get_nir_src(if_stmt->condition),
-                                   BRW_REGISTER_TYPE_D));
+   if (brw_reg_type_to_size(src.type) == 2)
+      inst = bld.MOV(bld.null_reg_w(), retype(src, BRW_REGISTER_TYPE_W));
+   else
+      inst = bld.MOV(bld.null_reg_d(), retype(src, BRW_REGISTER_TYPE_D));
+
    inst->conditional_mod = BRW_CONDITIONAL_NZ;
 
    bld.IF(BRW_PREDICATE_NORMAL);
-- 
2.11.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to