spu_vertex_shader.h File Reference

Include dependency graph for spu_vertex_shader.h:

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

Go to the source code of this file.

Data Structures

struct  spu_vs_context

Typedefs

typedef void(* spu_full_fetch_func )(struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, unsigned count)

Functions

void spu_update_vertex_fetch (struct spu_vs_context *draw)
static void spu_vertex_fetch (struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, unsigned count)
void spu_bind_vertex_shader (struct spu_vs_context *draw, struct cell_shader_info *vs)
void spu_execute_vertex_shader (struct spu_vs_context *draw, const struct cell_command_vs *vs)


Typedef Documentation

typedef void(* spu_full_fetch_func)(struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, unsigned count)

Definition at line 10 of file spu_vertex_shader.h.


Function Documentation

void spu_bind_vertex_shader ( struct spu_vs_context draw,
struct cell_shader_info vs 
)

Definition at line 194 of file spu_vertex_shader.c.

References cell_shader_info::declarations, spu_exec_machine::Declarations, cell_shader_info::immediates, spu_exec_machine::Imms, cell_shader_info::instructions, spu_exec_machine::Instructions, spu_vs_context::machine, cell_shader_info::num_declarations, cell_shader_info::num_immediates, cell_shader_info::num_instructions, cell_shader_info::num_outputs, spu_vs_context::num_vs_outputs, spu_exec_machine::NumDeclarations, spu_exec_machine::NumInstructions, PIPE_MAX_SAMPLERS, PIPE_SHADER_VERTEX, ROUNDUP16, spu_exec_machine_init(), TAG_VERTEX_BUFFER, and wait_on_mask().

00196 {
00197    const unsigned immediate_addr = vs->immediates;
00198    const unsigned immediate_size = 
00199        ROUNDUP16((sizeof(float) * 4 * vs->num_immediates)
00200                  + (immediate_addr & 0x0f));
00201  
00202 
00203    mfc_get(immediates, immediate_addr & ~0x0f, immediate_size,
00204            TAG_VERTEX_BUFFER, 0, 0);
00205 
00206    draw->machine.Instructions = (struct tgsi_full_instruction *)
00207        vs->instructions;
00208    draw->machine.NumInstructions = vs->num_instructions;
00209 
00210    draw->machine.Declarations = (struct tgsi_full_declaration *)
00211        vs->declarations;
00212    draw->machine.NumDeclarations = vs->num_declarations;
00213 
00214    draw->num_vs_outputs = vs->num_outputs;
00215 
00216    /* specify the shader to interpret/execute */
00217    spu_exec_machine_init(&draw->machine,
00218                          PIPE_MAX_SAMPLERS,
00219                          NULL /*samplers*/,
00220                          PIPE_SHADER_VERTEX);
00221 
00222    wait_on_mask(1 << TAG_VERTEX_BUFFER);
00223 
00224    (void) memcpy(& draw->machine.Imms, &immediates[immediate_addr & 0x0f],
00225                  sizeof(float) * 4 * vs->num_immediates);
00226 }

void spu_execute_vertex_shader ( struct spu_vs_context draw,
const struct cell_command_vs vs 
)

Definition at line 230 of file spu_vertex_shader.c.

References cell_command_vs::elts, MIN2, cell_command_vs::nr_attrs, spu_vs_context::nr_attrs, spu_vs_context::nr_planes, cell_command_vs::nr_planes, cell_command_vs::num_elts, cell_command_vs::plane, spu_vs_context::plane, run_vertex_program(), spu_vs_context::vertex_fetch, and cell_command_vs::vOut.

00232 {
00233    unsigned i;
00234 
00235    (void) memcpy(draw->plane, vs->plane, sizeof(float) * 4 * vs->nr_planes);
00236    draw->nr_planes = vs->nr_planes;
00237    draw->vertex_fetch.nr_attrs = vs->nr_attrs;
00238 
00239    for (i = 0; i < vs->num_elts; i += 4) {
00240       const unsigned batch_size = MIN2(vs->num_elts - i, 4);
00241 
00242       run_vertex_program(draw, & vs->elts[i], batch_size, &vs->vOut[i]);
00243    }
00244 }

void spu_update_vertex_fetch ( struct spu_vs_context draw  ) 

Definition at line 142 of file spu_vertex_fetch.c.

References spu_vs_context::fetch_func, generic_vertex_fetch(), and spu_vs_context::vertex_fetch.

00143 {
00144    draw->vertex_fetch.fetch_func = generic_vertex_fetch;
00145 }

static void spu_vertex_fetch ( struct spu_vs_context draw,
struct spu_exec_machine machine,
const unsigned *  elts,
unsigned  count 
) [static]

Definition at line 43 of file spu_vertex_shader.h.

References spu_vs_context::dirty, spu_vs_context::fetch_func, spu_update_vertex_fetch(), and spu_vs_context::vertex_fetch.

00047 {
00048    if (draw->vertex_fetch.dirty) {
00049       spu_update_vertex_fetch(draw);
00050       draw->vertex_fetch.dirty = 0;
00051    }
00052    
00053    (*draw->vertex_fetch.fetch_func)(draw, machine, elts, count);
00054 }


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