Mesa (master): i965/fs: Report the right value in fs_inst::regs_read() for PIXEL_X/Y

Jason Ekstrand jekstrand at kemper.freedesktop.org
Tue Jun 30 23:48:22 UTC 2015


Module: Mesa
Branch: master
Commit: 12bc22ef58377191508af91a918efd18e2da7500
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=12bc22ef58377191508af91a918efd18e2da7500

Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date:   Thu Jun 18 17:48:27 2015 -0700

i965/fs: Report the right value in fs_inst::regs_read() for PIXEL_X/Y

Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
Acked-by: Francisco Jerez <currojerez at riseup.net>

---

 src/mesa/drivers/dri/i965/brw_fs.cpp |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index e83a092..d91ad0a 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -701,6 +701,7 @@ fs_inst::is_partial_write() const
 int
 fs_inst::regs_read(int arg) const
 {
+   unsigned components = 1;
    switch (opcode) {
    case FS_OPCODE_FB_WRITE:
    case SHADER_OPCODE_URB_WRITE_SIMD8:
@@ -726,6 +727,12 @@ fs_inst::regs_read(int arg) const
          return exec_size / 4;
       break;
 
+   case FS_OPCODE_PIXEL_X:
+   case FS_OPCODE_PIXEL_Y:
+      if (arg == 0)
+         components = 1;
+      break;
+
    default:
       if (is_tex() && arg == 0 && src[0].file == GRF)
          return mlen;
@@ -742,8 +749,8 @@ fs_inst::regs_read(int arg) const
       if (src[arg].stride == 0) {
          return 1;
       } else {
-         int size = src[arg].width * src[arg].stride * type_sz(src[arg].type);
-         return (size + 31) / 32;
+         int size = components * src[arg].width * type_sz(src[arg].type);
+         return DIV_ROUND_UP(size * src[arg].stride, 32);
       }
    case MRF:
       unreachable("MRF registers are not allowed as sources");




More information about the mesa-commit mailing list