13464ebd5Sriastradh/* 23464ebd5Sriastradh * Mesa 3-D graphics library 33464ebd5Sriastradh * 43464ebd5Sriastradh * Copyright (C) 1999-2004 Brian Paul All Rights Reserved. 53464ebd5Sriastradh * 63464ebd5Sriastradh * Permission is hereby granted, free of charge, to any person obtaining a 73464ebd5Sriastradh * copy of this software and associated documentation files (the "Software"), 83464ebd5Sriastradh * to deal in the Software without restriction, including without limitation 93464ebd5Sriastradh * the rights to use, copy, modify, merge, publish, distribute, sublicense, 103464ebd5Sriastradh * and/or sell copies of the Software, and to permit persons to whom the 113464ebd5Sriastradh * Software is furnished to do so, subject to the following conditions: 123464ebd5Sriastradh * 133464ebd5Sriastradh * The above copyright notice and this permission notice shall be included 143464ebd5Sriastradh * in all copies or substantial portions of the Software. 153464ebd5Sriastradh * 163464ebd5Sriastradh * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 173464ebd5Sriastradh * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 183464ebd5Sriastradh * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 19af69d88dSmrg * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20af69d88dSmrg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21af69d88dSmrg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22af69d88dSmrg * OTHER DEALINGS IN THE SOFTWARE. 233464ebd5Sriastradh */ 243464ebd5Sriastradh 253464ebd5Sriastradh 263464ebd5Sriastradh/** 273464ebd5Sriastradh * \file glapi_dispatch.c 283464ebd5Sriastradh * 293464ebd5Sriastradh * This file generates all the gl* function entrypoints. This code is not 303464ebd5Sriastradh * used if optimized assembly stubs are available (e.g., using 313464ebd5Sriastradh * glapi/glapi_x86.S on IA32 or glapi/glapi_sparc.S on SPARC). 323464ebd5Sriastradh * 333464ebd5Sriastradh * \note 343464ebd5Sriastradh * This file is also used to build the client-side libGL that loads DRI-based 353464ebd5Sriastradh * device drivers. At build-time it is symlinked to src/glx. 363464ebd5Sriastradh * 373464ebd5Sriastradh * \author Brian Paul <brian@precisioninsight.com> 383464ebd5Sriastradh */ 393464ebd5Sriastradh 403464ebd5Sriastradh#include "glapi/glapi_priv.h" 4101e04c3fSmrg#include "glapitable.h" 423464ebd5Sriastradh 433464ebd5Sriastradh 443464ebd5Sriastradh#if !(defined(USE_X86_ASM) || defined(USE_X86_64_ASM) || defined(USE_SPARC_ASM)) 453464ebd5Sriastradh 46af69d88dSmrg#if defined(_WIN32) 473464ebd5Sriastradh#define KEYWORD1 GLAPI 483464ebd5Sriastradh#else 493464ebd5Sriastradh#define KEYWORD1 PUBLIC 503464ebd5Sriastradh#endif 513464ebd5Sriastradh 523464ebd5Sriastradh#define KEYWORD2 GLAPIENTRY 533464ebd5Sriastradh 543464ebd5Sriastradh#define NAME(func) gl##func 553464ebd5Sriastradh 563464ebd5Sriastradh#if 0 /* Use this to log GL calls to stdout (for DEBUG only!) */ 573464ebd5Sriastradh 583464ebd5Sriastradh#define F stdout 593464ebd5Sriastradh#define DISPATCH(FUNC, ARGS, MESSAGE) \ 603464ebd5Sriastradh fprintf MESSAGE; \ 613464ebd5Sriastradh GET_DISPATCH()->FUNC ARGS 623464ebd5Sriastradh 633464ebd5Sriastradh#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ 643464ebd5Sriastradh fprintf MESSAGE; \ 653464ebd5Sriastradh return GET_DISPATCH()->FUNC ARGS 663464ebd5Sriastradh 673464ebd5Sriastradh#else 683464ebd5Sriastradh 693464ebd5Sriastradh#define DISPATCH(FUNC, ARGS, MESSAGE) \ 703464ebd5Sriastradh GET_DISPATCH()->FUNC ARGS 713464ebd5Sriastradh 723464ebd5Sriastradh#define RETURN_DISPATCH(FUNC, ARGS, MESSAGE) \ 733464ebd5Sriastradh return GET_DISPATCH()->FUNC ARGS 743464ebd5Sriastradh 753464ebd5Sriastradh#endif /* logging */ 763464ebd5Sriastradh 773464ebd5Sriastradh 783464ebd5Sriastradh#ifndef GLAPIENTRY 793464ebd5Sriastradh#define GLAPIENTRY 803464ebd5Sriastradh#endif 813464ebd5Sriastradh 823464ebd5Sriastradh#ifdef GLX_INDIRECT_RENDERING 833464ebd5Sriastradh/* those link to libglapi.a should provide the entry points */ 843464ebd5Sriastradh#define _GLAPI_SKIP_PROTO_ENTRY_POINTS 853464ebd5Sriastradh#endif 86af69d88dSmrg 87af69d88dSmrg/* These prototypes are necessary because GLES1 library builds will create 88af69d88dSmrg * dispatch functions for them. We can't directly include GLES/gl.h because 89af69d88dSmrg * it would conflict the previously-included GL/gl.h. Since GLES1 ABI is not 90af69d88dSmrg * expected to every add more functions, the path of least resistance is to 91af69d88dSmrg * just duplicate the prototypes for the functions that aren't already in 92af69d88dSmrg * desktop OpenGL. 93af69d88dSmrg */ 94af69d88dSmrg#include <GLES/glplatform.h> 95af69d88dSmrg 9601e04c3fSmrg 9701e04c3fSmrg/* Redefine GL_API to avoid MSVC/MinGW warnings about different dllimport 9801e04c3fSmrg * attributes for these prototypes vs those in the GLES/gl.h header. 9901e04c3fSmrg */ 10001e04c3fSmrg#undef GL_API 10101e04c3fSmrg#define GL_API KEYWORD1 10201e04c3fSmrg 103af69d88dSmrgGL_API void GL_APIENTRY glClearDepthf (GLclampf depth); 104af69d88dSmrgGL_API void GL_APIENTRY glClipPlanef (GLenum plane, const GLfloat *equation); 105af69d88dSmrgGL_API void GL_APIENTRY glFrustumf (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); 1067ec681f3SmrgGL_API void GL_APIENTRY glGetClipPlanef (GLenum pname, GLfloat *equation); 107af69d88dSmrgGL_API void GL_APIENTRY glOrthof (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); 108af69d88dSmrg 109af69d88dSmrgGL_API void GL_APIENTRY glAlphaFuncx (GLenum func, GLclampx ref); 110af69d88dSmrgGL_API void GL_APIENTRY glClearColorx (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); 111af69d88dSmrgGL_API void GL_APIENTRY glClearDepthx (GLclampx depth); 112af69d88dSmrgGL_API void GL_APIENTRY glClipPlanex (GLenum plane, const GLfixed *equation); 113af69d88dSmrgGL_API void GL_APIENTRY glColor4x (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); 114af69d88dSmrgGL_API void GL_APIENTRY glDepthRangex (GLclampx zNear, GLclampx zFar); 115af69d88dSmrgGL_API void GL_APIENTRY glFogx (GLenum pname, GLfixed param); 116af69d88dSmrgGL_API void GL_APIENTRY glFogxv (GLenum pname, const GLfixed *params); 117af69d88dSmrgGL_API void GL_APIENTRY glFrustumx (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); 1187ec681f3SmrgGL_API void GL_APIENTRY glGetClipPlanex (GLenum pname, GLfixed *equation); 119af69d88dSmrgGL_API void GL_APIENTRY glGetFixedv (GLenum pname, GLfixed *params); 120af69d88dSmrgGL_API void GL_APIENTRY glGetLightxv (GLenum light, GLenum pname, GLfixed *params); 121af69d88dSmrgGL_API void GL_APIENTRY glGetMaterialxv (GLenum face, GLenum pname, GLfixed *params); 122af69d88dSmrgGL_API void GL_APIENTRY glGetTexEnvxv (GLenum env, GLenum pname, GLfixed *params); 123af69d88dSmrgGL_API void GL_APIENTRY glGetTexParameterxv (GLenum target, GLenum pname, GLfixed *params); 124af69d88dSmrgGL_API void GL_APIENTRY glLightModelx (GLenum pname, GLfixed param); 125af69d88dSmrgGL_API void GL_APIENTRY glLightModelxv (GLenum pname, const GLfixed *params); 126af69d88dSmrgGL_API void GL_APIENTRY glLightx (GLenum light, GLenum pname, GLfixed param); 127af69d88dSmrgGL_API void GL_APIENTRY glLightxv (GLenum light, GLenum pname, const GLfixed *params); 128af69d88dSmrgGL_API void GL_APIENTRY glLineWidthx (GLfixed width); 129af69d88dSmrgGL_API void GL_APIENTRY glLoadMatrixx (const GLfixed *m); 130af69d88dSmrgGL_API void GL_APIENTRY glMaterialx (GLenum face, GLenum pname, GLfixed param); 131af69d88dSmrgGL_API void GL_APIENTRY glMaterialxv (GLenum face, GLenum pname, const GLfixed *params); 132af69d88dSmrgGL_API void GL_APIENTRY glMultMatrixx (const GLfixed *m); 133af69d88dSmrgGL_API void GL_APIENTRY glMultiTexCoord4x (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); 134af69d88dSmrgGL_API void GL_APIENTRY glNormal3x (GLfixed nx, GLfixed ny, GLfixed nz); 135af69d88dSmrgGL_API void GL_APIENTRY glOrthox (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); 136af69d88dSmrgGL_API void GL_APIENTRY glPointParameterx (GLenum pname, GLfixed param); 137af69d88dSmrgGL_API void GL_APIENTRY glPointParameterxv (GLenum pname, const GLfixed *params); 138af69d88dSmrgGL_API void GL_APIENTRY glPointSizex (GLfixed size); 139af69d88dSmrgGL_API void GL_APIENTRY glPolygonOffsetx (GLfixed factor, GLfixed units); 140af69d88dSmrgGL_API void GL_APIENTRY glRotatex (GLfixed angle, GLfixed x, GLfixed y, GLfixed z); 141af69d88dSmrgGL_API void GL_APIENTRY glSampleCoveragex (GLclampx value, GLboolean invert); 142af69d88dSmrgGL_API void GL_APIENTRY glScalex (GLfixed x, GLfixed y, GLfixed z); 143af69d88dSmrgGL_API void GL_APIENTRY glTexEnvx (GLenum target, GLenum pname, GLfixed param); 144af69d88dSmrgGL_API void GL_APIENTRY glTexEnvxv (GLenum target, GLenum pname, const GLfixed *params); 145af69d88dSmrgGL_API void GL_APIENTRY glTexParameterx (GLenum target, GLenum pname, GLfixed param); 146af69d88dSmrgGL_API void GL_APIENTRY glTexParameterxv (GLenum target, GLenum pname, const GLfixed *params); 147af69d88dSmrgGL_API void GL_APIENTRY glTranslatex (GLfixed x, GLfixed y, GLfixed z); 148af69d88dSmrgGL_API void GL_APIENTRY glPointSizePointerOES (GLenum type, GLsizei stride, const GLvoid *pointer); 14901e04c3fSmrgGL_API void GL_APIENTRY glBlendBarrier (void); 15001e04c3fSmrgGL_API void GL_APIENTRY glPrimitiveBoundingBox (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); 15101e04c3fSmrg 15201e04c3fSmrg/* Enable frame pointer elimination on Windows, otherwise forgetting to add 15301e04c3fSmrg * APIENTRY to _mesa_* entrypoints will not cause crashes on debug builds, as 15401e04c3fSmrg * the initial ESP value is saved in the EBP in the function prologue, then 15501e04c3fSmrg * restored on the epilogue, clobbering any corruption in the ESP pointer due 15601e04c3fSmrg * to mismatch in the callee calling convention. 15701e04c3fSmrg * 15801e04c3fSmrg * On MSVC it's not sufficient to enable /Oy -- other optimizations must be 15901e04c3fSmrg * enabled or frame pointer will be used regardless. 16001e04c3fSmrg * 16101e04c3fSmrg * We don't do this when NDEBUG is defined since, frame pointer omission 16201e04c3fSmrg * optimization compiler flag are already specified on release builds, and 16301e04c3fSmrg * because on profile builds we must have frame pointers or certain profilers 16401e04c3fSmrg * might fail to unwind the stack. 16501e04c3fSmrg */ 16601e04c3fSmrg#if defined(_WIN32) && !defined(NDEBUG) 16701e04c3fSmrg# if defined(_MSC_VER) 16801e04c3fSmrg# pragma optimize( "gty", on ) 16901e04c3fSmrg# elif defined(__GNUC__) 17001e04c3fSmrg# pragma GCC optimize ("omit-frame-pointer") 17101e04c3fSmrg# endif 17201e04c3fSmrg#endif 173af69d88dSmrg 1747ec681f3Smrg#include "glapitemp.h" 1753464ebd5Sriastradh 1763464ebd5Sriastradh#endif /* USE_X86_ASM */ 177