/*
* Mesa 3-D graphics library
- * Version: 6.5.1
*
* Copyright (C) 1999-2006 Brian Paul All Rights Reserved.
*
* 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
* Mesa, including lighting, clipping, texture image conversion etc.
*/
+#ifndef __STDC_FORMAT_MACROS
+#define __STDC_FORMAT_MACROS
+#endif
+
+#include <stdio.h>
+#include <inttypes.h>
+
#include "main/glheader.h"
#include "main/mtypes.h"
#include "tnl/t_context.h"
printf( "\n" ); \
printf( "/* =====================================================" \
"========\n" ); \
- printf( " * Offsets for %s\n", x ); \
+ printf( " * Offsets for " x "\n" ); \
printf( " */\n" ); \
printf( "\n" ); \
} while (0)
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 ) \
- printf( "#define %s\t0x%x\n", 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%" 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) )
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_LIGHTS ", struct gl_context, Light._EnabledLights );
+ OFFSET( "CTX_LIGHT_NEED_VERTS ", struct gl_context, Light._NeedVertices );
+ OFFSET( "CTX_LIGHT_BASE_COLOR ", struct gl_context, Light._BaseColor );
/* struct vertex_buffer 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_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 );