17117f1b4Smrg/*
27117f1b4Smrg Copyright (C) Intel Corp.  2006.  All Rights Reserved.
3af69d88dSmrg Intel funded Tungsten Graphics to
47117f1b4Smrg develop this 3D driver.
57117f1b4Smrg
67117f1b4Smrg Permission is hereby granted, free of charge, to any person obtaining
77117f1b4Smrg a copy of this software and associated documentation files (the
87117f1b4Smrg "Software"), to deal in the Software without restriction, including
97117f1b4Smrg without limitation the rights to use, copy, modify, merge, publish,
107117f1b4Smrg distribute, sublicense, and/or sell copies of the Software, and to
117117f1b4Smrg permit persons to whom the Software is furnished to do so, subject to
127117f1b4Smrg the following conditions:
137117f1b4Smrg
147117f1b4Smrg The above copyright notice and this permission notice (including the
157117f1b4Smrg next paragraph) shall be included in all copies or substantial
167117f1b4Smrg portions of the Software.
177117f1b4Smrg
187117f1b4Smrg THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
197117f1b4Smrg EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
207117f1b4Smrg MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
217117f1b4Smrg IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
227117f1b4Smrg LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
237117f1b4Smrg OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
247117f1b4Smrg WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
257117f1b4Smrg
267117f1b4Smrg **********************************************************************/
277117f1b4Smrg /*
287117f1b4Smrg  * Authors:
29af69d88dSmrg  *   Keith Whitwell <keithw@vmware.com>
307117f1b4Smrg  */
317117f1b4Smrg
327117f1b4Smrg#ifndef VBO_ATTRIB_H
337117f1b4Smrg#define VBO_ATTRIB_H
347117f1b4Smrg
357117f1b4Smrg/*
3601e04c3fSmrg * Note: The first 32 attributes match the VERT_ATTRIB_* definitions.
3701e04c3fSmrg * However, we have extra attributes for storing per-vertex glMaterial
3801e04c3fSmrg * values.  The material attributes get shifted into the generic positions
3901e04c3fSmrg * at draw time.
4001e04c3fSmrg *
4101e04c3fSmrg * One reason we can't alias materials and generics here is display lists.
4201e04c3fSmrg * A display list might contain both generic attributes and material
4301e04c3fSmrg * attributes which are selected at draw time depending on whether we're
4401e04c3fSmrg * using fixed function or a shader.  <sigh>
457117f1b4Smrg */
4601e04c3fSmrgenum vbo_attrib {
4701e04c3fSmrg   VBO_ATTRIB_POS,
4801e04c3fSmrg   VBO_ATTRIB_NORMAL,
4901e04c3fSmrg   VBO_ATTRIB_COLOR0,
5001e04c3fSmrg   VBO_ATTRIB_COLOR1,
5101e04c3fSmrg   VBO_ATTRIB_FOG,
5201e04c3fSmrg   VBO_ATTRIB_COLOR_INDEX,
5301e04c3fSmrg   VBO_ATTRIB_TEX0,
5401e04c3fSmrg   VBO_ATTRIB_TEX1,
5501e04c3fSmrg   VBO_ATTRIB_TEX2,
5601e04c3fSmrg   VBO_ATTRIB_TEX3,
5701e04c3fSmrg   VBO_ATTRIB_TEX4,
5801e04c3fSmrg   VBO_ATTRIB_TEX5,
5901e04c3fSmrg   VBO_ATTRIB_TEX6,
6001e04c3fSmrg   VBO_ATTRIB_TEX7,
6101e04c3fSmrg   VBO_ATTRIB_POINT_SIZE,
627117f1b4Smrg
6301e04c3fSmrg   VBO_ATTRIB_GENERIC0, /* Not used? */
6401e04c3fSmrg   VBO_ATTRIB_GENERIC1,
6501e04c3fSmrg   VBO_ATTRIB_GENERIC2,
6601e04c3fSmrg   VBO_ATTRIB_GENERIC3,
6701e04c3fSmrg   VBO_ATTRIB_GENERIC4,
6801e04c3fSmrg   VBO_ATTRIB_GENERIC5,
6901e04c3fSmrg   VBO_ATTRIB_GENERIC6,
7001e04c3fSmrg   VBO_ATTRIB_GENERIC7,
7101e04c3fSmrg   VBO_ATTRIB_GENERIC8,
7201e04c3fSmrg   VBO_ATTRIB_GENERIC9,
7301e04c3fSmrg   VBO_ATTRIB_GENERIC10,
7401e04c3fSmrg   VBO_ATTRIB_GENERIC11,
7501e04c3fSmrg   VBO_ATTRIB_GENERIC12,
7601e04c3fSmrg   VBO_ATTRIB_GENERIC13,
7701e04c3fSmrg   VBO_ATTRIB_GENERIC14,
7801e04c3fSmrg   VBO_ATTRIB_GENERIC15,
797ec681f3Smrg   VBO_ATTRIB_EDGEFLAG,
807117f1b4Smrg
8101e04c3fSmrg   /* XXX: in the vertex program inputs_read flag, we alias
8201e04c3fSmrg    * materials and generics and use knowledge about the program
8301e04c3fSmrg    * (whether it is a fixed-function emulation) to
8401e04c3fSmrg    * differentiate.  Here we must keep them apart instead.
8501e04c3fSmrg    */
8601e04c3fSmrg   VBO_ATTRIB_MAT_FRONT_AMBIENT,
8701e04c3fSmrg   VBO_ATTRIB_MAT_BACK_AMBIENT,
8801e04c3fSmrg   VBO_ATTRIB_MAT_FRONT_DIFFUSE,
8901e04c3fSmrg   VBO_ATTRIB_MAT_BACK_DIFFUSE,
9001e04c3fSmrg   VBO_ATTRIB_MAT_FRONT_SPECULAR,
9101e04c3fSmrg   VBO_ATTRIB_MAT_BACK_SPECULAR,
9201e04c3fSmrg   VBO_ATTRIB_MAT_FRONT_EMISSION,
9301e04c3fSmrg   VBO_ATTRIB_MAT_BACK_EMISSION,
9401e04c3fSmrg   VBO_ATTRIB_MAT_FRONT_SHININESS,
9501e04c3fSmrg   VBO_ATTRIB_MAT_BACK_SHININESS,
9601e04c3fSmrg   VBO_ATTRIB_MAT_FRONT_INDEXES,
9701e04c3fSmrg   VBO_ATTRIB_MAT_BACK_INDEXES,
987117f1b4Smrg
9901e04c3fSmrg   VBO_ATTRIB_MAX
1007117f1b4Smrg};
1017117f1b4Smrg
1027117f1b4Smrg#define VBO_ATTRIB_FIRST_MATERIAL VBO_ATTRIB_MAT_FRONT_AMBIENT
1037117f1b4Smrg#define VBO_ATTRIB_LAST_MATERIAL VBO_ATTRIB_MAT_BACK_INDEXES
1047117f1b4Smrg
10501e04c3fSmrg
10601e04c3fSmrg/** VBO_ATTRIB_POS .. VBO_ATTRIB_POINT_SIZE */
1077ec681f3Smrg#define VBO_ATTRIBS_LEGACY  (BITFIELD64_MASK(VBO_ATTRIB_GENERIC0) | \
1087ec681f3Smrg                             BITFIELD64_BIT(VBO_ATTRIB_EDGEFLAG))
10901e04c3fSmrg
11001e04c3fSmrg/** VBO_ATTRIB_MAT_FRONT_AMBIENT .. VBO_ATTRIB_MAT_BACK_INDEXES */
11101e04c3fSmrg#define VBO_ATTRIBS_MATERIALS BITFIELD64_RANGE(VBO_ATTRIB_MAT_FRONT_AMBIENT, \
11201e04c3fSmrg                     VBO_ATTRIB_LAST_MATERIAL - VBO_ATTRIB_FIRST_MATERIAL + 1)
11301e04c3fSmrg
1147ec681f3Smrg/**
1157ec681f3Smrg * Move material attribs to the last generic attribs, moving LAST_MATERIAL
1167ec681f3Smrg * to GENERIC15, etc.
1177ec681f3Smrg */
1187ec681f3Smrg#define VBO_MATERIAL_SHIFT (VBO_ATTRIB_LAST_MATERIAL - VBO_ATTRIB_GENERIC15)
11901e04c3fSmrg
12001e04c3fSmrg
12101e04c3fSmrg
1227ec681f3Smrg#define VBO_MAX_COPIED_VERTS 31
1237117f1b4Smrg
1247117f1b4Smrg#endif
125