# Copy these files to avoid generation object files into src/mesa/program
env.Prepend(CPPPATH = ['#src/mesa/main'])
-env.Command('glsl/imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
env.Command('glsl/extensions_table.c', '#src/mesa/main/extensions_table.c', Copy('$TARGET', '$SOURCE'))
# Copy these files to avoid generation object files into src/mesa/program
env.Prepend(CPPPATH = ['#src/mesa/program'])
mesa_objs = env.StaticObject([
'glsl/extensions_table.c',
- 'glsl/imports.c',
'glsl/symbol_table.c',
'glsl/dummy_errors.c',
])
#include "gl_nir.h"
#include "ir_uniform.h"
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
static nir_ssa_def *
#include "gl_nir.h"
#include "ir_uniform.h"
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
struct lower_samplers_as_deref_state {
#include "compiler/nir/nir_builtin_builder.h"
#include "compiler/nir/nir_deref.h"
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/shaderobj.h"
#include "util/u_math.h"
*/
#include <string.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "ir.h"
#include "compiler/glsl_types.h"
#include "util/hash_table.h"
#include "util/u_string.h"
#include "util/u_math.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/shaderobj.h"
#include "main/enums.h"
#include "main/mtypes.h"
*/
#include <gtest/gtest.h>
#include "standalone_scaffolding.h"
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "ir.h"
* DEALINGS IN THE SOFTWARE.
*/
#include <gtest/gtest.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "util/ralloc.h"
* DEALINGS IN THE SOFTWARE.
*/
#include <gtest/gtest.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "ir.h"
* DEALINGS IN THE SOFTWARE.
*/
#include <gtest/gtest.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "util/ralloc.h"
* DEALINGS IN THE SOFTWARE.
*/
#include <gtest/gtest.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "ir.h"
* DEALINGS IN THE SOFTWARE.
*/
#include <gtest/gtest.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "ir.h"
* DEALINGS IN THE SOFTWARE.
*/
#include <gtest/gtest.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "util/ralloc.h"
* DEALINGS IN THE SOFTWARE.
*/
#include <gtest/gtest.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "util/ralloc.h"
*/
#include "nir.h"
-#include <main/imports.h>
+#include <util/imports.h>
/**
* SSA-based copy propagation
#include <GL/glxproto.h>
#include "xm_api.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/errors.h"
#include "util/u_math.h"
#include "hud/hud_context.h"
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "xm_public.h"
#include <GL/glx.h>
#define BRW_REG_H
#include <stdbool.h>
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/macros.h"
#include "program/prog_instruction.h"
#include "brw_eu_defines.h"
def printRealHeader(self):
print('#include "main/glheader.h"')
print('#include "main/enums.h"')
- print('#include "main/imports.h"')
+ print('#include "util/imports.h"')
print('#include "main/mtypes.h"')
print('')
print('typedef struct PACKED {')
#include "main/genmipmap.h"
#include "main/hint.h"
#include "main/histogram.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/light.h"
#include "main/lines.h"
#include "main/matrix.h"
* can SET_FuncName, are used to get and set the dispatch pointer for the
* named function in the specified dispatch table.
*/
+
+#include "main/glheader.h"
""")
return
LOCAL_SRC_FILES := \
main/extensions_table.c \
- main/imports.c \
program/symbol_table.c \
program/dummy_errors.c
main/colortab.h \
main/compute.c \
main/compute.h \
- main/compiler.h \
main/condrender.c \
main/condrender.h \
main/config.h \
main/histogram.h \
main/image.c \
main/image.h \
- main/imports.c \
- main/imports.h \
main/light.c \
main/light.h \
main/lines.c \
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/accum.h"
#include "main/arrayobj.h"
#include "main/context.h"
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/arbprogram.h"
#include "main/arrayobj.h"
#include "main/blend.h"
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/arbprogram.h"
#include "main/arrayobj.h"
#include "main/blend.h"
#include "i830_context.h"
#include "main/api_exec.h"
#include "main/extensions.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/version.h"
#include "main/vtxfmt.h"
#include "tnl/tnl.h"
#include "main/api_exec.h"
#include "main/framebuffer.h"
#include "main/extensions.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/version.h"
#include "main/vtxfmt.h"
#include "i915_reg.h"
#include "i915_debug.h"
-#include "main/imports.h"
+#include "util/imports.h"
+#include "main/glheader.h"
static const char *opcodes[0x20] = {
"NOP",
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/renderbuffer.h"
#include "main/framebuffer.h"
**************************************************************************/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/bufferobj.h"
#include "main/extensions.h"
#include "main/fbobject.h"
#include "main/framebuffer.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/points.h"
#include "main/renderbuffer.h"
#include "main/enums.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/fbobject.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/enums.h"
* performance bottleneck, though.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "intel_context.h"
#include "intel_batchbuffer.h"
* (GL_NV_conditional_render, GL_ARB_conditional_render_inverted) on Gen7+.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/condrender.h"
#include "brw_context.h"
#include "main/fbobject.h"
#include "main/extensions.h"
#include "main/glthread.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/points.h"
#include "main/version.h"
* The driver implementation of the GL_APPLE_object_purgeable extension.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/bufferobj.h"
*
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/bufferobj.h"
#include "main/varray.h"
#include "vbo/vbo.h"
*/
#include <pthread.h>
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/glspirv.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
* big we throw out all of the cache data and let it get regenerated.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/streaming-load-memcpy.h"
#include "x86/common_x86_asm.h"
#include "intel_batchbuffer.h"
* appropriately synced with the stage of the pipeline for our extensions'
* needs.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/queryobj.h"
#include "brw_context.h"
#include <libsync.h> /* Requires Android or libdrm-2.4.72 */
-#include "main/imports.h"
+#include "util/imports.h"
#include "brw_context.h"
#include "intel_batchbuffer.h"
*/
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/context.h"
#include "brw_context.h"
#include "brw_vs.h"
* GL_EXT_transform_feedback, and friends) on platforms that support
* hardware contexts (Gen6+).
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "brw_context.h"
#include "brw_defines.h"
*
* Support for query buffer objects (GL_ARB_query_buffer_object) on Haswell+.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "brw_context.h"
#include "brw_defines.h"
* This provides core GL buffer object functionality.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/streaming-load-memcpy.h"
*/
#include "main/enums.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/fbobject.h"
* Batched upload via BOs.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "brw_bufmgr.h"
#include "brw_context.h"
#ifndef __NOUVEAU_DRIVER_H__
#define __NOUVEAU_DRIVER_H__
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/formats.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/context.h"
#include "util/simple_list.h"
#include "main/api_arrayelt.h"
#include "main/api_exec.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/extensions.h"
#include "main/version.h"
#include "main/vtxfmt.h"
#include <errno.h>
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/context.h"
#include "swrast/swrast.h"
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/state.h"
#include <errno.h>
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "r200_context.h"
#include "r200_sanity.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/enums.h"
#include "main/light.h"
#include "main/framebuffer.h"
#include "main/errors.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/enums.h"
#include "main/api_arrayelt.h"
#include "main/state.h"
#include "main/mtypes.h"
#include "main/enums.h"
#include "main/image.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/state.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/enums.h"
#include "main/light.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/image.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/macros.h"
#include "main/state.h"
*
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/bufferobj.h"
#include <errno.h>
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/fbobject.h"
#include "main/api_exec.h"
#include "main/context.h"
#include "util/simple_list.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/extensions.h"
#include "main/version.h"
#include "main/vtxfmt.h"
**************************************************************************/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/enums.h"
#include "c99_math.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/mtypes.h"
#include "main/enums.h"
#include "swrast/swrast.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "util/simple_list.h"
#include "radeon_context.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/macros.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/state.h"
#include "radeon_queryobj.h"
#include "radeon_debug.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/queryobj.h"
#include <inttypes.h>
*
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "util/simple_list.h"
#include "radeon_common_context.h"
#include <errno.h>
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/enums.h"
#include "main/light.h"
#include "main/context.h"
#include "main/errors.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/api_arrayelt.h"
#include "swrast/swrast.h"
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/enums.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/state.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/light.h"
#include "main/enums.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/image.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/macros.h"
#include "main/teximage.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/mipmap.h"
#include "main/fbobject.h"
#include "main/formats.h"
#include "main/framebuffer.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/renderbuffer.h"
#include "main/version.h"
#include "main/vtxfmt.h"
#include "main/extensions.h"
#include "main/formats.h"
#include "main/framebuffer.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mipmap.h"
#include "main/mtypes.h"
#include "main/context.h"
#include "main/config.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/version.h"
#include "xfonts.h"
#include <stdio.h>
#include "glxheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "xfonts.h"
#include "main/context.h"
#include "main/extensions.h"
#include "main/framebuffer.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/renderbuffer.h"
#include "main/teximage.h"
#include "glxheader.h"
#include "xmesaP.h"
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/formats.h"
#include "main/framebuffer.h"
#include "main/renderbuffer.h"
#include "main/macros.h"
#include "main/mipmap.h"
#include "main/image.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/pbo.h"
#include "main/texformat.h"
#include <stdio.h>
#include "c99_math.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "glxheader.h"
#include "xmesaP.h"
#include "format_unpack.h"
#include "format_pack.h"
#include "framebuffer.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "state.h"
#include "mtypes.h"
#include "api_arrayelt.h"
#include "bufferobj.h"
#include "context.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "mtypes.h"
#include "main/dispatch.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/hash.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/arbprogram.h"
#include "glheader.h"
#include "hash.h"
#include "image.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "bufferobj.h"
#include "arrayobj.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/hash.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/enums.h"
#include "main/mtypes.h"
*/
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "accum.h"
#include "arrayobj.h"
#include "attrib.h"
#include "glheader.h"
#include "enums.h"
#include "hash.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "bufferobj.h"
#include "externalobjects.h"
+++ /dev/null
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * 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
- * 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.
- */
-
-
-/**
- * \file compiler.h
- * Compiler-related stuff.
- */
-
-
-#ifndef COMPILER_H
-#define COMPILER_H
-
-
-#include <assert.h>
-
-#include "util/macros.h"
-
-#include "c99_compat.h" /* inline, __func__, etc. */
-
-
-/**
- * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
- * Do not use these unless absolutely necessary!
- * Try to use a runtime test instead.
- * For now, only used by some DRI hardware drivers for color/texel packing.
- */
-#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
-#if defined(__linux__)
-#include <byteswap.h>
-#define CPU_TO_LE32( x ) bswap_32( x )
-#elif defined(__APPLE__)
-#include <CoreFoundation/CFByteOrder.h>
-#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
-#elif defined(__OpenBSD__)
-#include <sys/types.h>
-#define CPU_TO_LE32( x ) htole32( x )
-#else /*__linux__ */
-#include <sys/endian.h>
-#define CPU_TO_LE32( x ) bswap32( x )
-#endif /*__linux__*/
-#define MESA_BIG_ENDIAN 1
-#else
-#define CPU_TO_LE32( x ) ( x )
-#define MESA_LITTLE_ENDIAN 1
-#endif
-#define LE32_TO_CPU( x ) CPU_TO_LE32( x )
-
-
-
-#define IEEE_ONE 0x3f800000
-
-
-#endif /* COMPILER_H */
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "accum.h"
#include "api_exec.h"
#include "api_loopback.h"
#include "errors.h"
-#include "imports.h"
+#include "util/imports.h"
#include "extensions.h"
#include "mtypes.h"
#include "vbo/vbo.h"
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/cpuinfo.h"
#include "enums.h"
#include "formats.h"
#include "hash.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "debug.h"
#include "get.h"
#include "context.h"
#include "debug_output.h"
#include "enums.h"
-#include "imports.h"
+#include "util/imports.h"
#include "hash.h"
#include "mtypes.h"
#include "version.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "depth.h"
#include "enums.h"
#include "c99_math.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "api_arrayelt.h"
#include "api_exec.h"
#include "api_loopback.h"
#include "arrayobj.h"
#include "bufferobj.h"
#include "context.h"
-#include "imports.h"
+#include "util/imports.h"
#include "mtypes.h"
#include "pipelineobj.h"
#include "enums.h"
*/
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "draw_validate.h"
#include "bufferobj.h"
#include "context.h"
#include "main/errors.h"
#include "main/drawtex.h"
#include "main/state.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include <stdio.h>
#include "errors.h"
#include "enums.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "debug_output.h"
#include "context.h"
#include "depth.h"
#include "fog.h"
-#include "imports.h"
+#include "util/imports.h"
#include "light.h"
#include "lines.h"
#include "matrix.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "eval.h"
#include "macros.h"
#include <stdio.h>
-#include "imports.h"
+#include "util/imports.h"
+#include "main/glheader.h"
#include "execmem.h"
#include "c11/threads.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "extensions.h"
#include "macros.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/samplerobj.h"
#include "main/shaderobj.h"
#define FORMAT_UTILS_H
#include "formats.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "util/rounding.h"
#include "util/half_float.h"
#include "errors.h"
-#include "imports.h"
+#include "util/imports.h"
#include "formats.h"
#include "macros.h"
#include "glformats.h"
#include <stdio.h>
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "blend.h"
#include "buffers.h"
#include "context.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "c11/threads.h"
/**
#include "enums.h"
#include "context.h"
#include "hint.h"
-#include "imports.h"
+#include "util/imports.h"
#include "mtypes.h"
#include "colormac.h"
#include "glformats.h"
#include "image.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "mtypes.h"
+++ /dev/null
-/**
- * \file imports.c
- * Standard C library function wrappers.
- *
- * Imports are services which the device driver or window system or
- * operating system provides to the core renderer. The core renderer (Mesa)
- * will call these functions in order to do memory allocation, simple I/O,
- * etc.
- *
- * Some drivers will want to override/replace this file with something
- * specialized, but that'll be rare.
- *
- * Eventually, I want to move roll the glheader.h file into this.
- *
- * \todo Functions still needed:
- * - scanf
- * - qsort
- * - rand and RAND_MAX
- */
-
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * 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
- * 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.
- */
-
-#include <stdio.h>
-#include <stdarg.h>
-#include "c99_math.h"
-#include "imports.h"
-#include "context.h"
-#include "version.h"
-
-#ifdef _GNU_SOURCE
-#include <locale.h>
-#ifdef __APPLE__
-#include <xlocale.h>
-#endif
-#endif
-
-
-#ifdef _WIN32
-#define vsnprintf _vsnprintf
-#elif defined(__IBMC__) || defined(__IBMCPP__)
-extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
-#endif
-
-/**********************************************************************/
-/** \name Memory */
-/*@{*/
-
-/**
- * Allocate aligned memory.
- *
- * \param bytes number of bytes to allocate.
- * \param alignment alignment (must be greater than zero).
- *
- * Allocates extra memory to accommodate rounding up the address for
- * alignment and to record the real malloc address.
- *
- * \sa _mesa_align_free().
- */
-void *
-_mesa_align_malloc(size_t bytes, unsigned long alignment)
-{
-#if defined(HAVE_POSIX_MEMALIGN)
- void *mem;
- int err = posix_memalign(& mem, alignment, bytes);
- if (err)
- return NULL;
- return mem;
-#elif defined(_WIN32)
- return _aligned_malloc(bytes, alignment);
-#else
- uintptr_t ptr, buf;
-
- assert( alignment > 0 );
-
- ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *));
- if (!ptr)
- return NULL;
-
- buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
- *(uintptr_t *)(buf - sizeof(void *)) = ptr;
-
-#ifndef NDEBUG
- /* mark the non-aligned area */
- while ( ptr < buf - sizeof(void *) ) {
- *(unsigned long *)ptr = 0xcdcdcdcd;
- ptr += sizeof(unsigned long);
- }
-#endif
-
- return (void *) buf;
-#endif /* defined(HAVE_POSIX_MEMALIGN) */
-}
-
-/**
- * Same as _mesa_align_malloc(), but using calloc(1, ) instead of
- * malloc()
- */
-void *
-_mesa_align_calloc(size_t bytes, unsigned long alignment)
-{
-#if defined(HAVE_POSIX_MEMALIGN)
- void *mem;
-
- mem = _mesa_align_malloc(bytes, alignment);
- if (mem != NULL) {
- (void) memset(mem, 0, bytes);
- }
-
- return mem;
-#elif defined(_WIN32)
- void *mem;
-
- mem = _aligned_malloc(bytes, alignment);
- if (mem != NULL) {
- (void) memset(mem, 0, bytes);
- }
-
- return mem;
-#else
- uintptr_t ptr, buf;
-
- assert( alignment > 0 );
-
- ptr = (uintptr_t)calloc(1, bytes + alignment + sizeof(void *));
- if (!ptr)
- return NULL;
-
- buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
- *(uintptr_t *)(buf - sizeof(void *)) = ptr;
-
-#ifndef NDEBUG
- /* mark the non-aligned area */
- while ( ptr < buf - sizeof(void *) ) {
- *(unsigned long *)ptr = 0xcdcdcdcd;
- ptr += sizeof(unsigned long);
- }
-#endif
-
- return (void *)buf;
-#endif /* defined(HAVE_POSIX_MEMALIGN) */
-}
-
-/**
- * Free memory which was allocated with either _mesa_align_malloc()
- * or _mesa_align_calloc().
- * \param ptr pointer to the memory to be freed.
- * The actual address to free is stored in the word immediately before the
- * address the client sees.
- * Note that it is legal to pass NULL pointer to this function and will be
- * handled accordingly.
- */
-void
-_mesa_align_free(void *ptr)
-{
-#if defined(HAVE_POSIX_MEMALIGN)
- free(ptr);
-#elif defined(_WIN32)
- _aligned_free(ptr);
-#else
- if (ptr) {
- void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
- void *realAddr = *cubbyHole;
- free(realAddr);
- }
-#endif /* defined(HAVE_POSIX_MEMALIGN) */
-}
-
-/**
- * Reallocate memory, with alignment.
- */
-void *
-_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
- unsigned long alignment)
-{
-#if defined(_WIN32)
- (void) oldSize;
- return _aligned_realloc(oldBuffer, newSize, alignment);
-#else
- const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
- void *newBuf = _mesa_align_malloc(newSize, alignment);
- if (newBuf && oldBuffer && copySize > 0) {
- memcpy(newBuf, oldBuffer, copySize);
- }
-
- _mesa_align_free(oldBuffer);
- return newBuf;
-#endif
-}
-
-/*@}*/
-
-
-/** Needed due to #ifdef's, above. */
-int
-_mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list args)
-{
- return vsnprintf( str, size, fmt, args);
-}
-
-/** Wrapper around vsnprintf() */
-int
-_mesa_snprintf( char *str, size_t size, const char *fmt, ... )
-{
- int r;
- va_list args;
- va_start( args, fmt );
- r = vsnprintf( str, size, fmt, args );
- va_end( args );
- return r;
-}
-
-
+++ /dev/null
-/*
- * Mesa 3-D graphics library
- *
- * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included
- * in all copies or substantial portions of the Software.
- *
- * 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
- * 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.
- */
-
-
-/**
- * \file imports.h
- * Standard C library function wrappers.
- *
- * This file provides wrappers for all the standard C library functions
- * like malloc(), free(), printf(), getenv(), etc.
- */
-
-
-#ifndef IMPORTS_H
-#define IMPORTS_H
-
-
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include "compiler.h"
-#include "glheader.h"
-#include "util/bitscan.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-
-/**********************************************************************/
-/** Memory macros */
-/*@{*/
-
-/** Allocate a structure of type \p T */
-#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T))
-/** Allocate and zero a structure of type \p T */
-#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
-
-/*@}*/
-
-
-/*
- * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
- * as offsets into buffer stores. Since the vertex array pointer and
- * buffer store pointer are both pointers and we need to add them, we use
- * this macro.
- * Both pointers/offsets are expressed in bytes.
- */
-#define ADD_POINTERS(A, B) ( (GLubyte *) (A) + (uintptr_t) (B) )
-
-
-/**
- * Sometimes we treat GLfloats as GLints. On x86 systems, moving a float
- * as an int (thereby using integer registers instead of FP registers) is
- * a performance win. Typically, this can be done with ordinary casts.
- * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0)
- * these casts generate warnings.
- * The following union typedef is used to solve that.
- */
-typedef union { GLfloat f; GLint i; GLuint u; } fi_type;
-
-
-
-/*@}*/
-
-
-/***
- *** LOG2: Log base 2 of float
- ***/
-static inline GLfloat LOG2(GLfloat x)
-{
-#if 0
- /* This is pretty fast, but not accurate enough (only 2 fractional bits).
- * Based on code from http://www.stereopsis.com/log2.html
- */
- const GLfloat y = x * x * x * x;
- const GLuint ix = *((GLuint *) &y);
- const GLuint exp = (ix >> 23) & 0xFF;
- const GLint log2 = ((GLint) exp) - 127;
- return (GLfloat) log2 * (1.0 / 4.0); /* 4, because of x^4 above */
-#endif
- /* Pretty fast, and accurate.
- * Based on code from http://www.flipcode.com/totd/
- */
- fi_type num;
- GLint log_2;
- num.f = x;
- log_2 = ((num.i >> 23) & 255) - 128;
- num.i &= ~(255 << 23);
- num.i += 127 << 23;
- num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
- return num.f + log_2;
-}
-
-
-
-/**
- * finite macro.
- */
-#if defined(_MSC_VER)
-# define finite _finite
-#endif
-
-
-/***
- *** IS_INF_OR_NAN: test if float is infinite or NaN
- ***/
-#if defined(isfinite)
-#define IS_INF_OR_NAN(x) (!isfinite(x))
-#elif defined(finite)
-#define IS_INF_OR_NAN(x) (!finite(x))
-#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-#define IS_INF_OR_NAN(x) (!isfinite(x))
-#else
-#define IS_INF_OR_NAN(x) (!finite(x))
-#endif
-
-
-/**
- * Convert float to int by rounding to nearest integer, away from zero.
- */
-static inline int IROUND(float f)
-{
- return (int) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F));
-}
-
-/**
- * Convert double to int by rounding to nearest integer, away from zero.
- */
-static inline int IROUNDD(double d)
-{
- return (int) ((d >= 0.0) ? (d + 0.5) : (d - 0.5));
-}
-
-/**
- * Convert float to int64 by rounding to nearest integer.
- */
-static inline GLint64 IROUND64(float f)
-{
- return (GLint64) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F));
-}
-
-
-/**
- * Convert positive float to int by rounding to nearest integer.
- */
-static inline int IROUND_POS(float f)
-{
- assert(f >= 0.0F);
- return (int) (f + 0.5F);
-}
-
-/** Return (as an integer) floor of float */
-static inline int IFLOOR(float f)
-{
-#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
- /*
- * IEEE floor for computers that round to nearest or even.
- * 'f' must be between -4194304 and 4194303.
- * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
- * but uses some IEEE specific tricks for better speed.
- * Contributed by Josh Vanderhoof
- */
- int ai, bi;
- double af, bf;
- af = (3 << 22) + 0.5 + (double)f;
- bf = (3 << 22) + 0.5 - (double)f;
- /* GCC generates an extra fstp/fld without this. */
- __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
- __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
- return (ai - bi) >> 1;
-#else
- int ai, bi;
- double af, bf;
- fi_type u;
- af = (3 << 22) + 0.5 + (double)f;
- bf = (3 << 22) + 0.5 - (double)f;
- u.f = (float) af; ai = u.i;
- u.f = (float) bf; bi = u.i;
- return (ai - bi) >> 1;
-#endif
-}
-
-
-/**
- * Is x a power of two?
- */
-static inline int
-_mesa_is_pow_two(int x)
-{
- return !(x & (x - 1));
-}
-
-/**
- * Round given integer to next higer power of two
- * If X is zero result is undefined.
- *
- * Source for the fallback implementation is
- * Sean Eron Anderson's webpage "Bit Twiddling Hacks"
- * http://graphics.stanford.edu/~seander/bithacks.html
- *
- * When using builtin function have to do some work
- * for case when passed values 1 to prevent hiting
- * undefined result from __builtin_clz. Undefined
- * results would be different depending on optimization
- * level used for build.
- */
-static inline int32_t
-_mesa_next_pow_two_32(uint32_t x)
-{
-#ifdef HAVE___BUILTIN_CLZ
- uint32_t y = (x != 1);
- return (1 + y) << ((__builtin_clz(x - y) ^ 31) );
-#else
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x++;
- return x;
-#endif
-}
-
-static inline int64_t
-_mesa_next_pow_two_64(uint64_t x)
-{
-#ifdef HAVE___BUILTIN_CLZLL
- uint64_t y = (x != 1);
- STATIC_ASSERT(sizeof(x) == sizeof(long long));
- return (1 + y) << ((__builtin_clzll(x - y) ^ 63));
-#else
- x--;
- x |= x >> 1;
- x |= x >> 2;
- x |= x >> 4;
- x |= x >> 8;
- x |= x >> 16;
- x |= x >> 32;
- x++;
- return x;
-#endif
-}
-
-
-/*
- * Returns the floor form of binary logarithm for a 32-bit integer.
- */
-static inline GLuint
-_mesa_logbase2(GLuint n)
-{
-#ifdef HAVE___BUILTIN_CLZ
- return (31 - __builtin_clz(n | 1));
-#else
- GLuint pos = 0;
- if (n >= 1<<16) { n >>= 16; pos += 16; }
- if (n >= 1<< 8) { n >>= 8; pos += 8; }
- if (n >= 1<< 4) { n >>= 4; pos += 4; }
- if (n >= 1<< 2) { n >>= 2; pos += 2; }
- if (n >= 1<< 1) { pos += 1; }
- return pos;
-#endif
-}
-
-
-/**********************************************************************
- * Functions
- */
-
-extern void *
-_mesa_align_malloc( size_t bytes, unsigned long alignment );
-
-extern void *
-_mesa_align_calloc( size_t bytes, unsigned long alignment );
-
-extern void
-_mesa_align_free( void *ptr );
-
-extern void *
-_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
- unsigned long alignment);
-
-extern int
-_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4);
-
-extern int
-_mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list arg);
-
-
-#if defined(_WIN32) && !defined(HAVE_STRTOK_R)
-#define strtok_r strtok_s
-#endif
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif /* IMPORTS_H */
#include "c99_math.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "enums.h"
#include "light.h"
#include "util/macros.h"
#include "util/u_math.h"
#include "util/rounding.h"
-#include "imports.h"
+#include "util/imports.h"
+#include "main/glheader.h"
/**
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "enums.h"
#include "macros.h"
*/
#include "errors.h"
-#include "imports.h"
+#include "util/imports.h"
#include "formats.h"
#include "glformats.h"
#include "mipmap.h"
#include "glheader.h"
#include "enums.h"
#include "hash.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "bufferobj.h"
#include "fbobject.h"
#include "glheader.h"
#include "enums.h"
#include "image.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "mtypes.h"
#include "pack.h"
#include "pixeltransfer.h"
-#include "imports.h"
+#include "util/imports.h"
#include "glformats.h"
#include "format_utils.h"
#include "format_pack.h"
#include "bufferobj.h"
#include "glformats.h"
#include "image.h"
-#include "imports.h"
+#include "util/imports.h"
#include "mtypes.h"
#include "pbo.h"
#include "glheader.h"
#include "macros.h"
#include "pixeltransfer.h"
-#include "imports.h"
+#include "util/imports.h"
#include "mtypes.h"
#include "util/rounding.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "image.h"
#include "enums.h"
#include "context.h"
#include "enums.h"
#include "hash.h"
-#include "imports.h"
+#include "util/imports.h"
#include "queryobj.h"
#include "mtypes.h"
*/
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "blend.h"
#include "bufferobj.h"
#include "context.h"
#include <stdbool.h>
#include "remap.h"
-#include "imports.h"
+#include "util/imports.h"
#include "glapi/glapi.h"
#define MAX_ENTRY_POINTS 16
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "fbobject.h"
#include "formats.h"
* Shared-context state
*/
-#include "imports.h"
+#include "util/imports.h"
#include "mtypes.h"
#include "hash.h"
#include "atifragshader.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "macros.h"
#include "stencil.h"
#include <inttypes.h>
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "macros.h"
#include "get.h"
#include "GL/gl.h"
#include "GL/glext.h"
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/api_exec.h"
#include "main/context.h"
#include "main/remap.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "context.h"
#include "formats.h"
#include "mtypes.h"
#include "glheader.h"
#include "context.h"
#include "mtypes.h"
-#include "imports.h"
+#include "util/imports.h"
#include "pixelstore.h"
#include "texcompress_cpal.h"
#include "teximage.h"
#include "errors.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
#include "config.h"
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "image.h"
#include "macros.h"
#include "mipmap.h"
*/
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "image.h"
#include "macros.h"
#include "mtypes.h"
#include "framebuffer.h"
#include "hash.h"
#include "image.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "mipmap.h"
#include "multisample.h"
#include "fbobject.h"
#include "formats.h"
#include "hash.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "shaderimage.h"
#include "teximage.h"
#include "glheader.h"
#include "context.h"
#include "enums.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "teximage.h"
#include "texobj.h"
#include "mtypes.h"
#include "pack.h"
#include "pbo.h"
-#include "imports.h"
+#include "util/imports.h"
#include "texcompress.h"
#include "texcompress_fxt1.h"
#include "texcompress_rgtc.h"
#include "glheader.h"
#include "context.h"
#include "enums.h"
-#include "imports.h"
+#include "util/imports.h"
#include "hash.h"
#include "mtypes.h"
#include "shaderimage.h"
#include "glheader.h"
#include "context.h"
#include "enums.h"
-#include "imports.h"
+#include "util/imports.h"
#include "macros.h"
#include "teximage.h"
#include "texobj.h"
#include <stdbool.h>
#include "bufferobj.h"
-#include "compiler.h"
+#include "util/compiler.h"
#include "glheader.h"
#include "mtypes.h"
#include <inttypes.h> /* for PRId64 macro */
#include "glheader.h"
-#include "imports.h"
+#include "util/imports.h"
#include "bufferobj.h"
#include "context.h"
#include "enable.h"
#include <stdio.h>
#include "context.h"
-#include "imports.h"
+#include "util/imports.h"
#include "mtypes.h"
#include "version.h"
#include "git_sha1.h"
#include "glheader.h"
#include "api_arrayelt.h"
#include "context.h"
-#include "imports.h"
+#include "util/imports.h"
#include "mtypes.h"
#include "vtxfmt.h"
#include "eval.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "m_matrix.h"
#include "m_xform.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "m_matrix.h"
#include "m_xform.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "m_matrix.h"
#include "m_xform.h"
#include "c99_math.h"
#include "main/errors.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#define MATH_ASM_PTR_SIZE sizeof(void *)
#include "math/m_vector_asm.h"
#include <stddef.h>
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "m_vector.h"
#define _M_XFORM_H
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/glheader.h"
#include "math/m_matrix.h"
#include "math/m_vector.h"
'main/colortab.h',
'main/compute.c',
'main/compute.h',
- 'main/compiler.h',
'main/condrender.c',
'main/condrender.h',
'main/config.h',
'main/histogram.h',
'main/image.c',
'main/image.h',
- 'main/imports.c',
- 'main/imports.h',
'main/light.c',
'main/light.h',
'main/lines.c',
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/mtypes.h"
#include "arbprogparse.h"
#include "main/glheader.h"
#include "main/mtypes.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/shaderobj.h"
#include "program/prog_cache.h"
#include "program/program.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "prog_noise.h"
#define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) )
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
* \author Ian Romanick <ian.d.romanick@intel.com>
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "prog_parameter.h"
#include "prog_parameter_layout.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "prog_instruction.h"
#include "prog_parameter.h"
#include "prog_print.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/blend.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/fbobject.h"
#include "compiler/nir/nir.h"
#include "compiler/nir/nir_builder.h"
#include "compiler/glsl/list.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "util/ralloc.h"
#endif
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "program/prog_instruction.h"
#include "program/prog_statevars.h"
#include "program/symbol_table.h"
#include "main/errors.h"
#include "main/mtypes.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "program/program.h"
#include "program/prog_parameter.h"
#include "program/prog_parameter_layout.h"
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/errors.h"
#include "symbol_table.h"
#include "../../util/hash_table.h"
*
**************************************************************************/
-#include "main/imports.h"
+#include "util/imports.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
#include "compiler/glsl/ir_uniform.h"
* Brian Paul
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
#include "main/shaderapi.h"
*
**************************************************************************/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/shaderimage.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
* Brian Paul
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/framebuffer.h"
#include "main/state.h"
*
**************************************************************************/
-#include "main/imports.h"
+#include "util/imports.h"
#include "program/prog_parameter.h"
#include "program/prog_print.h"
#include "compiler/glsl/ir_uniform.h"
*/
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/dlist.h"
* Brian Paul
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/image.h"
#include "main/macros.h"
#include <inttypes.h> /* for PRId64 macro */
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/arrayobj.h"
#include "main/bufferobj.h"
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "pipe/p_context.h"
*/
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/blit.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/image.h"
#include "main/macros.h"
#include "main/teximage.h"
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/fbobject.h"
#include "main/framebuffer.h"
* Brian Paul
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/feedback.h"
#include "main/varray.h"
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/externalobjects.h"
**************************************************************************/
#include "main/bufferobj.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/framebuffer.h"
#include "state_tracker/st_cb_msaa.h"
*/
-#include "main/imports.h"
-#include "main/compiler.h"
+#include "util/imports.h"
+#include "util/compiler.h"
#include "main/context.h"
#include "main/queryobj.h"
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/arrayobj.h"
#include "main/feedback.h"
#include "main/bufferobj.h"
#include "main/image.h"
#include "main/pbo.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/readpix.h"
#include "main/enums.h"
#include "main/framebuffer.h"
* DEALINGS IN THE SOFTWARE.
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/context.h"
#ifndef ST_CB_SEMAPHOREOBJECTS_H
#define ST_CB_SEMAPHOREOBJECTS_H
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/mtypes.h"
struct dd_function_table;
#include "main/format_utils.h"
#include "main/glformats.h"
#include "main/image.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mipmap.h"
#include "main/pack.h"
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "pipe/p_context.h"
*
**************************************************************************/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/accum.h"
#include "main/api_exec.h"
#include "main/context.h"
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/image.h"
#include "main/bufferobj.h"
#include "main/macros.h"
*
**************************************************************************/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/arrayobj.h"
#include "main/image.h"
#include "main/macros.h"
#include "compiler/nir/nir.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/macros.h"
#include "main/spirv_extensions.h"
* \author Brian Paul
*/
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/formats.h"
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mipmap.h"
#include "main/teximage.h"
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/hash.h"
#include "main/mtypes.h"
#include "program/prog_parameter.h"
#include "c99_math.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/teximage.h"
#include "main/glheader.h"
#include "main/context.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/state.h"
#include "s_aatriangle.h"
#include "s_context.h"
#include "main/condrender.h"
#include "main/format_pack.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "s_context.h"
*/
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/bufferobj.h"
#include "main/mtypes.h"
#include "main/samplerobj.h"
#include "main/macros.h"
#include "main/blit.h"
#include "main/pixeltransfer.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "s_context.h"
#include "s_depth.h"
#include "main/format_unpack.h"
#include "main/format_pack.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "s_context.h"
#include "s_depth.h"
#include "main/format_utils.h"
#include "main/glformats.h"
#include "main/image.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/pack.h"
#include "main/pbo.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "s_context.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/fbobject.h"
#include "main/formats.h"
#include "main/format_pack.h"
#include "main/format_unpack.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/image.h"
#include "main/samplerobj.h"
#include "main/state.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/format_pack.h"
#include "main/format_unpack.h"
#include "main/stencil.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/pixeltransfer.h"
#include "main/samplerobj.h"
#include "c99_math.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/samplerobj.h"
#include "main/teximage.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/state.h"
#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/format_pack.h"
#include "s_context.h"
*/
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/state.h"
#include "tnl/tnl.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/context.h"
#include "main/macros.h"
#include "main/mtypes.h"
#define _T_CONTEXT_H
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "math/m_vector.h"
#include "main/bufferobj.h"
#include "main/condrender.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "main/macros.h"
#include "main/enums.h"
#include "main/glheader.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "t_context.h"
#include "main/bufferobj.h"
#include "main/errors.h"
#include "main/glheader.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "vbo/vbo.h"
#include "main/glheader.h"
#include "main/bufferobj.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/glformats.h"
#include "main/macros.h"
#include "main/mtypes.h"
#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "math/m_xform.h"
#include "main/glheader.h"
#include "main/light.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "util/simple_list.h"
#include "main/mtypes.h"
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "math/m_xform.h"
#include "main/glheader.h"
#include "main/mtypes.h"
#include "main/dd.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "t_context.h"
#include "t_pipeline.h"
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/samplerobj.h"
#include "main/state.h"
#include "math/m_xform.h"
#include "main/context.h"
#include "main/enums.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "math/m_xform.h"
#include "util/bitscan.h"
#include "main/errors.h"
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "math/m_xform.h"
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "math/m_xform.h"
#include "main/glheader.h"
#include "main/macros.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/mtypes.h"
#include "math/m_xform.h"
#define VBO_EXEC_H
#include "main/dd.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "vbo.h"
#include "vbo_attrib.h"
*/
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/varray.h"
#include "main/glheader.h"
#include "main/bufferobj.h"
#include "main/context.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "main/light.h"
#include "main/state.h"
#include "main/context.h"
#include "main/glheader.h"
#include "main/enums.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/dispatch.h"
#include "glapi/glapi.h"
#endif
#include "main/errors.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "common_x86_asm.h"
#ifndef ASM_MMX_H
#define ASM_MMX_H
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/glheader.h"
struct gl_context;
#include <stdio.h>
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/execmem.h"
#include "x86sse.h"
libglsl_util = static_library(
'glsl_util',
files(
- 'mesa/main/extensions_table.c', 'mesa/main/imports.c',
+ 'mesa/main/extensions_table.c',
'mesa/program/prog_parameter.c', 'mesa/program/symbol_table.c',
'mesa/program/dummy_errors.c',
),
#include "main/mtypes.h"
#include "compiler/glsl/glsl_to_nir.h"
#include "compiler/nir_types.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "compiler/nir/nir_builder.h"
#include "disassemble.h"
#include "main/mtypes.h"
#include "compiler/glsl/glsl_to_nir.h"
#include "compiler/nir_types.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "compiler/nir/nir_builder.h"
#include "util/half_float.h"
#include "util/u_math.h"
blob.h \
build_id.c \
build_id.h \
+ compiler.h \
crc32.c \
crc32.h \
dag.c \
half_float.h \
hash_table.c \
hash_table.h \
+ imports.c \
+ imports.h \
list.h \
macros.h \
mesa-sha1.c \
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ * Copyright (C) 2009 VMware, Inc. All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * 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
+ * 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.
+ */
+
+
+/**
+ * \file compiler.h
+ * Compiler-related stuff.
+ */
+
+
+#ifndef COMPILER_H
+#define COMPILER_H
+
+
+#include <assert.h>
+
+#include "util/macros.h"
+
+#include "c99_compat.h" /* inline, __func__, etc. */
+
+
+/**
+ * Either define MESA_BIG_ENDIAN or MESA_LITTLE_ENDIAN, and CPU_TO_LE32.
+ * Do not use these unless absolutely necessary!
+ * Try to use a runtime test instead.
+ * For now, only used by some DRI hardware drivers for color/texel packing.
+ */
+#if defined(BYTE_ORDER) && defined(BIG_ENDIAN) && BYTE_ORDER == BIG_ENDIAN
+#if defined(__linux__)
+#include <byteswap.h>
+#define CPU_TO_LE32( x ) bswap_32( x )
+#elif defined(__APPLE__)
+#include <CoreFoundation/CFByteOrder.h>
+#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x )
+#elif defined(__OpenBSD__)
+#include <sys/types.h>
+#define CPU_TO_LE32( x ) htole32( x )
+#else /*__linux__ */
+#include <sys/endian.h>
+#define CPU_TO_LE32( x ) bswap32( x )
+#endif /*__linux__*/
+#define MESA_BIG_ENDIAN 1
+#else
+#define CPU_TO_LE32( x ) ( x )
+#define MESA_LITTLE_ENDIAN 1
+#endif
+#define LE32_TO_CPU( x ) CPU_TO_LE32( x )
+
+
+
+#define IEEE_ONE 0x3f800000
+
+
+#endif /* COMPILER_H */
#include "util/u_queue.h"
#include "util/mesa-sha1.h"
#include "util/ralloc.h"
-#include "main/compiler.h"
+#include "util/compiler.h"
#include "main/errors.h"
#include "disk_cache.h"
--- /dev/null
+/**
+ * \file imports.c
+ * Standard C library function wrappers.
+ *
+ * Imports are services which the device driver or window system or
+ * operating system provides to the core renderer. The core renderer (Mesa)
+ * will call these functions in order to do memory allocation, simple I/O,
+ * etc.
+ *
+ * Some drivers will want to override/replace this file with something
+ * specialized, but that'll be rare.
+ *
+ * Eventually, I want to move roll the glheader.h file into this.
+ *
+ * \todo Functions still needed:
+ * - scanf
+ * - qsort
+ * - rand and RAND_MAX
+ */
+
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2007 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * 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
+ * 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.
+ */
+
+#include <stdio.h>
+#include <stdarg.h>
+#include "c99_math.h"
+#include "imports.h"
+
+#ifdef _GNU_SOURCE
+#include <locale.h>
+#ifdef __APPLE__
+#include <xlocale.h>
+#endif
+#endif
+
+
+#ifdef _WIN32
+#define vsnprintf _vsnprintf
+#elif defined(__IBMC__) || defined(__IBMCPP__)
+extern int vsnprintf(char *str, size_t count, const char *fmt, va_list arg);
+#endif
+
+/**********************************************************************/
+/** \name Memory */
+/*@{*/
+
+/**
+ * Allocate aligned memory.
+ *
+ * \param bytes number of bytes to allocate.
+ * \param alignment alignment (must be greater than zero).
+ *
+ * Allocates extra memory to accommodate rounding up the address for
+ * alignment and to record the real malloc address.
+ *
+ * \sa _mesa_align_free().
+ */
+void *
+_mesa_align_malloc(size_t bytes, unsigned long alignment)
+{
+#if defined(HAVE_POSIX_MEMALIGN)
+ void *mem;
+ int err = posix_memalign(& mem, alignment, bytes);
+ if (err)
+ return NULL;
+ return mem;
+#elif defined(_WIN32)
+ return _aligned_malloc(bytes, alignment);
+#else
+ uintptr_t ptr, buf;
+
+ assert( alignment > 0 );
+
+ ptr = (uintptr_t)malloc(bytes + alignment + sizeof(void *));
+ if (!ptr)
+ return NULL;
+
+ buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
+ *(uintptr_t *)(buf - sizeof(void *)) = ptr;
+
+#ifndef NDEBUG
+ /* mark the non-aligned area */
+ while ( ptr < buf - sizeof(void *) ) {
+ *(unsigned long *)ptr = 0xcdcdcdcd;
+ ptr += sizeof(unsigned long);
+ }
+#endif
+
+ return (void *) buf;
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
+}
+
+/**
+ * Same as _mesa_align_malloc(), but using calloc(1, ) instead of
+ * malloc()
+ */
+void *
+_mesa_align_calloc(size_t bytes, unsigned long alignment)
+{
+#if defined(HAVE_POSIX_MEMALIGN)
+ void *mem;
+
+ mem = _mesa_align_malloc(bytes, alignment);
+ if (mem != NULL) {
+ (void) memset(mem, 0, bytes);
+ }
+
+ return mem;
+#elif defined(_WIN32)
+ void *mem;
+
+ mem = _aligned_malloc(bytes, alignment);
+ if (mem != NULL) {
+ (void) memset(mem, 0, bytes);
+ }
+
+ return mem;
+#else
+ uintptr_t ptr, buf;
+
+ assert( alignment > 0 );
+
+ ptr = (uintptr_t)calloc(1, bytes + alignment + sizeof(void *));
+ if (!ptr)
+ return NULL;
+
+ buf = (ptr + alignment + sizeof(void *)) & ~(uintptr_t)(alignment - 1);
+ *(uintptr_t *)(buf - sizeof(void *)) = ptr;
+
+#ifndef NDEBUG
+ /* mark the non-aligned area */
+ while ( ptr < buf - sizeof(void *) ) {
+ *(unsigned long *)ptr = 0xcdcdcdcd;
+ ptr += sizeof(unsigned long);
+ }
+#endif
+
+ return (void *)buf;
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
+}
+
+/**
+ * Free memory which was allocated with either _mesa_align_malloc()
+ * or _mesa_align_calloc().
+ * \param ptr pointer to the memory to be freed.
+ * The actual address to free is stored in the word immediately before the
+ * address the client sees.
+ * Note that it is legal to pass NULL pointer to this function and will be
+ * handled accordingly.
+ */
+void
+_mesa_align_free(void *ptr)
+{
+#if defined(HAVE_POSIX_MEMALIGN)
+ free(ptr);
+#elif defined(_WIN32)
+ _aligned_free(ptr);
+#else
+ if (ptr) {
+ void **cubbyHole = (void **) ((char *) ptr - sizeof(void *));
+ void *realAddr = *cubbyHole;
+ free(realAddr);
+ }
+#endif /* defined(HAVE_POSIX_MEMALIGN) */
+}
+
+/**
+ * Reallocate memory, with alignment.
+ */
+void *
+_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
+ unsigned long alignment)
+{
+#if defined(_WIN32)
+ (void) oldSize;
+ return _aligned_realloc(oldBuffer, newSize, alignment);
+#else
+ const size_t copySize = (oldSize < newSize) ? oldSize : newSize;
+ void *newBuf = _mesa_align_malloc(newSize, alignment);
+ if (newBuf && oldBuffer && copySize > 0) {
+ memcpy(newBuf, oldBuffer, copySize);
+ }
+
+ _mesa_align_free(oldBuffer);
+ return newBuf;
+#endif
+}
+
+/*@}*/
+
+
+/** Needed due to #ifdef's, above. */
+int
+_mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list args)
+{
+ return vsnprintf( str, size, fmt, args);
+}
+
+/** Wrapper around vsnprintf() */
+int
+_mesa_snprintf( char *str, size_t size, const char *fmt, ... )
+{
+ int r;
+ va_list args;
+ va_start( args, fmt );
+ r = vsnprintf( str, size, fmt, args );
+ va_end( args );
+ return r;
+}
+
+
--- /dev/null
+/*
+ * Mesa 3-D graphics library
+ *
+ * Copyright (C) 1999-2008 Brian Paul All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * 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
+ * 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.
+ */
+
+
+/**
+ * \file imports.h
+ * Standard C library function wrappers.
+ *
+ * This file provides wrappers for all the standard C library functions
+ * like malloc(), free(), printf(), getenv(), etc.
+ */
+
+
+#ifndef IMPORTS_H
+#define IMPORTS_H
+
+
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include "util/compiler.h"
+#include "util/bitscan.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/**********************************************************************/
+/** Memory macros */
+/*@{*/
+
+/** Allocate a structure of type \p T */
+#define MALLOC_STRUCT(T) (struct T *) malloc(sizeof(struct T))
+/** Allocate and zero a structure of type \p T */
+#define CALLOC_STRUCT(T) (struct T *) calloc(1, sizeof(struct T))
+
+/*@}*/
+
+
+/*
+ * For GL_ARB_vertex_buffer_object we need to treat vertex array pointers
+ * as offsets into buffer stores. Since the vertex array pointer and
+ * buffer store pointer are both pointers and we need to add them, we use
+ * this macro.
+ * Both pointers/offsets are expressed in bytes.
+ */
+#define ADD_POINTERS(A, B) ( (uint8_t *) (A) + (uintptr_t) (B) )
+
+
+/**
+ * Sometimes we treat floats as ints. On x86 systems, moving a float
+ * as an int (thereby using integer registers instead of FP registers) is
+ * a performance win. Typically, this can be done with ordinary casts.
+ * But with gcc's -fstrict-aliasing flag (which defaults to on in gcc 3.0)
+ * these casts generate warnings.
+ * The following union typedef is used to solve that.
+ */
+typedef union { float f; int i; unsigned u; } fi_type;
+
+
+
+/*@}*/
+
+
+/***
+ *** LOG2: Log base 2 of float
+ ***/
+static inline float LOG2(float x)
+{
+#if 0
+ /* This is pretty fast, but not accurate enough (only 2 fractional bits).
+ * Based on code from http://www.stereopsis.com/log2.html
+ */
+ const float y = x * x * x * x;
+ const unsigned ix = *((unsigned *) &y);
+ const unsigned exp = (ix >> 23) & 0xFF;
+ const int log2 = ((int) exp) - 127;
+ return (float) log2 * (1.0 / 4.0); /* 4, because of x^4 above */
+#endif
+ /* Pretty fast, and accurate.
+ * Based on code from http://www.flipcode.com/totd/
+ */
+ fi_type num;
+ int log_2;
+ num.f = x;
+ log_2 = ((num.i >> 23) & 255) - 128;
+ num.i &= ~(255 << 23);
+ num.i += 127 << 23;
+ num.f = ((-1.0f/3) * num.f + 2) * num.f - 2.0f/3;
+ return num.f + log_2;
+}
+
+
+
+/**
+ * finite macro.
+ */
+#if defined(_MSC_VER)
+# define finite _finite
+#endif
+
+
+/***
+ *** IS_INF_OR_NAN: test if float is infinite or NaN
+ ***/
+#if defined(isfinite)
+#define IS_INF_OR_NAN(x) (!isfinite(x))
+#elif defined(finite)
+#define IS_INF_OR_NAN(x) (!finite(x))
+#elif defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
+#define IS_INF_OR_NAN(x) (!isfinite(x))
+#else
+#define IS_INF_OR_NAN(x) (!finite(x))
+#endif
+
+
+/**
+ * Convert float to int by rounding to nearest integer, away from zero.
+ */
+static inline int IROUND(float f)
+{
+ return (int) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F));
+}
+
+/**
+ * Convert double to int by rounding to nearest integer, away from zero.
+ */
+static inline int IROUNDD(double d)
+{
+ return (int) ((d >= 0.0) ? (d + 0.5) : (d - 0.5));
+}
+
+/**
+ * Convert float to int64 by rounding to nearest integer.
+ */
+static inline int64_t IROUND64(float f)
+{
+ return (int64_t) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F));
+}
+
+
+/**
+ * Convert positive float to int by rounding to nearest integer.
+ */
+static inline int IROUND_POS(float f)
+{
+ assert(f >= 0.0F);
+ return (int) (f + 0.5F);
+}
+
+/** Return (as an integer) floor of float */
+static inline int IFLOOR(float f)
+{
+#if defined(USE_X86_ASM) && defined(__GNUC__) && defined(__i386__)
+ /*
+ * IEEE floor for computers that round to nearest or even.
+ * 'f' must be between -4194304 and 4194303.
+ * This floor operation is done by "(iround(f + .5) + iround(f - .5)) >> 1",
+ * but uses some IEEE specific tricks for better speed.
+ * Contributed by Josh Vanderhoof
+ */
+ int ai, bi;
+ double af, bf;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ /* GCC generates an extra fstp/fld without this. */
+ __asm__ ("fstps %0" : "=m" (ai) : "t" (af) : "st");
+ __asm__ ("fstps %0" : "=m" (bi) : "t" (bf) : "st");
+ return (ai - bi) >> 1;
+#else
+ int ai, bi;
+ double af, bf;
+ fi_type u;
+ af = (3 << 22) + 0.5 + (double)f;
+ bf = (3 << 22) + 0.5 - (double)f;
+ u.f = (float) af; ai = u.i;
+ u.f = (float) bf; bi = u.i;
+ return (ai - bi) >> 1;
+#endif
+}
+
+
+/**
+ * Is x a power of two?
+ */
+static inline int
+_mesa_is_pow_two(int x)
+{
+ return !(x & (x - 1));
+}
+
+/**
+ * Round given integer to next higer power of two
+ * If X is zero result is undefined.
+ *
+ * Source for the fallback implementation is
+ * Sean Eron Anderson's webpage "Bit Twiddling Hacks"
+ * http://graphics.stanford.edu/~seander/bithacks.html
+ *
+ * When using builtin function have to do some work
+ * for case when passed values 1 to prevent hiting
+ * undefined result from __builtin_clz. Undefined
+ * results would be different depending on optimization
+ * level used for build.
+ */
+static inline int32_t
+_mesa_next_pow_two_32(uint32_t x)
+{
+#ifdef HAVE___BUILTIN_CLZ
+ uint32_t y = (x != 1);
+ return (1 + y) << ((__builtin_clz(x - y) ^ 31) );
+#else
+ x--;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ x++;
+ return x;
+#endif
+}
+
+static inline int64_t
+_mesa_next_pow_two_64(uint64_t x)
+{
+#ifdef HAVE___BUILTIN_CLZLL
+ uint64_t y = (x != 1);
+ STATIC_ASSERT(sizeof(x) == sizeof(long long));
+ return (1 + y) << ((__builtin_clzll(x - y) ^ 63));
+#else
+ x--;
+ x |= x >> 1;
+ x |= x >> 2;
+ x |= x >> 4;
+ x |= x >> 8;
+ x |= x >> 16;
+ x |= x >> 32;
+ x++;
+ return x;
+#endif
+}
+
+
+/*
+ * Returns the floor form of binary logarithm for a 32-bit integer.
+ */
+static inline unsigned
+_mesa_logbase2(unsigned n)
+{
+#ifdef HAVE___BUILTIN_CLZ
+ return (31 - __builtin_clz(n | 1));
+#else
+ unsigned pos = 0;
+ if (n >= 1<<16) { n >>= 16; pos += 16; }
+ if (n >= 1<< 8) { n >>= 8; pos += 8; }
+ if (n >= 1<< 4) { n >>= 4; pos += 4; }
+ if (n >= 1<< 2) { n >>= 2; pos += 2; }
+ if (n >= 1<< 1) { pos += 1; }
+ return pos;
+#endif
+}
+
+
+/**********************************************************************
+ * Functions
+ */
+
+extern void *
+_mesa_align_malloc( size_t bytes, unsigned long alignment );
+
+extern void *
+_mesa_align_calloc( size_t bytes, unsigned long alignment );
+
+extern void
+_mesa_align_free( void *ptr );
+
+extern void *
+_mesa_align_realloc(void *oldBuffer, size_t oldSize, size_t newSize,
+ unsigned long alignment);
+
+extern int
+_mesa_snprintf( char *str, size_t size, const char *fmt, ... ) PRINTFLIKE(3, 4);
+
+extern int
+_mesa_vsnprintf(char *str, size_t size, const char *fmt, va_list arg);
+
+
+#if defined(_WIN32) && !defined(HAVE_STRTOK_R)
+#define strtok_r strtok_s
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#endif /* IMPORTS_H */
'blob.h',
'build_id.c',
'build_id.h',
+ 'compiler.h',
'crc32.c',
'crc32.h',
'dag.c',
'half_float.h',
'hash_table.c',
'hash_table.h',
+ 'imports.c',
+ 'imports.h',
'list.h',
'macros.h',
'mesa-sha1.c',
#include <stdbool.h>
#include "ralloc.h"
-#include "main/imports.h"
+#include "util/imports.h"
#include "main/macros.h"
#include "util/bitset.h"
#include "register_allocate.h"