st_draw.h revision f9995b30756140724f41daf963fa06167912be7f
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#include "main/mtypes.h"
404f9ca250d6172176263ef7415fce7140986bc0bcVinson Lee
41b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrianstruct _mesa_index_buffer;
424f9ca250d6172176263ef7415fce7140986bc0bcVinson Leestruct _mesa_prim;
434f9ca250d6172176263ef7415fce7140986bc0bcVinson Leestruct st_context;
4451da8ee85eccf0df3721cbd863cd174382d1ddfdBrian
458e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwellvoid st_init_draw( struct st_context *st );
4651da8ee85eccf0df3721cbd863cd174382d1ddfdBrian
478e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwellvoid st_destroy_draw( struct st_context *st );
488e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell
49b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrianextern void
50f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergst_draw_vbo(struct gl_context *ctx,
51b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian            const struct gl_client_array **arrays,
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,
57b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian            GLuint max_index);
58b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian
59b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrianextern void
60f9995b30756140724f41daf963fa06167912be7fKristian Høgsbergst_feedback_draw_vbo(struct gl_context *ctx,
61b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian                     const struct gl_client_array **arrays,
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,
67b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian                     GLuint max_index);
68b4bacd1fca336f043d1ee3c3a346fbd42a3b02ebBrian
698627a14ec872c532ac7660abfaf1a2db9b8608bbKeith Whitwell/* Internal function:
708627a14ec872c532ac7660abfaf1a2db9b8608bbKeith Whitwell */
718627a14ec872c532ac7660abfaf1a2db9b8608bbKeith Whitwellextern GLuint
725b27b4ad37bd992d2d3a6fd9d407277113544f30Brian Paulst_pipe_vertex_format(GLenum type, GLuint size, GLenum format,
735b27b4ad37bd992d2d3a6fd9d407277113544f30Brian Paul                      GLboolean normalized);
748627a14ec872c532ac7660abfaf1a2db9b8608bbKeith Whitwell
7544af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul
7644af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul/**
7744af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * When drawing with VBOs, the addresses specified with
7844af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
7944af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * addresses.  At some point we need to convert those pointers to offsets.
8044af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * This function is basically a cast wrapper to avoid warnings when building
8144af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul * in 64-bit mode.
8244af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul */
8344af5a953f4189978f698b6a26b5f7b1c6298929Brian Paulstatic INLINE unsigned
8444af5a953f4189978f698b6a26b5f7b1c6298929Brian Paulpointer_to_offset(const void *ptr)
8544af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul{
8644af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul   return (unsigned) (((unsigned long) ptr) & 0xffffffffUL);
8744af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul}
8844af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul
8944af5a953f4189978f698b6a26b5f7b1c6298929Brian Paul
908e4a95a93d15a6707a29454cd47e10b08314cda2Keith Whitwell#endif
91