2 /**************************************************************************
4 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
7 * Permission is hereby granted, free of charge, to any person obtaining a
8 * copy of this software and associated documentation files (the
9 * "Software"), to deal in the Software without restriction, including
10 * without limitation the rights to use, copy, modify, merge, publish,
11 * distribute, sub license, and/or sell copies of the Software, and to
12 * permit persons to whom the Software is furnished to do so, subject to
13 * the following conditions:
15 * The above copyright notice and this permission notice (including the
16 * next paragraph) shall be included in all copies or substantial portions
19 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
20 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
22 * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
23 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
24 * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
25 * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 **************************************************************************/
30 * \brief Public interface into the drawing module.
33 /* Authors: Keith Whitwell <keith@tungstengraphics.com>
37 #ifndef DRAW_CONTEXT_H
38 #define DRAW_CONTEXT_H
41 #include "pipe/p_state.h"
47 struct draw_vertex_shader
;
51 struct draw_context
*draw_create( void );
53 void draw_destroy( struct draw_context
*draw
);
55 void draw_set_viewport_state( struct draw_context
*draw
,
56 const struct pipe_viewport_state
*viewport
);
58 void draw_set_clip_state( struct draw_context
*pipe
,
59 const struct pipe_clip_state
*clip
);
61 void draw_set_rasterizer_state( struct draw_context
*draw
,
62 const struct pipe_rasterizer_state
*raster
);
64 void draw_set_rasterize_stage( struct draw_context
*draw
,
65 struct draw_stage
*stage
);
67 void draw_wide_point_threshold(struct draw_context
*draw
, float threshold
);
69 void draw_wide_line_threshold(struct draw_context
*draw
, float threshold
);
71 void draw_enable_line_stipple(struct draw_context
*draw
, boolean enable
);
73 void draw_enable_point_sprites(struct draw_context
*draw
, boolean enable
);
75 void draw_set_mrd(struct draw_context
*draw
, double mrd
);
78 draw_install_aaline_stage(struct draw_context
*draw
, struct pipe_context
*pipe
);
81 draw_install_aapoint_stage(struct draw_context
*draw
, struct pipe_context
*pipe
);
84 draw_install_pstipple_stage(struct draw_context
*draw
, struct pipe_context
*pipe
);
88 draw_find_vs_output(const struct draw_context
*draw
,
89 uint semantic_name
, uint semantic_index
);
92 draw_num_vs_outputs(const struct draw_context
*draw
);
96 draw_texture_samplers(struct draw_context
*draw
,
98 struct tgsi_sampler
**samplers
);
103 * Vertex shader functions
106 struct draw_vertex_shader
*
107 draw_create_vertex_shader(struct draw_context
*draw
,
108 const struct pipe_shader_state
*shader
);
109 void draw_bind_vertex_shader(struct draw_context
*draw
,
110 struct draw_vertex_shader
*dvs
);
111 void draw_delete_vertex_shader(struct draw_context
*draw
,
112 struct draw_vertex_shader
*dvs
);
117 * Vertex data functions
120 void draw_set_vertex_buffers(struct draw_context
*draw
,
122 const struct pipe_vertex_buffer
*buffers
);
124 void draw_set_vertex_elements(struct draw_context
*draw
,
126 const struct pipe_vertex_element
*elements
);
129 draw_set_mapped_element_buffer_range( struct draw_context
*draw
,
133 const void *elements
);
135 void draw_set_mapped_element_buffer( struct draw_context
*draw
,
137 const void *elements
);
139 void draw_set_mapped_vertex_buffer(struct draw_context
*draw
,
140 unsigned attr
, const void *buffer
);
142 void draw_set_mapped_constant_buffer(struct draw_context
*draw
,
146 void draw_set_edgeflags( struct draw_context
*draw
,
147 const unsigned *edgeflag
);
150 /***********************************************************************
154 void draw_arrays(struct draw_context
*draw
, unsigned prim
,
155 unsigned start
, unsigned count
);
157 void draw_flush(struct draw_context
*draw
);
160 /*******************************************************************************
161 * Driver backend interface
164 void draw_set_render( struct draw_context
*draw
,
165 struct vbuf_render
*render
);
167 void draw_set_driver_clipping( struct draw_context
*draw
,
168 boolean bypass_clipping
);
170 void draw_set_force_passthrough( struct draw_context
*draw
,
173 /*******************************************************************************
176 boolean
draw_need_pipeline(const struct draw_context
*draw
,
177 const struct pipe_rasterizer_state
*rasterizer
,
182 #endif /* DRAW_CONTEXT_H */