aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/xorg/xorg_renderer.h
blob: 9ab554f63f9ae14206cfe3d04d634aa4335b4ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#ifndef XORG_RENDERER_H
#define XORG_RENDERER_H

#include "pipe/p_context.h"
#include "pipe/p_state.h"

struct xorg_shaders;
struct exa_pixmap_priv;

/* max number of vertices *
 * max number of attributes per vertex *
 * max number of components per attribute
 *
 * currently the max is 5 quads
 */
#define BUF_SIZE (20 * 3 * 4)

struct xorg_renderer {
   struct pipe_context *pipe;

   struct cso_context *cso;
   struct xorg_shaders *shaders;

   struct pipe_constant_buffer vs_const_buffer;
   struct pipe_constant_buffer fs_const_buffer;

   float vertices[BUF_SIZE];
   int num_vertices;
};

struct xorg_renderer *renderer_create(struct pipe_context *pipe);
void renderer_destroy(struct xorg_renderer *renderer);

void renderer_bind_framebuffer(struct xorg_renderer *r,
                               struct exa_pixmap_priv *priv);
void renderer_bind_viewport(struct xorg_renderer *r,
                            struct exa_pixmap_priv *dst);
void renderer_bind_rasterizer(struct xorg_renderer *r);
void renderer_set_constants(struct xorg_renderer *r,
                            int shader_type,
                            const float *buffer,
                            int size);
void renderer_copy_pixmap(struct xorg_renderer *r,
                          struct exa_pixmap_priv *dst_priv, int dx, int dy,
                          struct exa_pixmap_priv *src_priv, int sx, int sy,
                          int width, int height);

void renderer_draw_solid_rect(struct xorg_renderer *r,
                              int x0, int y0,
                              int x1, int y1,
                              float *color);

void renderer_draw_textures(struct xorg_renderer *r,
                            int *pos,
                            int width, int height,
                            struct pipe_texture **textures,
                            int num_textures,
                            float *src_matrix,
                            float *mask_matrix);

void renderer_draw_yuv(struct xorg_renderer *r,
                       int src_x, int src_y, int src_w, int src_h,
                       int dst_x, int dst_y, int dst_w, int dst_h,
                       struct pipe_texture **textures);

void renderer_begin_solid(struct xorg_renderer *r,
                          float *color);
void renderer_solid(struct xorg_renderer *r,
                    int x0, int y0,
                    int x1, int y1);
void renderer_end_solid(struct xorg_renderer *r);


#endif