ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

gen_matypes.c
Go to the documentation of this file.
00001 /*
00002  * Mesa 3-D graphics library
00003  * Version:  6.5.1
00004  *
00005  * Copyright (C) 1999-2006  Brian Paul   All Rights Reserved.
00006  *
00007  * Permission is hereby granted, free of charge, to any person obtaining a
00008  * copy of this software and associated documentation files (the "Software"),
00009  * to deal in the Software without restriction, including without limitation
00010  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
00011  * and/or sell copies of the Software, and to permit persons to whom the
00012  * Software is furnished to do so, subject to the following conditions:
00013  *
00014  * The above copyright notice and this permission notice shall be included
00015  * in all copies or substantial portions of the Software.
00016  *
00017  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
00018  * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00019  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
00020  * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
00021  * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
00022  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
00023  *
00024  * Authors:
00025  *    Gareth Hughes
00026  */
00027 
00028 /*
00029  * This generates an asm version of mtypes.h (called matypes.h), so that
00030  * Mesa's x86 assembly code can access the internal structures easily.
00031  * This will be particularly useful when developing new x86 asm code for
00032  * Mesa, including lighting, clipping, texture image conversion etc.
00033  */
00034 
00035 #include "main/glheader.h"
00036 #include "main/mtypes.h"
00037 #include "tnl/t_context.h"
00038 
00039 
00040 #undef offsetof
00041 #define offsetof( type, member ) ((size_t) &((type *)0)->member)
00042 
00043 
00044 #define OFFSET_HEADER( x )                      \
00045 do {                                    \
00046    printf( "\n" );                          \
00047    printf( "\n" );                          \
00048    printf( "/* ====================================================="   \
00049        "========\n" );                      \
00050    printf( " * Offsets for %s\n", x );                  \
00051    printf( " */\n" );                           \
00052    printf( "\n" );                          \
00053 } while (0)
00054 
00055 #define DEFINE_HEADER( x )                      \
00056 do {                                    \
00057    printf( "\n" );                          \
00058    printf( "/*\n" );                            \
00059    printf( " * Flags for %s\n", x );                    \
00060    printf( " */\n" );                           \
00061    printf( "\n" );                          \
00062 } while (0)
00063 
00064 #if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64)
00065 #define OFFSET( s, t, m )                       \
00066    printf( "#define %s\t%ld\n", s, offsetof( t, m ) );
00067 #else
00068 #define OFFSET( s, t, m )                       \
00069    printf( "#define %s\t%d\n", s, offsetof( t, m ) );
00070 #endif
00071 
00072 #if defined(__BEOS__) || defined(__HAIKU__) || defined(_LP64)
00073 #define SIZEOF( s, t )                          \
00074    printf( "#define %s\t%ld\n", s, sizeof(t) );
00075 #else
00076 #define SIZEOF( s, t )                          \
00077    printf( "#define %s\t%d\n", s, sizeof(t) );
00078 #endif
00079 
00080 #define DEFINE( s, d )                          \
00081    printf( "#define %s\t0x%x\n", s, d );
00082 
00083 
00084 
00085 int main( int argc, char **argv )
00086 {
00087    printf( "/*\n" );
00088    printf( " * This file is automatically generated from the Mesa internal type\n" );
00089    printf( " * definitions.  Do not edit directly.\n" );
00090    printf( " */\n" );
00091    printf( "\n" );
00092    printf( "#ifndef __ASM_TYPES_H__\n" );
00093    printf( "#define __ASM_TYPES_H__\n" );
00094    printf( "\n" );
00095 
00096 
00097    /* GLcontext offsets:
00098     */
00099    OFFSET_HEADER( "GLcontext" );
00100 
00101    OFFSET( "CTX_DRIVER_CTX              ", GLcontext, DriverCtx );
00102    printf( "\n" );
00103    OFFSET( "CTX_LIGHT_ENABLED           ", GLcontext, Light.Enabled );
00104    OFFSET( "CTX_LIGHT_SHADE_MODEL       ", GLcontext, Light.ShadeModel );
00105    OFFSET( "CTX_LIGHT_COLOR_MAT_FACE    ", GLcontext, Light.ColorMaterialFace );
00106    OFFSET( "CTX_LIGHT_COLOR_MAT_MODE    ", GLcontext, Light.ColorMaterialMode );
00107    OFFSET( "CTX_LIGHT_COLOR_MAT_MASK    ", GLcontext, Light.ColorMaterialBitmask );
00108    OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", GLcontext, Light.ColorMaterialEnabled );
00109    OFFSET( "CTX_LIGHT_ENABLED_LIST      ", GLcontext, Light.EnabledList );
00110    OFFSET( "CTX_LIGHT_NEED_VERTS        ", GLcontext, Light._NeedVertices );
00111    OFFSET( "CTX_LIGHT_FLAGS             ", GLcontext, Light._Flags );
00112    OFFSET( "CTX_LIGHT_BASE_COLOR        ", GLcontext, Light._BaseColor );
00113 
00114 
00115    /* struct vertex_buffer offsets:
00116     */
00117    OFFSET_HEADER( "struct vertex_buffer" );
00118 
00119    OFFSET( "VB_SIZE                ", struct vertex_buffer, Size );
00120    OFFSET( "VB_COUNT               ", struct vertex_buffer, Count );
00121    printf( "\n" );
00122    OFFSET( "VB_ELTS                ", struct vertex_buffer, Elts );
00123    OFFSET( "VB_OBJ_PTR             ", struct vertex_buffer, ObjPtr );
00124    OFFSET( "VB_EYE_PTR             ", struct vertex_buffer, EyePtr );
00125    OFFSET( "VB_CLIP_PTR            ", struct vertex_buffer, ClipPtr );
00126    OFFSET( "VB_PROJ_CLIP_PTR       ", struct vertex_buffer, NdcPtr );
00127    OFFSET( "VB_CLIP_OR_MASK        ", struct vertex_buffer, ClipOrMask );
00128    OFFSET( "VB_CLIP_MASK           ", struct vertex_buffer, ClipMask );
00129    OFFSET( "VB_NORMAL_PTR          ", struct vertex_buffer, NormalPtr );
00130    OFFSET( "VB_EDGE_FLAG           ", struct vertex_buffer, EdgeFlag );
00131    OFFSET( "VB_TEX0_COORD_PTR      ", struct vertex_buffer, TexCoordPtr[0] );
00132    OFFSET( "VB_TEX1_COORD_PTR      ", struct vertex_buffer, TexCoordPtr[1] );
00133    OFFSET( "VB_TEX2_COORD_PTR      ", struct vertex_buffer, TexCoordPtr[2] );
00134    OFFSET( "VB_TEX3_COORD_PTR      ", struct vertex_buffer, TexCoordPtr[3] );
00135    OFFSET( "VB_INDEX_PTR           ", struct vertex_buffer, IndexPtr );
00136    OFFSET( "VB_COLOR_PTR           ", struct vertex_buffer, ColorPtr );
00137    OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr );
00138    OFFSET( "VB_FOG_COORD_PTR       ", struct vertex_buffer, FogCoordPtr );
00139    OFFSET( "VB_PRIMITIVE           ", struct vertex_buffer, Primitive );
00140    printf( "\n" );
00141 
00142    DEFINE_HEADER( "struct vertex_buffer" );
00143 
00144    /* XXX use new labels here someday after vertex proram is done */
00145    DEFINE( "VERT_BIT_OBJ           ", VERT_BIT_POS );
00146    DEFINE( "VERT_BIT_NORM          ", VERT_BIT_NORMAL );
00147    DEFINE( "VERT_BIT_RGBA          ", VERT_BIT_COLOR0 );
00148    DEFINE( "VERT_BIT_SPEC_RGB      ", VERT_BIT_COLOR1 );
00149    DEFINE( "VERT_BIT_FOG_COORD     ", VERT_BIT_FOG );
00150    DEFINE( "VERT_BIT_TEX0          ", VERT_BIT_TEX0 );
00151    DEFINE( "VERT_BIT_TEX1          ", VERT_BIT_TEX1 );
00152    DEFINE( "VERT_BIT_TEX2          ", VERT_BIT_TEX2 );
00153    DEFINE( "VERT_BIT_TEX3          ", VERT_BIT_TEX3 );
00154 
00155 
00156    /* GLvector4f offsets:
00157     */
00158    OFFSET_HEADER( "GLvector4f" );
00159 
00160    OFFSET( "V4F_DATA          ", GLvector4f, data );
00161    OFFSET( "V4F_START         ", GLvector4f, start );
00162    OFFSET( "V4F_COUNT         ", GLvector4f, count );
00163    OFFSET( "V4F_STRIDE        ", GLvector4f, stride );
00164    OFFSET( "V4F_SIZE          ", GLvector4f, size );
00165    OFFSET( "V4F_FLAGS         ", GLvector4f, flags );
00166 
00167    DEFINE_HEADER( "GLvector4f" );
00168 
00169    DEFINE( "VEC_MALLOC        ", VEC_MALLOC );
00170    DEFINE( "VEC_NOT_WRITEABLE ", VEC_NOT_WRITEABLE );
00171    DEFINE( "VEC_BAD_STRIDE    ", VEC_BAD_STRIDE );
00172    printf( "\n" );
00173    DEFINE( "VEC_SIZE_1        ", VEC_SIZE_1 );
00174    DEFINE( "VEC_SIZE_2        ", VEC_SIZE_2 );
00175    DEFINE( "VEC_SIZE_3        ", VEC_SIZE_3 );
00176    DEFINE( "VEC_SIZE_4        ", VEC_SIZE_4 );
00177 
00178 
00179    /* GLmatrix offsets:
00180     */
00181    OFFSET_HEADER( "GLmatrix" );
00182 
00183    OFFSET( "MATRIX_DATA   ", GLmatrix, m );
00184    OFFSET( "MATRIX_INV    ", GLmatrix, inv );
00185    OFFSET( "MATRIX_FLAGS  ", GLmatrix, flags );
00186    OFFSET( "MATRIX_TYPE   ", GLmatrix, type );
00187 
00188 
00189    /* struct gl_light offsets:
00190     */
00191    OFFSET_HEADER( "struct gl_light" );
00192 
00193    OFFSET( "LIGHT_NEXT              ", struct gl_light, next );
00194    OFFSET( "LIGHT_PREV              ", struct gl_light, prev );
00195    printf( "\n" );
00196    OFFSET( "LIGHT_AMBIENT           ", struct gl_light, Ambient );
00197    OFFSET( "LIGHT_DIFFUSE           ", struct gl_light, Diffuse );
00198    OFFSET( "LIGHT_SPECULAR          ", struct gl_light, Specular );
00199    OFFSET( "LIGHT_EYE_POSITION      ", struct gl_light, EyePosition );
00200    OFFSET( "LIGHT_EYE_DIRECTION     ", struct gl_light, EyeDirection );
00201    OFFSET( "LIGHT_SPOT_EXPONENT     ", struct gl_light, SpotExponent );
00202    OFFSET( "LIGHT_SPOT_CUTOFF       ", struct gl_light, SpotCutoff );
00203    OFFSET( "LIGHT_COS_CUTOFF        ", struct gl_light, _CosCutoff );
00204    OFFSET( "LIGHT_CONST_ATTEN       ", struct gl_light, ConstantAttenuation );
00205    OFFSET( "LIGHT_LINEAR_ATTEN      ", struct gl_light, LinearAttenuation );
00206    OFFSET( "LIGHT_QUADRATIC_ATTEN   ", struct gl_light, QuadraticAttenuation );
00207    OFFSET( "LIGHT_ENABLED           ", struct gl_light, Enabled );
00208    printf( "\n" );
00209    OFFSET( "LIGHT_FLAGS             ", struct gl_light, _Flags );
00210    printf( "\n" );
00211    OFFSET( "LIGHT_POSITION          ", struct gl_light, _Position );
00212    OFFSET( "LIGHT_VP_INF_NORM       ", struct gl_light, _VP_inf_norm );
00213    OFFSET( "LIGHT_H_INF_NORM        ", struct gl_light, _h_inf_norm );
00214    OFFSET( "LIGHT_NORM_DIRECTION    ", struct gl_light, _NormDirection );
00215    OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation );
00216    printf( "\n" );
00217    OFFSET( "LIGHT_SPOT_EXP_TABLE    ", struct gl_light, _SpotExpTable );
00218    OFFSET( "LIGHT_MAT_AMBIENT       ", struct gl_light, _MatAmbient );
00219    OFFSET( "LIGHT_MAT_DIFFUSE       ", struct gl_light, _MatDiffuse );
00220    OFFSET( "LIGHT_MAT_SPECULAR      ", struct gl_light, _MatSpecular );
00221    printf( "\n" );
00222    SIZEOF( "SIZEOF_GL_LIGHT         ", struct gl_light );
00223 
00224    DEFINE_HEADER( "struct gl_light" );
00225 
00226    DEFINE( "LIGHT_SPOT              ", LIGHT_SPOT );
00227    DEFINE( "LIGHT_LOCAL_VIEWER      ", LIGHT_LOCAL_VIEWER );
00228    DEFINE( "LIGHT_POSITIONAL        ", LIGHT_POSITIONAL );
00229    printf( "\n" );
00230    DEFINE( "LIGHT_NEED_VERTICES     ", LIGHT_NEED_VERTICES );
00231 
00232 
00233    /* struct gl_lightmodel offsets:
00234     */
00235    OFFSET_HEADER( "struct gl_lightmodel" );
00236 
00237    OFFSET( "LIGHT_MODEL_AMBIENT       ", struct gl_lightmodel, Ambient );
00238    OFFSET( "LIGHT_MODEL_LOCAL_VIEWER  ", struct gl_lightmodel, LocalViewer );
00239    OFFSET( "LIGHT_MODEL_TWO_SIDE      ", struct gl_lightmodel, TwoSide );
00240    OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl );
00241 
00242 
00243    printf( "\n" );
00244    printf( "\n" );
00245    printf( "#endif /* __ASM_TYPES_H__ */\n" );
00246 
00247    return 0;
00248 }

Generated on Sun May 27 2012 04:20:49 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.