i965/fs: use SSA values directly
[mesa.git] / src / mesa / drivers / dri / i965 / brw_sf_emit.c
index 04d21a8f4e9e680ed9dfdf24eea642644c9eb415..b3ee5c116275b9edc24630189569c51c0d852add 100644 (file)
@@ -101,7 +101,7 @@ have_attr(struct brw_sf_compile *c, GLuint attr)
 static void copy_bfc( struct brw_sf_compile *c,
                      struct brw_reg vert )
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    GLuint i;
 
    for (i = 0; i < 2; i++) {
@@ -116,7 +116,7 @@ static void copy_bfc( struct brw_sf_compile *c,
 
 static void do_twoside_color( struct brw_sf_compile *c )
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    GLuint backface_conditional = c->key.frontface_ccw ? BRW_CONDITIONAL_G : BRW_CONDITIONAL_L;
 
    /* Already done in clip program:
@@ -159,7 +159,7 @@ static void copy_flatshaded_attributes(struct brw_sf_compile *c,
                                        struct brw_reg dst,
                                        struct brw_reg src)
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    int i;
 
    for (i = 0; i < c->vue_map.num_slots; i++) {
@@ -191,8 +191,7 @@ static int count_flatshaded_attributes(struct brw_sf_compile *c)
  */
 static void do_flatshade_triangle( struct brw_sf_compile *c )
 {
-   struct brw_compile *p = &c->func;
-   struct brw_context *brw = p->brw;
+   struct brw_codegen *p = &c->func;
    GLuint nr;
    GLuint jmpi = 1;
 
@@ -201,7 +200,7 @@ static void do_flatshade_triangle( struct brw_sf_compile *c )
    if (c->key.primitive == SF_UNFILLED_TRIS)
       return;
 
-   if (brw->gen == 5)
+   if (p->devinfo->gen == 5)
        jmpi = 2;
 
    nr = count_flatshaded_attributes(c);
@@ -224,8 +223,7 @@ static void do_flatshade_triangle( struct brw_sf_compile *c )
 
 static void do_flatshade_line( struct brw_sf_compile *c )
 {
-   struct brw_compile *p = &c->func;
-   struct brw_context *brw = p->brw;
+   struct brw_codegen *p = &c->func;
    GLuint nr;
    GLuint jmpi = 1;
 
@@ -234,7 +232,7 @@ static void do_flatshade_line( struct brw_sf_compile *c )
    if (c->key.primitive == SF_UNFILLED_TRIS)
       return;
 
-   if (brw->gen == 5)
+   if (p->devinfo->gen == 5)
        jmpi = 2;
 
    nr = count_flatshaded_attributes(c);
@@ -307,7 +305,7 @@ static void alloc_regs( struct brw_sf_compile *c )
 
 static void copy_z_inv_w( struct brw_sf_compile *c )
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    GLuint i;
 
    /* Copy both scalars with a single MOV:
@@ -327,7 +325,6 @@ static void invert_det( struct brw_sf_compile *c)
             BRW_MATH_FUNCTION_INV,
             0,
             c->det,
-            BRW_MATH_DATA_SCALAR,
             BRW_MATH_PRECISION_FULL);
 
 }
@@ -400,7 +397,7 @@ calculate_point_sprite_mask(struct brw_sf_compile *c, GLuint reg)
 }
 
 static void
-set_predicate_control_flag_value(struct brw_compile *p,
+set_predicate_control_flag_value(struct brw_codegen *p,
                                  struct brw_sf_compile *c,
                                  unsigned value)
 {
@@ -418,7 +415,7 @@ set_predicate_control_flag_value(struct brw_compile *p,
 
 void brw_emit_tri_setup(struct brw_sf_compile *c, bool allocate)
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    GLuint i;
 
    c->flag_value = 0xff;
@@ -507,7 +504,7 @@ void brw_emit_tri_setup(struct brw_sf_compile *c, bool allocate)
 
 void brw_emit_line_setup(struct brw_sf_compile *c, bool allocate)
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    GLuint i;
 
    c->flag_value = 0xff;
@@ -579,7 +576,7 @@ void brw_emit_line_setup(struct brw_sf_compile *c, bool allocate)
 
 void brw_emit_point_sprite_setup(struct brw_sf_compile *c, bool allocate)
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    GLuint i;
 
    c->flag_value = 0xff;
@@ -616,7 +613,6 @@ void brw_emit_point_sprite_setup(struct brw_sf_compile *c, bool allocate)
                   BRW_MATH_FUNCTION_INV,
                   0,
                   c->dx0,
-                  BRW_MATH_DATA_SCALAR,
                   BRW_MATH_PRECISION_FULL);
 
         brw_set_default_access_mode(p, BRW_ALIGN_16);
@@ -672,7 +668,7 @@ void brw_emit_point_sprite_setup(struct brw_sf_compile *c, bool allocate)
  */
 void brw_emit_point_setup(struct brw_sf_compile *c, bool allocate)
 {
-   struct brw_compile *p = &c->func;
+   struct brw_codegen *p = &c->func;
    GLuint i;
 
    c->flag_value = 0xff;
@@ -731,8 +727,7 @@ void brw_emit_point_setup(struct brw_sf_compile *c, bool allocate)
 
 void brw_emit_anyprim_setup( struct brw_sf_compile *c )
 {
-   struct brw_compile *p = &c->func;
-   struct brw_context *brw = p->brw;
+   struct brw_codegen *p = &c->func;
    struct brw_reg payload_prim = brw_uw1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0);
    struct brw_reg payload_attr = get_element_ud(brw_vec1_reg(BRW_GENERAL_REGISTER_FILE, 1, 0), 0);
    struct brw_reg primmask;
@@ -754,7 +749,7 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
                                               (1<<_3DPRIM_POLYGON) |
                                               (1<<_3DPRIM_RECTLIST) |
                                               (1<<_3DPRIM_TRIFAN_NOSTIPPLE)));
-   brw_inst_set_cond_modifier(brw, brw_last_inst, BRW_CONDITIONAL_Z);
+   brw_inst_set_cond_modifier(p->devinfo, brw_last_inst, BRW_CONDITIONAL_Z);
    jmp = brw_JMPI(p, brw_imm_d(0), BRW_PREDICATE_NORMAL) - p->store;
    brw_emit_tri_setup(c, false);
    brw_land_fwd_jump(p, jmp);
@@ -765,13 +760,13 @@ void brw_emit_anyprim_setup( struct brw_sf_compile *c )
                                               (1<<_3DPRIM_LINESTRIP_CONT) |
                                               (1<<_3DPRIM_LINESTRIP_BF) |
                                               (1<<_3DPRIM_LINESTRIP_CONT_BF)));
-   brw_inst_set_cond_modifier(brw, brw_last_inst, BRW_CONDITIONAL_Z);
+   brw_inst_set_cond_modifier(p->devinfo, brw_last_inst, BRW_CONDITIONAL_Z);
    jmp = brw_JMPI(p, brw_imm_d(0), BRW_PREDICATE_NORMAL) - p->store;
    brw_emit_line_setup(c, false);
    brw_land_fwd_jump(p, jmp);
 
    brw_AND(p, v1_null_ud, payload_attr, brw_imm_ud(1<<BRW_SPRITE_POINT_ENABLE));
-   brw_inst_set_cond_modifier(brw, brw_last_inst, BRW_CONDITIONAL_Z);
+   brw_inst_set_cond_modifier(p->devinfo, brw_last_inst, BRW_CONDITIONAL_Z);
    jmp = brw_JMPI(p, brw_imm_d(0), BRW_PREDICATE_NORMAL) - p->store;
    brw_emit_point_sprite_setup(c, false);
    brw_land_fwd_jump(p, jmp);