renderer.h revision e5968a5355f0165aa7f3f8e71a27df884e5a3efb
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 pipe_resource;
37struct pipe_sampler_state;
38struct pipe_sampler_view;
39struct pipe_surface;
40
41struct renderer *renderer_create(struct vg_context *owner);
42void renderer_destroy(struct renderer *);
43
44VGboolean renderer_copy_begin(struct renderer *renderer,
45                              struct pipe_surface *dst,
46                              VGboolean y0_top,
47                              struct pipe_sampler_view *src);
48
49void renderer_copy(struct renderer *renderer,
50                   VGint x, VGint y, VGint w, VGint h,
51                   VGint sx, VGint sy, VGint sw, VGint sh);
52
53void renderer_copy_end(struct renderer *renderer);
54
55VGboolean renderer_drawtex_begin(struct renderer *renderer,
56                                 struct pipe_sampler_view *src);
57
58void renderer_drawtex(struct renderer *renderer,
59                      VGint x, VGint y, VGint w, VGint h,
60                      VGint sx, VGint sy, VGint sw, VGint sh);
61
62void renderer_drawtex_end(struct renderer *renderer);
63
64VGboolean renderer_scissor_begin(struct renderer *renderer,
65                                 VGboolean restore_dsa);
66
67void renderer_scissor(struct renderer *renderer,
68                      VGint x, VGint y, VGint width, VGint height);
69
70void renderer_scissor_end(struct renderer *renderer);
71
72VGboolean renderer_clear_begin(struct renderer *renderer);
73
74void renderer_clear(struct renderer *renderer,
75                    VGint x, VGint y, VGint width, VGint height,
76                    const VGfloat color[4]);
77
78void renderer_clear_end(struct renderer *renderer);
79
80VGboolean renderer_filter_begin(struct renderer *renderer,
81                                struct pipe_resource *dst,
82                                VGboolean y0_top,
83                                VGbitfield channel_mask,
84                                const struct pipe_sampler_state **samplers,
85                                struct pipe_sampler_view **views,
86                                VGint num_samplers,
87                                void *fs,
88                                const void *const_buffer,
89                                VGint const_buffer_len);
90
91void renderer_filter(struct renderer *renderer,
92                     VGint x, VGint y, VGint w, VGint h,
93                     VGint sx, VGint sy, VGint sw, VGint sh);
94
95void renderer_filter_end(struct renderer *renderer);
96
97void renderer_draw_quad(struct renderer *,
98                        VGfloat x1, VGfloat y1,
99                        VGfloat x2, VGfloat y2,
100                        VGfloat depth);
101void renderer_draw_texture(struct renderer *,
102                           struct pipe_resource *texture,
103                           VGfloat x1offset, VGfloat y1offset,
104                           VGfloat x2offset, VGfloat y2offset,
105                           VGfloat x1, VGfloat y1,
106                           VGfloat x2, VGfloat y2);
107void renderer_texture_quad(struct renderer *,
108                           struct pipe_resource *texture,
109                           VGfloat x1offset, VGfloat y1offset,
110                           VGfloat x2offset, VGfloat y2offset,
111                           VGfloat x1, VGfloat y1,
112                           VGfloat x2, VGfloat y2,
113                           VGfloat x3, VGfloat y3,
114                           VGfloat x4, VGfloat y4);
115void renderer_copy_texture(struct renderer *r,
116                           struct pipe_sampler_view *src,
117                           VGfloat sx1, VGfloat sy1,
118                           VGfloat sx2, VGfloat sy2,
119                           struct pipe_resource *dst,
120                           VGfloat dx1, VGfloat dy1,
121                           VGfloat dx2, VGfloat dy2);
122void renderer_copy_surface(struct renderer *r,
123                           struct pipe_surface *src,
124                           int sx1, int sy1,
125                           int sx2, int sy2,
126                           struct pipe_surface *dst,
127                           int dx1, int dy1,
128                           int dx2, int dy2,
129                           float z, unsigned filter);
130
131
132#endif
133