<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Tue, Dec 4, 2018 at 1:18 AM Iago Toral Quiroga <<a href="mailto:itoral@igalia.com">itoral@igalia.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">We were assuming 32-bit elements.<br>
---<br>
 src/intel/compiler/brw_fs_generator.cpp | 34 +++++++++++++------------<br>
 1 file changed, 18 insertions(+), 16 deletions(-)<br>
<br>
diff --git a/src/intel/compiler/brw_fs_generator.cpp b/src/intel/compiler/brw_fs_generator.cpp<br>
index 08dd83dded7..bffd9bc4787 100644<br>
--- a/src/intel/compiler/brw_fs_generator.cpp<br>
+++ b/src/intel/compiler/brw_fs_generator.cpp<br>
@@ -1259,7 +1259,7 @@ fs_generator::generate_ddx(const fs_inst *inst,<br>
    struct brw_reg src0 = src;<br>
    struct brw_reg src1 = src;<br>
<br>
-   src0.subnr   = sizeof(float);<br>
+   src0.subnr   = type_sz(src.type);<br></blockquote><div><br></div><div>Should this be "+="?  I think this is broken if we're SIMD8 and in the second half of a register.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
    src0.vstride = vstride;<br>
    src0.width   = width;<br>
    src0.hstride = BRW_HORIZONTAL_STRIDE_0;<br>
@@ -1278,23 +1278,25 @@ void<br>
 fs_generator::generate_ddy(const fs_inst *inst,<br>
                            struct brw_reg dst, struct brw_reg src)<br>
 {<br>
+   const uint32_t type_size = type_sz(src.type);<br>
+<br>
    if (inst->opcode == FS_OPCODE_DDY_FINE) {<br>
       /* produce accurate derivatives */<br>
       if (devinfo->gen >= 11) {<br>
          src = stride(src, 0, 2, 1);<br>
-         struct brw_reg src_0  = byte_offset(src,  0 * sizeof(float));<br>
-         struct brw_reg src_2  = byte_offset(src,  2 * sizeof(float));<br>
-         struct brw_reg src_4  = byte_offset(src,  4 * sizeof(float));<br>
-         struct brw_reg src_6  = byte_offset(src,  6 * sizeof(float));<br>
-         struct brw_reg src_8  = byte_offset(src,  8 * sizeof(float));<br>
-         struct brw_reg src_10 = byte_offset(src, 10 * sizeof(float));<br>
-         struct brw_reg src_12 = byte_offset(src, 12 * sizeof(float));<br>
-         struct brw_reg src_14 = byte_offset(src, 14 * sizeof(float));<br>
-<br>
-         struct brw_reg dst_0  = byte_offset(dst,  0 * sizeof(float));<br>
-         struct brw_reg dst_4  = byte_offset(dst,  4 * sizeof(float));<br>
-         struct brw_reg dst_8  = byte_offset(dst,  8 * sizeof(float));<br>
-         struct brw_reg dst_12 = byte_offset(dst, 12 * sizeof(float));<br>
+         struct brw_reg src_0  = byte_offset(src,  0 * type_size);<br>
+         struct brw_reg src_2  = byte_offset(src,  2 * type_size);<br>
+         struct brw_reg src_4  = byte_offset(src,  4 * type_size);<br>
+         struct brw_reg src_6  = byte_offset(src,  6 * type_size);<br>
+         struct brw_reg src_8  = byte_offset(src,  8 * type_size);<br>
+         struct brw_reg src_10 = byte_offset(src, 10 * type_size);<br>
+         struct brw_reg src_12 = byte_offset(src, 12 * type_size);<br>
+         struct brw_reg src_14 = byte_offset(src, 14 * type_size);<br>
+<br>
+         struct brw_reg dst_0  = byte_offset(dst,  0 * type_size);<br>
+         struct brw_reg dst_4  = byte_offset(dst,  4 * type_size);<br>
+         struct brw_reg dst_8  = byte_offset(dst,  8 * type_size);<br>
+         struct brw_reg dst_12 = byte_offset(dst, 12 * type_size);<br>
<br>
          brw_push_insn_state(p);<br>
          brw_set_default_exec_size(p, BRW_EXECUTE_4);<br>
@@ -1323,8 +1325,8 @@ fs_generator::generate_ddy(const fs_inst *inst,<br>
       /* replicate the derivative at the top-left pixel to other pixels */<br>
       struct brw_reg src0 = stride(src, 4, 4, 0);<br>
       struct brw_reg src1 = stride(src, 4, 4, 0);<br>
-      src0.subnr = 0 * sizeof(float);<br>
-      src1.subnr = 2 * sizeof(float);<br>
+      src0.subnr = 0 * type_size;<br>
+      src1.subnr = 2 * type_size;<br></blockquote><div><br></div><div>Again, +=?  Or, better yet, maybe byte_offset().<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<br>
       brw_ADD(p, dst, negate(src0), src1);<br>
    }<br>
-- <br>
2.17.1<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div></div>