Mesa (master): i965/fs: Return zero from fs_inst:: components_read for non-present sources.
Francisco Jerez
currojerez at kemper.freedesktop.org
Tue Aug 16 23:37:29 UTC 2016
Module: Mesa
Branch: master
Commit: 61a02fb74c07d574b726a8b27517a02251aa4be4
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=61a02fb74c07d574b726a8b27517a02251aa4be4
Author: Francisco Jerez <currojerez at riseup.net>
Date: Fri Aug 12 18:33:58 2016 -0700
i965/fs: Return zero from fs_inst::components_read for non-present sources.
This makes it easier for the caller to find out how many scalar
components are actually read by the instruction. As a bonus we no
longer need to special-case BAD_FILE in the implementation of
fs_inst::regs_read.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/mesa/drivers/dri/i965/brw_fs.cpp | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp
index f236089..1842d56 100644
--- a/src/mesa/drivers/dri/i965/brw_fs.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
@@ -715,6 +715,10 @@ fs_inst::is_partial_write() const
unsigned
fs_inst::components_read(unsigned i) const
{
+ /* Return zero if the source is not present. */
+ if (src[i].file == BAD_FILE)
+ return 0;
+
switch (opcode) {
case FS_OPCODE_LINTERP:
if (i == 0)
@@ -895,11 +899,10 @@ fs_inst::regs_read(int arg) const
}
switch (src[arg].file) {
- case BAD_FILE:
- return 0;
case UNIFORM:
case IMM:
return 1;
+ case BAD_FILE:
case ARF:
case FIXED_GRF:
case VGRF:
More information about the mesa-commit
mailing list