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