From 4d5f0eb0487ad13e90f7248c95c023c35457eaf9 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Sat, 13 Sep 2014 11:49:55 -0700 Subject: [PATCH] i965/fs: Refactor fs_inst::is_send_from_grf() A switch statement is much easier to read/edit than a big giant or statement. Signed-off-by: Jason Ekstrand Reviewed-by: Matt Turner --- src/mesa/drivers/dri/i965/brw_fs.cpp | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index e93010b59f5..99a33bd0647 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -368,15 +368,22 @@ fs_inst::overwrites_reg(const fs_reg ®) const bool fs_inst::is_send_from_grf() const { - return (opcode == FS_OPCODE_VARYING_PULL_CONSTANT_LOAD_GEN7 || - opcode == SHADER_OPCODE_SHADER_TIME_ADD || - opcode == FS_OPCODE_INTERPOLATE_AT_CENTROID || - opcode == FS_OPCODE_INTERPOLATE_AT_SAMPLE || - opcode == FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET || - opcode == FS_OPCODE_INTERPOLATE_AT_PER_SLOT_OFFSET || - (opcode == FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD && - src[1].file == GRF) || - (is_tex() && src[0].file == GRF)); + switch (opcode) { + case FS_OPCODE_VARYING_PULL_CONSTANT_LOAD_GEN7: + case SHADER_OPCODE_SHADER_TIME_ADD: + case FS_OPCODE_INTERPOLATE_AT_CENTROID: + case FS_OPCODE_INTERPOLATE_AT_SAMPLE: + case FS_OPCODE_INTERPOLATE_AT_SHARED_OFFSET: + case FS_OPCODE_INTERPOLATE_AT_PER_SLOT_OFFSET: + return true; + case FS_OPCODE_UNIFORM_PULL_CONSTANT_LOAD: + return src[1].file == GRF; + default: + if (is_tex()) + return src[0].file == GRF; + + return false; + } } bool -- 2.30.2