i965/vs: Use a send from a 2-register VGRF for shader time writes.
authorEric Anholt <eric@anholt.net>
Tue, 18 Dec 2012 01:11:21 +0000 (17:11 -0800)
committerEric Anholt <eric@anholt.net>
Thu, 28 Mar 2013 18:46:37 +0000 (11:46 -0700)
This will let us emit it later, after we're setting up MRFs for the
URB write.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
src/mesa/drivers/dri/i965/brw_vec4.cpp
src/mesa/drivers/dri/i965/brw_vec4_emit.cpp

index 35dd9aed43c3d9ddfbfd8102dca347777079269e..a40a0b475700fe279220c69bbd85fb80ae84f09a 100644 (file)
@@ -222,7 +222,7 @@ vec4_instruction::is_math()
 bool
 vec4_instruction::is_send_from_grf()
 {
-   return false;
+   return opcode == SHADER_OPCODE_SHADER_TIME_ADD;
 }
 
 bool
@@ -1264,20 +1264,20 @@ vec4_visitor::emit_shader_time_write(enum shader_time_shader_type type,
    int shader_time_index = brw_get_shader_time_index(brw, prog, &vp->Base,
                                                      type);
 
-   int base_mrf = 6;
+   dst_reg dst =
+      dst_reg(this, glsl_type::get_array_instance(glsl_type::vec4_type, 2));
 
-   dst_reg offset_mrf = dst_reg(MRF, base_mrf);
-   offset_mrf.type = BRW_REGISTER_TYPE_UD;
-   emit(MOV(offset_mrf, src_reg(shader_time_index * SHADER_TIME_STRIDE)));
+   dst_reg offset = dst;
+   dst_reg time = dst;
+   time.reg_offset++;
 
-   dst_reg time_mrf = dst_reg(MRF, base_mrf + 1);
-   time_mrf.type = BRW_REGISTER_TYPE_UD;
-   emit(MOV(time_mrf, src_reg(value)));
+   offset.type = BRW_REGISTER_TYPE_UD;
+   emit(MOV(offset, src_reg(shader_time_index * SHADER_TIME_STRIDE)));
 
-   vec4_instruction *inst;
-   inst = emit(SHADER_OPCODE_SHADER_TIME_ADD);
-   inst->base_mrf = base_mrf;
-   inst->mlen = 2;
+   time.type = BRW_REGISTER_TYPE_UD;
+   emit(MOV(time, src_reg(value)));
+
+   emit(SHADER_OPCODE_SHADER_TIME_ADD, dst_reg(), src_reg(dst));
 }
 
 bool
index 54f3efd08ecad50c74a2fa1e4241106125bcb33e..cb49a042390250c168993eb394071918727bd8d2 100644 (file)
@@ -674,8 +674,7 @@ vec4_generator::generate_vs_instruction(vec4_instruction *instruction,
       break;
 
    case SHADER_OPCODE_SHADER_TIME_ADD:
-      brw_shader_time_add(p, brw_message_reg(inst->base_mrf),
-                          SURF_INDEX_VS_SHADER_TIME);
+      brw_shader_time_add(p, src[0], SURF_INDEX_VS_SHADER_TIME);
       break;
 
    default: