brw_sf.h File Reference

Include dependency graph for brw_sf.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  brw_sf_prog_key
struct  brw_sf_point_tex
struct  brw_sf_compile

Defines

#define SF_POINTS   0
#define SF_LINES   1
#define SF_TRIANGLES   2
#define SF_UNFILLED_TRIS   3

Functions

void brw_emit_tri_setup (struct brw_sf_compile *c)
void brw_emit_line_setup (struct brw_sf_compile *c)
void brw_emit_point_setup (struct brw_sf_compile *c)
void brw_emit_point_sprite_setup (struct brw_sf_compile *c)
void brw_emit_anyprim_setup (struct brw_sf_compile *c)


Define Documentation

#define SF_LINES   1

Definition at line 41 of file brw_sf.h.

#define SF_POINTS   0

Definition at line 40 of file brw_sf.h.

#define SF_TRIANGLES   2

Definition at line 42 of file brw_sf.h.

#define SF_UNFILLED_TRIS   3

Definition at line 43 of file brw_sf.h.


Function Documentation

void brw_emit_anyprim_setup ( struct brw_sf_compile c  ) 

void brw_emit_line_setup ( struct brw_sf_compile c  ) 

Definition at line 259 of file brw_sf_emit.c.

References brw_sf_compile::a1_sub_a0, alloc_regs(), brw_ADD(), brw_MOV(), brw_MUL(), brw_null_reg(), brw_set_predicate_control_flag_value(), BRW_URB_SWIZZLE_TRANSPOSE, brw_urb_WRITE(), brw_vec8_grf(), calculate_masks(), copy_z_inv_w(), brw_sf_compile::dx0, brw_sf_compile::dy0, brw_sf_compile::func, brw_sf_compile::inv_det, brw_sf_compile::inv_w, invert_det(), brw_sf_compile::m1Cx, brw_sf_compile::m2Cy, brw_sf_compile::m3C0, negate(), brw_sf_compile::nr_setup_regs, brw_sf_compile::nr_verts, offset(), brw_sf_compile::tmp, and brw_sf_compile::vert.

00260 {
00261    struct brw_compile *p = &c->func;
00262    unsigned i;
00263 
00264 
00265    c->nr_verts = 2;
00266    alloc_regs(c);
00267    invert_det(c);
00268    copy_z_inv_w(c);
00269 
00270    for (i = 0; i < c->nr_setup_regs; i++)
00271    {
00272       /* Pair of incoming attributes:
00273        */
00274       struct brw_reg a0 = offset(c->vert[0], i);
00275       struct brw_reg a1 = offset(c->vert[1], i);
00276       ushort pc, pc_persp, pc_linear;
00277       boolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
00278 
00279       if (pc_persp)
00280       {
00281          brw_set_predicate_control_flag_value(p, pc_persp);
00282          brw_MUL(p, a0, a0, c->inv_w[0]);
00283          brw_MUL(p, a1, a1, c->inv_w[1]);
00284       }
00285 
00286       /* Calculate coefficients for position, color:
00287        */
00288       if (pc_linear) {
00289          brw_set_predicate_control_flag_value(p, pc_linear);
00290 
00291          brw_ADD(p, c->a1_sub_a0, a1, negate(a0));
00292 
00293          brw_MUL(p, c->tmp, c->a1_sub_a0, c->dx0);
00294          brw_MUL(p, c->m1Cx, c->tmp, c->inv_det);
00295 
00296          brw_MUL(p, c->tmp, c->a1_sub_a0, c->dy0);
00297          brw_MUL(p, c->m2Cy, c->tmp, c->inv_det);
00298       }
00299 
00300       {
00301          brw_set_predicate_control_flag_value(p, pc);
00302 
00303          /* start point for interpolation
00304           */
00305          brw_MOV(p, c->m3C0, a0);
00306 
00307          /* Copy m0..m3 to URB.
00308           */
00309          brw_urb_WRITE(p,
00310                        brw_null_reg(),
00311                        0,
00312                        brw_vec8_grf(0, 0),
00313                        0,       /* allocate */
00314                        1,       /* used */
00315                        4,       /* msg len */
00316                        0,       /* response len */
00317                        last,    /* eot */
00318                        last,    /* writes complete */
00319                        i*4,     /* urb destination offset */
00320                        BRW_URB_SWIZZLE_TRANSPOSE);
00321       }
00322    }
00323 }

