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