1 /**************************************************************************
3 * Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas.
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
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 **************************************************************************/
32 #include "pipe/p_compiler.h"
33 #include "pipe/p_context.h"
34 #include "pipe/p_state.h"
38 util_draw_init_info(struct pipe_draw_info
*info
)
40 memset(info
, 0, sizeof(*info
));
41 info
->instance_count
= 1;
42 info
->max_index
= 0xffffffff;
47 util_draw_arrays(struct pipe_context
*pipe
, uint mode
, uint start
, uint count
)
49 struct pipe_draw_info info
;
51 util_draw_init_info(&info
);
55 info
.min_index
= start
;
56 info
.max_index
= start
+ count
- 1;
58 pipe
->draw_vbo(pipe
, &info
);
62 util_draw_elements(struct pipe_context
*pipe
, int index_bias
,
63 uint mode
, uint start
, uint count
)
65 struct pipe_draw_info info
;
67 util_draw_init_info(&info
);
72 info
.index_bias
= index_bias
;
74 pipe
->draw_vbo(pipe
, &info
);
78 util_draw_arrays_instanced(struct pipe_context
*pipe
,
79 uint mode
, uint start
, uint count
,
83 struct pipe_draw_info info
;
85 util_draw_init_info(&info
);
89 info
.start_instance
= start_instance
;
90 info
.instance_count
= instance_count
;
91 info
.min_index
= start
;
92 info
.max_index
= start
+ count
- 1;
94 pipe
->draw_vbo(pipe
, &info
);
98 util_draw_elements_instanced(struct pipe_context
*pipe
,
100 uint mode
, uint start
, uint count
,
104 struct pipe_draw_info info
;
106 util_draw_init_info(&info
);
111 info
.index_bias
= index_bias
;
112 info
.start_instance
= start_instance
;
113 info
.instance_count
= instance_count
;
115 pipe
->draw_vbo(pipe
, &info
);
119 util_draw_range_elements(struct pipe_context
*pipe
,
123 uint mode
, uint start
, uint count
)
125 struct pipe_draw_info info
;
127 util_draw_init_info(&info
);
132 info
.index_bias
= index_bias
;
133 info
.min_index
= min_index
;
134 info
.max_index
= max_index
;
136 pipe
->draw_vbo(pipe
, &info
);