Tizen 2.0 Release
[profile/ivi/osmesa.git] / src / gallium / drivers / cell / spu / spu_vertex_shader.h
1 #ifndef SPU_VERTEX_SHADER_H
2 #define SPU_VERTEX_SHADER_H
3
4 #include "cell/common.h"
5 #include "pipe/p_format.h"
6 #include "spu_exec.h"
7
8 struct spu_vs_context;
9
10 typedef void (*spu_full_fetch_func)( struct spu_vs_context *draw,
11                                      struct spu_exec_machine *machine,
12                                      const unsigned *elts,
13                                      unsigned count );
14
15 struct spu_vs_context {
16    struct pipe_viewport_state viewport;
17
18    struct {
19       uint64_t src_ptr[PIPE_MAX_ATTRIBS];
20       unsigned pitch[PIPE_MAX_ATTRIBS];
21       unsigned size[PIPE_MAX_ATTRIBS];
22       unsigned code_offset[PIPE_MAX_ATTRIBS];
23       unsigned nr_attrs;
24       boolean dirty;
25
26       spu_full_fetch_func fetch_func;
27       void *code;
28    } vertex_fetch;
29    
30    /* Clip derived state:
31     */
32    float plane[12][4];
33    unsigned nr_planes;
34
35    struct spu_exec_machine machine;
36    const float (*constants)[4];
37
38    unsigned num_vs_outputs;
39 };
40
41 extern void spu_update_vertex_fetch(struct spu_vs_context *draw);
42
43 static INLINE void spu_vertex_fetch(struct spu_vs_context *draw,
44                                     struct spu_exec_machine *machine,
45                                     const unsigned *elts,
46                                     unsigned count)
47 {
48    if (draw->vertex_fetch.dirty) {
49       spu_update_vertex_fetch(draw);
50       draw->vertex_fetch.dirty = 0;
51    }
52    
53    (*draw->vertex_fetch.fetch_func)(draw, machine, elts, count);
54 }
55
56 struct cell_command_vs;
57
58 extern void
59 spu_bind_vertex_shader(struct spu_vs_context *draw,
60                        struct cell_shader_info *vs);
61
62 extern void
63 spu_execute_vertex_shader(struct spu_vs_context *draw,
64                           const struct cell_command_vs *vs);
65
66 #endif /* SPU_VERTEX_SHADER_H */