brw_sf_state.c File Reference

Include dependency graph for brw_sf_state.c:

Go to the source code of this file.

Functions

static void upload_sf_vp (struct brw_context *brw)
static void upload_sf_unit (struct brw_context *brw)

Variables

struct brw_tracked_state brw_sf_vp
struct brw_tracked_state brw_sf_unit


Function Documentation

static void upload_sf_unit ( struct brw_context brw  )  [static]

Definition at line 78 of file brw_sf_state.c.

References brw_sf_unit_state::aa_enable, align(), assert, brw_context::attribs, brw_cache_data(), BRW_CULLMODE_BACK, BRW_CULLMODE_BOTH, BRW_CULLMODE_FRONT, BRW_CULLMODE_NONE, BRW_DEBUG, BRW_FLOATING_POINT_NON_IEEE_754, BRW_FRONTWINDING_CCW, BRW_FRONTWINDING_CW, BRW_SF_UNIT, brw_context::cache, CLAMP, brw_sf_unit_state::cull_mode, DEBUG_SINGLE_THREAD, DEBUG_STATS, brw_sf_unit_state::dest_org_hbias, brw_sf_unit_state::dest_org_vbias, thread3::dispatch_grf_start_reg, thread1::floating_point_mode, brw_sf_unit_state::front_winding, thread0::grf_reg_count, thread0::kernel_start_pointer, brw_sf_unit_state::line_endcap_aa_region_width, brw_sf_unit_state::line_last_pixel_enable, pipe_rasterizer_state::line_smooth, pipe_rasterizer_state::line_width, brw_sf_unit_state::line_width, brw_sf_unit_state::linestrip_pv, brw_sf_unit_state::max_threads, MIN2, brw_context::nr_sf_entries, brw_sf_unit_state::nr_urb_entries, brw_sf_unit_state::point_rast_rule, brw_sf_unit_state::point_size, pipe_rasterizer_state::point_size_per_vertex, pipe_rasterizer_state::point_sprite, brw_context::prog_data, brw_context::prog_gs_offset, brw_context::Raster, brw_sf_unit_state::scissor, pipe_rasterizer_state::scissor, brw_context::sf, brw_sf_unit_state::sf5, brw_sf_unit_state::sf6, brw_sf_unit_state::sf7, brw_sf_unit_state::sf_viewport_state_offset, brw_context::sfsize, brw_sf_unit_state::sprite_point, brw_context::state_gs_offset, brw_sf_unit_state::stats_enable, brw_sf_unit_state::thread0, brw_sf_unit_state::thread1, brw_sf_unit_state::thread3, brw_sf_unit_state::thread4, brw_vs_prog_data::total_grf, brw_sf_unit_state::trifan_pv, brw_sf_unit_state::tristrip_pv, brw_context::urb, brw_sf_unit_state::urb_entry_allocation_size, thread3::urb_entry_read_length, thread3::urb_entry_read_offset, brw_vs_prog_data::urb_read_length, brw_sf_unit_state::use_point_size_state, brw_sf_unit_state::viewport_transform, and brw_context::vp_gs_offset.

