14a49301eSmrg/**************************************************************************
24a49301eSmrg *
3af69d88dSmrg * Copyright 2004 VMware, Inc.
44a49301eSmrg * All Rights Reserved.
54a49301eSmrg *
64a49301eSmrg * Permission is hereby granted, free of charge, to any person obtaining a
74a49301eSmrg * copy of this software and associated documentation files (the
84a49301eSmrg * "Software"), to deal in the Software without restriction, including
94a49301eSmrg * without limitation the rights to use, copy, modify, merge, publish,
104a49301eSmrg * distribute, sub license, and/or sell copies of the Software, and to
114a49301eSmrg * permit persons to whom the Software is furnished to do so, subject to
124a49301eSmrg * the following conditions:
134a49301eSmrg *
144a49301eSmrg * The above copyright notice and this permission notice (including the
154a49301eSmrg * next paragraph) shall be included in all copies or substantial portions
164a49301eSmrg * of the Software.
174a49301eSmrg *
184a49301eSmrg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
194a49301eSmrg * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
204a49301eSmrg * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21af69d88dSmrg * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
224a49301eSmrg * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
234a49301eSmrg * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
244a49301eSmrg * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
254a49301eSmrg *
264a49301eSmrg **************************************************************************/
274a49301eSmrg
284a49301eSmrg /*
294a49301eSmrg  * Authors:
30af69d88dSmrg  *   Keith Whitwell <keithw@vmware.com>
314a49301eSmrg  */
324a49301eSmrg
334a49301eSmrg
344a49301eSmrg#ifndef ST_DRAW_H
354a49301eSmrg#define ST_DRAW_H
364a49301eSmrg
373464ebd5Sriastradh#include "main/glheader.h"
383464ebd5Sriastradh
394a49301eSmrgstruct _mesa_index_buffer;
403464ebd5Sriastradhstruct _mesa_prim;
413464ebd5Sriastradhstruct gl_context;
423464ebd5Sriastradhstruct st_context;
434a49301eSmrg
447ec681f3Smrgvoid st_init_draw_functions(struct pipe_screen *screen,
457ec681f3Smrg                            struct dd_function_table *functions);
464a49301eSmrg
474a49301eSmrgvoid st_destroy_draw( struct st_context *st );
484a49301eSmrg
4901e04c3fSmrgstruct draw_context *st_get_draw_context(struct st_context *st);
504a49301eSmrg
514a49301eSmrgextern void
523464ebd5Sriastradhst_feedback_draw_vbo(struct gl_context *ctx,
534a49301eSmrg                     const struct _mesa_prim *prims,
547ec681f3Smrg                     unsigned nr_prims,
554a49301eSmrg                     const struct _mesa_index_buffer *ib,
567ec681f3Smrg		     bool index_bounds_valid,
577ec681f3Smrg                     bool primitive_restart,
587ec681f3Smrg                     unsigned restart_index,
597ec681f3Smrg                     unsigned min_index,
607ec681f3Smrg                     unsigned max_index,
617ec681f3Smrg                     unsigned num_instances,
627ec681f3Smrg                     unsigned base_instance);
634a49301eSmrg
644a49301eSmrg/**
654a49301eSmrg * When drawing with VBOs, the addresses specified with
664a49301eSmrg * glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
674a49301eSmrg * addresses.  At some point we need to convert those pointers to offsets.
684a49301eSmrg * This function is basically a cast wrapper to avoid warnings when building
694a49301eSmrg * in 64-bit mode.
704a49301eSmrg */
7101e04c3fSmrgstatic inline unsigned
724a49301eSmrgpointer_to_offset(const void *ptr)
734a49301eSmrg{
74af69d88dSmrg   return (unsigned) (((GLsizeiptr) ptr) & 0xffffffffUL);
754a49301eSmrg}
764a49301eSmrg
774a49301eSmrg
7801e04c3fSmrgbool
7901e04c3fSmrgst_draw_quad(struct st_context *st,
8001e04c3fSmrg             float x0, float y0, float x1, float y1, float z,
8101e04c3fSmrg             float s0, float t0, float s1, float t1,
8201e04c3fSmrg             const float *color,
8301e04c3fSmrg             unsigned num_instances);
8401e04c3fSmrg
854a49301eSmrg#endif
86