X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fx86%2Fgen_matypes.c;h=1e904aa0b1370876b857bdf034254f1a293ca7c8;hb=488d4c482637af4b0ab25a3b0e664795164fe819;hp=648bf8787dbd8bbac5759d179bb1e3033db7f71b;hpb=dbf3a15313eed930a3d8fdde12e457259c43651b;p=mesa.git diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index 648bf8787db..1e904aa0b13 100644 --- a/src/mesa/x86/gen_matypes.c +++ b/src/mesa/x86/gen_matypes.c @@ -1,6 +1,5 @@ /* * Mesa 3-D graphics library - * Version: 6.5.1 * * Copyright (C) 1999-2006 Brian Paul All Rights Reserved. * @@ -17,9 +16,10 @@ * 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. + * THE AUTHORS OR COPYRIGHT HOLDERS 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 @@ -32,6 +32,11 @@ * Mesa, including lighting, clipping, texture image conversion etc. */ +#ifndef __STDC_FORMAT_MACROS +#define __STDC_FORMAT_MACROS +#endif +#include + #include "main/glheader.h" #include "main/mtypes.h" #include "tnl/t_context.h" @@ -47,7 +52,7 @@ do { \ printf( "\n" ); \ printf( "/* =====================================================" \ "========\n" ); \ - printf( " * Offsets for %s\n", x ); \ + printf( " * Offsets for " x "\n" ); \ printf( " */\n" ); \ printf( "\n" ); \ } while (0) @@ -56,19 +61,42 @@ do { \ do { \ printf( "\n" ); \ printf( "/*\n" ); \ - printf( " * Flags for %s\n", x ); \ + printf( " * Flags for " x "\n" ); \ printf( " */\n" ); \ printf( "\n" ); \ } while (0) -#define OFFSET( s, t, m ) \ - printf( "#define %s\t%lu\n", s, (unsigned long) offsetof( t, m ) ); +#ifdef ASM_OFFSETS -#define SIZEOF( s, t ) \ - printf( "#define %s\t%lu\n", s, (unsigned long) sizeof(t) ); +/* + * Format the asm output in a special way that we can manipulate + * after the fact and turn into the final header for the target. + */ + +#define DEFINE_UL( s, ul ) \ + __asm__ __volatile__ ( "\n->" s " %0" : : "i" (ul) ) + +#define DEFINE( s, d ) \ + DEFINE_UL( s, d ) + +#define printf( x ) \ + __asm__ __volatile__ ( "\n->" x ) + +#else + +#define DEFINE_UL( s, ul ) \ + printf( "#define %s\t%lu\n", s, (unsigned long) (ul) ); #define DEFINE( s, d ) \ - printf( "#define %s\t0x%x\n", s, d ); + printf( "#define %s\t0x%" PRIx64 "\n", s, (uint64_t) d ); + +#endif + +#define OFFSET( s, t, m ) \ + DEFINE_UL( s, offsetof( t, m ) ) + +#define SIZEOF( s, t ) \ + DEFINE_UL( s, sizeof(t) ) @@ -88,17 +116,15 @@ int main( int argc, char **argv ) */ OFFSET_HEADER( "struct gl_context" ); - OFFSET( "CTX_DRIVER_CTX ", struct gl_context, DriverCtx ); printf( "\n" ); OFFSET( "CTX_LIGHT_ENABLED ", struct gl_context, Light.Enabled ); OFFSET( "CTX_LIGHT_SHADE_MODEL ", struct gl_context, Light.ShadeModel ); OFFSET( "CTX_LIGHT_COLOR_MAT_FACE ", struct gl_context, Light.ColorMaterialFace ); OFFSET( "CTX_LIGHT_COLOR_MAT_MODE ", struct gl_context, Light.ColorMaterialMode ); - OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", struct gl_context, Light.ColorMaterialBitmask ); + OFFSET( "CTX_LIGHT_COLOR_MAT_MASK ", struct gl_context, Light._ColorMaterialBitmask ); OFFSET( "CTX_LIGHT_COLOR_MAT_ENABLED ", struct gl_context, Light.ColorMaterialEnabled ); OFFSET( "CTX_LIGHT_ENABLED_LIST ", struct gl_context, Light.EnabledList ); OFFSET( "CTX_LIGHT_NEED_VERTS ", struct gl_context, Light._NeedVertices ); - OFFSET( "CTX_LIGHT_FLAGS ", struct gl_context, Light._Flags ); OFFSET( "CTX_LIGHT_BASE_COLOR ", struct gl_context, Light._BaseColor ); @@ -204,7 +230,6 @@ int main( int argc, char **argv ) OFFSET( "LIGHT_NORM_DIRECTION ", struct gl_light, _NormSpotDirection ); 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 );