OSDN Git Service

intel/fs: Fix extract_u8 of an odd byte from a 64-bit integer
[android-x86/external-mesa.git] / src / intel / compiler / brw_fs_nir.cpp
index eb7ea7e..747529e 100644 (file)
@@ -1639,6 +1639,13 @@ fs_visitor::nir_emit_alu(const fs_builder &bld, nir_alu_instr *instr)
             fs_reg w_temp = bld.vgrf(BRW_REGISTER_TYPE_W);
             bld.MOV(w_temp, subscript(op[0], type, byte));
             bld.MOV(result, w_temp);
+         } else if (byte & 1) {
+            /* Extract the high byte from the word containing the desired byte
+             * offset.
+             */
+            bld.SHR(result,
+                    subscript(op[0], BRW_REGISTER_TYPE_UW, byte / 2),
+                    brw_imm_uw(8));
          } else {
             /* Otherwise use an AND with 0xff and a word type */
             bld.AND(result,