00079 {
00080    struct brw_sf_unit_state sf;
00081    memset(&sf, 0, sizeof(sf));
00082 
00083    /* CACHE_NEW_SF_PROG */
00084    sf.thread0.grf_reg_count = align(brw->sf.prog_data->total_grf, 16) / 16 - 1;
00085    sf.thread0.kernel_start_pointer = brw->sf.prog_gs_offset >> 6;
00086    sf.thread3.urb_entry_read_length = brw->sf.prog_data->urb_read_length;
00087 
00088    sf.thread1.floating_point_mode = BRW_FLOATING_POINT_NON_IEEE_754;
00089    sf.thread3.dispatch_grf_start_reg = 3;
00090    sf.thread3.urb_entry_read_offset = 1;
00091 
00092    /* BRW_NEW_URB_FENCE */
00093    sf.thread4.nr_urb_entries = brw->urb.nr_sf_entries;
00094    sf.thread4.urb_entry_allocation_size = brw->urb.sfsize - 1;
00095    sf.thread4.max_threads = MIN2(12, brw->urb.nr_sf_entries / 2) - 1;
00096 
00097    if (BRW_DEBUG & DEBUG_SINGLE_THREAD)
00098       sf.thread4.max_threads = 0;
00099 
00100    if (BRW_DEBUG & DEBUG_STATS)
00101       sf.thread4.stats_enable = 1;
00102 
00103    /* CACHE_NEW_SF_VP */
00104    sf.sf5.sf_viewport_state_offset = brw->sf.vp_gs_offset >> 5;
00105    sf.sf5.viewport_transform = 1;
00106 
00107    /* BRW_NEW_RASTER */
00108    if (brw->attribs.Raster->scissor)
00109       sf.sf6.scissor = 1;
00110 
00111 #if 0
00112    if (brw->attribs.Polygon->FrontFace == GL_CCW)
00113       sf.sf5.front_winding = BRW_FRONTWINDING_CCW;
00114    else
00115       sf.sf5.front_winding = BRW_FRONTWINDING_CW;
00116 
00117 
00118    if (brw->attribs.Polygon->CullFlag) {
00119       switch (brw->attribs.Polygon->CullFaceMode) {
00120       case GL_FRONT:
00121          sf.sf6.cull_mode = BRW_CULLMODE_FRONT;
00122          break;
00123       case GL_BACK:
00124          sf.sf6.cull_mode = BRW_CULLMODE_BACK;
00125          break;
00126       case GL_FRONT_AND_BACK:
00127          sf.sf6.cull_mode = BRW_CULLMODE_BOTH;
00128          break;
00129       default:
00130          assert(0);
00131          break;
00132       }
00133    }
00134    else
00135       sf.sf6.cull_mode = BRW_CULLMODE_NONE;
00136 #else
00137    sf.sf5.front_winding = BRW_FRONTWINDING_CCW;
00138    sf.sf6.cull_mode = BRW_CULLMODE_NONE;
00139 #endif
00140 
00141    sf.sf6.line_width = CLAMP(brw->attribs.Raster->line_width, 1.0, 5.0) * (1<<1);
00142 
00143    sf.sf6.line_endcap_aa_region_width = 1;
00144    if (brw->attribs.Raster->line_smooth)
00145       sf.sf6.aa_enable = 1;
00146    else if (sf.sf6.line_width <= 0x2)
00147        sf.sf6.line_width = 0;
00148 
00149    sf.sf6.point_rast_rule = 1;  /* opengl conventions */
00150 
00151    sf.sf7.sprite_point = brw->attribs.Raster->point_sprite;
00152    sf.sf7.point_size = CLAMP(brw->attribs.Raster->line_width, 1.0, 255.0) * (1<<3);
00153    sf.sf7.use_point_size_state = !brw->attribs.Raster->point_size_per_vertex;
00154 
00155    /* might be BRW_NEW_PRIMITIVE if we have to adjust pv for polygons:
00156     */
00157    sf.sf7.trifan_pv = 2;
00158    sf.sf7.linestrip_pv = 1;
00159    sf.sf7.tristrip_pv = 2;
00160    sf.sf7.line_last_pixel_enable = 0;
00161 
00162    /* Set bias for OpenGL rasterization rules:
00163     */
00164    sf.sf6.dest_org_vbias = 0x8;
00165    sf.sf6.dest_org_hbias = 0x8;
00166 
00167    brw->sf.state_gs_offset = brw_cache_data( &brw->cache[BRW_SF_UNIT], &sf );
00168 }

static void upload_sf_vp ( struct brw_context brw  )  [static]

Definition at line 40 of file brw_sf_state.c.

References brw_context::attribs, brw_cache_data(), BRW_SF_VP, brw_context::cache, brw_sf_viewport::m00, brw_sf_viewport::m11, brw_sf_viewport::m22, brw_sf_viewport::m30, brw_sf_viewport::m31, brw_sf_viewport::m32, pipe_scissor_state::maxx, pipe_scissor_state::maxy, pipe_scissor_state::minx, pipe_scissor_state::miny, pipe_viewport_state::scale, brw_context::Scissor, brw_sf_viewport::scissor, brw_context::sf, pipe_viewport_state::translate, brw_sf_viewport::viewport, brw_context::Viewport, brw_context::vp_gs_offset, brw_sf_viewport::xmax, brw_sf_viewport::xmin, brw_sf_viewport::ymax, and brw_sf_viewport::ymin.

00041 {
00042    struct brw_sf_viewport sfv;
00043 
00044    memset(&sfv, 0, sizeof(sfv));
00045 
00046 
00047    /* BRW_NEW_VIEWPORT */
00048    {
00049       const float *scale = brw->attribs.Viewport.scale;
00050       const float *trans = brw->attribs.Viewport.translate;
00051 
00052       sfv.viewport.m00 = scale[0];
00053       sfv.viewport.m11 = scale[1];
00054       sfv.viewport.m22 = scale[2]; 
00055       sfv.viewport.m30 = trans[0];
00056       sfv.viewport.m31 = trans[1];
00057       sfv.viewport.m32 = trans[2];
00058    }
00059 
00060    /* _NEW_SCISSOR */
00061    sfv.scissor.xmin = brw->attribs.Scissor.minx;
00062    sfv.scissor.xmax = brw->attribs.Scissor.maxx - 1;
00063    sfv.scissor.ymin = brw->attribs.Scissor.miny;
00064    sfv.scissor.ymax = brw->attribs.Scissor.maxy - 1;
00065 
00066    brw->sf.vp_gs_offset = brw_cache_data( &brw->cache[BRW_SF_VP], &sfv );
00067 }


Variable Documentation

struct brw_tracked_state brw_sf_unit

Initial value:

 {
   .dirty = {
      .brw   = ( 0x2  |
                 0x10000 ),
      .cache = ( (1<<BRW_SF_VP)  |
                 (1<<BRW_SF_PROG) )
   },
   .update = upload_sf_unit
}

Definition at line 171 of file brw_sf_state.c.

struct brw_tracked_state brw_sf_vp

Initial value:

 {
   .dirty = {
      .brw   = ( 0x20  |
                 0x1 ),
      .cache = 0
   },
   .update = upload_sf_vp
}

Definition at line 69 of file brw_sf_state.c.


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