Merge remote branch 'upstream/gallium-0.1' into nouveau-gallium-0.1
[mesa.git] / src / mesa / state_tracker / st_draw.c
1 /**************************************************************************
2 *
3 * Copyright 2007 Tungsten Graphics, Inc., Cedar Park, Texas.
4 * 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 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.
25 *
26 **************************************************************************/
27
28 /*
29 * Authors:
30 * Keith Whitwell <keith@tungstengraphics.com>
31 */
32
33 #include "main/imports.h"
34 #include "main/image.h"
35
36 #include "vbo/vbo.h"
37
38 #include "st_context.h"
39 #include "st_atom.h"
40 #include "st_cb_bufferobjects.h"
41 #include "st_draw.h"
42 #include "st_program.h"
43
44 #include "pipe/p_context.h"
45 #include "pipe/p_defines.h"
46 #include "pipe/p_inlines.h"
47
48 #include "draw/draw_private.h"
49 #include "draw/draw_context.h"
50
51
52 static GLuint double_types[4] = {
53 PIPE_FORMAT_R64_FLOAT,
54 PIPE_FORMAT_R64G64_FLOAT,
55 PIPE_FORMAT_R64G64B64_FLOAT,
56 PIPE_FORMAT_R64G64B64A64_FLOAT
57 };
58
59 static GLuint float_types[4] = {
60 PIPE_FORMAT_R32_FLOAT,
61 PIPE_FORMAT_R32G32_FLOAT,
62 PIPE_FORMAT_R32G32B32_FLOAT,
63 PIPE_FORMAT_R32G32B32A32_FLOAT
64 };
65
66 static GLuint uint_types_norm[4] = {
67 PIPE_FORMAT_R32_UNORM,
68 PIPE_FORMAT_R32G32_UNORM,
69 PIPE_FORMAT_R32G32B32_UNORM,
70 PIPE_FORMAT_R32G32B32A32_UNORM
71 };
72
73 static GLuint uint_types_scale[4] = {
74 PIPE_FORMAT_R32_USCALED,
75 PIPE_FORMAT_R32G32_USCALED,
76 PIPE_FORMAT_R32G32B32_USCALED,
77 PIPE_FORMAT_R32G32B32A32_USCALED
78 };
79
80 static GLuint int_types_norm[4] = {
81 PIPE_FORMAT_R32_SNORM,
82 PIPE_FORMAT_R32G32_SNORM,
83 PIPE_FORMAT_R32G32B32_SNORM,
84 PIPE_FORMAT_R32G32B32A32_SNORM
85 };
86
87 static GLuint int_types_scale[4] = {
88 PIPE_FORMAT_R32_SSCALED,
89 PIPE_FORMAT_R32G32_SSCALED,
90 PIPE_FORMAT_R32G32B32_SSCALED,
91 PIPE_FORMAT_R32G32B32A32_SSCALED
92 };
93
94 static GLuint ushort_types_norm[4] = {
95 PIPE_FORMAT_R16_UNORM,
96 PIPE_FORMAT_R16G16_UNORM,
97 PIPE_FORMAT_R16G16B16_UNORM,
98 PIPE_FORMAT_R16G16B16A16_UNORM
99 };
100
101 static GLuint ushort_types_scale[4] = {
102 PIPE_FORMAT_R16_USCALED,
103 PIPE_FORMAT_R16G16_USCALED,
104 PIPE_FORMAT_R16G16B16_USCALED,
105 PIPE_FORMAT_R16G16B16A16_USCALED
106 };
107
108 static GLuint short_types_norm[4] = {
109 PIPE_FORMAT_R16_SNORM,
110 PIPE_FORMAT_R16G16_SNORM,
111 PIPE_FORMAT_R16G16B16_SNORM,
112 PIPE_FORMAT_R16G16B16A16_SNORM
113 };
114
115 static GLuint short_types_scale[4] = {
116 PIPE_FORMAT_R16_SSCALED,
117 PIPE_FORMAT_R16G16_SSCALED,
118 PIPE_FORMAT_R16G16B16_SSCALED,
119 PIPE_FORMAT_R16G16B16A16_SSCALED
120 };
121
122 static GLuint ubyte_types_norm[4] = {
123 PIPE_FORMAT_R8_UNORM,
124 PIPE_FORMAT_R8G8_UNORM,
125 PIPE_FORMAT_R8G8B8_UNORM,
126 PIPE_FORMAT_R8G8B8A8_UNORM
127 };
128
129 static GLuint ubyte_types_scale[4] = {
130 PIPE_FORMAT_R8_USCALED,
131 PIPE_FORMAT_R8G8_USCALED,
132 PIPE_FORMAT_R8G8B8_USCALED,
133 PIPE_FORMAT_R8G8B8A8_USCALED
134 };
135
136 static GLuint byte_types_norm[4] = {
137 PIPE_FORMAT_R8_SNORM,
138 PIPE_FORMAT_R8G8_SNORM,
139 PIPE_FORMAT_R8G8B8_SNORM,
140 PIPE_FORMAT_R8G8B8A8_SNORM
141 };
142
143 static GLuint byte_types_scale[4] = {
144 PIPE_FORMAT_R8_SSCALED,
145 PIPE_FORMAT_R8G8_SSCALED,
146 PIPE_FORMAT_R8G8B8_SSCALED,
147 PIPE_FORMAT_R8G8B8A8_SSCALED
148 };
149
150 static GLuint fixed_types[4] = {
151 PIPE_FORMAT_R32_FIXED,
152 PIPE_FORMAT_R32G32_FIXED,
153 PIPE_FORMAT_R32G32B32_FIXED,
154 PIPE_FORMAT_R32G32B32A32_FIXED
155 };
156
157
158
159 /**
160 * Return a PIPE_FORMAT_x for the given GL datatype and size.
161 */
162 static GLuint
163 pipe_vertex_format(GLenum type, GLuint size, GLboolean normalized)
164 {
165 assert((type >= GL_BYTE && type <= GL_DOUBLE) ||
166 type == GL_FIXED);
167 assert(size >= 1);
168 assert(size <= 4);
169
170 if (normalized) {
171 switch (type) {
172 case GL_DOUBLE: return double_types[size-1];
173 case GL_FLOAT: return float_types[size-1];
174 case GL_INT: return int_types_norm[size-1];
175 case GL_SHORT: return short_types_norm[size-1];
176 case GL_BYTE: return byte_types_norm[size-1];
177 case GL_UNSIGNED_INT: return uint_types_norm[size-1];
178 case GL_UNSIGNED_SHORT: return ushort_types_norm[size-1];
179 case GL_UNSIGNED_BYTE: return ubyte_types_norm[size-1];
180 case GL_FIXED: return fixed_types[size-1];
181 default: assert(0); return 0;
182 }
183 }
184 else {
185 switch (type) {
186 case GL_DOUBLE: return double_types[size-1];
187 case GL_FLOAT: return float_types[size-1];
188 case GL_INT: return int_types_scale[size-1];
189 case GL_SHORT: return short_types_scale[size-1];
190 case GL_BYTE: return byte_types_scale[size-1];
191 case GL_UNSIGNED_INT: return uint_types_scale[size-1];
192 case GL_UNSIGNED_SHORT: return ushort_types_scale[size-1];
193 case GL_UNSIGNED_BYTE: return ubyte_types_scale[size-1];
194 case GL_FIXED: return fixed_types[size-1];
195 default: assert(0); return 0;
196 }
197 }
198 return 0; /* silence compiler warning */
199 }
200
201
202 /*
203 * If edge flags are needed, setup an bitvector of flags and call
204 * pipe->set_edgeflags().
205 * XXX memleak: need to free the returned pointer at some point
206 */
207 static void *
208 setup_edgeflags(GLcontext *ctx, GLenum primMode, GLint start, GLint count,
209 const struct gl_client_array *array)
210 {
211 struct pipe_context *pipe = ctx->st->pipe;
212
213 if ((primMode == GL_TRIANGLES ||
214 primMode == GL_QUADS ||
215 primMode == GL_POLYGON) &&
216 (ctx->Polygon.FrontMode != GL_FILL ||
217 ctx->Polygon.BackMode != GL_FILL)) {
218 /* need edge flags */
219 GLint i;
220 unsigned *vec;
221 struct st_buffer_object *stobj = st_buffer_object(array->BufferObj);
222 ubyte *map;
223
224 if (!stobj)
225 return NULL;
226
227 vec = (unsigned *) calloc(sizeof(unsigned), (count + 31) / 32);
228 if (!vec)
229 return NULL;
230
231 map = pipe_buffer_map(pipe, stobj->buffer, PIPE_BUFFER_USAGE_CPU_READ);
232 map = ADD_POINTERS(map, array->Ptr);
233
234 for (i = 0; i < count; i++) {
235 if (*((float *) map))
236 vec[i/32] |= 1 << (i % 32);
237
238 map += array->StrideB;
239 }
240
241 pipe_buffer_unmap(pipe, stobj->buffer);
242
243 pipe->set_edgeflags(pipe, vec);
244
245 return vec;
246 }
247 else {
248 /* edge flags not needed */
249 pipe->set_edgeflags(pipe, NULL);
250 return NULL;
251 }
252 }
253
254
255
256 /**
257 * This function gets plugged into the VBO module and is called when
258 * we have something to render.
259 * Basically, translate the information into the format expected by pipe.
260 */
261 void
262 st_draw_vbo(GLcontext *ctx,
263 const struct gl_client_array **arrays,
264 const struct _mesa_prim *prims,
265 GLuint nr_prims,
266 const struct _mesa_index_buffer *ib,
267 GLuint min_index,
268 GLuint max_index)
269 {
270 struct pipe_context *pipe = ctx->st->pipe;
271 const struct st_vertex_program *vp;
272 const struct pipe_shader_state *vs;
273 struct pipe_vertex_buffer vbuffer[PIPE_MAX_SHADER_INPUTS];
274 GLuint attr;
275 struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
276
277 /* sanity check for pointer arithmetic below */
278 assert(sizeof(arrays[0]->Ptr[0]) == 1);
279
280 st_validate_state(ctx->st);
281
282 /* must get these after state validation! */
283 vp = ctx->st->vp;
284 vs = &ctx->st->vp->state;
285
286 /* loop over TGSI shader inputs to determine vertex buffer
287 * and attribute info
288 */
289 for (attr = 0; attr < vp->num_inputs; attr++) {
290 const GLuint mesaAttr = vp->index_to_input[attr];
291 struct gl_buffer_object *bufobj = arrays[mesaAttr]->BufferObj;
292
293 if (bufobj && bufobj->Name) {
294 /* Attribute data is in a VBO.
295 * Recall that for VBOs, the gl_client_array->Ptr field is
296 * really an offset from the start of the VBO, not a pointer.
297 */
298 struct st_buffer_object *stobj = st_buffer_object(bufobj);
299 assert(stobj->buffer);
300
301 vbuffer[attr].buffer = NULL;
302 pipe_reference_buffer(pipe, &vbuffer[attr].buffer, stobj->buffer);
303 vbuffer[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
304 velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
305 assert(velements[attr].src_offset <= 2048); /* 11-bit field */
306 }
307 else {
308 /* attribute data is in user-space memory, not a VBO */
309 uint bytes;
310
311 if (!arrays[mesaAttr]->StrideB) {
312 bytes = arrays[mesaAttr]->Size
313 * _mesa_sizeof_type(arrays[mesaAttr]->Type);
314 } else {
315 bytes = arrays[mesaAttr]->StrideB * (max_index + 1);
316 }
317
318 /* wrap user data */
319 vbuffer[attr].buffer
320 = pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
321 bytes);
322 vbuffer[attr].buffer_offset = 0;
323 velements[attr].src_offset = 0;
324 }
325
326 /* common-case setup */
327 vbuffer[attr].pitch = arrays[mesaAttr]->StrideB; /* in bytes */
328 vbuffer[attr].max_index = max_index;
329 velements[attr].vertex_buffer_index = attr;
330 velements[attr].nr_components = arrays[mesaAttr]->Size;
331 velements[attr].src_format
332 = pipe_vertex_format(arrays[mesaAttr]->Type,
333 arrays[mesaAttr]->Size,
334 arrays[mesaAttr]->Normalized);
335 assert(velements[attr].src_format);
336 }
337
338 pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
339 pipe->set_vertex_elements(pipe, vp->num_inputs, velements);
340
341 /* do actual drawing */
342 if (ib) {
343 /* indexed primitive */
344 struct gl_buffer_object *bufobj = ib->obj;
345 struct pipe_buffer *indexBuf = NULL;
346 unsigned indexSize, indexOffset, i;
347
348 switch (ib->type) {
349 case GL_UNSIGNED_INT:
350 indexSize = 4;
351 break;
352 case GL_UNSIGNED_SHORT:
353 indexSize = 2;
354 break;
355 case GL_UNSIGNED_BYTE:
356 indexSize = 1;
357 break;
358 default:
359 assert(0);
360 return;
361 }
362
363 /* get/create the index buffer object */
364 if (bufobj && bufobj->Name) {
365 /* elements/indexes are in a real VBO */
366 struct st_buffer_object *stobj = st_buffer_object(bufobj);
367 pipe_reference_buffer(pipe, &indexBuf, stobj->buffer);
368 indexOffset = (unsigned) ib->ptr / indexSize;
369 }
370 else {
371 /* element/indicies are in user space memory */
372 indexBuf = pipe_user_buffer_create(pipe, (void *) ib->ptr,
373 ib->count * indexSize);
374 indexOffset = 0;
375 }
376
377 /* draw */
378 if (nr_prims == 1 && pipe->draw_range_elements != NULL) {
379 i = 0;
380
381 /* XXX: exercise temporary path to pass min/max directly
382 * through to driver & draw module. These interfaces still
383 * need a bit of work...
384 */
385 setup_edgeflags(ctx, prims[i].mode,
386 prims[i].start + indexOffset, prims[i].count,
387 arrays[VERT_ATTRIB_EDGEFLAG]);
388
389 pipe->draw_range_elements(pipe, indexBuf, indexSize,
390 min_index,
391 max_index,
392 prims[i].mode,
393 prims[i].start + indexOffset, prims[i].count);
394 }
395 else {
396 for (i = 0; i < nr_prims; i++) {
397 setup_edgeflags(ctx, prims[i].mode,
398 prims[i].start + indexOffset, prims[i].count,
399 arrays[VERT_ATTRIB_EDGEFLAG]);
400
401 pipe->draw_elements(pipe, indexBuf, indexSize,
402 prims[i].mode,
403 prims[i].start + indexOffset, prims[i].count);
404 }
405 }
406
407 pipe_reference_buffer(pipe, &indexBuf, NULL);
408 }
409 else {
410 /* non-indexed */
411 GLuint i;
412 for (i = 0; i < nr_prims; i++) {
413 setup_edgeflags(ctx, prims[i].mode,
414 prims[i].start, prims[i].count,
415 arrays[VERT_ATTRIB_EDGEFLAG]);
416
417 pipe->draw_arrays(pipe, prims[i].mode, prims[i].start, prims[i].count);
418 }
419 }
420
421 /* unreference buffers (frees wrapped user-space buffer objects) */
422 for (attr = 0; attr < vp->num_inputs; attr++) {
423 pipe_reference_buffer(pipe, &vbuffer[attr].buffer, NULL);
424 assert(!vbuffer[attr].buffer);
425 }
426 pipe->set_vertex_buffers(pipe, vp->num_inputs, vbuffer);
427 }
428
429
430
431 /**
432 * Set the (private) draw module's post-transformed vertex format when in
433 * GL_SELECT or GL_FEEDBACK mode or for glRasterPos.
434 */
435 static void
436 set_feedback_vertex_format(GLcontext *ctx)
437 {
438 #if 0
439 struct st_context *st = ctx->st;
440 struct vertex_info vinfo;
441 GLuint i;
442
443 memset(&vinfo, 0, sizeof(vinfo));
444
445 if (ctx->RenderMode == GL_SELECT) {
446 assert(ctx->RenderMode == GL_SELECT);
447 vinfo.num_attribs = 1;
448 vinfo.format[0] = FORMAT_4F;
449 vinfo.interp_mode[0] = INTERP_LINEAR;
450 }
451 else {
452 /* GL_FEEDBACK, or glRasterPos */
453 /* emit all attribs (pos, color, texcoord) as GLfloat[4] */
454 vinfo.num_attribs = st->state.vs->cso->state.num_outputs;
455 for (i = 0; i < vinfo.num_attribs; i++) {
456 vinfo.format[i] = FORMAT_4F;
457 vinfo.interp_mode[i] = INTERP_LINEAR;
458 }
459 }
460
461 draw_set_vertex_info(st->draw, &vinfo);
462 #endif
463 }
464
465
466 /**
467 * Called by VBO to draw arrays when in selection or feedback mode and
468 * to implement glRasterPos.
469 * This is very much like the normal draw_vbo() function above.
470 * Look at code refactoring some day.
471 * Might move this into the failover module some day.
472 */
473 void
474 st_feedback_draw_vbo(GLcontext *ctx,
475 const struct gl_client_array **arrays,
476 const struct _mesa_prim *prims,
477 GLuint nr_prims,
478 const struct _mesa_index_buffer *ib,
479 GLuint min_index,
480 GLuint max_index)
481 {
482 struct st_context *st = ctx->st;
483 struct pipe_context *pipe = st->pipe;
484 struct draw_context *draw = st->draw;
485 const struct st_vertex_program *vp;
486 const struct pipe_shader_state *vs;
487 struct pipe_buffer *index_buffer_handle = 0;
488 struct pipe_vertex_buffer vbuffers[PIPE_MAX_SHADER_INPUTS];
489 struct pipe_vertex_element velements[PIPE_MAX_ATTRIBS];
490 GLuint attr, i;
491 ubyte *mapped_constants;
492
493 assert(draw);
494
495 st_validate_state(ctx->st);
496
497 /* must get these after state validation! */
498 vp = ctx->st->vp;
499 vs = &st->vp->state;
500
501 if (!st->vp->draw_shader) {
502 st->vp->draw_shader = draw_create_vertex_shader(draw, vs);
503 }
504
505 /*
506 * Set up the draw module's state.
507 *
508 * We'd like to do this less frequently, but the normal state-update
509 * code sends state updates to the pipe, not to our private draw module.
510 */
511 assert(draw);
512 draw_set_viewport_state(draw, &st->state.viewport);
513 draw_set_clip_state(draw, &st->state.clip);
514 draw_set_rasterizer_state(draw, &st->state.rasterizer);
515 draw_bind_vertex_shader(draw, st->vp->draw_shader);
516 set_feedback_vertex_format(ctx);
517
518 /* loop over TGSI shader inputs to determine vertex buffer
519 * and attribute info
520 */
521 for (attr = 0; attr < vp->num_inputs; attr++) {
522 const GLuint mesaAttr = vp->index_to_input[attr];
523 struct gl_buffer_object *bufobj = arrays[mesaAttr]->BufferObj;
524 void *map;
525
526 if (bufobj && bufobj->Name) {
527 /* Attribute data is in a VBO.
528 * Recall that for VBOs, the gl_client_array->Ptr field is
529 * really an offset from the start of the VBO, not a pointer.
530 */
531 struct st_buffer_object *stobj = st_buffer_object(bufobj);
532 assert(stobj->buffer);
533
534 vbuffers[attr].buffer = NULL;
535 pipe_reference_buffer(pipe, &vbuffers[attr].buffer, stobj->buffer);
536 vbuffers[attr].buffer_offset = (unsigned) arrays[0]->Ptr;/* in bytes */
537 velements[attr].src_offset = arrays[mesaAttr]->Ptr - arrays[0]->Ptr;
538 }
539 else {
540 /* attribute data is in user-space memory, not a VBO */
541 uint bytes = (arrays[mesaAttr]->Size
542 * _mesa_sizeof_type(arrays[mesaAttr]->Type)
543 * (max_index + 1));
544
545 /* wrap user data */
546 vbuffers[attr].buffer
547 = pipe_user_buffer_create(pipe, (void *) arrays[mesaAttr]->Ptr,
548 bytes);
549 vbuffers[attr].buffer_offset = 0;
550 velements[attr].src_offset = 0;
551 }
552
553 /* common-case setup */
554 vbuffers[attr].pitch = arrays[mesaAttr]->StrideB; /* in bytes */
555 vbuffers[attr].max_index = max_index;
556 velements[attr].vertex_buffer_index = attr;
557 velements[attr].nr_components = arrays[mesaAttr]->Size;
558 velements[attr].src_format = pipe_vertex_format(arrays[mesaAttr]->Type,
559 arrays[mesaAttr]->Size,
560 arrays[mesaAttr]->Normalized);
561 assert(velements[attr].src_format);
562
563 /* tell draw about this attribute */
564 #if 0
565 draw_set_vertex_buffer(draw, attr, &vbuffer[attr]);
566 #endif
567
568 /* map the attrib buffer */
569 map = pipe_buffer_map(pipe, vbuffers[attr].buffer,
570 PIPE_BUFFER_USAGE_CPU_READ);
571 draw_set_mapped_vertex_buffer(draw, attr, map);
572 }
573
574 draw_set_vertex_buffers(draw, vp->num_inputs, vbuffers);
575 draw_set_vertex_elements(draw, vp->num_inputs, velements);
576
577 if (ib) {
578 unsigned indexSize;
579 struct gl_buffer_object *bufobj = ib->obj;
580 struct st_buffer_object *stobj = st_buffer_object(bufobj);
581 void *map;
582
583 index_buffer_handle = stobj->buffer;
584
585 switch (ib->type) {
586 case GL_UNSIGNED_INT:
587 indexSize = 4;
588 break;
589 case GL_UNSIGNED_SHORT:
590 indexSize = 2;
591 break;
592 default:
593 assert(0);
594 return;
595 }
596
597 map = pipe_buffer_map(pipe, index_buffer_handle,
598 PIPE_BUFFER_USAGE_CPU_READ);
599 draw_set_mapped_element_buffer(draw, indexSize, map);
600 }
601 else {
602 /* no index/element buffer */
603 draw_set_mapped_element_buffer(draw, 0, NULL);
604 }
605
606
607 /* map constant buffers */
608 mapped_constants = pipe_buffer_map(pipe,
609 st->state.constants[PIPE_SHADER_VERTEX].buffer,
610 PIPE_BUFFER_USAGE_CPU_READ);
611 draw_set_mapped_constant_buffer(st->draw, mapped_constants,
612 st->state.constants[PIPE_SHADER_VERTEX].buffer->size);
613
614
615 /* draw here */
616 for (i = 0; i < nr_prims; i++) {
617 draw_arrays(draw, prims[i].mode, prims[i].start, prims[i].count);
618 }
619
620
621 /* unmap constant buffers */
622 pipe_buffer_unmap(pipe, st->state.constants[PIPE_SHADER_VERTEX].buffer);
623
624 /*
625 * unmap vertex/index buffers
626 */
627 for (i = 0; i < PIPE_MAX_ATTRIBS; i++) {
628 if (draw->pt.vertex_buffer[i].buffer) {
629 pipe_buffer_unmap(pipe, draw->pt.vertex_buffer[i].buffer);
630 pipe_reference_buffer(pipe, &draw->pt.vertex_buffer[i].buffer, NULL);
631 draw_set_mapped_vertex_buffer(draw, i, NULL);
632 }
633 }
634 if (ib) {
635 pipe_buffer_unmap(pipe, index_buffer_handle);
636 draw_set_mapped_element_buffer(draw, 0, NULL);
637 }
638 }
639
640
641
642 void st_init_draw( struct st_context *st )
643 {
644 GLcontext *ctx = st->ctx;
645
646 vbo_set_draw_func(ctx, st_draw_vbo);
647 }
648
649
650 void st_destroy_draw( struct st_context *st )
651 {
652 }
653
654