26f2619c52b029c1e2b8973cb35756450d1f9bf9
[mesa.git] / src / mesa / tnl / t_vertex.h
1 /*
2 * Copyright 2003 Tungsten Graphics, inc.
3 * All Rights Reserved.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * on the rights to use, copy, modify, merge, publish, distribute, sub
9 * license, and/or sell copies of the Software, and to permit persons to whom
10 * the Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice (including the next
13 * paragraph) shall be included in all copies or substantial portions of the
14 * Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
19 * TUNGSTEN GRAPHICS AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22 * USE OR OTHER DEALINGS IN THE SOFTWARE.
23 *
24 * Authors:
25 * Keith Whitwell <keithw@tungstengraphics.com>
26 */
27
28 #ifndef _TNL_VERTEX_H
29 #define _TNL_VERTEX_H
30
31 /* New mechanism to specify hardware vertices so that tnl can build
32 * and manipulate them directly.
33 */
34
35 enum tnl_attr_format {
36 EMIT_1F = 1,
37 EMIT_2F = 2,
38 EMIT_3F = 3,
39 EMIT_4F = 4,
40 EMIT_2F_VIEWPORT, /* do viewport transform and emit */
41 EMIT_3F_VIEWPORT, /* do viewport transform and emit */
42 EMIT_4F_VIEWPORT, /* do viewport transform and emit */
43 EMIT_3F_XYW, /* for projective texture */
44 EMIT_1UB_1F, /* for fog coordinate */
45 EMIT_3UB_3F_BGR, /* for specular color */
46 EMIT_3UB_3F_RGB, /* for specular color */
47 EMIT_4UB_4F_BGRA, /* for color */
48 EMIT_4UB_4F_RGBA, /* for color */
49 EMIT_NOP_1F,
50 EMIT_NOP_1UB,
51 };
52
53 struct tnl_attr_map {
54 GLuint attr; /* VERT_ATTRIB_ enum */
55 enum tnl_attr_format format;
56 };
57
58
59 /* Emit hardware vertices to a given buffer:
60 */
61 extern void _tnl_emit( GLcontext *ctx,
62 GLuint start, GLuint end,
63 void *dest,
64 GLuint stride );
65
66 /* Interpolate between two vertices to produce a third:
67 */
68 extern void _tnl_interp( GLcontext *ctx,
69 GLfloat t,
70 GLuint edst, GLuint eout, GLuint ein,
71 GLboolean force_boundary );
72
73 /* Copy colors from one vertex to another:
74 */
75 extern void _tnl_copy_colors( GLcontext *ctx, GLuint edst, GLuint esrc );
76
77
78 /* Extract a named attribute from a hardware vertex. Will have to
79 * reverse any viewport transformation, swizzling or other conversions
80 * which may have been applied:
81 */
82 extern void _tnl_get_attr( GLcontext *ctx, void *vertex, GLenum attrib,
83 GLfloat *dest );
84
85 /* Populate a swrast SWvertex from an attrib-style vertex.
86 */
87 extern void _tnl_translate( GLcontext *ctx, const void *vertex,
88 SWvertex *dest );
89
90
91
92 #endif