Mesa (master): i965/fs: Collect all emits of texture ops for Gen4 into one place

Chris Forbes chrisf at kemper.freedesktop.org
Sat Aug 9 01:21:58 UTC 2014


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

Author: Chris Forbes <chrisf at ijw.co.nz>
Date:   Sun Aug  3 20:48:20 2014 +1200

i965/fs: Collect all emits of texture ops for Gen4 into one place

Reduces duplication, and will do so even more when we change the sampler
plumbing.

Signed-off-by: Chris Forbes <chrisf at ijw.co.nz>
Reviewed-by: Matt Turner <mattst88 at gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

---

 src/mesa/drivers/dri/i965/brw_fs_visitor.cpp |   31 +++++++++-----------------
 1 file changed, 11 insertions(+), 20 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
index 752e5a4..0e09087 100644
--- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
+++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp
@@ -1227,29 +1227,20 @@ fs_visitor::emit_texture_gen4(ir_texture *ir, fs_reg dst, fs_reg coordinate,
                     BRW_REGISTER_TYPE_F));
    }
 
-   fs_inst *inst = NULL;
+   enum opcode opcode;
+
    switch (ir->op) {
-   case ir_tex:
-      inst = emit(SHADER_OPCODE_TEX, dst, reg_undef);
-      break;
-   case ir_txb:
-      inst = emit(FS_OPCODE_TXB, dst, reg_undef);
-      break;
-   case ir_txl:
-      inst = emit(SHADER_OPCODE_TXL, dst, reg_undef);
-      break;
-   case ir_txd:
-      inst = emit(SHADER_OPCODE_TXD, dst, reg_undef);
-      break;
-   case ir_txs:
-      inst = emit(SHADER_OPCODE_TXS, dst, reg_undef);
-      break;
-   case ir_txf:
-      inst = emit(SHADER_OPCODE_TXF, dst, reg_undef);
-      break;
+   case ir_tex: opcode = SHADER_OPCODE_TEX; break;
+   case ir_txb: opcode = FS_OPCODE_TXB; break;
+   case ir_txl: opcode = SHADER_OPCODE_TXL; break;
+   case ir_txd: opcode = SHADER_OPCODE_TXD; break;
+   case ir_txs: opcode = SHADER_OPCODE_TXS; break;
+   case ir_txf: opcode = SHADER_OPCODE_TXF; break;
    default:
-      fail("unrecognized texture opcode");
+      unreachable("not reached");
    }
+
+   fs_inst *inst = emit(opcode, dst, reg_undef);
    inst->base_mrf = base_mrf;
    inst->mlen = mlen;
    inst->header_present = true;




More information about the mesa-commit mailing list