i965/vec4: support packing tcs inputs
authorTimothy Arceri <timothy.arceri@collabora.com>
Thu, 23 Jun 2016 04:26:16 +0000 (14:26 +1000)
committerTimothy Arceri <timothy.arceri@collabora.com>
Thu, 21 Jul 2016 02:06:11 +0000 (12:06 +1000)
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Reviewed-by: Edward O'Callaghan <funfunctor@folklore1984.net>
src/mesa/drivers/dri/i965/brw_vec4_tcs.cpp
src/mesa/drivers/dri/i965/brw_vec4_tcs.h

index f61c612b3a73b0b11b20850bab092d88bc2423b3..8bd150ad1b43fcd84383a20de175244a7a92fe35 100644 (file)
@@ -166,6 +166,7 @@ void
 vec4_tcs_visitor::emit_input_urb_read(const dst_reg &dst,
                                       const src_reg &vertex_index,
                                       unsigned base_offset,
+                                      unsigned first_component,
                                       const src_reg &indirect_offset)
 {
    vec4_instruction *inst;
@@ -191,7 +192,9 @@ vec4_tcs_visitor::emit_input_urb_read(const dst_reg &dst,
    if (inst->offset == 0 && indirect_offset.file == BAD_FILE) {
       emit(MOV(dst, swizzle(src_reg(temp), BRW_SWIZZLE_WWWW)));
    } else {
-      emit(MOV(dst, src_reg(temp)));
+      src_reg src = src_reg(temp);
+      src.swizzle = BRW_SWZ_COMP_INPUT(first_component);
+      emit(MOV(dst, src));
    }
 }
 
@@ -267,7 +270,8 @@ vec4_tcs_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
       dst_reg dst = get_nir_dest(instr->dest, BRW_REGISTER_TYPE_D);
       dst.writemask = brw_writemask_for_size(instr->num_components);
 
-      emit_input_urb_read(dst, vertex_index, imm_offset, indirect_offset);
+      emit_input_urb_read(dst, vertex_index, imm_offset,
+                          nir_intrinsic_component(instr), indirect_offset);
       break;
    }
    case nir_intrinsic_load_input:
index 329cd7dfc2527a136b91ffbec0bf37cadde323fe..d408e56554e8bc4966b1a2f9ee641a83bbc364c0 100644 (file)
@@ -60,6 +60,7 @@ protected:
    void emit_input_urb_read(const dst_reg &dst,
                             const src_reg &vertex_index,
                             unsigned base_offset,
+                            unsigned first_component,
                             const src_reg &indirect_offset);
    void emit_output_urb_read(const dst_reg &dst,
                              unsigned base_offset,