renderer.h revision 20ce148c305200c760f34d2098d92bc77cb6deee
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 vg_state; 37struct st_framebuffer; 38struct pipe_resource; 39struct pipe_sampler_state; 40struct pipe_sampler_view; 41struct pipe_surface; 42struct pipe_vertex_element; 43struct pipe_vertex_buffer; 44 45struct renderer *renderer_create(struct vg_context *owner); 46void renderer_destroy(struct renderer *); 47 48void renderer_validate(struct renderer *renderer, 49 VGbitfield dirty, 50 const struct st_framebuffer *stfb, 51 const struct vg_state *state); 52 53void renderer_validate_for_shader(struct renderer *renderer, 54 const struct pipe_sampler_state **samplers, 55 struct pipe_sampler_view **views, 56 VGint num_samplers, 57 void *fs, 58 const void *const_buffer, 59 VGint const_buffer_len); 60 61VGboolean renderer_copy_begin(struct renderer *renderer, 62 struct pipe_surface *dst, 63 VGboolean y0_top, 64 struct pipe_sampler_view *src); 65 66void renderer_copy(struct renderer *renderer, 67 VGint x, VGint y, VGint w, VGint h, 68 VGint sx, VGint sy, VGint sw, VGint sh); 69 70void renderer_copy_end(struct renderer *renderer); 71 72VGboolean renderer_drawtex_begin(struct renderer *renderer, 73 struct pipe_sampler_view *src); 74 75void renderer_drawtex(struct renderer *renderer, 76 VGint x, VGint y, VGint w, VGint h, 77 VGint sx, VGint sy, VGint sw, VGint sh); 78 79void renderer_drawtex_end(struct renderer *renderer); 80 81VGboolean renderer_scissor_begin(struct renderer *renderer, 82 VGboolean restore_dsa); 83 84void renderer_scissor(struct renderer *renderer, 85 VGint x, VGint y, VGint width, VGint height); 86 87void renderer_scissor_end(struct renderer *renderer); 88 89VGboolean renderer_clear_begin(struct renderer *renderer); 90 91void renderer_clear(struct renderer *renderer, 92 VGint x, VGint y, VGint width, VGint height, 93 const VGfloat color[4]); 94 95void renderer_clear_end(struct renderer *renderer); 96 97VGboolean renderer_filter_begin(struct renderer *renderer, 98 struct pipe_resource *dst, 99 VGboolean y0_top, 100 VGbitfield channel_mask, 101 const struct pipe_sampler_state **samplers, 102 struct pipe_sampler_view **views, 103 VGint num_samplers, 104 void *fs, 105 const void *const_buffer, 106 VGint const_buffer_len); 107 108void renderer_filter(struct renderer *renderer, 109 VGint x, VGint y, VGint w, VGint h, 110 VGint sx, VGint sy, VGint sw, VGint sh); 111 112void renderer_filter_end(struct renderer *renderer); 113 114VGboolean renderer_polygon_stencil_begin(struct renderer *renderer, 115 struct pipe_vertex_element *velem, 116 VGFillRule rule, 117 VGboolean restore_dsa); 118 119void renderer_polygon_stencil(struct renderer *renderer, 120 struct pipe_vertex_buffer *vbuf, 121 VGuint mode, VGuint start, VGuint count); 122 123void renderer_polygon_stencil_end(struct renderer *renderer); 124 125VGboolean renderer_polygon_fill_begin(struct renderer *renderer, 126 VGboolean save_dsa); 127 128void renderer_polygon_fill(struct renderer *renderer, 129 VGfloat min_x, VGfloat min_y, 130 VGfloat max_x, VGfloat max_y); 131 132void renderer_polygon_fill_end(struct renderer *renderer); 133 134void renderer_texture_quad(struct renderer *, 135 struct pipe_resource *texture, 136 VGfloat x1offset, VGfloat y1offset, 137 VGfloat x2offset, VGfloat y2offset, 138 VGfloat x1, VGfloat y1, 139 VGfloat x2, VGfloat y2, 140 VGfloat x3, VGfloat y3, 141 VGfloat x4, VGfloat y4); 142 143void renderer_copy_surface(struct renderer *r, 144 struct pipe_surface *src, 145 int sx1, int sy1, 146 int sx2, int sy2, 147 struct pipe_surface *dst, 148 int dx1, int dy1, 149 int dx2, int dy2, 150 float z, unsigned filter); 151 152 153#endif 154