aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/vbo/vbo_attrib.h
blob: fb178e17d677acb78b55594a71e63bb631c92fad (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/*
 Copyright (C) Intel Corp.  2006.  All Rights Reserved.
 Intel funded Tungsten Graphics to
 develop this 3D driver.
 
 Permission is hereby granted, free of charge, to any person obtaining
 a copy of this software and associated documentation files (the
 "Software"), to deal in the Software without restriction, including
 without limitation the rights to use, copy, modify, merge, publish,
 distribute, sublicense, and/or sell copies of the Software, and to
 permit persons to whom the Software is furnished to do so, subject to
 the following conditions:
 
 The above copyright notice and this permission notice (including the
 next paragraph) shall be included in all copies or substantial
 portions of the Software.
 
 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
 MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
 IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
 LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 
 **********************************************************************/
 /*
  * Authors:
  *   Keith Whitwell <keithw@vmware.com>
  */

#ifndef VBO_ATTRIB_H
#define VBO_ATTRIB_H

#include "main/mtypes.h"

/*
 * Note: The first 32 attributes match the VERT_ATTRIB_* definitions.
 * However, we have extra attributes for storing per-vertex glMaterial
 * values.  The material attributes get shifted into the generic positions
 * at draw time.
 *
 * One reason we can't alias materials and generics here is display lists.
 * A display list might contain both generic attributes and material
 * attributes which are selected at draw time depending on whether we're
 * using fixed function or a shader.  <sigh>
 */
enum vbo_attrib {
   VBO_ATTRIB_POS,
   VBO_ATTRIB_NORMAL,
   VBO_ATTRIB_COLOR0,
   VBO_ATTRIB_COLOR1,
   VBO_ATTRIB_FOG,
   VBO_ATTRIB_COLOR_INDEX,
   VBO_ATTRIB_EDGEFLAG,
   VBO_ATTRIB_TEX0,
   VBO_ATTRIB_TEX1,
   VBO_ATTRIB_TEX2,
   VBO_ATTRIB_TEX3,
   VBO_ATTRIB_TEX4,
   VBO_ATTRIB_TEX5,
   VBO_ATTRIB_TEX6,
   VBO_ATTRIB_TEX7,
   VBO_ATTRIB_POINT_SIZE,

   VBO_ATTRIB_GENERIC0, /* Not used? */
   VBO_ATTRIB_GENERIC1,
   VBO_ATTRIB_GENERIC2,
   VBO_ATTRIB_GENERIC3,
   VBO_ATTRIB_GENERIC4,
   VBO_ATTRIB_GENERIC5,
   VBO_ATTRIB_GENERIC6,
   VBO_ATTRIB_GENERIC7,
   VBO_ATTRIB_GENERIC8,
   VBO_ATTRIB_GENERIC9,
   VBO_ATTRIB_GENERIC10,
   VBO_ATTRIB_GENERIC11,
   VBO_ATTRIB_GENERIC12,
   VBO_ATTRIB_GENERIC13,
   VBO_ATTRIB_GENERIC14,
   VBO_ATTRIB_GENERIC15,

   /* XXX: in the vertex program inputs_read flag, we alias
    * materials and generics and use knowledge about the program
    * (whether it is a fixed-function emulation) to
    * differentiate.  Here we must keep them apart instead.
    */
   VBO_ATTRIB_MAT_FRONT_AMBIENT,
   VBO_ATTRIB_MAT_BACK_AMBIENT,
   VBO_ATTRIB_MAT_FRONT_DIFFUSE,
   VBO_ATTRIB_MAT_BACK_DIFFUSE,
   VBO_ATTRIB_MAT_FRONT_SPECULAR,
   VBO_ATTRIB_MAT_BACK_SPECULAR,
   VBO_ATTRIB_MAT_FRONT_EMISSION,
   VBO_ATTRIB_MAT_BACK_EMISSION,
   VBO_ATTRIB_MAT_FRONT_SHININESS,
   VBO_ATTRIB_MAT_BACK_SHININESS,
   VBO_ATTRIB_MAT_FRONT_INDEXES,
   VBO_ATTRIB_MAT_BACK_INDEXES,

   VBO_ATTRIB_MAX
};

#define VBO_ATTRIB_FIRST_MATERIAL VBO_ATTRIB_MAT_FRONT_AMBIENT
#define VBO_ATTRIB_LAST_MATERIAL VBO_ATTRIB_MAT_BACK_INDEXES


/** VBO_ATTRIB_POS .. VBO_ATTRIB_POINT_SIZE */
#define VBO_ATTRIBS_LEGACY  BITFIELD64_MASK(VBO_ATTRIB_GENERIC0)

/** VBO_ATTRIB_MAT_FRONT_AMBIENT .. VBO_ATTRIB_MAT_BACK_INDEXES */
#define VBO_ATTRIBS_MATERIALS BITFIELD64_RANGE(VBO_ATTRIB_MAT_FRONT_AMBIENT, \
                     VBO_ATTRIB_LAST_MATERIAL - VBO_ATTRIB_FIRST_MATERIAL + 1)

/** Shift to move legacy material attribs into generic slots */
#define VBO_MATERIAL_SHIFT (VBO_ATTRIB_FIRST_MATERIAL - VBO_ATTRIB_GENERIC0)




#define VBO_MAX_COPIED_VERTS 3

#endif