i965/fs: Migrate translation of NIR texturing instructions to the IR builder.
authorFrancisco Jerez <currojerez@riseup.net>
Wed, 3 Jun 2015 18:02:57 +0000 (21:02 +0300)
committerFrancisco Jerez <currojerez@riseup.net>
Tue, 9 Jun 2015 12:18:34 +0000 (15:18 +0300)
v2: Don't remove assignments of base_ir just yet.

Reviewed-by: Matt Turner <mattst88@gmail.com>
src/mesa/drivers/dri/i965/brw_fs.h
src/mesa/drivers/dri/i965/brw_fs_nir.cpp

index 338c8168778384b036d1d9942c60d2bbd00aeb2e..ef0256dce64cb1c29c33577d34a461b5aaf8d076 100644 (file)
@@ -319,7 +319,8 @@ public:
    void nir_emit_alu(const brw::fs_builder &bld, nir_alu_instr *instr);
    void nir_emit_intrinsic(const brw::fs_builder &bld,
                            nir_intrinsic_instr *instr);
-   void nir_emit_texture(nir_tex_instr *instr);
+   void nir_emit_texture(const brw::fs_builder &bld,
+                         nir_tex_instr *instr);
    void nir_emit_jump(const brw::fs_builder &bld,
                       nir_jump_instr *instr);
    fs_reg get_nir_src(nir_src src);
index 46448fc4aa0335d697800e264dfee3f11ceea593..372e606a1a16a9ff855b8f025a1f109706d02aa4 100644 (file)
@@ -456,7 +456,7 @@ fs_visitor::nir_emit_instr(nir_instr *instr)
       break;
 
    case nir_instr_type_tex:
-      nir_emit_texture(nir_instr_as_tex(instr));
+      nir_emit_texture(abld, nir_instr_as_tex(instr));
       break;
 
    case nir_instr_type_load_const:
@@ -1584,7 +1584,7 @@ fs_visitor::nir_emit_intrinsic(const fs_builder &bld, nir_intrinsic_instr *instr
 }
 
 void
-fs_visitor::nir_emit_texture(nir_tex_instr *instr)
+fs_visitor::nir_emit_texture(const fs_builder &bld, nir_tex_instr *instr)
 {
    unsigned sampler = instr->sampler_index;
    fs_reg sampler_reg(sampler);
@@ -1671,8 +1671,8 @@ fs_visitor::nir_emit_texture(nir_tex_instr *instr)
 
          /* Emit code to evaluate the actual indexing expression */
          sampler_reg = vgrf(glsl_type::uint_type);
-         emit(ADD(sampler_reg, src, fs_reg(sampler)));
-         emit_uniformize(sampler_reg, sampler_reg);
+         bld.ADD(sampler_reg, src, fs_reg(sampler));
+         bld.emit_uniformize(sampler_reg, sampler_reg);
          break;
       }