spu_vertex_fetch.c File Reference

Include dependency graph for spu_vertex_fetch.c:

Go to the source code of this file.

Typedefs

typedef void(* spu_fetch_func )(qword *out, const qword *in, const qword *shuffle_data)

Functions

static void generic_vertex_fetch (struct spu_vs_context *draw, struct spu_exec_machine *machine, const unsigned *elts, unsigned count)
 Fetch vertex attributes for 'count' vertices.
void spu_update_vertex_fetch (struct spu_vs_context *draw)

Variables

static const qword
fetch_shuffle_data[5] 
ALIGN16_ATTRIB


Typedef Documentation

typedef void(* spu_fetch_func)(qword *out, const qword *in, const qword *shuffle_data)

Definition at line 42 of file spu_vertex_fetch.c.


Function Documentation

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

Fetch vertex attributes for 'count' vertices.

Definition at line 87 of file spu_vertex_fetch.c.

References ALIGN16_ATTRIB, ASSERT, spu_vs_context::code, spu_vs_context::code_offset, spu_exec_machine::Inputs, spu_vs_context::nr_attrs, spu_vs_context::pitch, spu_exec_channel::q, spu_vs_context::size, spu_dcache_fetch_unaligned(), spu_vs_context::src_ptr, spu_vs_context::vertex_fetch, and spu_exec_vector::xyzw.

00091 {
00092    unsigned nr_attrs = draw->vertex_fetch.nr_attrs;
00093    unsigned attr;
00094 
00095    ASSERT(count <= 4);
00096 
00097 #if DRAW_DBG
00098    printf("SPU: %s count = %u, nr_attrs = %u\n", 
00099           __FUNCTION__, count, nr_attrs);
00100 #endif
00101 
00102    /* loop over vertex attributes (vertex shader inputs)
00103     */
00104    for (attr = 0; attr < nr_attrs; attr++) {
00105       const unsigned pitch = draw->vertex_fetch.pitch[attr];
00106       const uint64_t src = draw->vertex_fetch.src_ptr[attr];
00107       const spu_fetch_func fetch = (spu_fetch_func)
00108           (draw->vertex_fetch.code + draw->vertex_fetch.code_offset[attr]);
00109       unsigned i;
00110       unsigned idx;
00111       const unsigned bytes_per_entry = draw->vertex_fetch.size[attr];
00112       const unsigned quads_per_entry = (bytes_per_entry + 15) / 16;
00113       qword in[2 * 4] ALIGN16_ATTRIB;
00114 
00115 
00116       /* Fetch four attributes for four vertices.  
00117        */
00118       idx = 0;
00119       for (i = 0; i < count; i++) {
00120          const uint64_t addr = src + (elts[i] * pitch);
00121 
00122 #if DRAW_DBG
00123          printf("SPU: fetching = 0x%llx\n", addr);
00124 #endif
00125 
00126          spu_dcache_fetch_unaligned(& in[idx], addr, bytes_per_entry);
00127          idx += quads_per_entry;
00128       }
00129 
00130       /* Be nice and zero out any missing vertices.
00131        */
00132       (void) memset(& in[idx], 0, (8 - idx) * sizeof(qword));
00133 
00134 
00135       /* Convert all 4 vertices to vectors of float.
00136        */
00137       (*fetch)(&machine->Inputs[attr].xyzw[0].q, in, fetch_shuffle_data);
00138    }
00139 }

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 }


Variable Documentation

const qword fetch_shuffle_data [5] ALIGN16_ATTRIB [static]

Definition at line 46 of file spu_vertex_fetch.c.


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