X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fx86%2Fgen_matypes.c;h=1e904aa0b1370876b857bdf034254f1a293ca7c8;hb=488d4c482637af4b0ab25a3b0e664795164fe819;hp=0d7e0f1f98b85f58beae62e003b0a36c958d9dee;hpb=37c79d4d765b10a79e0cf217cc1e70d3fbb7a0c5;p=mesa.git diff --git a/src/mesa/x86/gen_matypes.c b/src/mesa/x86/gen_matypes.c index 0d7e0f1f98b..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,29 +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) -#if defined(__BEOS__) || defined(__HAIKU__) || 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 +#ifdef ASM_OFFSETS + +/* + * 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 ) -#if defined(__BEOS__) || defined(__HAIKU__) || 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_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) ) @@ -94,22 +112,20 @@ int main( int argc, char **argv ) printf( "\n" ); - /* GLcontext offsets: + /* struct gl_context offsets: */ - OFFSET_HEADER( "GLcontext" ); + OFFSET_HEADER( "struct gl_context" ); - 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 ); + 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_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_BASE_COLOR ", struct gl_context, Light._BaseColor ); /* struct vertex_buffer offsets: @@ -214,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 );