/*@{*/
-/**
- * One-time initialization mutex lock.
- *
- * \sa Used by one_time_init().
- */
-mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
-
-
/**
* Calls all the various one-time-fini functions in Mesa
*/
_mesa_locale_fini();
}
+/**
+ * Calls all the various one-time-init functions in Mesa
+ */
+
+static void
+one_time_init(void)
+{
+ GLuint i;
+
+ STATIC_ASSERT(sizeof(GLbyte) == 1);
+ STATIC_ASSERT(sizeof(GLubyte) == 1);
+ STATIC_ASSERT(sizeof(GLshort) == 2);
+ STATIC_ASSERT(sizeof(GLushort) == 2);
+ STATIC_ASSERT(sizeof(GLint) == 4);
+ STATIC_ASSERT(sizeof(GLuint) == 4);
+
+ _mesa_locale_init();
+
+ _mesa_one_time_init_extension_overrides();
+
+ _mesa_get_cpu_features();
+
+ for (i = 0; i < 256; i++) {
+ _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
+ }
+
+ atexit(one_time_fini);
+
+#if defined(DEBUG)
+ if (MESA_VERBOSE != 0) {
+ _mesa_debug(NULL, "Mesa " PACKAGE_VERSION " DEBUG build" MESA_GIT_SHA1 "\n");
+ }
+#endif
+
+ /* Take a glsl type reference for the duration of libGL's life to avoid
+ * unecessary creation/destruction of glsl types.
+ */
+ glsl_type_singleton_init_or_ref();
+
+ _mesa_init_remap_table();
+}
+
+/**
+ * One-time initialization mutex lock.
+ *
+ * \sa Used by _mesa_initialize().
+ */
+mtx_t OneTimeLock = _MTX_INITIALIZER_NP;
+
+
/**
* Calls all the various one-time-init functions in Mesa.
*
mtx_lock(&OneTimeLock);
/* truly one-time init */
- if (!initialized) {
- GLuint i;
-
- STATIC_ASSERT(sizeof(GLbyte) == 1);
- STATIC_ASSERT(sizeof(GLubyte) == 1);
- STATIC_ASSERT(sizeof(GLshort) == 2);
- STATIC_ASSERT(sizeof(GLushort) == 2);
- STATIC_ASSERT(sizeof(GLint) == 4);
- STATIC_ASSERT(sizeof(GLuint) == 4);
-
- _mesa_locale_init();
-
- _mesa_one_time_init_extension_overrides();
-
- _mesa_get_cpu_features();
-
- for (i = 0; i < 256; i++) {
- _mesa_ubyte_to_float_color_tab[i] = (float) i / 255.0F;
- }
-
- atexit(one_time_fini);
-
-#if defined(DEBUG)
- if (MESA_VERBOSE != 0) {
- _mesa_debug(NULL, "Mesa " PACKAGE_VERSION " DEBUG build" MESA_GIT_SHA1 "\n");
- }
-#endif
-
- /* Take a glsl type reference for the duration of libGL's life to avoid
- * unecessary creation/destruction of glsl types.
- */
- glsl_type_singleton_init_or_ref();
-
- _mesa_init_remap_table();
- }
+ if (!initialized)
+ one_time_init();
initialized = true;