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 vg_state; 37 struct st_framebuffer; 38 struct pipe_resource; 39 struct pipe_sampler_state; 40 struct pipe_sampler_view; 41 struct pipe_surface; 42 struct pipe_vertex_element; 43 struct pipe_vertex_buffer; 44 struct matrix; 45 46 struct renderer *renderer_create(struct vg_context *owner); 47 void renderer_destroy(struct renderer *); 48 49 void renderer_validate(struct renderer *renderer, 50 VGbitfield dirty, 51 const struct st_framebuffer *stfb, 52 const struct vg_state *state); 53 54 void renderer_validate_for_shader(struct renderer *renderer, 55 const struct pipe_sampler_state **samplers, 56 struct pipe_sampler_view **views, 57 VGint num_samplers, 58 const struct matrix *modelview, 59 void *fs, 60 const void *const_buffer, 61 VGint const_buffer_len); 62 63 void renderer_validate_for_mask_rendering(struct renderer *renderer, 64 struct pipe_surface *dst, 65 const struct matrix *modelview); 66 67 VGboolean renderer_copy_begin(struct renderer *renderer, 68 struct pipe_surface *dst, 69 VGboolean y0_top, 70 struct pipe_sampler_view *src); 71 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); 75 76 void renderer_copy_end(struct renderer *renderer); 77 78 VGboolean renderer_drawtex_begin(struct renderer *renderer, 79 struct pipe_sampler_view *src); 80 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); 84 85 void renderer_drawtex_end(struct renderer *renderer); 86 87 VGboolean renderer_scissor_begin(struct renderer *renderer, 88 VGboolean restore_dsa); 89 90 void renderer_scissor(struct renderer *renderer, 91 VGint x, VGint y, VGint width, VGint height); 92 93 void renderer_scissor_end(struct renderer *renderer); 94 95 VGboolean renderer_clear_begin(struct renderer *renderer); 96 97 void renderer_clear(struct renderer *renderer, 98 VGint x, VGint y, VGint width, VGint height, 99 const VGfloat color[4]); 100 101 void renderer_clear_end(struct renderer *renderer); 102 103 VGboolean renderer_filter_begin(struct renderer *renderer, 104 struct pipe_resource *dst, 105 VGboolean y0_top, 106 VGbitfield channel_mask, 107 const struct pipe_sampler_state **samplers, 108 struct pipe_sampler_view **views, 109 VGint num_samplers, 110 void *fs, 111 const void *const_buffer, 112 VGint const_buffer_len); 113 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); 117 118 void renderer_filter_end(struct renderer *renderer); 119 120 VGboolean renderer_polygon_stencil_begin(struct renderer *renderer, 121 struct pipe_vertex_element *velem, 122 VGFillRule rule, 123 VGboolean restore_dsa); 124 125 void renderer_polygon_stencil(struct renderer *renderer, 126 struct pipe_vertex_buffer *vbuf, 127 VGuint mode, VGuint start, VGuint count); 128 129 void renderer_polygon_stencil_end(struct renderer *renderer); 130 131 VGboolean renderer_polygon_fill_begin(struct renderer *renderer, 132 VGboolean save_dsa); 133 134 void renderer_polygon_fill(struct renderer *renderer, 135 VGfloat min_x, VGfloat min_y, 136 VGfloat max_x, VGfloat max_y); 137 138 void renderer_polygon_fill_end(struct renderer *renderer); 139 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); 148 149 void renderer_copy_surface(struct renderer *r, 150 struct pipe_surface *src, 151 int sx1, int sy1, 152 int sx2, int sy2, 153 struct pipe_surface *dst, 154 int dx1, int dy1, 155 int dx2, int dy2, 156 float z, unsigned filter); 157 158 159 #endif 160