/** * Calls all the various one-time-init functions in Mesa. * * While holding a global mutex lock, calls several initialization functions, * and sets the glapi callbacks if the \c MESA_DEBUG environment variable is * defined. * * \sa _math_init(). */ static void one_time_init( GLcontext *ctx ) { static GLboolean alreadyCalled = GL_FALSE; (void) ctx; _glthread_LOCK_MUTEX(OneTimeLock); if (!alreadyCalled) { GLuint i; /* do some implementation tests */ assert( sizeof(GLbyte) == 1 ); assert( sizeof(GLubyte) == 1 ); assert( sizeof(GLshort) == 2 ); assert( sizeof(GLushort) == 2 ); assert( sizeof(GLint) == 4 ); assert( sizeof(GLuint) == 4 ); _mesa_get_cpu_features(); _mesa_init_remap_table(); _mesa_init_sqrt_table(); for (i = 0; i < 256; i++) { _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F; } if (_mesa_getenv("MESA_DEBUG")) { _glapi_noop_enable_warnings(GL_TRUE); _glapi_set_warning_func( (_glapi_warning_func) _mesa_warning ); } else { _glapi_noop_enable_warnings(GL_FALSE); } #if defined(DEBUG) && defined(__DATE__) && defined(__TIME__) _mesa_debug(ctx, "Mesa %s DEBUG build %s %s\n", MESA_VERSION_STRING, __DATE__, __TIME__); #endif alreadyCalled = GL_TRUE; } _glthread_UNLOCK_MUTEX(OneTimeLock); dummy_enum_func(); }
const GLubyte* MesaSoftwareRenderer::_GetString(gl_context* ctx, GLenum name) { switch (name) { case GL_VENDOR: return (const GLubyte*) "Mesa Project"; case GL_RENDERER: { _mesa_get_cpu_features(); static char buffer[256] = { '\0' }; if (!buffer[0]) { char* cpuInfo = _mesa_get_cpu_string(); // Let's build an renderer string sprintf(buffer, "Software Rasterizer for %s", cpuInfo); free(cpuInfo); } return (const GLubyte*) buffer; } default: // Let core library handle all other cases return NULL; } }