Merge branch 'gallium-noblocks'
[mesa.git] / src / gallium / state_trackers / xorg / xorg_renderer.h
1 #ifndef XORG_RENDERER_H
2 #define XORG_RENDERER_H
3
4 #include "pipe/p_context.h"
5 #include "pipe/p_state.h"
6
7 struct xorg_shaders;
8 struct exa_pixmap_priv;
9
10 /* max number of vertices *
11 * max number of attributes per vertex *
12 * max number of components per attribute
13 *
14 * currently the max is 100 quads
15 */
16 #define BUF_SIZE (100 * 4 * 3 * 4)
17
18 struct xorg_renderer {
19 struct pipe_context *pipe;
20
21 struct cso_context *cso;
22 struct xorg_shaders *shaders;
23
24 int fb_width;
25 int fb_height;
26 struct pipe_constant_buffer vs_const_buffer;
27 struct pipe_constant_buffer fs_const_buffer;
28
29 float buffer[BUF_SIZE];
30 int buffer_size;
31
32 /* number of attributes per vertex for the current
33 * draw operation */
34 int attrs_per_vertex;
35 };
36
37 struct xorg_renderer *renderer_create(struct pipe_context *pipe);
38 void renderer_destroy(struct xorg_renderer *renderer);
39
40 void renderer_bind_destination(struct xorg_renderer *r,
41 struct pipe_surface *surface,
42 int width,
43 int height );
44
45 void renderer_bind_framebuffer(struct xorg_renderer *r,
46 struct exa_pixmap_priv *priv);
47 void renderer_bind_viewport(struct xorg_renderer *r,
48 struct exa_pixmap_priv *dst);
49 void renderer_set_constants(struct xorg_renderer *r,
50 int shader_type,
51 const float *buffer,
52 int size);
53
54
55 void renderer_draw_yuv(struct xorg_renderer *r,
56 int src_x, int src_y, int src_w, int src_h,
57 int dst_x, int dst_y, int dst_w, int dst_h,
58 struct pipe_texture **textures);
59
60 void renderer_begin_solid(struct xorg_renderer *r);
61 void renderer_solid(struct xorg_renderer *r,
62 int x0, int y0,
63 int x1, int y1,
64 float *color);
65
66 void renderer_begin_textures(struct xorg_renderer *r,
67 struct pipe_texture **textures,
68 int num_textures);
69 void renderer_texture(struct xorg_renderer *r,
70 int *pos,
71 int width, int height,
72 struct pipe_texture **textures,
73 int num_textures,
74 float *src_matrix,
75 float *mask_matrix);
76
77 void renderer_draw_flush(struct xorg_renderer *r);
78
79 struct pipe_texture *
80 renderer_clone_texture(struct xorg_renderer *r,
81 struct pipe_texture *src);
82
83 void renderer_copy_prepare(struct xorg_renderer *r,
84 struct pipe_surface *dst_surface,
85 struct pipe_texture *src_texture);
86
87 void renderer_copy_pixmap(struct xorg_renderer *r,
88 int dx, int dy,
89 int sx, int sy,
90 int width, int height,
91 float src_width,
92 float src_height);
93
94
95 #endif