void brw_emit_point_setup ( struct brw_sf_compile c  ) 

Definition at line 329 of file brw_sf_emit.c.

References alloc_regs(), brw_imm_ud(), brw_MOV(), brw_MUL(), brw_null_reg(), brw_set_predicate_control_flag_value(), BRW_URB_SWIZZLE_TRANSPOSE, brw_urb_WRITE(), brw_vec8_grf(), calculate_masks(), copy_z_inv_w(), brw_sf_compile::func, brw_sf_compile::inv_w, brw_sf_compile::m1Cx, brw_sf_compile::m2Cy, brw_sf_compile::m3C0, brw_sf_compile::nr_setup_regs, brw_sf_compile::nr_verts, offset(), and brw_sf_compile::vert.

00330 {
00331    struct brw_compile *p = &c->func;
00332    unsigned i;
00333 
00334    c->nr_verts = 1;
00335    alloc_regs(c);
00336    copy_z_inv_w(c);
00337 
00338    brw_MOV(p, c->m1Cx, brw_imm_ud(0)); /* zero - move out of loop */
00339    brw_MOV(p, c->m2Cy, brw_imm_ud(0)); /* zero - move out of loop */
00340 
00341    for (i = 0; i < c->nr_setup_regs; i++)
00342    {
00343       struct brw_reg a0 = offset(c->vert[0], i);
00344       ushort pc, pc_persp, pc_linear;
00345       boolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
00346 
00347       if (pc_persp)
00348       {
00349          /* This seems odd as the values are all constant, but the
00350           * fragment shader will be expecting it:
00351           */
00352          brw_set_predicate_control_flag_value(p, pc_persp);
00353          brw_MUL(p, a0, a0, c->inv_w[0]);
00354       }
00355 
00356 
00357       /* The delta values are always zero, just send the starting
00358        * coordinate.  Again, this is to fit in with the interpolation
00359        * code in the fragment shader.
00360        */
00361       {
00362          brw_set_predicate_control_flag_value(p, pc);
00363 
00364          brw_MOV(p, c->m3C0, a0); /* constant value */
00365 
00366          /* Copy m0..m3 to URB.
00367           */
00368          brw_urb_WRITE(p,
00369                        brw_null_reg(),
00370                        0,
00371                        brw_vec8_grf(0, 0),
00372                        0,       /* allocate */
00373                        1,       /* used */
00374                        4,       /* msg len */
00375                        0,       /* response len */
00376                        last,    /* eot */
00377                        last,    /* writes complete */
00378                        i*4,     /* urb destination offset */
00379                        BRW_URB_SWIZZLE_TRANSPOSE);
00380       }
00381    }
00382 }

void brw_emit_point_sprite_setup ( struct brw_sf_compile c  ) 

void brw_emit_tri_setup ( struct brw_sf_compile c  ) 

Definition at line 175 of file brw_sf_emit.c.

