st/vega: Add FILTER renderer state for image filtering.
[mesa.git] / src / gallium / state_trackers / vega / renderer.h
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
33 struct renderer;
34
35 struct vg_context;
36 struct pipe_resource;
37 struct pipe_sampler_state;
38 struct pipe_sampler_view;
39 struct pipe_surface;
40
41 struct renderer *renderer_create(struct vg_context *owner);
42 void renderer_destroy(struct renderer *);
43
44 VGboolean renderer_copy_begin(struct renderer *renderer,
45 struct pipe_surface *dst,
46 VGboolean y0_top,
47 struct pipe_sampler_view *src);
48
49 void renderer_copy(struct renderer *renderer,
50 VGint x, VGint y, VGint w, VGint h,
51 VGint sx, VGint sy, VGint sw, VGint sh);
52
53 void renderer_copy_end(struct renderer *renderer);
54
55 VGboolean renderer_drawtex_begin(struct renderer *renderer,
56 struct pipe_sampler_view *src);
57
58 void renderer_drawtex(struct renderer *renderer,
59 VGint x, VGint y, VGint w, VGint h,
60 VGint sx, VGint sy, VGint sw, VGint sh);
61
62 void renderer_drawtex_end(struct renderer *renderer);
63
64 VGboolean renderer_scissor_begin(struct renderer *renderer,
65 VGboolean restore_dsa);
66
67 void renderer_scissor(struct renderer *renderer,
68 VGint x, VGint y, VGint width, VGint height);
69
70 void renderer_scissor_end(struct renderer *renderer);
71
72 VGboolean renderer_clear_begin(struct renderer *renderer);
73
74 void renderer_clear(struct renderer *renderer,
75 VGint x, VGint y, VGint width, VGint height,
76 const VGfloat color[4]);
77
78 void renderer_clear_end(struct renderer *renderer);
79
80 VGboolean 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
91 void renderer_filter(struct renderer *renderer,
92 VGint x, VGint y, VGint w, VGint h,
93 VGint sx, VGint sy, VGint sw, VGint sh);
94
95 void renderer_filter_end(struct renderer *renderer);
96
97 void renderer_draw_quad(struct renderer *,
98 VGfloat x1, VGfloat y1,
99 VGfloat x2, VGfloat y2,
100 VGfloat depth);
101 void 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);
107 void 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);
115 void 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);
122 void 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