1848b8605Smrg/**************************************************************************
2848b8605Smrg *
3848b8605Smrg * Copyright 2004 VMware, Inc.
4848b8605Smrg * All Rights Reserved.
5848b8605Smrg *
6848b8605Smrg * Permission is hereby granted, free of charge, to any person obtaining a
7848b8605Smrg * copy of this software and associated documentation files (the
8848b8605Smrg * "Software"), to deal in the Software without restriction, including
9848b8605Smrg * without limitation the rights to use, copy, modify, merge, publish,
10848b8605Smrg * distribute, sub license, and/or sell copies of the Software, and to
11848b8605Smrg * permit persons to whom the Software is furnished to do so, subject to
12848b8605Smrg * the following conditions:
13848b8605Smrg *
14848b8605Smrg * The above copyright notice and this permission notice (including the
15848b8605Smrg * next paragraph) shall be included in all copies or substantial portions
16848b8605Smrg * of the Software.
17848b8605Smrg *
18848b8605Smrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19848b8605Smrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20848b8605Smrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21848b8605Smrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22848b8605Smrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23848b8605Smrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24848b8605Smrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25848b8605Smrg *
26848b8605Smrg **************************************************************************/
27848b8605Smrg
28848b8605Smrg /*
29848b8605Smrg  * Authors:
30848b8605Smrg  *   Keith Whitwell <keithw@vmware.com>
31848b8605Smrg  */
32848b8605Smrg
33848b8605Smrg
34848b8605Smrg#ifndef ST_DRAW_H
35848b8605Smrg#define ST_DRAW_H
36848b8605Smrg
37848b8605Smrg#include "main/glheader.h"
38848b8605Smrg
39848b8605Smrgstruct _mesa_index_buffer;
40848b8605Smrgstruct _mesa_prim;
41848b8605Smrgstruct gl_context;
42848b8605Smrgstruct st_context;
43848b8605Smrg
44b8e80941Smrgvoid st_init_draw_functions(struct dd_function_table *functions);
45848b8605Smrg
46848b8605Smrgvoid st_destroy_draw( struct st_context *st );
47848b8605Smrg
48b8e80941Smrgstruct draw_context *st_get_draw_context(struct st_context *st);
49848b8605Smrg
50848b8605Smrgextern void
51848b8605Smrgst_feedback_draw_vbo(struct gl_context *ctx,
52848b8605Smrg                     const struct _mesa_prim *prims,
53848b8605Smrg                     GLuint nr_prims,
54848b8605Smrg                     const struct _mesa_index_buffer *ib,
55848b8605Smrg		     GLboolean index_bounds_valid,
56848b8605Smrg                     GLuint min_index,
57848b8605Smrg                     GLuint max_index,
58848b8605Smrg                     struct gl_transform_feedback_object *tfb_vertcount,
59b8e80941Smrg                     unsigned stream,
60848b8605Smrg                     struct gl_buffer_object *indirect);
61848b8605Smrg
62848b8605Smrg/**
63848b8605Smrg * When drawing with VBOs, the addresses specified with
64848b8605Smrg * glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
65848b8605Smrg * addresses.  At some point we need to convert those pointers to offsets.
66848b8605Smrg * This function is basically a cast wrapper to avoid warnings when building
67848b8605Smrg * in 64-bit mode.
68848b8605Smrg */
69b8e80941Smrgstatic inline unsigned
70848b8605Smrgpointer_to_offset(const void *ptr)
71848b8605Smrg{
72848b8605Smrg   return (unsigned) (((GLsizeiptr) ptr) & 0xffffffffUL);
73848b8605Smrg}
74848b8605Smrg
75848b8605Smrg
76b8e80941Smrgbool
77b8e80941Smrgst_draw_quad(struct st_context *st,
78b8e80941Smrg             float x0, float y0, float x1, float y1, float z,
79b8e80941Smrg             float s0, float t0, float s1, float t1,
80b8e80941Smrg             const float *color,
81b8e80941Smrg             unsigned num_instances);
82b8e80941Smrg
83848b8605Smrg#endif
84