brw_vs.c File Reference

Include dependency graph for brw_vs.c:

Go to the source code of this file.

Functions

static void do_vs_prog (struct brw_context *brw, const struct brw_vertex_program *vp, struct brw_vs_prog_key *key)
static void brw_upload_vs_prog (struct brw_context *brw)

Variables

struct brw_tracked_state brw_vs_prog


Function Documentation

static void brw_upload_vs_prog ( struct brw_context brw  )  [static]

Definition at line 83 of file brw_vs.c.

References assert, brw_context::attribs, brw_search_cache(), BRW_VS_PROG, brw_context::cache, brw_context::Clip, brw_vs_prog_key::copy_edgeflag, do_vs_prog(), pipe_rasterizer_state::fill_ccw, pipe_rasterizer_state::fill_cw, brw_vertex_program::id, pipe_clip_state::nr, brw_vs_prog_key::nr_userclip, PIPE_POLYGON_MODE_FILL, brw_context::prog_data, brw_context::prog_gs_offset, brw_vs_prog_key::program_string_id, brw_context::Raster, brw_context::VertexProgram, and brw_context::vs.

00084 {
00085    struct brw_vs_prog_key key;
00086    const struct brw_vertex_program *vp = brw->attribs.VertexProgram;
00087 
00088    assert(vp);
00089 
00090    memset(&key, 0, sizeof(key));
00091 
00092    /* Just upload the program verbatim for now.  Always send it all
00093     * the inputs it asks for, whether they are varying or not.
00094     */
00095    key.program_string_id = vp->id;
00096    key.nr_userclip = brw->attribs.Clip.nr;
00097    key.copy_edgeflag = (brw->attribs.Raster->fill_cw != PIPE_POLYGON_MODE_FILL ||
00098                         brw->attribs.Raster->fill_ccw != PIPE_POLYGON_MODE_FILL);
00099 
00100    /* Make an early check for the key.
00101     */
00102    if (brw_search_cache(&brw->cache[BRW_VS_PROG],
00103                         &key, sizeof(key),
00104                         &brw->vs.prog_data,
00105                         &brw->vs.prog_gs_offset))
00106        return;
00107 
00108    do_vs_prog(brw, vp, &key);
00109 }

static void do_vs_prog ( struct brw_context brw,
const struct brw_vertex_program vp,
struct brw_vs_prog_key key 
) [static]

Definition at line 39 of file brw_vs.c.

References brw_get_program(), brw_init_compile(), brw_upload_cache(), brw_vs_emit(), BRW_VS_PROG, brw_context::cache, brw_vs_prog_key::copy_edgeflag, brw_vs_compile::func, brw_vertex_program::info, brw_vs_prog_data::inputs_read, brw_vs_compile::key, tgsi_shader_info::num_inputs, tgsi_shader_info::num_outputs, brw_vs_prog_data::outputs_written, brw_context::prog_data, brw_vs_compile::prog_data, brw_context::prog_gs_offset, brw_vs_compile::vp, and brw_context::vs.

00042 {
00043    unsigned program_size;
00044    const unsigned *program;
00045    struct brw_vs_compile c;
00046 
00047    memset(&c, 0, sizeof(c));
00048    memcpy(&c.key, key, sizeof(*key));
00049 
00050    brw_init_compile(&c.func);
00051    c.vp = vp;
00052 
00053    c.prog_data.outputs_written = vp->info.num_outputs;
00054    c.prog_data.inputs_read = vp->info.num_inputs;
00055 
00056 #if 0
00057    if (c.key.copy_edgeflag) {
00058       c.prog_data.outputs_written |= 1<<VERT_RESULT_EDGE;
00059       c.prog_data.inputs_read |= 1<<VERT_ATTRIB_EDGEFLAG;
00060    }
00061 #endif
00062 
00063    /* Emit GEN4 code.
00064     */
00065    brw_vs_emit(&c);
00066 
00067    /* get the program
00068     */
00069    program = brw_get_program(&c.func, &program_size);
00070 
00071    /*
00072     */
00073    brw->vs.prog_gs_offset = brw_upload_cache( &brw->cache[BRW_VS_PROG],
00074                                               &c.key,
00075                                               sizeof(c.key),
00076                                               program,
00077                                               program_size,
00078                                               &c.prog_data,
00079                                               &brw->vs.prog_data);
00080 }


Variable Documentation

struct brw_tracked_state brw_vs_prog

Initial value:

 {
   .dirty = {
      .brw   =  0x4000 ,
      .cache = 0
   },
   .update = brw_upload_vs_prog
}

Definition at line 114 of file brw_vs.c.


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