renderer.h revision b730f0fc52a208b5f2a308199724ab02aa391fec
1/**************************************************************************
2 *
3 * Copyright 2009 VMware, Inc.  All Rights Reserved.
4 * Copyright 2010 LunarG, Inc.  All Rights Reserved.
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the
8 * "Software"), to deal in the Software without restriction, including
9 * without limitation the rights to use, copy, modify, merge, publish,
10 * distribute, sub license, and/or sell copies of the Software, and to
11 * permit persons to whom the Software is furnished to do so, subject to
12 * the following conditions:
13 *
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
16 * of the Software.
17 *
18 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21 * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25 *
26 **************************************************************************/
27
28#ifndef RENDERER_H
29#define RENDERER_H
30
31#include "VG/openvg.h"
32
33struct renderer;
34
35struct vg_context;
36struct vg_state;
37struct st_framebuffer;
38struct pipe_resource;
39struct pipe_sampler_state;
40struct pipe_sampler_view;
41struct pipe_surface;
42struct pipe_vertex_element;
43struct pipe_vertex_buffer;
44
45struct renderer *renderer_create(struct vg_context *owner);
46void renderer_destroy(struct renderer *);
47
48void renderer_validate(struct renderer *renderer,
49                       VGbitfield dirty,
50                       const struct st_framebuffer *stfb,
51                       const struct vg_state *state);
52
53VGboolean renderer_copy_begin(struct renderer *renderer,
54                              struct pipe_surface *dst,
55                              VGboolean y0_top,
56                              struct pipe_sampler_view *src);
57
58void renderer_copy(struct renderer *renderer,
59                   VGint x, VGint y, VGint w, VGint h,
60                   VGint sx, VGint sy, VGint sw, VGint sh);
61
62void renderer_copy_end(struct renderer *renderer);
63
64VGboolean renderer_drawtex_begin(struct renderer *renderer,
65                                 struct pipe_sampler_view *src);
66
67void renderer_drawtex(struct renderer *renderer,
68                      VGint x, VGint y, VGint w, VGint h,
69                      VGint sx, VGint sy, VGint sw, VGint sh);
70
71void renderer_drawtex_end(struct renderer *renderer);
72
73VGboolean renderer_scissor_begin(struct renderer *renderer,
74                                 VGboolean restore_dsa);
75
76void renderer_scissor(struct renderer *renderer,
77                      VGint x, VGint y, VGint width, VGint height);
78
79void renderer_scissor_end(struct renderer *renderer);
80
81VGboolean renderer_clear_begin(struct renderer *renderer);
82
83void renderer_clear(struct renderer *renderer,
84                    VGint x, VGint y, VGint width, VGint height,
85                    const VGfloat color[4]);
86
87void renderer_clear_end(struct renderer *renderer);
88
89VGboolean renderer_filter_begin(struct renderer *renderer,
90                                struct pipe_resource *dst,
91                                VGboolean y0_top,
92                                VGbitfield channel_mask,
93                                const struct pipe_sampler_state **samplers,
94                                struct pipe_sampler_view **views,
95                                VGint num_samplers,
96                                void *fs,
97                                const void *const_buffer,
98                                VGint const_buffer_len);
99
100void renderer_filter(struct renderer *renderer,
101                     VGint x, VGint y, VGint w, VGint h,
102                     VGint sx, VGint sy, VGint sw, VGint sh);
103
104void renderer_filter_end(struct renderer *renderer);
105
106VGboolean renderer_polygon_stencil_begin(struct renderer *renderer,
107                                         struct pipe_vertex_element *velem,
108                                         VGFillRule rule,
109                                         VGboolean restore_dsa);
110
111void renderer_polygon_stencil(struct renderer *renderer,
112                              struct pipe_vertex_buffer *vbuf,
113                              VGuint mode, VGuint start, VGuint count);
114
115void renderer_polygon_stencil_end(struct renderer *renderer);
116
117VGboolean renderer_polygon_fill_begin(struct renderer *renderer,
118                                      VGboolean save_dsa);
119
120void renderer_polygon_fill(struct renderer *renderer,
121                           VGfloat min_x, VGfloat min_y,
122                           VGfloat max_x, VGfloat max_y);
123
124void renderer_polygon_fill_end(struct renderer *renderer);
125
126void renderer_draw_quad(struct renderer *,
127                        VGfloat x1, VGfloat y1,
128                        VGfloat x2, VGfloat y2,
129                        VGfloat depth);
130void renderer_draw_texture(struct renderer *,
131                           struct pipe_resource *texture,
132                           VGfloat x1offset, VGfloat y1offset,
133                           VGfloat x2offset, VGfloat y2offset,
134                           VGfloat x1, VGfloat y1,
135                           VGfloat x2, VGfloat y2);
136void renderer_texture_quad(struct renderer *,
137                           struct pipe_resource *texture,
138                           VGfloat x1offset, VGfloat y1offset,
139                           VGfloat x2offset, VGfloat y2offset,
140                           VGfloat x1, VGfloat y1,
141                           VGfloat x2, VGfloat y2,
142                           VGfloat x3, VGfloat y3,
143                           VGfloat x4, VGfloat y4);
144void renderer_copy_texture(struct renderer *r,
145                           struct pipe_sampler_view *src,
146                           VGfloat sx1, VGfloat sy1,
147                           VGfloat sx2, VGfloat sy2,
148                           struct pipe_resource *dst,
149                           VGfloat dx1, VGfloat dy1,
150                           VGfloat dx2, VGfloat dy2);
151void renderer_copy_surface(struct renderer *r,
152                           struct pipe_surface *src,
153                           int sx1, int sy1,
154                           int sx2, int sy2,
155                           struct pipe_surface *dst,
156                           int dx1, int dy1,
157                           int dx2, int dy2,
158                           float z, unsigned filter);
159
160
161#endif
162