i965/fs: Fix fs_inst::regs_written calculation for instructions with scalar dst.
authorFrancisco Jerez <currojerez@riseup.net>
Tue, 3 Feb 2015 19:57:38 +0000 (21:57 +0200)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 10 Feb 2015 14:05:51 +0000 (16:05 +0200)
Scalar registers are required to have zero stride, fix the
regs_written calculation not to assume that the instruction writes
zero registers in that case.

v2: Rename CEILING() to DIV_ROUND_UP(). (Matt, Ken)

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.cpp

index 2f264255c0799844332b60c8fd7bb8c90849c5d0..f149ab5e6c1c0cbefd84539efb99c9ce5c4bc507 100644 (file)
@@ -126,7 +126,8 @@ fs_inst::init(enum opcode opcode, uint8_t exec_size, const fs_reg &dst,
    case HW_REG:
    case MRF:
    case ATTR:
-      this->regs_written = (dst.width * dst.stride * type_sz(dst.type) + 31) / 32;
+      this->regs_written =
+         DIV_ROUND_UP(MAX2(dst.width * dst.stride, 1) * type_sz(dst.type), 32);
       break;
    case BAD_FILE:
       this->regs_written = 0;