Go to the source code of this file.
Functions | |
static void | softpipe_map_constant_buffers (struct softpipe_context *sp) |
static void | softpipe_unmap_constant_buffers (struct softpipe_context *sp) |
boolean | softpipe_draw_arrays (struct pipe_context *pipe, unsigned mode, unsigned start, unsigned count) |
boolean | softpipe_draw_range_elements (struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned min_index, unsigned max_index, unsigned mode, unsigned start, unsigned count) |
Draw vertex arrays, with optional indexing. | |
boolean | softpipe_draw_elements (struct pipe_context *pipe, struct pipe_buffer *indexBuffer, unsigned indexSize, unsigned mode, unsigned start, unsigned count) |
void | softpipe_set_edgeflags (struct pipe_context *pipe, const unsigned *edgeflags) |
Variables | |
static unsigned | reduced_prim [PIPE_PRIM_POLYGON+1] |
boolean softpipe_draw_arrays | ( | struct pipe_context * | pipe, | |
unsigned | mode, | |||
unsigned | start, | |||
unsigned | count | |||
) |
Definition at line 98 of file sp_draw_arrays.c.
References softpipe_draw_elements().
00100 { 00101 return softpipe_draw_elements(pipe, NULL, 0, mode, start, count); 00102 }
boolean softpipe_draw_elements | ( | struct pipe_context * | pipe, | |
struct pipe_buffer * | indexBuffer, | |||
unsigned | indexSize, | |||
unsigned | mode, | |||
unsigned | start, | |||
unsigned | count | |||
) |
Definition at line 183 of file sp_draw_arrays.c.
References softpipe_draw_range_elements().
00187 { 00188 return softpipe_draw_range_elements( pipe, indexBuffer, 00189 indexSize, 00190 0, 0xffffffff, 00191 mode, start, count ); 00192 }
boolean softpipe_draw_range_elements | ( | struct pipe_context * | pipe, | |
struct pipe_buffer * | indexBuffer, | |||
unsigned | indexSize, | |||
unsigned | min_index, | |||
unsigned | max_index, | |||
unsigned | mode, | |||
unsigned | start, | |||
unsigned | count | |||
) |
Draw vertex arrays, with optional indexing.
Basically, map the vertex buffers (and drawing surfaces), then hand off the drawing to the 'draw' module.
XXX should the element buffer be specified/bound with a separate function?
Definition at line 115 of file sp_draw_arrays.c.
References pipe_vertex_buffer::buffer, softpipe_context::dirty, softpipe_context::draw, draw, draw_arrays(), draw_set_mapped_element_buffer(), draw_set_mapped_element_buffer_range(), draw_set_mapped_vertex_buffer(), softpipe_context::num_vertex_buffers, pipe_buffer_map(), pipe_buffer_unmap(), PIPE_BUFFER_USAGE_CPU_READ, softpipe_context::reduced_api_prim, reduced_prim, pipe_context::screen, softpipe_context(), softpipe_map_constant_buffers(), softpipe_map_surfaces(), softpipe_unmap_constant_buffers(), softpipe_update_derived(), TRUE, and softpipe_context::vertex_buffer.
00121 { 00122 struct softpipe_context *sp = softpipe_context(pipe); 00123 struct draw_context *draw = sp->draw; 00124 unsigned i; 00125 00126 sp->reduced_api_prim = reduced_prim[mode]; 00127 00128 if (sp->dirty) 00129 softpipe_update_derived( sp ); 00130 00131 softpipe_map_surfaces(sp); 00132 softpipe_map_constant_buffers(sp); 00133 00134 /* 00135 * Map vertex buffers 00136 */ 00137 for (i = 0; i < sp->num_vertex_buffers; i++) { 00138 void *buf 00139 = pipe_buffer_map(pipe->screen, 00140 sp->vertex_buffer[i].buffer, 00141 PIPE_BUFFER_USAGE_CPU_READ); 00142 draw_set_mapped_vertex_buffer(draw, i, buf); 00143 } 00144 /* Map index buffer, if present */ 00145 if (indexBuffer) { 00146 void *mapped_indexes 00147 = pipe_buffer_map(pipe->screen, indexBuffer, 00148 PIPE_BUFFER_USAGE_CPU_READ); 00149 draw_set_mapped_element_buffer_range(draw, indexSize, 00150 min_index, 00151 max_index, 00152 mapped_indexes); 00153 } 00154 else { 00155 /* no index/element buffer */ 00156 draw_set_mapped_element_buffer_range(draw, 0, start, start + count - 1, NULL); 00157 } 00158 00159 00160 /* draw! */ 00161 draw_arrays(draw, mode, start, count); 00162 00163 /* 00164 * unmap vertex/index buffers - will cause draw module to flush 00165 */ 00166 for (i = 0; i < sp->num_vertex_buffers; i++) { 00167 draw_set_mapped_vertex_buffer(draw, i, NULL); 00168 pipe_buffer_unmap(pipe->screen, sp->vertex_buffer[i].buffer); 00169 } 00170 if (indexBuffer) { 00171 draw_set_mapped_element_buffer(draw, 0, NULL); 00172 pipe_buffer_unmap(pipe->screen, indexBuffer); 00173 } 00174 00175 00176 /* Note: leave drawing surfaces mapped */ 00177 softpipe_unmap_constant_buffers(sp); 00178 00179 return TRUE; 00180 }
static void softpipe_map_constant_buffers | ( | struct softpipe_context * | sp | ) | [static] |
Definition at line 47 of file sp_draw_arrays.c.
References pipe_constant_buffer::buffer, pipe_winsys::buffer_map, softpipe_context::constants, softpipe_context::draw, draw_set_mapped_constant_buffer(), softpipe_context::mapped_constants, softpipe_context::pipe, PIPE_BUFFER_USAGE_CPU_READ, PIPE_SHADER_TYPES, PIPE_SHADER_VERTEX, pipe_constant_buffer::size, and pipe_context::winsys.
00048 { 00049 struct pipe_winsys *ws = sp->pipe.winsys; 00050 uint i; 00051 for (i = 0; i < PIPE_SHADER_TYPES; i++) { 00052 if (sp->constants[i].size) 00053 sp->mapped_constants[i] = ws->buffer_map(ws, sp->constants[i].buffer, 00054 PIPE_BUFFER_USAGE_CPU_READ); 00055 } 00056 00057 draw_set_mapped_constant_buffer(sp->draw, 00058 sp->mapped_constants[PIPE_SHADER_VERTEX], 00059 sp->constants[PIPE_SHADER_VERTEX].size); 00060 }
void softpipe_set_edgeflags | ( | struct pipe_context * | pipe, | |
const unsigned * | edgeflags | |||
) |
Definition at line 197 of file sp_draw_arrays.c.
References softpipe_context::draw, draw_set_edgeflags(), and softpipe_context().
00198 { 00199 struct softpipe_context *sp = softpipe_context(pipe); 00200 draw_set_edgeflags(sp->draw, edgeflags); 00201 }
static void softpipe_unmap_constant_buffers | ( | struct softpipe_context * | sp | ) | [static] |
Definition at line 63 of file sp_draw_arrays.c.
References pipe_constant_buffer::buffer, pipe_winsys::buffer_unmap, softpipe_context::constants, softpipe_context::draw, draw_flush(), draw_set_mapped_constant_buffer(), softpipe_context::mapped_constants, softpipe_context::pipe, pipe_constant_buffer::size, and pipe_context::winsys.
00064 { 00065 struct pipe_winsys *ws = sp->pipe.winsys; 00066 uint i; 00067 00068 /* really need to flush all prims since the vert/frag shaders const buffers 00069 * are going away now. 00070 */ 00071 draw_flush(sp->draw); 00072 00073 draw_set_mapped_constant_buffer(sp->draw, NULL, 0); 00074 00075 for (i = 0; i < 2; i++) { 00076 if (sp->constants[i].size) 00077 ws->buffer_unmap(ws, sp->constants[i].buffer); 00078 sp->mapped_constants[i] = NULL; 00079 } 00080 }
unsigned reduced_prim[PIPE_PRIM_POLYGON+1] [static] |
Initial value:
{ PIPE_PRIM_POINTS, PIPE_PRIM_LINES, PIPE_PRIM_LINES, PIPE_PRIM_LINES, PIPE_PRIM_TRIANGLES, PIPE_PRIM_TRIANGLES, PIPE_PRIM_TRIANGLES, PIPE_PRIM_TRIANGLES, PIPE_PRIM_TRIANGLES, PIPE_PRIM_TRIANGLES }
Definition at line 83 of file sp_draw_arrays.c.