18e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell/**************************************************************************
28e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
351da8ee85eccf0df3721cbd863cd174382d1ddfdBrian * Copyright 2004 Tungsten Graphics, Inc., Cedar Park, Texas.
48e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * All Rights Reserved.
58e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
68e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * Permission is hereby granted, free of charge, to any person obtaining a
78e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * copy of this software and associated documentation files (the
88e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * "Software"), to deal in the Software without restriction, including
98e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * without limitation the rights to use, copy, modify, merge, publish,
108e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * distribute, sub license, and/or sell copies of the Software, and to
118e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * permit persons to whom the Software is furnished to do so, subject to
128e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * the following conditions:
138e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
148e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * The above copyright notice and this permission notice (including the
158e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * next paragraph) shall be included in all copies or substantial portions
168e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * of the Software.
178e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
188e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
198e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
208e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
218e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * IN NO EVENT SHALL TUNGSTEN GRAPHICS AND/OR ITS SUPPLIERS BE LIABLE FOR
228e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
238e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
248e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
258e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell *
268e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell **************************************************************************/
278e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
288e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell /*
298e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell  * Authors:
308e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell  *   Keith Whitwell <keith@tungstengraphics.com>
318e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell  */
328e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
338e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
348e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#ifndef ST_DRAW_H
358e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#define ST_DRAW_H
368e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
374f9ca250d6172176263ef7415fce7140986bc0bcVinson Lee#include "main/compiler.h"
384f9ca250d6172176263ef7415fce7140986bc0bcVinson Lee#include "main/glheader.h"
394f9ca250d6172176263ef7415fce7140986bc0bcVinson Lee
40b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrianstruct _mesa_index_buffer;
414f9ca250d6172176263ef7415fce7140986bc0bcVinson Leestruct _mesa_prim;
423d03b4d839afeb4939b28c21ca32f6cb069f4495Vinson Leestruct gl_client_array;
433d03b4d839afeb4939b28c21ca32f6cb069f4495Vinson Leestruct gl_context;
444f9ca250d6172176263ef7415fce7140986bc0bcVinson Leestruct st_context;
4551da8ee85eccf0df3721cbd863cd174382d1ddfdBrian
468e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwellvoid st_init_draw( struct st_context *st );
4751da8ee85eccf0df3721cbd863cd174382d1ddfdBrian
488e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwellvoid st_destroy_draw( struct st_context *st );
498e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
50b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrianextern void
51f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergst_draw_vbo(struct gl_context *ctx,
52b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian            const struct _mesa_prim *prims,
53b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian            GLuint nr_prims,
54b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian            const struct _mesa_index_buffer *ib,
552708ddfb06a36d8568e2aa130bf1f7d551fcd309Eric Anholt	    GLboolean index_bounds_valid,
56b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian            GLuint min_index,
5714bb957b996dcc5392b8fa589bd3ffa5c55cb6b4Marek Olšák            GLuint max_index,
5814bb957b996dcc5392b8fa589bd3ffa5c55cb6b4Marek Olšák            struct gl_transform_feedback_object *tfb_vertcount);
59b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian
60b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrianextern void
61f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergst_feedback_draw_vbo(struct gl_context *ctx,
62b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian                     const struct _mesa_prim *prims,
63b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian                     GLuint nr_prims,
64b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian                     const struct _mesa_index_buffer *ib,
652708ddfb06a36d8568e2aa130bf1f7d551fcd309Eric Anholt		     GLboolean index_bounds_valid,
66b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian                     GLuint min_index,
6714bb957b996dcc5392b8fa589bd3ffa5c55cb6b4Marek Olšák                     GLuint max_index,
6814bb957b996dcc5392b8fa589bd3ffa5c55cb6b4Marek Olšák                     struct gl_transform_feedback_object *tfb_vertcount);
69b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian
7044af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul/**
7144af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * When drawing with VBOs, the addresses specified with
7244af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
7344af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * addresses.  At some point we need to convert those pointers to offsets.
7444af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * This function is basically a cast wrapper to avoid warnings when building
7544af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * in 64-bit mode.
7644af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul */
7744af5a953f4189978f698b6a26b5f7b1c6298929Brian Paulstatic INLINE unsigned
7844af5a953f4189978f698b6a26b5f7b1c6298929Brian Paulpointer_to_offset(const void *ptr)
7944af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul{
8044af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul   return (unsigned) (((unsigned long) ptr) & 0xffffffffUL);
8144af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul}
8244af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul
8344af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul
848e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif
85