i965: new VS: move NDC computation (GEN4-5) to a separate function.
authorPaul Berry <stereotype441@gmail.com>
Tue, 23 Aug 2011 17:26:15 +0000 (10:26 -0700)
committerPaul Berry <stereotype441@gmail.com>
Tue, 6 Sep 2011 18:04:09 +0000 (11:04 -0700)
Reviewed-by: Eric Anholt <eric@anholt.net>
src/mesa/drivers/dri/i965/brw_vec4.h
src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp

index dfe9c025e823ebd353a571fedc507a11b6c0c75f..9b93296058953cd841254af7c21136a099a71a54 100644 (file)
@@ -463,6 +463,7 @@ public:
    void emit_math2_gen4(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1);
    void emit_math(enum opcode opcode, dst_reg dst, src_reg src0, src_reg src1);
 
+   void emit_ndc_computation();
    int emit_vue_header_gen6(int header_mrf);
    int emit_vue_header_gen4(int header_mrf);
    void emit_urb_writes(void);
index 71d8b395d556ed804913bc6713a1837f202bf821..3335ea246fb092765687dec2f10bba51c8504c9c 100644 (file)
@@ -1698,8 +1698,8 @@ vec4_visitor::visit(ir_if *ir)
    emit(BRW_OPCODE_ENDIF);
 }
 
-int
-vec4_visitor::emit_vue_header_gen4(int header_mrf)
+void
+vec4_visitor::emit_ndc_computation()
 {
    /* Get the position */
    src_reg pos = src_reg(output_reg[VERT_RESULT_HPOS]);
@@ -1719,6 +1719,12 @@ vec4_visitor::emit_vue_header_gen4(int header_mrf)
    ndc_xyz.writemask = WRITEMASK_XYZ;
 
    emit(MUL(ndc_xyz, pos, src_reg(ndc_w)));
+}
+
+int
+vec4_visitor::emit_vue_header_gen4(int header_mrf)
+{
+   emit_ndc_computation();
 
    if ((c->prog_data.outputs_written & BITFIELD64_BIT(VERT_RESULT_PSIZ)) ||
        c->key.nr_userclip || brw->has_negative_rhw_bug) {