1 /**************************************************************************
3 * Copyright 2009 VMware, Inc. All Rights Reserved.
4 * Copyright 2010 LunarG, Inc. All Rights Reserved.
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:
14 * The above copyright notice and this permission notice (including the
15 * next paragraph) shall be included in all copies or substantial portions
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.
26 **************************************************************************/
31 #include "VG/openvg.h"
37 struct st_framebuffer
;
39 struct pipe_sampler_state
;
40 struct pipe_sampler_view
;
42 struct pipe_vertex_element
;
43 struct pipe_vertex_buffer
;
46 struct renderer
*renderer_create(struct vg_context
*owner
);
47 void renderer_destroy(struct renderer
*);
49 void renderer_validate(struct renderer
*renderer
,
51 const struct st_framebuffer
*stfb
,
52 const struct vg_state
*state
);
54 void renderer_validate_for_shader(struct renderer
*renderer
,
55 const struct pipe_sampler_state
**samplers
,
56 struct pipe_sampler_view
**views
,
58 const struct matrix
*modelview
,
60 const void *const_buffer
,
61 VGint const_buffer_len
);
63 void renderer_validate_for_mask_rendering(struct renderer
*renderer
,
64 struct pipe_surface
*dst
,
65 const struct matrix
*modelview
);
67 VGboolean
renderer_copy_begin(struct renderer
*renderer
,
68 struct pipe_surface
*dst
,
70 struct pipe_sampler_view
*src
);
72 void renderer_copy(struct renderer
*renderer
,
73 VGint x
, VGint y
, VGint w
, VGint h
,
74 VGint sx
, VGint sy
, VGint sw
, VGint sh
);
76 void renderer_copy_end(struct renderer
*renderer
);
78 VGboolean
renderer_drawtex_begin(struct renderer
*renderer
,
79 struct pipe_sampler_view
*src
);
81 void renderer_drawtex(struct renderer
*renderer
,
82 VGint x
, VGint y
, VGint w
, VGint h
,
83 VGint sx
, VGint sy
, VGint sw
, VGint sh
);
85 void renderer_drawtex_end(struct renderer
*renderer
);
87 VGboolean
renderer_scissor_begin(struct renderer
*renderer
,
88 VGboolean restore_dsa
);
90 void renderer_scissor(struct renderer
*renderer
,
91 VGint x
, VGint y
, VGint width
, VGint height
);
93 void renderer_scissor_end(struct renderer
*renderer
);
95 VGboolean
renderer_clear_begin(struct renderer
*renderer
);
97 void renderer_clear(struct renderer
*renderer
,
98 VGint x
, VGint y
, VGint width
, VGint height
,
99 const VGfloat color
[4]);
101 void renderer_clear_end(struct renderer
*renderer
);
103 VGboolean
renderer_filter_begin(struct renderer
*renderer
,
104 struct pipe_resource
*dst
,
106 VGbitfield channel_mask
,
107 const struct pipe_sampler_state
**samplers
,
108 struct pipe_sampler_view
**views
,
111 const void *const_buffer
,
112 VGint const_buffer_len
);
114 void renderer_filter(struct renderer
*renderer
,
115 VGint x
, VGint y
, VGint w
, VGint h
,
116 VGint sx
, VGint sy
, VGint sw
, VGint sh
);
118 void renderer_filter_end(struct renderer
*renderer
);
120 VGboolean
renderer_polygon_stencil_begin(struct renderer
*renderer
,
121 struct pipe_vertex_element
*velem
,
123 VGboolean restore_dsa
);
125 void renderer_polygon_stencil(struct renderer
*renderer
,
126 struct pipe_vertex_buffer
*vbuf
,
127 VGuint mode
, VGuint start
, VGuint count
);
129 void renderer_polygon_stencil_end(struct renderer
*renderer
);
131 VGboolean
renderer_polygon_fill_begin(struct renderer
*renderer
,
134 void renderer_polygon_fill(struct renderer
*renderer
,
135 VGfloat min_x
, VGfloat min_y
,
136 VGfloat max_x
, VGfloat max_y
);
138 void renderer_polygon_fill_end(struct renderer
*renderer
);
140 void renderer_texture_quad(struct renderer
*,
141 struct pipe_resource
*texture
,
142 VGfloat x1offset
, VGfloat y1offset
,
143 VGfloat x2offset
, VGfloat y2offset
,
144 VGfloat x1
, VGfloat y1
,
145 VGfloat x2
, VGfloat y2
,
146 VGfloat x3
, VGfloat y3
,
147 VGfloat x4
, VGfloat y4
);
149 void renderer_copy_surface(struct renderer
*r
,
150 struct pipe_surface
*src
,
153 struct pipe_surface
*dst
,
156 float z
, unsigned filter
);