1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2004 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
15bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
16bf215546Sopenharmony_ci * of the Software.
17bf215546Sopenharmony_ci *
18bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
19bf215546Sopenharmony_ci * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
20bf215546Sopenharmony_ci * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT.
21bf215546Sopenharmony_ci * IN NO EVENT SHALL VMWARE AND/OR ITS SUPPLIERS BE LIABLE FOR
22bf215546Sopenharmony_ci * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
23bf215546Sopenharmony_ci * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
24bf215546Sopenharmony_ci * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci /*
29bf215546Sopenharmony_ci  * Authors:
30bf215546Sopenharmony_ci  *   Keith Whitwell <keithw@vmware.com>
31bf215546Sopenharmony_ci  */
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#ifndef ST_DRAW_H
35bf215546Sopenharmony_ci#define ST_DRAW_H
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci#include "main/glheader.h"
38bf215546Sopenharmony_ci
39bf215546Sopenharmony_cistruct _mesa_index_buffer;
40bf215546Sopenharmony_cistruct _mesa_prim;
41bf215546Sopenharmony_cistruct gl_context;
42bf215546Sopenharmony_cistruct st_context;
43bf215546Sopenharmony_ci
44bf215546Sopenharmony_civoid st_init_draw_functions(struct pipe_screen *screen,
45bf215546Sopenharmony_ci                            struct dd_function_table *functions);
46bf215546Sopenharmony_ci
47bf215546Sopenharmony_civoid st_destroy_draw( struct st_context *st );
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_cistruct draw_context *st_get_draw_context(struct st_context *st);
50bf215546Sopenharmony_ci
51bf215546Sopenharmony_ciextern void
52bf215546Sopenharmony_cist_feedback_draw_vbo(struct gl_context *ctx,
53bf215546Sopenharmony_ci                     const struct _mesa_prim *prims,
54bf215546Sopenharmony_ci                     unsigned nr_prims,
55bf215546Sopenharmony_ci                     const struct _mesa_index_buffer *ib,
56bf215546Sopenharmony_ci		     bool index_bounds_valid,
57bf215546Sopenharmony_ci                     bool primitive_restart,
58bf215546Sopenharmony_ci                     unsigned restart_index,
59bf215546Sopenharmony_ci                     unsigned min_index,
60bf215546Sopenharmony_ci                     unsigned max_index,
61bf215546Sopenharmony_ci                     unsigned num_instances,
62bf215546Sopenharmony_ci                     unsigned base_instance);
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_ci/**
65bf215546Sopenharmony_ci * When drawing with VBOs, the addresses specified with
66bf215546Sopenharmony_ci * glVertex/Color/TexCoordPointer() are really offsets into the VBO, not real
67bf215546Sopenharmony_ci * addresses.  At some point we need to convert those pointers to offsets.
68bf215546Sopenharmony_ci * This function is basically a cast wrapper to avoid warnings when building
69bf215546Sopenharmony_ci * in 64-bit mode.
70bf215546Sopenharmony_ci */
71bf215546Sopenharmony_cistatic inline unsigned
72bf215546Sopenharmony_cipointer_to_offset(const void *ptr)
73bf215546Sopenharmony_ci{
74bf215546Sopenharmony_ci   return (unsigned) (((GLsizeiptr) ptr) & 0xffffffffUL);
75bf215546Sopenharmony_ci}
76bf215546Sopenharmony_ci
77bf215546Sopenharmony_ci
78bf215546Sopenharmony_cibool
79bf215546Sopenharmony_cist_draw_quad(struct st_context *st,
80bf215546Sopenharmony_ci             float x0, float y0, float x1, float y1, float z,
81bf215546Sopenharmony_ci             float s0, float t0, float s1, float t1,
82bf215546Sopenharmony_ci             const float *color,
83bf215546Sopenharmony_ci             unsigned num_instances);
84bf215546Sopenharmony_ci
85bf215546Sopenharmony_civoid
86bf215546Sopenharmony_cist_draw_transform_feedback(struct gl_context *ctx, GLenum mode,
87bf215546Sopenharmony_ci                           unsigned num_instances, unsigned stream,
88bf215546Sopenharmony_ci                           struct gl_transform_feedback_object *tfb_vertcount);
89bf215546Sopenharmony_ci
90bf215546Sopenharmony_civoid
91bf215546Sopenharmony_cist_indirect_draw_vbo(struct gl_context *ctx,
92bf215546Sopenharmony_ci                     GLuint mode,
93bf215546Sopenharmony_ci                     struct gl_buffer_object *indirect_data,
94bf215546Sopenharmony_ci                     GLsizeiptr indirect_offset,
95bf215546Sopenharmony_ci                     unsigned draw_count,
96bf215546Sopenharmony_ci                     unsigned stride,
97bf215546Sopenharmony_ci                     struct gl_buffer_object *indirect_draw_count,
98bf215546Sopenharmony_ci                     GLsizeiptr indirect_draw_count_offset,
99bf215546Sopenharmony_ci                     const struct _mesa_index_buffer *ib,
100bf215546Sopenharmony_ci                     bool primitive_restart,
101bf215546Sopenharmony_ci                     unsigned restart_index);
102bf215546Sopenharmony_ci
103bf215546Sopenharmony_cibool
104bf215546Sopenharmony_cist_draw_hw_select_prepare_common(struct gl_context *ctx);
105bf215546Sopenharmony_cibool
106bf215546Sopenharmony_cist_draw_hw_select_prepare_mode(struct gl_context *ctx, struct pipe_draw_info *info);
107bf215546Sopenharmony_civoid
108bf215546Sopenharmony_cist_init_hw_select_draw_functions(struct pipe_screen *screen,
109bf215546Sopenharmony_ci                                 struct dd_function_table *functions);
110bf215546Sopenharmony_ci
111bf215546Sopenharmony_ci#endif
112