revert 213 commits (to 56092) from the last month. 10 still need work to resolve...
[AROS.git] / workbench / libs / mesa / src / gallium / auxiliary / util / u_draw.h
blobfdb683ca8a290c49502d1ad3e7a178155af90705
1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * All Rights Reserved.
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:
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.
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 TUNGSTEN GRAPHICS 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.
26 **************************************************************************/
28 #ifndef U_DRAW_H
29 #define U_DRAW_H
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_context.h"
34 #include "pipe/p_state.h"
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
42 static INLINE void
43 util_draw_init_info(struct pipe_draw_info *info)
45 memset(info, 0, sizeof(*info));
46 info->instance_count = 1;
47 info->max_index = 0xffffffff;
51 static INLINE void
52 util_draw_arrays(struct pipe_context *pipe, uint mode, uint start, uint count)
54 struct pipe_draw_info info;
56 util_draw_init_info(&info);
57 info.mode = mode;
58 info.start = start;
59 info.count = count;
60 info.min_index = start;
61 info.max_index = start + count - 1;
63 pipe->draw_vbo(pipe, &info);
66 static INLINE void
67 util_draw_elements(struct pipe_context *pipe, int index_bias,
68 uint mode, uint start, uint count)
70 struct pipe_draw_info info;
72 util_draw_init_info(&info);
73 info.indexed = TRUE;
74 info.mode = mode;
75 info.start = start;
76 info.count = count;
77 info.index_bias = index_bias;
79 pipe->draw_vbo(pipe, &info);
82 static INLINE void
83 util_draw_arrays_instanced(struct pipe_context *pipe,
84 uint mode, uint start, uint count,
85 uint start_instance,
86 uint instance_count)
88 struct pipe_draw_info info;
90 util_draw_init_info(&info);
91 info.mode = mode;
92 info.start = start;
93 info.count = count;
94 info.start_instance = start_instance;
95 info.instance_count = instance_count;
96 info.min_index = start;
97 info.max_index = start + count - 1;
99 pipe->draw_vbo(pipe, &info);
102 static INLINE void
103 util_draw_elements_instanced(struct pipe_context *pipe,
104 int index_bias,
105 uint mode, uint start, uint count,
106 uint start_instance,
107 uint instance_count)
109 struct pipe_draw_info info;
111 util_draw_init_info(&info);
112 info.indexed = TRUE;
113 info.mode = mode;
114 info.start = start;
115 info.count = count;
116 info.index_bias = index_bias;
117 info.start_instance = start_instance;
118 info.instance_count = instance_count;
120 pipe->draw_vbo(pipe, &info);
123 static INLINE void
124 util_draw_range_elements(struct pipe_context *pipe,
125 int index_bias,
126 uint min_index,
127 uint max_index,
128 uint mode, uint start, uint count)
130 struct pipe_draw_info info;
132 util_draw_init_info(&info);
133 info.indexed = TRUE;
134 info.mode = mode;
135 info.start = start;
136 info.count = count;
137 info.index_bias = index_bias;
138 info.min_index = min_index;
139 info.max_index = max_index;
141 pipe->draw_vbo(pipe, &info);
145 unsigned
146 util_draw_max_index(
147 const struct pipe_vertex_buffer *vertex_buffers,
148 unsigned nr_vertex_buffers,
149 const struct pipe_vertex_element *vertex_elements,
150 unsigned nr_vertex_elements,
151 const struct pipe_draw_info *info);
154 #ifdef __cplusplus
156 #endif
158 #endif /* !U_DRAW_H */