00001 #ifndef SPU_VERTEX_SHADER_H
00002 #define SPU_VERTEX_SHADER_H
00003
00004 #include "cell/common.h"
00005 #include "pipe/p_format.h"
00006 #include "spu_exec.h"
00007
00008 struct spu_vs_context;
00009
00010 typedef void (*spu_full_fetch_func)( struct spu_vs_context *draw,
00011 struct spu_exec_machine *machine,
00012 const unsigned *elts,
00013 unsigned count );
00014
00015 struct spu_vs_context {
00016 struct pipe_viewport_state viewport;
00017
00018 struct {
00019 uint64_t src_ptr[PIPE_MAX_ATTRIBS];
00020 unsigned pitch[PIPE_MAX_ATTRIBS];
00021 unsigned size[PIPE_MAX_ATTRIBS];
00022 unsigned code_offset[PIPE_MAX_ATTRIBS];
00023 unsigned nr_attrs;
00024 boolean dirty;
00025
00026 spu_full_fetch_func fetch_func;
00027 void *code;
00028 } vertex_fetch;
00029
00030
00031
00032 float plane[12][4];
00033 unsigned nr_planes;
00034
00035 struct spu_exec_machine machine;
00036 const float (*constants)[4];
00037
00038 unsigned num_vs_outputs;
00039 };
00040
00041 extern void spu_update_vertex_fetch(struct spu_vs_context *draw);
00042
00043 static INLINE void spu_vertex_fetch(struct spu_vs_context *draw,
00044 struct spu_exec_machine *machine,
00045 const unsigned *elts,
00046 unsigned count)
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 }
00055
00056 struct cell_command_vs;
00057
00058 extern void
00059 spu_bind_vertex_shader(struct spu_vs_context *draw,
00060 struct cell_shader_info *vs);
00061
00062 extern void
00063 spu_execute_vertex_shader(struct spu_vs_context *draw,
00064 const struct cell_command_vs *vs);
00065
00066 #endif