References brw_sf_compile::a1_sub_a0, brw_sf_compile::a2_sub_a0, alloc_regs(), brw_ADD(), brw_MAC(), brw_MOV(), brw_MUL(), brw_null_reg(), brw_set_predicate_control_flag_value(), BRW_URB_SWIZZLE_TRANSPOSE, brw_urb_WRITE(), brw_vec8_grf(), calculate_masks(), copy_z_inv_w(), debug_printf(), brw_sf_compile::dx0, brw_sf_compile::dx2, brw_sf_compile::dy0, brw_sf_compile::dy2, brw_sf_compile::func, brw_sf_compile::inv_det, brw_sf_compile::inv_w, invert_det(), brw_sf_compile::m1Cx, brw_sf_compile::m2Cy, brw_sf_compile::m3C0, negate(), brw_sf_compile::nr_setup_regs, brw_sf_compile::nr_verts, offset(), brw_sf_compile::tmp, and brw_sf_compile::vert.

00176 {
00177    struct brw_compile *p = &c->func;
00178    unsigned i;
00179 
00180    debug_printf("%s START ==============\n", __FUNCTION__);
00181 
00182    c->nr_verts = 3;
00183    alloc_regs(c);
00184    invert_det(c);
00185    copy_z_inv_w(c);
00186 
00187 
00188    for (i = 0; i < c->nr_setup_regs; i++)
00189    {
00190       /* Pair of incoming attributes:
00191        */
00192       struct brw_reg a0 = offset(c->vert[0], i);
00193       struct brw_reg a1 = offset(c->vert[1], i);
00194       struct brw_reg a2 = offset(c->vert[2], i);
00195       ushort pc = 0, pc_persp = 0, pc_linear = 0;
00196       boolean last = calculate_masks(c, i, &pc, &pc_persp, &pc_linear);
00197 
00198       if (pc_persp)
00199       {
00200          brw_set_predicate_control_flag_value(p, pc_persp);
00201          brw_MUL(p, a0, a0, c->inv_w[0]);
00202          brw_MUL(p, a1, a1, c->inv_w[1]);
00203          brw_MUL(p, a2, a2, c->inv_w[2]);
00204       }
00205 
00206 
00207       /* Calculate coefficients for interpolated values:
00208        */
00209       if (pc_linear)
00210       {
00211          brw_set_predicate_control_flag_value(p, pc_linear);
00212 
00213          brw_ADD(p, c->a1_sub_a0, a1, negate(a0));
00214          brw_ADD(p, c->a2_sub_a0, a2, negate(a0));
00215 
00216          /* calculate dA/dx
00217           */
00218          brw_MUL(p, brw_null_reg(), c->a1_sub_a0, c->dy2);
00219          brw_MAC(p, c->tmp, c->a2_sub_a0, negate(c->dy0));
00220          brw_MUL(p, c->m1Cx, c->tmp, c->inv_det);
00221 
00222          /* calculate dA/dy
00223           */
00224          brw_MUL(p, brw_null_reg(), c->a2_sub_a0, c->dx0);
00225          brw_MAC(p, c->tmp, c->a1_sub_a0, negate(c->dx2));
00226          brw_MUL(p, c->m2Cy, c->tmp, c->inv_det);
00227       }
00228 
00229       {
00230          brw_set_predicate_control_flag_value(p, pc);
00231          /* start point for interpolation
00232           */
00233          brw_MOV(p, c->m3C0, a0);
00234 
00235          /* Copy m0..m3 to URB.  m0 is implicitly copied from r0 in
00236           * the send instruction:
00237           */
00238          brw_urb_WRITE(p,
00239                        brw_null_reg(),
00240                        0,
00241                        brw_vec8_grf(0, 0), /* r0, will be copied to m0 */
00242                        0,       /* allocate */
00243                        1,       /* used */
00244                        4,       /* msg len */
00245                        0,       /* response len */
00246                        last,    /* eot */
00247                        last,    /* writes complete */
00248                        i*4,     /* offset */
00249                        BRW_URB_SWIZZLE_TRANSPOSE); /* XXX: Swizzle control "SF to windower" */
00250       }
00251    }
00252 
00253    debug_printf("%s DONE ==============\n", __FUNCTION__);
00254 
00255 }


Generated on Tue Sep 29 06:25:38 2009 for Gallium3D by  doxygen 1.5.4