From f4092abdf94af6a99aff944d6264bc1284e8bdd4 Mon Sep 17 00:00:00 2001 From: Reinhard Tartler Date: Mon, 10 Oct 2011 17:43:39 +0200 Subject: Imported nx-X11-3.1.0-1.tar.gz Summary: Imported nx-X11-3.1.0-1.tar.gz Keywords: Imported nx-X11-3.1.0-1.tar.gz into Git repository --- nx-X11/extras/Mesa/src/mesa/x86/gen_matypes.c | 251 ++++++++++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 nx-X11/extras/Mesa/src/mesa/x86/gen_matypes.c (limited to 'nx-X11/extras/Mesa/src/mesa/x86/gen_matypes.c') diff --git a/nx-X11/extras/Mesa/src/mesa/x86/gen_matypes.c b/nx-X11/extras/Mesa/src/mesa/x86/gen_matypes.c new file mode 100644 index 000000000..d5cee5347 --- /dev/null +++ b/nx-X11/extras/Mesa/src/mesa/x86/gen_matypes.c @@ -0,0 +1,251 @@ +/* + * Mesa 3-D graphics library + * Version: 5.1 + * + * Copyright (C) 1999-2003 Brian Paul All Rights Reserved. + * + * 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 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 + * BRIAN PAUL 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: + * Gareth Hughes + */ + +/* + * This generates an asm version of mtypes.h (called matypes.h), so that + * Mesa's x86 assembly code can access the internal structures easily. + * This will be particularly useful when developing new x86 asm code for + * Mesa, including lighting, clipping, texture image conversion etc. + */ + +#include "main/glheader.h" +#include "main/mtypes.h" +#include "tnl/t_context.h" + + +#undef offsetof +#define offsetof( type, member ) ((size_t) &((type *)0)->member) + + +#define OFFSET_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "\n" ); \ + printf( "/* =====================================================" \ + "========\n" ); \ + printf( " * Offsets for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#define DEFINE_HEADER( x ) \ +do { \ + printf( "\n" ); \ + printf( "/*\n" ); \ + printf( " * Flags for %s\n", x ); \ + printf( " */\n" ); \ + printf( "\n" ); \ +} while (0) + +#if defined(__BEOS__) || defined(_LP64) +#define OFFSET( s, t, m ) \ + printf( "#define %s\t%ld\n", s, offsetof( t, m ) ); +#else +#define OFFSET( s, t, m ) \ + printf( "#define %s\t%d\n", s, offsetof( t, m ) ); +#endif + +#if defined(__BEOS__) || defined(_LP64) +#define SIZEOF( s, t ) \ + printf( "#define %s\t%ld\n", s, sizeof(t) ); +#else +#define SIZEOF( s, t ) \ + printf( "#define %s\t%d\n", s, sizeof(t) ); +#endif + +#define DEFINE( s, d ) \ + printf( "#define %s\t0x%x\n", s, d ); + + + +int main( int argc, char **argv ) +{ + printf( "/*\n" ); + printf( " * This file is automatically generated from the Mesa internal type\n" ); + printf( " * definitions. Do not edit directly.\n" ); + printf( " */\n" ); + printf( "\n" ); + printf( "#ifndef __ASM_TYPES_H__\n" ); + printf( "#define __ASM_TYPES_H__\n" ); + printf( "\n" ); + printf( "#include \"assyntax.h\"\n" ); + + + /* GLcontext offsets: + */ + OFFSET_HEADER( "GLcontext" ); + + OFFSET( "CTX_DRIVER_CTX ", GLcontext, DriverCtx ); + printf( "\n" ); + OFFSET( "CTX_LIGHT_ENABLED ", GLcontext, Light.Enabled ); + OFFSET( "CTX_LIGHT_SHADE_MODEL ", GLcontext, Light.ShadeModel ); + OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", GLcontext, Light.ColorMaterialFace ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", GLcontext, Light.ColorMaterialMode ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", GLcontext, Light.ColorMaterialBitmask ); + OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", GLcontext, Light.ColorMaterialEnabled ); + OFFSET( "CTX_LIGHT_ENABLED_LIST ", GLcontext, Light.EnabledList ); + OFFSET( "CTX_LIGHT_NEED_VERTS ", GLcontext, Light._NeedVertices ); + OFFSET( "CTX_LIGHT_FLAGS ", GLcontext, Light._Flags ); + OFFSET( "CTX_LIGHT_BASE_COLOR ", GLcontext, Light._BaseColor ); + + + /* struct vertex_buffer offsets: + */ + OFFSET_HEADER( "struct vertex_buffer" ); + + OFFSET( "VB_SIZE ", struct vertex_buffer, Size ); + OFFSET( "VB_COUNT ", struct vertex_buffer, Count ); + printf( "\n" ); + OFFSET( "VB_ELTS ", struct vertex_buffer, Elts ); + OFFSET( "VB_OBJ_PTR ", struct vertex_buffer, ObjPtr ); + OFFSET( "VB_EYE_PTR ", struct vertex_buffer, EyePtr ); + OFFSET( "VB_CLIP_PTR ", struct vertex_buffer, ClipPtr ); + OFFSET( "VB_PROJ_CLIP_PTR ", struct vertex_buffer, NdcPtr ); + OFFSET( "VB_CLIP_OR_MASK ", struct vertex_buffer, ClipOrMask ); + OFFSET( "VB_CLIP_MASK ", struct vertex_buffer, ClipMask ); + OFFSET( "VB_NORMAL_PTR ", struct vertex_buffer, NormalPtr ); + OFFSET( "VB_EDGE_FLAG ", struct vertex_buffer, EdgeFlag ); + OFFSET( "VB_TEX0_COORD_PTR ", struct vertex_buffer, TexCoordPtr[0] ); + OFFSET( "VB_TEX1_COORD_PTR ", struct vertex_buffer, TexCoordPtr[1] ); + OFFSET( "VB_TEX2_COORD_PTR ", struct vertex_buffer, TexCoordPtr[2] ); + OFFSET( "VB_TEX3_COORD_PTR ", struct vertex_buffer, TexCoordPtr[3] ); + OFFSET( "VB_INDEX_PTR ", struct vertex_buffer, IndexPtr ); + OFFSET( "VB_COLOR_PTR ", struct vertex_buffer, ColorPtr ); + OFFSET( "VB_SECONDARY_COLOR_PTR ", struct vertex_buffer, SecondaryColorPtr ); + OFFSET( "VB_FOG_COORD_PTR ", struct vertex_buffer, FogCoordPtr ); + OFFSET( "VB_POINT_SIZE_PTR ", struct vertex_buffer, PointSizePtr ); + OFFSET( "VB_PRIMITIVE ", struct vertex_buffer, Primitive ); + printf( "\n" ); + OFFSET( "VB_LAST_CLIPPED ", struct vertex_buffer, LastClipped ); + + DEFINE_HEADER( "struct vertex_buffer" ); + + /* XXX use new labels here someday after vertex proram is done */ + DEFINE( "VERT_BIT_OBJ ", VERT_BIT_POS ); + DEFINE( "VERT_BIT_NORM ", VERT_BIT_NORMAL ); + DEFINE( "VERT_BIT_RGBA ", VERT_BIT_COLOR0 ); + DEFINE( "VERT_BIT_SPEC_RGB ", VERT_BIT_COLOR1 ); + DEFINE( "VERT_BIT_FOG_COORD ", VERT_BIT_FOG ); + DEFINE( "VERT_BIT_TEX0 ", VERT_BIT_TEX0 ); + DEFINE( "VERT_BIT_TEX1 ", VERT_BIT_TEX1 ); + DEFINE( "VERT_BIT_TEX2 ", VERT_BIT_TEX2 ); + DEFINE( "VERT_BIT_TEX3 ", VERT_BIT_TEX3 ); + + + /* GLvector4f offsets: + */ + OFFSET_HEADER( "GLvector4f" ); + + OFFSET( "V4F_DATA ", GLvector4f, data ); + OFFSET( "V4F_START ", GLvector4f, start ); + OFFSET( "V4F_COUNT ", GLvector4f, count ); + OFFSET( "V4F_STRIDE ", GLvector4f, stride ); + OFFSET( "V4F_SIZE ", GLvector4f, size ); + OFFSET( "V4F_FLAGS ", GLvector4f, flags ); + + DEFINE_HEADER( "GLvector4f" ); + + DEFINE( "VEC_MALLOC ", VEC_MALLOC ); + DEFINE( "VEC_NOT_WRITEABLE ", VEC_NOT_WRITEABLE ); + DEFINE( "VEC_BAD_STRIDE ", VEC_BAD_STRIDE ); + printf( "\n" ); + DEFINE( "VEC_SIZE_1 ", VEC_SIZE_1 ); + DEFINE( "VEC_SIZE_2 ", VEC_SIZE_2 ); + DEFINE( "VEC_SIZE_3 ", VEC_SIZE_3 ); + DEFINE( "VEC_SIZE_4 ", VEC_SIZE_4 ); + + + /* GLmatrix offsets: + */ + OFFSET_HEADER( "GLmatrix" ); + + OFFSET( "MATRIX_DATA ", GLmatrix, m ); + OFFSET( "MATRIX_INV ", GLmatrix, inv ); + OFFSET( "MATRIX_FLAGS ", GLmatrix, flags ); + OFFSET( "MATRIX_TYPE ", GLmatrix, type ); + + + /* struct gl_light offsets: + */ + OFFSET_HEADER( "struct gl_light" ); + + OFFSET( "LIGHT_NEXT ", struct gl_light, next ); + OFFSET( "LIGHT_PREV ", struct gl_light, prev ); + printf( "\n" ); + OFFSET( "LIGHT_AMBIENT ", struct gl_light, Ambient ); + OFFSET( "LIGHT_DIFFUSE ", struct gl_light, Diffuse ); + OFFSET( "LIGHT_SPECULAR ", struct gl_light, Specular ); + OFFSET( "LIGHT_EYE_POSITION ", struct gl_light, EyePosition ); + OFFSET( "LIGHT_EYE_DIRECTION ", struct gl_light, EyeDirection ); + OFFSET( "LIGHT_SPOT_EXPONENT ", struct gl_light, SpotExponent ); + OFFSET( "LIGHT_SPOT_CUTOFF ", struct gl_light, SpotCutoff ); + OFFSET( "LIGHT_COS_CUTOFF ", struct gl_light, _CosCutoff ); + OFFSET( "LIGHT_CONST_ATTEN ", struct gl_light, ConstantAttenuation ); + OFFSET( "LIGHT_LINEAR_ATTEN ", struct gl_light, LinearAttenuation ); + OFFSET( "LIGHT_QUADRATIC_ATTEN ", struct gl_light, QuadraticAttenuation ); + OFFSET( "LIGHT_ENABLED ", struct gl_light, Enabled ); + printf( "\n" ); + OFFSET( "LIGHT_FLAGS ", struct gl_light, _Flags ); + printf( "\n" ); + OFFSET( "LIGHT_POSITION ", struct gl_light, _Position ); + OFFSET( "LIGHT_VP_INF_NORM ", struct gl_light, _VP_inf_norm ); + OFFSET( "LIGHT_H_INF_NORM ", struct gl_light, _h_inf_norm ); + OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormDirection ); + OFFSET( "LIGHT_VP_INF_SPOT_ATTEN ", struct gl_light, _VP_inf_spot_attenuation ); + printf( "\n" ); + OFFSET( "LIGHT_SPOT_EXP_TABLE ", struct gl_light, _SpotExpTable ); + OFFSET( "LIGHT_MAT_AMBIENT ", struct gl_light, _MatAmbient ); + OFFSET( "LIGHT_MAT_DIFFUSE ", struct gl_light, _MatDiffuse ); + OFFSET( "LIGHT_MAT_SPECULAR ", struct gl_light, _MatSpecular ); + printf( "\n" ); + SIZEOF( "SIZEOF_GL_LIGHT ", struct gl_light ); + + DEFINE_HEADER( "struct gl_light" ); + + DEFINE( "LIGHT_SPOT ", LIGHT_SPOT ); + DEFINE( "LIGHT_LOCAL_VIEWER ", LIGHT_LOCAL_VIEWER ); + DEFINE( "LIGHT_POSITIONAL ", LIGHT_POSITIONAL ); + printf( "\n" ); + DEFINE( "LIGHT_NEED_VERTICES ", LIGHT_NEED_VERTICES ); + + + /* struct gl_lightmodel offsets: + */ + OFFSET_HEADER( "struct gl_lightmodel" ); + + OFFSET( "LIGHT_MODEL_AMBIENT ", struct gl_lightmodel, Ambient ); + OFFSET( "LIGHT_MODEL_LOCAL_VIEWER ", struct gl_lightmodel, LocalViewer ); + OFFSET( "LIGHT_MODEL_TWO_SIDE ", struct gl_lightmodel, TwoSide ); + OFFSET( "LIGHT_MODEL_COLOR_CONTROL ", struct gl_lightmodel, ColorControl ); + + + printf( "\n" ); + printf( "\n" ); + printf( "#endif /* __ASM_TYPES_H__ */\n" ); + + return 0; +} -- cgit v1.2.3