From: Marek Olšák Date: Thu, 26 Mar 2020 01:11:44 +0000 (-0400) Subject: Move compiler.h and imports.h/c from src/mesa/main into src/util X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e5339fe4a47c242693962c9f90bbab8b74935cba;p=mesa.git Move compiler.h and imports.h/c from src/mesa/main into src/util Reviewed-by: Timothy Arceri --- diff --git a/src/compiler/SConscript.glsl b/src/compiler/SConscript.glsl index 7de4ff8c45a..85abfbac78a 100644 --- a/src/compiler/SConscript.glsl +++ b/src/compiler/SConscript.glsl @@ -71,7 +71,6 @@ if env['msvc']: # 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']) @@ -82,7 +81,6 @@ compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES']) mesa_objs = env.StaticObject([ 'glsl/extensions_table.c', - 'glsl/imports.c', 'glsl/symbol_table.c', 'glsl/dummy_errors.c', ]) diff --git a/src/compiler/glsl/gl_nir_lower_buffers.c b/src/compiler/glsl/gl_nir_lower_buffers.c index 60ac1417355..b83df08a867 100644 --- a/src/compiler/glsl/gl_nir_lower_buffers.c +++ b/src/compiler/glsl/gl_nir_lower_buffers.c @@ -26,7 +26,7 @@ #include "gl_nir.h" #include "ir_uniform.h" -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" static nir_ssa_def * diff --git a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c index a0a5f018ad7..49a06cfabb6 100644 --- a/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c +++ b/src/compiler/glsl/gl_nir_lower_samplers_as_deref.c @@ -61,7 +61,7 @@ #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 { diff --git a/src/compiler/glsl/glsl_to_nir.cpp b/src/compiler/glsl/glsl_to_nir.cpp index e6baf2add06..fe045eaca9b 100644 --- a/src/compiler/glsl/glsl_to_nir.cpp +++ b/src/compiler/glsl/glsl_to_nir.cpp @@ -37,7 +37,7 @@ #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" diff --git a/src/compiler/glsl/ir_clone.cpp b/src/compiler/glsl/ir_clone.cpp index eb24ffe9be2..e46d07d6f43 100644 --- a/src/compiler/glsl/ir_clone.cpp +++ b/src/compiler/glsl/ir_clone.cpp @@ -22,7 +22,7 @@ */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "ir.h" #include "compiler/glsl_types.h" #include "util/hash_table.h" diff --git a/src/compiler/glsl/linker.cpp b/src/compiler/glsl/linker.cpp index 77e7489a0a6..e0f9c3d06de 100644 --- a/src/compiler/glsl/linker.cpp +++ b/src/compiler/glsl/linker.cpp @@ -86,7 +86,7 @@ #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" diff --git a/src/compiler/glsl/tests/builtin_variable_test.cpp b/src/compiler/glsl/tests/builtin_variable_test.cpp index cbaa9a385d7..6d97ce5b0ba 100644 --- a/src/compiler/glsl/tests/builtin_variable_test.cpp +++ b/src/compiler/glsl/tests/builtin_variable_test.cpp @@ -22,7 +22,7 @@ */ #include #include "standalone_scaffolding.h" -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "ir.h" diff --git a/src/compiler/glsl/tests/copy_constant_to_storage_tests.cpp b/src/compiler/glsl/tests/copy_constant_to_storage_tests.cpp index 2cce7238503..9f8bd112ce5 100644 --- a/src/compiler/glsl/tests/copy_constant_to_storage_tests.cpp +++ b/src/compiler/glsl/tests/copy_constant_to_storage_tests.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "util/ralloc.h" diff --git a/src/compiler/glsl/tests/general_ir_test.cpp b/src/compiler/glsl/tests/general_ir_test.cpp index e05ecf9c3d5..275cff2a999 100644 --- a/src/compiler/glsl/tests/general_ir_test.cpp +++ b/src/compiler/glsl/tests/general_ir_test.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "ir.h" diff --git a/src/compiler/glsl/tests/invalidate_locations_test.cpp b/src/compiler/glsl/tests/invalidate_locations_test.cpp index 48c8884d5e4..7b8317f87f2 100644 --- a/src/compiler/glsl/tests/invalidate_locations_test.cpp +++ b/src/compiler/glsl/tests/invalidate_locations_test.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "util/ralloc.h" diff --git a/src/compiler/glsl/tests/lower_int64_test.cpp b/src/compiler/glsl/tests/lower_int64_test.cpp index a7e8186e41b..196710a3c6c 100644 --- a/src/compiler/glsl/tests/lower_int64_test.cpp +++ b/src/compiler/glsl/tests/lower_int64_test.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "ir.h" diff --git a/src/compiler/glsl/tests/sampler_types_test.cpp b/src/compiler/glsl/tests/sampler_types_test.cpp index ef03158bba9..d44d840f694 100644 --- a/src/compiler/glsl/tests/sampler_types_test.cpp +++ b/src/compiler/glsl/tests/sampler_types_test.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "ir.h" diff --git a/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp b/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp index 2bcb25d466c..dfb7235fa8b 100644 --- a/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp +++ b/src/compiler/glsl/tests/set_uniform_initializer_tests.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "util/ralloc.h" diff --git a/src/compiler/glsl/tests/varyings_test.cpp b/src/compiler/glsl/tests/varyings_test.cpp index 4ad73be381e..30df36acb2b 100644 --- a/src/compiler/glsl/tests/varyings_test.cpp +++ b/src/compiler/glsl/tests/varyings_test.cpp @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/mtypes.h" #include "main/macros.h" #include "util/ralloc.h" diff --git a/src/compiler/nir/nir_opt_copy_propagate.c b/src/compiler/nir/nir_opt_copy_propagate.c index 0961d6bbf29..00c78f38451 100644 --- a/src/compiler/nir/nir_opt_copy_propagate.c +++ b/src/compiler/nir/nir_opt_copy_propagate.c @@ -26,7 +26,7 @@ */ #include "nir.h" -#include
+#include /** * SSA-based copy propagation diff --git a/src/gallium/state_trackers/glx/xlib/glx_api.c b/src/gallium/state_trackers/glx/xlib/glx_api.c index 147f928f3c3..c820926790f 100644 --- a/src/gallium/state_trackers/glx/xlib/glx_api.c +++ b/src/gallium/state_trackers/glx/xlib/glx_api.c @@ -39,7 +39,7 @@ #include #include "xm_api.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/errors.h" #include "util/u_math.h" diff --git a/src/gallium/state_trackers/glx/xlib/xm_api.c b/src/gallium/state_trackers/glx/xlib/xm_api.c index 3e9d313138b..094b16721ab 100644 --- a/src/gallium/state_trackers/glx/xlib/xm_api.c +++ b/src/gallium/state_trackers/glx/xlib/xm_api.c @@ -70,7 +70,7 @@ #include "hud/hud_context.h" #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "xm_public.h" #include diff --git a/src/intel/compiler/brw_reg.h b/src/intel/compiler/brw_reg.h index a85b10e09f9..60dc2778edd 100644 --- a/src/intel/compiler/brw_reg.h +++ b/src/intel/compiler/brw_reg.h @@ -43,7 +43,7 @@ #define BRW_REG_H #include -#include "main/compiler.h" +#include "util/compiler.h" #include "main/macros.h" #include "program/prog_instruction.h" #include "brw_eu_defines.h" diff --git a/src/mapi/glapi/gen/gl_enums.py b/src/mapi/glapi/gen/gl_enums.py index 00f8134bae2..53987813642 100644 --- a/src/mapi/glapi/gen/gl_enums.py +++ b/src/mapi/glapi/gen/gl_enums.py @@ -52,7 +52,7 @@ class PrintGlEnums(gl_XML.gl_print_base): 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 {') diff --git a/src/mapi/glapi/gen/gl_genexec.py b/src/mapi/glapi/gen/gl_genexec.py index bd14bff4f27..0309ae58465 100644 --- a/src/mapi/glapi/gen/gl_genexec.py +++ b/src/mapi/glapi/gen/gl_genexec.py @@ -89,7 +89,7 @@ header = """/** #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" diff --git a/src/mapi/glapi/gen/gl_table.py b/src/mapi/glapi/gen/gl_table.py index 4b89ef8a856..e9fc0538cbe 100644 --- a/src/mapi/glapi/gen/gl_table.py +++ b/src/mapi/glapi/gen/gl_table.py @@ -100,6 +100,8 @@ class PrintRemapTable(gl_XML.gl_print_base): * 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 diff --git a/src/mesa/Android.libmesa_glsl_utils.mk b/src/mesa/Android.libmesa_glsl_utils.mk index 0d83cd5a9bf..e4e8b47d0e3 100644 --- a/src/mesa/Android.libmesa_glsl_utils.mk +++ b/src/mesa/Android.libmesa_glsl_utils.mk @@ -43,7 +43,6 @@ LOCAL_C_INCLUDES := \ LOCAL_SRC_FILES := \ main/extensions_table.c \ - main/imports.c \ program/symbol_table.c \ program/dummy_errors.c diff --git a/src/mesa/Makefile.sources b/src/mesa/Makefile.sources index cb4aab1d10a..bce32e70e35 100644 --- a/src/mesa/Makefile.sources +++ b/src/mesa/Makefile.sources @@ -43,7 +43,6 @@ MAIN_FILES = \ main/colortab.h \ main/compute.c \ main/compute.h \ - main/compiler.h \ main/condrender.c \ main/condrender.h \ main/config.h \ @@ -138,8 +137,6 @@ MAIN_FILES = \ main/histogram.h \ main/image.c \ main/image.h \ - main/imports.c \ - main/imports.h \ main/light.c \ main/light.h \ main/lines.c \ diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c index e36a80f6a55..89b21ec9b3f 100644 --- a/src/mesa/drivers/common/driverfuncs.c +++ b/src/mesa/drivers/common/driverfuncs.c @@ -24,7 +24,7 @@ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/accum.h" #include "main/arrayobj.h" #include "main/context.h" diff --git a/src/mesa/drivers/common/meta.c b/src/mesa/drivers/common/meta.c index 41722a38b38..617f6ea4a84 100644 --- a/src/mesa/drivers/common/meta.c +++ b/src/mesa/drivers/common/meta.c @@ -33,7 +33,7 @@ #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" diff --git a/src/mesa/drivers/common/meta_blit.c b/src/mesa/drivers/common/meta_blit.c index fec4db3af5c..96f1cba9d6f 100644 --- a/src/mesa/drivers/common/meta_blit.c +++ b/src/mesa/drivers/common/meta_blit.c @@ -24,7 +24,7 @@ #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" diff --git a/src/mesa/drivers/dri/i915/i830_context.c b/src/mesa/drivers/dri/i915/i830_context.c index 166c60190b7..865a3809c66 100644 --- a/src/mesa/drivers/dri/i915/i830_context.c +++ b/src/mesa/drivers/dri/i915/i830_context.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/drivers/dri/i915/i915_context.c b/src/mesa/drivers/dri/i915/i915_context.c index 2e19e57ae6c..d8db4ab42a3 100644 --- a/src/mesa/drivers/dri/i915/i915_context.c +++ b/src/mesa/drivers/dri/i915/i915_context.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/drivers/dri/i915/i915_debug_fp.c b/src/mesa/drivers/dri/i915/i915_debug_fp.c index d107c5afb38..474394e0df7 100644 --- a/src/mesa/drivers/dri/i915/i915_debug_fp.c +++ b/src/mesa/drivers/dri/i915/i915_debug_fp.c @@ -29,7 +29,8 @@ #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", diff --git a/src/mesa/drivers/dri/i915/i915_vtbl.c b/src/mesa/drivers/dri/i915/i915_vtbl.c index 562c83a665f..44c41bb43dc 100644 --- a/src/mesa/drivers/dri/i915/i915_vtbl.c +++ b/src/mesa/drivers/dri/i915/i915_vtbl.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/drivers/dri/i915/intel_buffer_objects.c b/src/mesa/drivers/dri/i915/intel_buffer_objects.c index e6760964909..6353c11ea32 100644 --- a/src/mesa/drivers/dri/i915/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i915/intel_buffer_objects.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/macros.h" #include "main/bufferobj.h" diff --git a/src/mesa/drivers/dri/i915/intel_context.c b/src/mesa/drivers/dri/i915/intel_context.c index ab4a0bf4961..2c3c488ee22 100644 --- a/src/mesa/drivers/dri/i915/intel_context.c +++ b/src/mesa/drivers/dri/i915/intel_context.c @@ -31,7 +31,7 @@ #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" diff --git a/src/mesa/drivers/dri/i915/intel_fbo.c b/src/mesa/drivers/dri/i915/intel_fbo.c index 880fd7cfba1..4f4a2fe96b9 100644 --- a/src/mesa/drivers/dri/i915/intel_fbo.c +++ b/src/mesa/drivers/dri/i915/intel_fbo.c @@ -27,7 +27,7 @@ #include "main/enums.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/mtypes.h" #include "main/fbobject.h" diff --git a/src/mesa/drivers/dri/i915/intel_render.c b/src/mesa/drivers/dri/i915/intel_render.c index a3952826246..9d90a5499fc 100644 --- a/src/mesa/drivers/dri/i915/intel_render.c +++ b/src/mesa/drivers/dri/i915/intel_render.c @@ -33,7 +33,7 @@ #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" diff --git a/src/mesa/drivers/dri/i915/intel_syncobj.c b/src/mesa/drivers/dri/i915/intel_syncobj.c index 4839164ed97..b5e363872ad 100644 --- a/src/mesa/drivers/dri/i915/intel_syncobj.c +++ b/src/mesa/drivers/dri/i915/intel_syncobj.c @@ -38,7 +38,7 @@ * performance bottleneck, though. */ -#include "main/imports.h" +#include "util/imports.h" #include "intel_context.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/brw_conditional_render.c b/src/mesa/drivers/dri/i965/brw_conditional_render.c index 5de6778430c..2450e707a2b 100644 --- a/src/mesa/drivers/dri/i965/brw_conditional_render.c +++ b/src/mesa/drivers/dri/i965/brw_conditional_render.c @@ -30,7 +30,7 @@ * (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" diff --git a/src/mesa/drivers/dri/i965/brw_context.c b/src/mesa/drivers/dri/i965/brw_context.c index 21566893ec8..5082657deac 100644 --- a/src/mesa/drivers/dri/i965/brw_context.c +++ b/src/mesa/drivers/dri/i965/brw_context.c @@ -37,7 +37,7 @@ #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" diff --git a/src/mesa/drivers/dri/i965/brw_object_purgeable.c b/src/mesa/drivers/dri/i965/brw_object_purgeable.c index c6d4a085f0f..fd55fe27e72 100644 --- a/src/mesa/drivers/dri/i965/brw_object_purgeable.c +++ b/src/mesa/drivers/dri/i965/brw_object_purgeable.c @@ -27,7 +27,7 @@ * 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" diff --git a/src/mesa/drivers/dri/i965/brw_primitive_restart.c b/src/mesa/drivers/dri/i965/brw_primitive_restart.c index 336c7f6131d..a780df31809 100644 --- a/src/mesa/drivers/dri/i965/brw_primitive_restart.c +++ b/src/mesa/drivers/dri/i965/brw_primitive_restart.c @@ -25,7 +25,7 @@ * */ -#include "main/imports.h" +#include "util/imports.h" #include "main/bufferobj.h" #include "main/varray.h" #include "vbo/vbo.h" diff --git a/src/mesa/drivers/dri/i965/brw_program.c b/src/mesa/drivers/dri/i965/brw_program.c index d250f02825b..54f700b7b11 100644 --- a/src/mesa/drivers/dri/i965/brw_program.c +++ b/src/mesa/drivers/dri/i965/brw_program.c @@ -30,7 +30,7 @@ */ #include -#include "main/imports.h" +#include "util/imports.h" #include "main/glspirv.h" #include "program/prog_parameter.h" #include "program/prog_print.h" diff --git a/src/mesa/drivers/dri/i965/brw_program_cache.c b/src/mesa/drivers/dri/i965/brw_program_cache.c index e4b321bcc4c..62d5c4dc991 100644 --- a/src/mesa/drivers/dri/i965/brw_program_cache.c +++ b/src/mesa/drivers/dri/i965/brw_program_cache.c @@ -44,7 +44,7 @@ * 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" diff --git a/src/mesa/drivers/dri/i965/brw_queryobj.c b/src/mesa/drivers/dri/i965/brw_queryobj.c index c48f8539275..b27a685d052 100644 --- a/src/mesa/drivers/dri/i965/brw_queryobj.c +++ b/src/mesa/drivers/dri/i965/brw_queryobj.c @@ -35,7 +35,7 @@ * 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" diff --git a/src/mesa/drivers/dri/i965/brw_sync.c b/src/mesa/drivers/dri/i965/brw_sync.c index d5e2d079380..73764834c6c 100644 --- a/src/mesa/drivers/dri/i965/brw_sync.c +++ b/src/mesa/drivers/dri/i965/brw_sync.c @@ -40,7 +40,7 @@ #include /* Requires Android or libdrm-2.4.72 */ -#include "main/imports.h" +#include "util/imports.h" #include "brw_context.h" #include "intel_batchbuffer.h" diff --git a/src/mesa/drivers/dri/i965/brw_vs.c b/src/mesa/drivers/dri/i965/brw_vs.c index b68a2fcaf28..1e9cecf9f90 100644 --- a/src/mesa/drivers/dri/i965/brw_vs.c +++ b/src/mesa/drivers/dri/i965/brw_vs.c @@ -30,7 +30,7 @@ */ -#include "main/compiler.h" +#include "util/compiler.h" #include "main/context.h" #include "brw_context.h" #include "brw_vs.h" diff --git a/src/mesa/drivers/dri/i965/gen6_queryobj.c b/src/mesa/drivers/dri/i965/gen6_queryobj.c index db6ae21da47..08fe90b8c02 100644 --- a/src/mesa/drivers/dri/i965/gen6_queryobj.c +++ b/src/mesa/drivers/dri/i965/gen6_queryobj.c @@ -31,7 +31,7 @@ * 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" diff --git a/src/mesa/drivers/dri/i965/hsw_queryobj.c b/src/mesa/drivers/dri/i965/hsw_queryobj.c index 0f6c4837936..4af64f029d5 100644 --- a/src/mesa/drivers/dri/i965/hsw_queryobj.c +++ b/src/mesa/drivers/dri/i965/hsw_queryobj.c @@ -26,7 +26,7 @@ * * 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" diff --git a/src/mesa/drivers/dri/i965/intel_buffer_objects.c b/src/mesa/drivers/dri/i965/intel_buffer_objects.c index 054ba6b22ff..7528248f62e 100644 --- a/src/mesa/drivers/dri/i965/intel_buffer_objects.c +++ b/src/mesa/drivers/dri/i965/intel_buffer_objects.c @@ -29,7 +29,7 @@ * 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" diff --git a/src/mesa/drivers/dri/i965/intel_fbo.c b/src/mesa/drivers/dri/i965/intel_fbo.c index c644ade0fd3..00071717383 100644 --- a/src/mesa/drivers/dri/i965/intel_fbo.c +++ b/src/mesa/drivers/dri/i965/intel_fbo.c @@ -24,7 +24,7 @@ */ #include "main/enums.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/mtypes.h" #include "main/fbobject.h" diff --git a/src/mesa/drivers/dri/i965/intel_upload.c b/src/mesa/drivers/dri/i965/intel_upload.c index d81ae43e8a0..595e330f3b6 100644 --- a/src/mesa/drivers/dri/i965/intel_upload.c +++ b/src/mesa/drivers/dri/i965/intel_upload.c @@ -28,7 +28,7 @@ * Batched upload via BOs. */ -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "brw_bufmgr.h" #include "brw_context.h" diff --git a/src/mesa/drivers/dri/nouveau/nouveau_driver.h b/src/mesa/drivers/dri/nouveau/nouveau_driver.h index 237e9563246..3230d7e0881 100644 --- a/src/mesa/drivers/dri/nouveau/nouveau_driver.h +++ b/src/mesa/drivers/dri/nouveau/nouveau_driver.h @@ -27,7 +27,7 @@ #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" diff --git a/src/mesa/drivers/dri/r200/r200_cmdbuf.c b/src/mesa/drivers/dri/r200/r200_cmdbuf.c index 5816709dc5f..3390e0a6672 100644 --- a/src/mesa/drivers/dri/r200/r200_cmdbuf.c +++ b/src/mesa/drivers/dri/r200/r200_cmdbuf.c @@ -32,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #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" diff --git a/src/mesa/drivers/dri/r200/r200_context.c b/src/mesa/drivers/dri/r200/r200_context.c index 4db7e9d005a..91ce34c6c42 100644 --- a/src/mesa/drivers/dri/r200/r200_context.c +++ b/src/mesa/drivers/dri/r200/r200_context.c @@ -37,7 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #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" diff --git a/src/mesa/drivers/dri/r200/r200_ioctl.c b/src/mesa/drivers/dri/r200/r200_ioctl.c index 90232d45e9e..293bec216c8 100644 --- a/src/mesa/drivers/dri/r200/r200_ioctl.c +++ b/src/mesa/drivers/dri/r200/r200_ioctl.c @@ -36,7 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/context.h" #include "swrast/swrast.h" diff --git a/src/mesa/drivers/dri/r200/r200_maos_arrays.c b/src/mesa/drivers/dri/r200/r200_maos_arrays.c index a3d45cf7369..646f8bfc973 100644 --- a/src/mesa/drivers/dri/r200/r200_maos_arrays.c +++ b/src/mesa/drivers/dri/r200/r200_maos_arrays.c @@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "main/glheader.h" #include "main/mtypes.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/state.h" diff --git a/src/mesa/drivers/dri/r200/r200_sanity.c b/src/mesa/drivers/dri/r200/r200_sanity.c index 6628674431c..ade7aaf007a 100644 --- a/src/mesa/drivers/dri/r200/r200_sanity.c +++ b/src/mesa/drivers/dri/r200/r200_sanity.c @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "r200_context.h" #include "r200_sanity.h" diff --git a/src/mesa/drivers/dri/r200/r200_state.c b/src/mesa/drivers/dri/r200/r200_state.c index b4cff8c2592..eff71dbd051 100644 --- a/src/mesa/drivers/dri/r200/r200_state.c +++ b/src/mesa/drivers/dri/r200/r200_state.c @@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/enums.h" #include "main/light.h" #include "main/framebuffer.h" diff --git a/src/mesa/drivers/dri/r200/r200_state_init.c b/src/mesa/drivers/dri/r200/r200_state_init.c index 47ecaffc8f7..9febc20363a 100644 --- a/src/mesa/drivers/dri/r200/r200_state_init.c +++ b/src/mesa/drivers/dri/r200/r200_state_init.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #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" diff --git a/src/mesa/drivers/dri/r200/r200_swtcl.c b/src/mesa/drivers/dri/r200/r200_swtcl.c index 0fda58656c7..d951bee4fa2 100644 --- a/src/mesa/drivers/dri/r200/r200_swtcl.c +++ b/src/mesa/drivers/dri/r200/r200_swtcl.c @@ -36,7 +36,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #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" diff --git a/src/mesa/drivers/dri/r200/r200_tcl.c b/src/mesa/drivers/dri/r200/r200_tcl.c index 662c041c79f..1802711eef0 100644 --- a/src/mesa/drivers/dri/r200/r200_tcl.c +++ b/src/mesa/drivers/dri/r200/r200_tcl.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/enums.h" #include "main/light.h" diff --git a/src/mesa/drivers/dri/r200/r200_tex.c b/src/mesa/drivers/dri/r200/r200_tex.c index 1b217b9ed2b..425ad538c04 100644 --- a/src/mesa/drivers/dri/r200/r200_tex.c +++ b/src/mesa/drivers/dri/r200/r200_tex.c @@ -32,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/enums.h" #include "main/image.h" diff --git a/src/mesa/drivers/dri/r200/r200_texstate.c b/src/mesa/drivers/dri/r200/r200_texstate.c index b227fbbfdf9..f98fadf560a 100644 --- a/src/mesa/drivers/dri/r200/r200_texstate.c +++ b/src/mesa/drivers/dri/r200/r200_texstate.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/macros.h" #include "main/state.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c index 2b76305dd45..4bb0078aba5 100644 --- a/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c +++ b/src/mesa/drivers/dri/radeon/radeon_buffer_objects.c @@ -25,7 +25,7 @@ * */ -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/bufferobj.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_common.c b/src/mesa/drivers/dri/radeon/radeon_common.c index a3bf00b09f7..ad63ea2d240 100644 --- a/src/mesa/drivers/dri/radeon/radeon_common.c +++ b/src/mesa/drivers/dri/radeon/radeon_common.c @@ -43,7 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/enums.h" #include "main/fbobject.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_context.c b/src/mesa/drivers/dri/radeon/radeon_context.c index d7ab93f5b87..5435d0f34be 100644 --- a/src/mesa/drivers/dri/radeon/radeon_context.c +++ b/src/mesa/drivers/dri/radeon/radeon_context.c @@ -40,7 +40,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #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" diff --git a/src/mesa/drivers/dri/radeon/radeon_fbo.c b/src/mesa/drivers/dri/radeon/radeon_fbo.c index 439b95bf7b1..e04ae54ad80 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fbo.c +++ b/src/mesa/drivers/dri/radeon/radeon_fbo.c @@ -26,7 +26,7 @@ **************************************************************************/ -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/mtypes.h" #include "main/enums.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_fog.c b/src/mesa/drivers/dri/radeon/radeon_fog.c index d5c6537036e..c4df8d28cce 100644 --- a/src/mesa/drivers/dri/radeon/radeon_fog.c +++ b/src/mesa/drivers/dri/radeon/radeon_fog.c @@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #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" diff --git a/src/mesa/drivers/dri/radeon/radeon_ioctl.c b/src/mesa/drivers/dri/radeon/radeon_ioctl.c index 8734fea9a92..f5092a414bb 100644 --- a/src/mesa/drivers/dri/radeon/radeon_ioctl.c +++ b/src/mesa/drivers/dri/radeon/radeon_ioctl.c @@ -42,7 +42,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #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" diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c index b6520c3d172..bdfa0a8ca1c 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_arrays.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/macros.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c index c9c91f8640c..443068e06d9 100644 --- a/src/mesa/drivers/dri/radeon/radeon_maos_verts.c +++ b/src/mesa/drivers/dri/radeon/radeon_maos_verts.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/state.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.c b/src/mesa/drivers/dri/radeon/radeon_queryobj.c index c75c1e03a4a..5225c99145d 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.c +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.c @@ -28,7 +28,7 @@ #include "radeon_queryobj.h" #include "radeon_debug.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/queryobj.h" #include diff --git a/src/mesa/drivers/dri/radeon/radeon_queryobj.h b/src/mesa/drivers/dri/radeon/radeon_queryobj.h index a2e7724da14..e1cda17b005 100644 --- a/src/mesa/drivers/dri/radeon/radeon_queryobj.h +++ b/src/mesa/drivers/dri/radeon/radeon_queryobj.h @@ -25,7 +25,7 @@ * */ -#include "main/imports.h" +#include "util/imports.h" #include "util/simple_list.h" #include "radeon_common_context.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_screen.c b/src/mesa/drivers/dri/radeon/radeon_screen.c index cde35d3abf6..2bf004e4f90 100644 --- a/src/mesa/drivers/dri/radeon/radeon_screen.c +++ b/src/mesa/drivers/dri/radeon/radeon_screen.c @@ -37,7 +37,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/framebuffer.h" #include "main/renderbuffer.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_state.c b/src/mesa/drivers/dri/radeon/radeon_state.c index 410a78fc084..b3873e2c0ec 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state.c +++ b/src/mesa/drivers/dri/radeon/radeon_state.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/enums.h" #include "main/light.h" #include "main/context.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_state_init.c b/src/mesa/drivers/dri/radeon/radeon_state_init.c index accf360e7ce..18e0fea490e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_state_init.c +++ b/src/mesa/drivers/dri/radeon/radeon_state_init.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/drivers/dri/radeon/radeon_swtcl.c b/src/mesa/drivers/dri/radeon/radeon_swtcl.c index 860bba6d32f..84e216281e3 100644 --- a/src/mesa/drivers/dri/radeon/radeon_swtcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_swtcl.c @@ -35,7 +35,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #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" diff --git a/src/mesa/drivers/dri/radeon/radeon_tcl.c b/src/mesa/drivers/dri/radeon/radeon_tcl.c index 61ff2311e95..0a228d21aaf 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tcl.c +++ b/src/mesa/drivers/dri/radeon/radeon_tcl.c @@ -33,7 +33,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/light.h" #include "main/enums.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_tex.c b/src/mesa/drivers/dri/radeon/radeon_tex.c index da5d469e04c..3db6cbeb71e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_tex.c +++ b/src/mesa/drivers/dri/radeon/radeon_tex.c @@ -32,7 +32,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/enums.h" #include "main/image.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_texstate.c b/src/mesa/drivers/dri/radeon/radeon_texstate.c index 1cfca191375..30cdc56bf1e 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texstate.c +++ b/src/mesa/drivers/dri/radeon/radeon_texstate.c @@ -34,7 +34,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/macros.h" #include "main/teximage.h" diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c index 069edc93a42..a2c43aa7b5b 100644 --- a/src/mesa/drivers/dri/radeon/radeon_texture.c +++ b/src/mesa/drivers/dri/radeon/radeon_texture.c @@ -30,7 +30,7 @@ */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/enums.h" #include "main/mipmap.h" diff --git a/src/mesa/drivers/dri/swrast/swrast.c b/src/mesa/drivers/dri/swrast/swrast.c index 20ba8ff5106..827f22cb5cc 100644 --- a/src/mesa/drivers/dri/swrast/swrast.c +++ b/src/mesa/drivers/dri/swrast/swrast.c @@ -39,7 +39,7 @@ #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" diff --git a/src/mesa/drivers/osmesa/osmesa.c b/src/mesa/drivers/osmesa/osmesa.c index 30e6c07e6aa..3635e305b8b 100644 --- a/src/mesa/drivers/osmesa/osmesa.c +++ b/src/mesa/drivers/osmesa/osmesa.c @@ -41,7 +41,7 @@ #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" diff --git a/src/mesa/drivers/x11/fakeglx.c b/src/mesa/drivers/x11/fakeglx.c index 593c8d1f7eb..4201a05df8f 100644 --- a/src/mesa/drivers/x11/fakeglx.c +++ b/src/mesa/drivers/x11/fakeglx.c @@ -47,7 +47,7 @@ #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" diff --git a/src/mesa/drivers/x11/xfonts.c b/src/mesa/drivers/x11/xfonts.c index 8405013b85c..04f397bd27d 100644 --- a/src/mesa/drivers/x11/xfonts.c +++ b/src/mesa/drivers/x11/xfonts.c @@ -31,7 +31,7 @@ #include #include "glxheader.h" #include "main/context.h" -#include "main/imports.h" +#include "util/imports.h" #include "xfonts.h" diff --git a/src/mesa/drivers/x11/xm_api.c b/src/mesa/drivers/x11/xm_api.c index 88f6630ed6a..c71448750f2 100644 --- a/src/mesa/drivers/x11/xm_api.c +++ b/src/mesa/drivers/x11/xm_api.c @@ -69,7 +69,7 @@ #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" diff --git a/src/mesa/drivers/x11/xm_buffer.c b/src/mesa/drivers/x11/xm_buffer.c index 0da08a6e64d..9e16726535c 100644 --- a/src/mesa/drivers/x11/xm_buffer.c +++ b/src/mesa/drivers/x11/xm_buffer.c @@ -32,7 +32,7 @@ #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" diff --git a/src/mesa/drivers/x11/xm_dd.c b/src/mesa/drivers/x11/xm_dd.c index 3c576c7cd8b..790cbccf505 100644 --- a/src/mesa/drivers/x11/xm_dd.c +++ b/src/mesa/drivers/x11/xm_dd.c @@ -37,7 +37,7 @@ #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" diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index da26235ff04..d5a27a981dc 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -32,7 +32,7 @@ #include #include "c99_math.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "glxheader.h" #include "xmesaP.h" diff --git a/src/mesa/main/accum.c b/src/mesa/main/accum.c index 89ae31556d3..86d19c57d92 100644 --- a/src/mesa/main/accum.c +++ b/src/mesa/main/accum.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/main/api_arrayelt.c b/src/mesa/main/api_arrayelt.c index 51a7d63b83e..022a1285c26 100644 --- a/src/mesa/main/api_arrayelt.c +++ b/src/mesa/main/api_arrayelt.c @@ -39,7 +39,7 @@ #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" diff --git a/src/mesa/main/arbprogram.c b/src/mesa/main/arbprogram.c index 1c8cc13d061..25de173784c 100644 --- a/src/mesa/main/arbprogram.c +++ b/src/mesa/main/arbprogram.c @@ -32,7 +32,7 @@ #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" diff --git a/src/mesa/main/arrayobj.c b/src/mesa/main/arrayobj.c index 6dbd09b39ec..371ca7b04e3 100644 --- a/src/mesa/main/arrayobj.c +++ b/src/mesa/main/arrayobj.c @@ -43,7 +43,7 @@ #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" diff --git a/src/mesa/main/atifragshader.c b/src/mesa/main/atifragshader.c index 71c8ce5efdf..75998f97bb8 100644 --- a/src/mesa/main/atifragshader.c +++ b/src/mesa/main/atifragshader.c @@ -24,7 +24,7 @@ #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" diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c index 133f1a8c424..c39412e9fe0 100644 --- a/src/mesa/main/attrib.c +++ b/src/mesa/main/attrib.c @@ -24,7 +24,7 @@ */ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "accum.h" #include "arrayobj.h" #include "attrib.h" diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c index b5d6bb188d9..881a9d3e00e 100644 --- a/src/mesa/main/bufferobj.c +++ b/src/mesa/main/bufferobj.c @@ -36,7 +36,7 @@ #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" diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h deleted file mode 100644 index 43a06b43139..00000000000 --- a/src/mesa/main/compiler.h +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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 - -#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 -#define CPU_TO_LE32( x ) bswap_32( x ) -#elif defined(__APPLE__) -#include -#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x ) -#elif defined(__OpenBSD__) -#include -#define CPU_TO_LE32( x ) htole32( x ) -#else /*__linux__ */ -#include -#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 */ diff --git a/src/mesa/main/context.c b/src/mesa/main/context.c index c183378d1d3..f9c8d22820a 100644 --- a/src/mesa/main/context.c +++ b/src/mesa/main/context.c @@ -77,7 +77,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "accum.h" #include "api_exec.h" #include "api_loopback.h" diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h index bf39ef2d08e..a816131742e 100644 --- a/src/mesa/main/context.h +++ b/src/mesa/main/context.h @@ -50,7 +50,7 @@ #include "errors.h" -#include "imports.h" +#include "util/imports.h" #include "extensions.h" #include "mtypes.h" #include "vbo/vbo.h" diff --git a/src/mesa/main/cpuinfo.c b/src/mesa/main/cpuinfo.c index 67f22ab9c81..c085d3430d4 100644 --- a/src/mesa/main/cpuinfo.c +++ b/src/mesa/main/cpuinfo.c @@ -23,7 +23,7 @@ */ -#include "main/imports.h" +#include "util/imports.h" #include "main/cpuinfo.h" diff --git a/src/mesa/main/debug.c b/src/mesa/main/debug.c index c27d1b80357..66ee2841b03 100644 --- a/src/mesa/main/debug.c +++ b/src/mesa/main/debug.c @@ -30,7 +30,7 @@ #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" diff --git a/src/mesa/main/debug_output.c b/src/mesa/main/debug_output.c index cd08015b73f..d643866c55a 100644 --- a/src/mesa/main/debug_output.c +++ b/src/mesa/main/debug_output.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/main/depth.c b/src/mesa/main/depth.c index 27bd4958253..f37d175b888 100644 --- a/src/mesa/main/depth.c +++ b/src/mesa/main/depth.c @@ -24,7 +24,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "depth.h" #include "enums.h" diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index 0fe027f0afc..3abac73ebb9 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -31,7 +31,7 @@ #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" diff --git a/src/mesa/main/draw_validate.c b/src/mesa/main/draw_validate.c index 779cd1c12c7..523281f7012 100644 --- a/src/mesa/main/draw_validate.c +++ b/src/mesa/main/draw_validate.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/main/drawpix.c b/src/mesa/main/drawpix.c index 2f55dde7b80..320081911bb 100644 --- a/src/mesa/main/drawpix.c +++ b/src/mesa/main/drawpix.c @@ -23,7 +23,7 @@ */ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "draw_validate.h" #include "bufferobj.h" #include "context.h" diff --git a/src/mesa/main/drawtex.c b/src/mesa/main/drawtex.c index 6114b3277b0..304c74879b5 100644 --- a/src/mesa/main/drawtex.c +++ b/src/mesa/main/drawtex.c @@ -24,7 +24,7 @@ #include "main/errors.h" #include "main/drawtex.h" #include "main/state.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" diff --git a/src/mesa/main/errors.c b/src/mesa/main/errors.c index 071b75c4727..7c8cb3886d9 100644 --- a/src/mesa/main/errors.c +++ b/src/mesa/main/errors.c @@ -32,7 +32,7 @@ #include #include "errors.h" #include "enums.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "debug_output.h" diff --git a/src/mesa/main/es1_conversion.c b/src/mesa/main/es1_conversion.c index 1dfe8278e71..020d891ae33 100644 --- a/src/mesa/main/es1_conversion.c +++ b/src/mesa/main/es1_conversion.c @@ -9,7 +9,7 @@ #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" diff --git a/src/mesa/main/eval.c b/src/mesa/main/eval.c index 86c8f75a1d2..e970265e2c3 100644 --- a/src/mesa/main/eval.c +++ b/src/mesa/main/eval.c @@ -38,7 +38,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "eval.h" #include "macros.h" diff --git a/src/mesa/main/execmem.c b/src/mesa/main/execmem.c index 35d4574ba2b..3b08f42a3dd 100644 --- a/src/mesa/main/execmem.c +++ b/src/mesa/main/execmem.c @@ -32,7 +32,8 @@ #include -#include "imports.h" +#include "util/imports.h" +#include "main/glheader.h" #include "execmem.h" #include "c11/threads.h" diff --git a/src/mesa/main/extensions.c b/src/mesa/main/extensions.c index 0aeda39cc22..6c1551687b2 100644 --- a/src/mesa/main/extensions.c +++ b/src/mesa/main/extensions.c @@ -31,7 +31,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "extensions.h" #include "macros.h" diff --git a/src/mesa/main/ff_fragment_shader.cpp b/src/mesa/main/ff_fragment_shader.cpp index 8f2b4e9de48..9ae86f4ee13 100644 --- a/src/mesa/main/ff_fragment_shader.cpp +++ b/src/mesa/main/ff_fragment_shader.cpp @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/main/format_utils.h b/src/mesa/main/format_utils.h index 3a528ceb3db..c298d0477ad 100644 --- a/src/mesa/main/format_utils.h +++ b/src/mesa/main/format_utils.h @@ -32,7 +32,7 @@ #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" diff --git a/src/mesa/main/formats.c b/src/mesa/main/formats.c index 370859d37ca..53f01ffc18a 100644 --- a/src/mesa/main/formats.c +++ b/src/mesa/main/formats.c @@ -25,7 +25,7 @@ #include "errors.h" -#include "imports.h" +#include "util/imports.h" #include "formats.h" #include "macros.h" #include "glformats.h" diff --git a/src/mesa/main/framebuffer.c b/src/mesa/main/framebuffer.c index 1c72f446b0d..1cfc472c8fa 100644 --- a/src/mesa/main/framebuffer.c +++ b/src/mesa/main/framebuffer.c @@ -31,7 +31,7 @@ #include #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "blend.h" #include "buffers.h" #include "context.h" diff --git a/src/mesa/main/hash.h b/src/mesa/main/hash.h index 64f2962aba6..040c6cb5824 100644 --- a/src/mesa/main/hash.h +++ b/src/mesa/main/hash.h @@ -33,7 +33,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "c11/threads.h" /** diff --git a/src/mesa/main/hint.c b/src/mesa/main/hint.c index 2bcaeebc4aa..5a09a7362a9 100644 --- a/src/mesa/main/hint.c +++ b/src/mesa/main/hint.c @@ -28,7 +28,7 @@ #include "enums.h" #include "context.h" #include "hint.h" -#include "imports.h" +#include "util/imports.h" #include "mtypes.h" diff --git a/src/mesa/main/image.c b/src/mesa/main/image.c index ad6b378f7f6..0ec1d09853e 100644 --- a/src/mesa/main/image.c +++ b/src/mesa/main/image.c @@ -34,7 +34,7 @@ #include "colormac.h" #include "glformats.h" #include "image.h" -#include "imports.h" +#include "util/imports.h" #include "macros.h" #include "mtypes.h" diff --git a/src/mesa/main/imports.c b/src/mesa/main/imports.c deleted file mode 100644 index 96f8ad443f3..00000000000 --- a/src/mesa/main/imports.c +++ /dev/null @@ -1,234 +0,0 @@ -/** - * \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 -#include -#include "c99_math.h" -#include "imports.h" -#include "context.h" -#include "version.h" - -#ifdef _GNU_SOURCE -#include -#ifdef __APPLE__ -#include -#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; -} - - diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h deleted file mode 100644 index 7cf5f247be4..00000000000 --- a/src/mesa/main/imports.h +++ /dev/null @@ -1,321 +0,0 @@ -/* - * 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 -#include -#include -#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 */ diff --git a/src/mesa/main/light.c b/src/mesa/main/light.c index 67faf8a1452..bae17c76f60 100644 --- a/src/mesa/main/light.c +++ b/src/mesa/main/light.c @@ -26,7 +26,7 @@ #include "c99_math.h" #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "enums.h" #include "light.h" diff --git a/src/mesa/main/macros.h b/src/mesa/main/macros.h index efdb0a09570..a54ade1fc9b 100644 --- a/src/mesa/main/macros.h +++ b/src/mesa/main/macros.h @@ -34,7 +34,8 @@ #include "util/macros.h" #include "util/u_math.h" #include "util/rounding.h" -#include "imports.h" +#include "util/imports.h" +#include "main/glheader.h" /** diff --git a/src/mesa/main/matrix.c b/src/mesa/main/matrix.c index 7d75a900e1b..58a48ed9933 100644 --- a/src/mesa/main/matrix.c +++ b/src/mesa/main/matrix.c @@ -36,7 +36,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "enums.h" #include "macros.h" diff --git a/src/mesa/main/mipmap.c b/src/mesa/main/mipmap.c index 88e6baa08ad..dc606877d01 100644 --- a/src/mesa/main/mipmap.c +++ b/src/mesa/main/mipmap.c @@ -28,7 +28,7 @@ */ #include "errors.h" -#include "imports.h" +#include "util/imports.h" #include "formats.h" #include "glformats.h" #include "mipmap.h" diff --git a/src/mesa/main/objectpurge.c b/src/mesa/main/objectpurge.c index d730f46b8ec..28d046b565c 100644 --- a/src/mesa/main/objectpurge.c +++ b/src/mesa/main/objectpurge.c @@ -31,7 +31,7 @@ #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" diff --git a/src/mesa/main/pack.c b/src/mesa/main/pack.c index 64ad115f8b5..818fcf85384 100644 --- a/src/mesa/main/pack.c +++ b/src/mesa/main/pack.c @@ -46,12 +46,12 @@ #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" diff --git a/src/mesa/main/pbo.c b/src/mesa/main/pbo.c index cea55f2a0d2..6af815759f1 100644 --- a/src/mesa/main/pbo.c +++ b/src/mesa/main/pbo.c @@ -36,7 +36,7 @@ #include "bufferobj.h" #include "glformats.h" #include "image.h" -#include "imports.h" +#include "util/imports.h" #include "mtypes.h" #include "pbo.h" diff --git a/src/mesa/main/pixeltransfer.c b/src/mesa/main/pixeltransfer.c index 22eac00a7df..1b8abd87a61 100644 --- a/src/mesa/main/pixeltransfer.c +++ b/src/mesa/main/pixeltransfer.c @@ -33,7 +33,7 @@ #include "glheader.h" #include "macros.h" #include "pixeltransfer.h" -#include "imports.h" +#include "util/imports.h" #include "mtypes.h" #include "util/rounding.h" diff --git a/src/mesa/main/polygon.c b/src/mesa/main/polygon.c index ae8f2a85645..f44542385b9 100644 --- a/src/mesa/main/polygon.c +++ b/src/mesa/main/polygon.c @@ -29,7 +29,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "image.h" #include "enums.h" diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c index 981ccf8f9c0..032f9e9a437 100644 --- a/src/mesa/main/queryobj.c +++ b/src/mesa/main/queryobj.c @@ -28,7 +28,7 @@ #include "context.h" #include "enums.h" #include "hash.h" -#include "imports.h" +#include "util/imports.h" #include "queryobj.h" #include "mtypes.h" diff --git a/src/mesa/main/readpix.c b/src/mesa/main/readpix.c index 6b3685dd82b..45e5754d9a4 100644 --- a/src/mesa/main/readpix.c +++ b/src/mesa/main/readpix.c @@ -23,7 +23,7 @@ */ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "blend.h" #include "bufferobj.h" #include "context.h" diff --git a/src/mesa/main/remap.c b/src/mesa/main/remap.c index fa412c0c4f7..c8b01fb1a58 100644 --- a/src/mesa/main/remap.c +++ b/src/mesa/main/remap.c @@ -37,7 +37,7 @@ #include #include "remap.h" -#include "imports.h" +#include "util/imports.h" #include "glapi/glapi.h" #define MAX_ENTRY_POINTS 16 diff --git a/src/mesa/main/renderbuffer.c b/src/mesa/main/renderbuffer.c index 0e017125ac0..34959776a6f 100644 --- a/src/mesa/main/renderbuffer.c +++ b/src/mesa/main/renderbuffer.c @@ -24,7 +24,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "fbobject.h" #include "formats.h" diff --git a/src/mesa/main/shared.c b/src/mesa/main/shared.c index 07fdc76ee56..3da48f3e747 100644 --- a/src/mesa/main/shared.c +++ b/src/mesa/main/shared.c @@ -27,7 +27,7 @@ * Shared-context state */ -#include "imports.h" +#include "util/imports.h" #include "mtypes.h" #include "hash.h" #include "atifragshader.h" diff --git a/src/mesa/main/stencil.c b/src/mesa/main/stencil.c index d89312ce12d..6ef6833bb71 100644 --- a/src/mesa/main/stencil.c +++ b/src/mesa/main/stencil.c @@ -48,7 +48,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "macros.h" #include "stencil.h" diff --git a/src/mesa/main/syncobj.c b/src/mesa/main/syncobj.c index 736f043f90c..41b7b22b0ae 100644 --- a/src/mesa/main/syncobj.c +++ b/src/mesa/main/syncobj.c @@ -57,7 +57,7 @@ #include #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "macros.h" #include "get.h" diff --git a/src/mesa/main/tests/dispatch_sanity.cpp b/src/mesa/main/tests/dispatch_sanity.cpp index e0324bd54d2..f03317a2d5f 100644 --- a/src/mesa/main/tests/dispatch_sanity.cpp +++ b/src/mesa/main/tests/dispatch_sanity.cpp @@ -43,7 +43,7 @@ #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" diff --git a/src/mesa/main/texcompress.c b/src/mesa/main/texcompress.c index 48d794ddfd2..6b97695c8ef 100644 --- a/src/mesa/main/texcompress.c +++ b/src/mesa/main/texcompress.c @@ -31,7 +31,7 @@ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "context.h" #include "formats.h" #include "mtypes.h" diff --git a/src/mesa/main/texcompress_cpal.c b/src/mesa/main/texcompress_cpal.c index c46ef8c53fb..db99649e2bf 100644 --- a/src/mesa/main/texcompress_cpal.c +++ b/src/mesa/main/texcompress_cpal.c @@ -34,7 +34,7 @@ #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" diff --git a/src/mesa/main/texcompress_fxt1.c b/src/mesa/main/texcompress_fxt1.c index bd284b36113..5b93eee3439 100644 --- a/src/mesa/main/texcompress_fxt1.c +++ b/src/mesa/main/texcompress_fxt1.c @@ -31,7 +31,7 @@ #include "errors.h" #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "image.h" #include "macros.h" #include "mipmap.h" diff --git a/src/mesa/main/texcompress_rgtc.c b/src/mesa/main/texcompress_rgtc.c index ef5c2bbfd8d..e6f6075ecff 100644 --- a/src/mesa/main/texcompress_rgtc.c +++ b/src/mesa/main/texcompress_rgtc.c @@ -35,7 +35,7 @@ #include "config.h" #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "image.h" #include "macros.h" #include "mipmap.h" diff --git a/src/mesa/main/texcompress_s3tc.c b/src/mesa/main/texcompress_s3tc.c index 78f03bf2920..faec72f365d 100644 --- a/src/mesa/main/texcompress_s3tc.c +++ b/src/mesa/main/texcompress_s3tc.c @@ -30,7 +30,7 @@ */ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "image.h" #include "macros.h" #include "mtypes.h" diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c index 65952bca5fa..86de72d7593 100644 --- a/src/mesa/main/teximage.c +++ b/src/mesa/main/teximage.c @@ -38,7 +38,7 @@ #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" diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c index c5459f4540f..4dc1bb1eed0 100644 --- a/src/mesa/main/texobj.c +++ b/src/mesa/main/texobj.c @@ -35,7 +35,7 @@ #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" diff --git a/src/mesa/main/texstorage.c b/src/mesa/main/texstorage.c index d2e0e52ecab..5f2d78e07d4 100644 --- a/src/mesa/main/texstorage.c +++ b/src/mesa/main/texstorage.c @@ -30,7 +30,7 @@ #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" diff --git a/src/mesa/main/texstore.c b/src/mesa/main/texstore.c index 9bbac5f1512..5c5331a6402 100755 --- a/src/mesa/main/texstore.c +++ b/src/mesa/main/texstore.c @@ -62,7 +62,7 @@ #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" diff --git a/src/mesa/main/texturebindless.c b/src/mesa/main/texturebindless.c index 9aaa0367c2d..eddf0ee4684 100644 --- a/src/mesa/main/texturebindless.c +++ b/src/mesa/main/texturebindless.c @@ -24,7 +24,7 @@ #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" diff --git a/src/mesa/main/textureview.c b/src/mesa/main/textureview.c index 62c86eb5f03..da09c1e3c58 100644 --- a/src/mesa/main/textureview.c +++ b/src/mesa/main/textureview.c @@ -34,7 +34,7 @@ #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" diff --git a/src/mesa/main/transformfeedback.h b/src/mesa/main/transformfeedback.h index 063e295a2ec..729b790ed6f 100644 --- a/src/mesa/main/transformfeedback.h +++ b/src/mesa/main/transformfeedback.h @@ -28,7 +28,7 @@ #include #include "bufferobj.h" -#include "compiler.h" +#include "util/compiler.h" #include "glheader.h" #include "mtypes.h" diff --git a/src/mesa/main/varray.c b/src/mesa/main/varray.c index 2f6aefc9ccb..3c9c6f3d31a 100644 --- a/src/mesa/main/varray.c +++ b/src/mesa/main/varray.c @@ -28,7 +28,7 @@ #include /* for PRId64 macro */ #include "glheader.h" -#include "imports.h" +#include "util/imports.h" #include "bufferobj.h" #include "context.h" #include "enable.h" diff --git a/src/mesa/main/version.c b/src/mesa/main/version.c index 58deb4b3cf8..cacf22e7950 100644 --- a/src/mesa/main/version.c +++ b/src/mesa/main/version.c @@ -25,7 +25,7 @@ #include #include "context.h" -#include "imports.h" +#include "util/imports.h" #include "mtypes.h" #include "version.h" #include "git_sha1.h" diff --git a/src/mesa/main/vtxfmt.c b/src/mesa/main/vtxfmt.c index f5ef0ac56c3..666124e1ca6 100644 --- a/src/mesa/main/vtxfmt.c +++ b/src/mesa/main/vtxfmt.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/math/m_debug_clip.c b/src/mesa/math/m_debug_clip.c index 044768dbdd2..adb731ca8c0 100644 --- a/src/mesa/math/m_debug_clip.c +++ b/src/mesa/math/m_debug_clip.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/math/m_debug_norm.c b/src/mesa/math/m_debug_norm.c index 8be07eecbe3..7ad5b6f6b29 100644 --- a/src/mesa/math/m_debug_norm.c +++ b/src/mesa/math/m_debug_norm.c @@ -30,7 +30,7 @@ #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" diff --git a/src/mesa/math/m_debug_xform.c b/src/mesa/math/m_debug_xform.c index 632c82ea258..f6e0bb24f54 100644 --- a/src/mesa/math/m_debug_xform.c +++ b/src/mesa/math/m_debug_xform.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/math/m_matrix.c b/src/mesa/math/m_matrix.c index d3f89ee7cb7..cc3af6870f8 100644 --- a/src/mesa/math/m_matrix.c +++ b/src/mesa/math/m_matrix.c @@ -38,7 +38,7 @@ #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" diff --git a/src/mesa/math/m_vector.c b/src/mesa/math/m_vector.c index f25b7b20642..af4eceaf014 100644 --- a/src/mesa/math/m_vector.c +++ b/src/mesa/math/m_vector.c @@ -30,7 +30,7 @@ #include #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "m_vector.h" diff --git a/src/mesa/math/m_xform.h b/src/mesa/math/m_xform.h index 0bb8e9bd861..d3a5c81d648 100644 --- a/src/mesa/math/m_xform.h +++ b/src/mesa/math/m_xform.h @@ -27,7 +27,7 @@ #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" diff --git a/src/mesa/meson.build b/src/mesa/meson.build index 11c176686cc..5c2ca120333 100644 --- a/src/mesa/meson.build +++ b/src/mesa/meson.build @@ -92,7 +92,6 @@ files_libmesa_common = files( 'main/colortab.h', 'main/compute.c', 'main/compute.h', - 'main/compiler.h', 'main/condrender.c', 'main/condrender.h', 'main/config.h', @@ -180,8 +179,6 @@ files_libmesa_common = files( 'main/histogram.h', 'main/image.c', 'main/image.h', - 'main/imports.c', - 'main/imports.h', 'main/light.c', 'main/light.h', 'main/lines.c', diff --git a/src/mesa/program/arbprogparse.c b/src/mesa/program/arbprogparse.c index 99aa6914624..7216f9fdcce 100644 --- a/src/mesa/program/arbprogparse.c +++ b/src/mesa/program/arbprogparse.c @@ -52,7 +52,7 @@ having three separate program parameter arrays. #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/mtypes.h" #include "arbprogparse.h" diff --git a/src/mesa/program/prog_cache.c b/src/mesa/program/prog_cache.c index ed93af7f13a..33f74cd7ab2 100644 --- a/src/mesa/program/prog_cache.c +++ b/src/mesa/program/prog_cache.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/program/prog_instruction.c b/src/mesa/program/prog_instruction.c index 91830d87f25..a999fd516a1 100644 --- a/src/mesa/program/prog_instruction.c +++ b/src/mesa/program/prog_instruction.c @@ -25,7 +25,7 @@ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "prog_instruction.h" #include "prog_parameter.h" diff --git a/src/mesa/program/prog_noise.c b/src/mesa/program/prog_noise.c index e2e209e5bd3..75a22d8b991 100644 --- a/src/mesa/program/prog_noise.c +++ b/src/mesa/program/prog_noise.c @@ -49,7 +49,7 @@ */ -#include "main/imports.h" +#include "util/imports.h" #include "prog_noise.h" #define FASTFLOOR(x) ( ((x)>0) ? ((int)x) : (((int)x)-1) ) diff --git a/src/mesa/program/prog_parameter.c b/src/mesa/program/prog_parameter.c index 2f3520bf750..80733e2b2f3 100644 --- a/src/mesa/program/prog_parameter.c +++ b/src/mesa/program/prog_parameter.c @@ -30,7 +30,7 @@ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "prog_instruction.h" #include "prog_parameter.h" diff --git a/src/mesa/program/prog_parameter_layout.c b/src/mesa/program/prog_parameter_layout.c index d28a6675c06..a254dc072af 100644 --- a/src/mesa/program/prog_parameter_layout.c +++ b/src/mesa/program/prog_parameter_layout.c @@ -28,7 +28,7 @@ * \author Ian Romanick */ -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "prog_parameter.h" #include "prog_parameter_layout.h" diff --git a/src/mesa/program/prog_print.c b/src/mesa/program/prog_print.c index e8d087c506b..049bef2c634 100644 --- a/src/mesa/program/prog_print.c +++ b/src/mesa/program/prog_print.c @@ -33,7 +33,7 @@ #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" diff --git a/src/mesa/program/prog_statevars.c b/src/mesa/program/prog_statevars.c index 54afc1bf678..06da12074cb 100644 --- a/src/mesa/program/prog_statevars.c +++ b/src/mesa/program/prog_statevars.c @@ -33,7 +33,7 @@ #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" diff --git a/src/mesa/program/prog_to_nir.c b/src/mesa/program/prog_to_nir.c index 95bcde2937e..c0c9ba66544 100644 --- a/src/mesa/program/prog_to_nir.c +++ b/src/mesa/program/prog_to_nir.c @@ -26,7 +26,7 @@ #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" diff --git a/src/mesa/program/program_lexer.l b/src/mesa/program/program_lexer.l index c4973fd2791..2c2a66812c7 100644 --- a/src/mesa/program/program_lexer.l +++ b/src/mesa/program/program_lexer.l @@ -27,7 +27,7 @@ #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" diff --git a/src/mesa/program/program_parse.y b/src/mesa/program/program_parse.y index f468e3b9b59..4e8e2eaf11e 100644 --- a/src/mesa/program/program_parse.y +++ b/src/mesa/program/program_parse.y @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/program/symbol_table.c b/src/mesa/program/symbol_table.c index ae7a1175e40..dcb32895828 100644 --- a/src/mesa/program/symbol_table.c +++ b/src/mesa/program/symbol_table.c @@ -21,7 +21,7 @@ * 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" diff --git a/src/mesa/state_tracker/st_atom_atomicbuf.c b/src/mesa/state_tracker/st_atom_atomicbuf.c index 1855c771d0c..1dd868b5095 100644 --- a/src/mesa/state_tracker/st_atom_atomicbuf.c +++ b/src/mesa/state_tracker/st_atom_atomicbuf.c @@ -24,7 +24,7 @@ * **************************************************************************/ -#include "main/imports.h" +#include "util/imports.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "compiler/glsl/ir_uniform.h" diff --git a/src/mesa/state_tracker/st_atom_constbuf.c b/src/mesa/state_tracker/st_atom_constbuf.c index ffe4b414477..530e2f2ce2e 100644 --- a/src/mesa/state_tracker/st_atom_constbuf.c +++ b/src/mesa/state_tracker/st_atom_constbuf.c @@ -31,7 +31,7 @@ * Brian Paul */ -#include "main/imports.h" +#include "util/imports.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "main/shaderapi.h" diff --git a/src/mesa/state_tracker/st_atom_image.c b/src/mesa/state_tracker/st_atom_image.c index db3539259ce..598109d24f4 100644 --- a/src/mesa/state_tracker/st_atom_image.c +++ b/src/mesa/state_tracker/st_atom_image.c @@ -24,7 +24,7 @@ * **************************************************************************/ -#include "main/imports.h" +#include "util/imports.h" #include "main/shaderimage.h" #include "program/prog_parameter.h" #include "program/prog_print.h" diff --git a/src/mesa/state_tracker/st_atom_shader.c b/src/mesa/state_tracker/st_atom_shader.c index e47124b122f..fde2eb55f62 100644 --- a/src/mesa/state_tracker/st_atom_shader.c +++ b/src/mesa/state_tracker/st_atom_shader.c @@ -35,7 +35,7 @@ * Brian Paul */ -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/framebuffer.h" #include "main/state.h" diff --git a/src/mesa/state_tracker/st_atom_storagebuf.c b/src/mesa/state_tracker/st_atom_storagebuf.c index 0355c988529..b12c9164464 100644 --- a/src/mesa/state_tracker/st_atom_storagebuf.c +++ b/src/mesa/state_tracker/st_atom_storagebuf.c @@ -24,7 +24,7 @@ * **************************************************************************/ -#include "main/imports.h" +#include "util/imports.h" #include "program/prog_parameter.h" #include "program/prog_print.h" #include "compiler/glsl/ir_uniform.h" diff --git a/src/mesa/state_tracker/st_cb_bitmap.c b/src/mesa/state_tracker/st_cb_bitmap.c index 788e004d651..44ad5334175 100644 --- a/src/mesa/state_tracker/st_cb_bitmap.c +++ b/src/mesa/state_tracker/st_cb_bitmap.c @@ -31,7 +31,7 @@ */ #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/image.h" #include "main/bufferobj.h" #include "main/dlist.h" diff --git a/src/mesa/state_tracker/st_cb_blit.c b/src/mesa/state_tracker/st_cb_blit.c index 91bf029faf2..73068b795f6 100644 --- a/src/mesa/state_tracker/st_cb_blit.c +++ b/src/mesa/state_tracker/st_cb_blit.c @@ -30,7 +30,7 @@ * Brian Paul */ -#include "main/imports.h" +#include "util/imports.h" #include "main/image.h" #include "main/macros.h" diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c index 7776bf6ef91..ea0861d340c 100644 --- a/src/mesa/state_tracker/st_cb_bufferobjects.c +++ b/src/mesa/state_tracker/st_cb_bufferobjects.c @@ -34,7 +34,7 @@ #include /* 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" diff --git a/src/mesa/state_tracker/st_cb_condrender.c b/src/mesa/state_tracker/st_cb_condrender.c index f02472aec8b..b2897bacb28 100644 --- a/src/mesa/state_tracker/st_cb_condrender.c +++ b/src/mesa/state_tracker/st_cb_condrender.c @@ -33,7 +33,7 @@ */ -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "pipe/p_context.h" diff --git a/src/mesa/state_tracker/st_cb_drawpixels.c b/src/mesa/state_tracker/st_cb_drawpixels.c index 6e1b2f11f73..ea9551be3a0 100644 --- a/src/mesa/state_tracker/st_cb_drawpixels.c +++ b/src/mesa/state_tracker/st_cb_drawpixels.c @@ -31,7 +31,7 @@ */ #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/image.h" #include "main/bufferobj.h" #include "main/blit.h" diff --git a/src/mesa/state_tracker/st_cb_drawtex.c b/src/mesa/state_tracker/st_cb_drawtex.c index 5982904d3ba..4be1195279b 100644 --- a/src/mesa/state_tracker/st_cb_drawtex.c +++ b/src/mesa/state_tracker/st_cb_drawtex.c @@ -12,7 +12,7 @@ -#include "main/imports.h" +#include "util/imports.h" #include "main/image.h" #include "main/macros.h" #include "main/teximage.h" diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c index bff917c84f6..81a099795bc 100644 --- a/src/mesa/state_tracker/st_cb_fbo.c +++ b/src/mesa/state_tracker/st_cb_fbo.c @@ -33,7 +33,7 @@ */ -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/fbobject.h" #include "main/framebuffer.h" diff --git a/src/mesa/state_tracker/st_cb_feedback.c b/src/mesa/state_tracker/st_cb_feedback.c index 1a02d8c5524..f8a7629be0c 100644 --- a/src/mesa/state_tracker/st_cb_feedback.c +++ b/src/mesa/state_tracker/st_cb_feedback.c @@ -37,7 +37,7 @@ * Brian Paul */ -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/feedback.h" #include "main/varray.h" diff --git a/src/mesa/state_tracker/st_cb_memoryobjects.c b/src/mesa/state_tracker/st_cb_memoryobjects.c index 7e5cd2a04cb..6a2f524836d 100644 --- a/src/mesa/state_tracker/st_cb_memoryobjects.c +++ b/src/mesa/state_tracker/st_cb_memoryobjects.c @@ -22,7 +22,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/externalobjects.h" diff --git a/src/mesa/state_tracker/st_cb_msaa.c b/src/mesa/state_tracker/st_cb_msaa.c index 6c5dc1fd43e..720a24e7254 100644 --- a/src/mesa/state_tracker/st_cb_msaa.c +++ b/src/mesa/state_tracker/st_cb_msaa.c @@ -26,7 +26,7 @@ **************************************************************************/ #include "main/bufferobj.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/framebuffer.h" #include "state_tracker/st_cb_msaa.h" diff --git a/src/mesa/state_tracker/st_cb_queryobj.c b/src/mesa/state_tracker/st_cb_queryobj.c index bce56e200c3..cee49f4eb14 100644 --- a/src/mesa/state_tracker/st_cb_queryobj.c +++ b/src/mesa/state_tracker/st_cb_queryobj.c @@ -33,8 +33,8 @@ */ -#include "main/imports.h" -#include "main/compiler.h" +#include "util/imports.h" +#include "util/compiler.h" #include "main/context.h" #include "main/queryobj.h" diff --git a/src/mesa/state_tracker/st_cb_rasterpos.c b/src/mesa/state_tracker/st_cb_rasterpos.c index f45e616abfa..823fb200587 100644 --- a/src/mesa/state_tracker/st_cb_rasterpos.c +++ b/src/mesa/state_tracker/st_cb_rasterpos.c @@ -36,7 +36,7 @@ */ -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/arrayobj.h" #include "main/feedback.h" diff --git a/src/mesa/state_tracker/st_cb_readpixels.c b/src/mesa/state_tracker/st_cb_readpixels.c index 33a29aa1282..9b3b9c4d6b6 100644 --- a/src/mesa/state_tracker/st_cb_readpixels.c +++ b/src/mesa/state_tracker/st_cb_readpixels.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_semaphoreobjects.c b/src/mesa/state_tracker/st_cb_semaphoreobjects.c index 4b1f21e6b17..d32de094fc1 100644 --- a/src/mesa/state_tracker/st_cb_semaphoreobjects.c +++ b/src/mesa/state_tracker/st_cb_semaphoreobjects.c @@ -21,7 +21,7 @@ * DEALINGS IN THE SOFTWARE. */ -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "main/context.h" diff --git a/src/mesa/state_tracker/st_cb_semaphoreobjects.h b/src/mesa/state_tracker/st_cb_semaphoreobjects.h index 6e87b82c803..dba0b7021ea 100644 --- a/src/mesa/state_tracker/st_cb_semaphoreobjects.h +++ b/src/mesa/state_tracker/st_cb_semaphoreobjects.h @@ -24,7 +24,7 @@ #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; diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c index d5dd61935bc..e585e40caa7 100644 --- a/src/mesa/state_tracker/st_cb_texture.c +++ b/src/mesa/state_tracker/st_cb_texture.c @@ -34,7 +34,7 @@ #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" diff --git a/src/mesa/state_tracker/st_cb_texturebarrier.c b/src/mesa/state_tracker/st_cb_texturebarrier.c index 4a9c72f2c62..45db0a3a576 100644 --- a/src/mesa/state_tracker/st_cb_texturebarrier.c +++ b/src/mesa/state_tracker/st_cb_texturebarrier.c @@ -33,7 +33,7 @@ */ -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "pipe/p_context.h" diff --git a/src/mesa/state_tracker/st_context.c b/src/mesa/state_tracker/st_context.c index 8bb94bac053..846a76c1733 100644 --- a/src/mesa/state_tracker/st_context.c +++ b/src/mesa/state_tracker/st_context.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "main/imports.h" +#include "util/imports.h" #include "main/accum.h" #include "main/api_exec.h" #include "main/context.h" diff --git a/src/mesa/state_tracker/st_draw.c b/src/mesa/state_tracker/st_draw.c index 86767151026..e3bea305a51 100644 --- a/src/mesa/state_tracker/st_draw.c +++ b/src/mesa/state_tracker/st_draw.c @@ -37,7 +37,7 @@ #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/image.h" #include "main/bufferobj.h" #include "main/macros.h" diff --git a/src/mesa/state_tracker/st_draw_feedback.c b/src/mesa/state_tracker/st_draw_feedback.c index 47e43f856d5..8d82884ba8d 100644 --- a/src/mesa/state_tracker/st_draw_feedback.c +++ b/src/mesa/state_tracker/st_draw_feedback.c @@ -25,7 +25,7 @@ * **************************************************************************/ -#include "main/imports.h" +#include "util/imports.h" #include "main/arrayobj.h" #include "main/image.h" #include "main/macros.h" diff --git a/src/mesa/state_tracker/st_extensions.c b/src/mesa/state_tracker/st_extensions.c index b52606398b3..7d77ed4151d 100644 --- a/src/mesa/state_tracker/st_extensions.c +++ b/src/mesa/state_tracker/st_extensions.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/state_tracker/st_format.c b/src/mesa/state_tracker/st_format.c index fb071beb64b..310c5b62ab7 100644 --- a/src/mesa/state_tracker/st_format.c +++ b/src/mesa/state_tracker/st_format.c @@ -32,7 +32,7 @@ * \author Brian Paul */ -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/enums.h" #include "main/formats.h" diff --git a/src/mesa/state_tracker/st_gen_mipmap.c b/src/mesa/state_tracker/st_gen_mipmap.c index d267b7a3055..1983bbc76c2 100644 --- a/src/mesa/state_tracker/st_gen_mipmap.c +++ b/src/mesa/state_tracker/st_gen_mipmap.c @@ -27,7 +27,7 @@ #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mipmap.h" #include "main/teximage.h" diff --git a/src/mesa/state_tracker/st_program.c b/src/mesa/state_tracker/st_program.c index a060880092e..466c3f1a29e 100644 --- a/src/mesa/state_tracker/st_program.c +++ b/src/mesa/state_tracker/st_program.c @@ -32,7 +32,7 @@ #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" diff --git a/src/mesa/swrast/s_aaline.c b/src/mesa/swrast/s_aaline.c index cdd860a41bc..6ee61f738e9 100644 --- a/src/mesa/swrast/s_aaline.c +++ b/src/mesa/swrast/s_aaline.c @@ -25,7 +25,7 @@ #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" diff --git a/src/mesa/swrast/s_aatriangle.c b/src/mesa/swrast/s_aatriangle.c index b5109870437..952bfb1a177 100644 --- a/src/mesa/swrast/s_aatriangle.c +++ b/src/mesa/swrast/s_aatriangle.c @@ -31,7 +31,7 @@ #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" diff --git a/src/mesa/swrast/s_clear.c b/src/mesa/swrast/s_clear.c index 4542761e248..158e5dace16 100644 --- a/src/mesa/swrast/s_clear.c +++ b/src/mesa/swrast/s_clear.c @@ -27,7 +27,7 @@ #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" diff --git a/src/mesa/swrast/s_context.c b/src/mesa/swrast/s_context.c index 5506ed51905..0f58376382f 100644 --- a/src/mesa/swrast/s_context.c +++ b/src/mesa/swrast/s_context.c @@ -26,7 +26,7 @@ */ #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/bufferobj.h" #include "main/mtypes.h" #include "main/samplerobj.h" diff --git a/src/mesa/swrast/s_copypix.c b/src/mesa/swrast/s_copypix.c index d0703fa07a6..acfa472066f 100644 --- a/src/mesa/swrast/s_copypix.c +++ b/src/mesa/swrast/s_copypix.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/swrast/s_depth.c b/src/mesa/swrast/s_depth.c index 6bc737c7956..fcf534428a1 100644 --- a/src/mesa/swrast/s_depth.c +++ b/src/mesa/swrast/s_depth.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/swrast/s_drawpix.c b/src/mesa/swrast/s_drawpix.c index 7ee401b2d4c..253d70cbbf2 100644 --- a/src/mesa/swrast/s_drawpix.c +++ b/src/mesa/swrast/s_drawpix.c @@ -32,7 +32,7 @@ #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" diff --git a/src/mesa/swrast/s_logic.c b/src/mesa/swrast/s_logic.c index c7cac2e4016..6571acbba69 100644 --- a/src/mesa/swrast/s_logic.c +++ b/src/mesa/swrast/s_logic.c @@ -25,7 +25,7 @@ #include "main/glheader.h" #include "main/context.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "s_context.h" diff --git a/src/mesa/swrast/s_renderbuffer.c b/src/mesa/swrast/s_renderbuffer.c index 6a0376cfef1..cf04eb093cb 100644 --- a/src/mesa/swrast/s_renderbuffer.c +++ b/src/mesa/swrast/s_renderbuffer.c @@ -31,7 +31,7 @@ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/fbobject.h" #include "main/formats.h" diff --git a/src/mesa/swrast/s_span.c b/src/mesa/swrast/s_span.c index 16b5c61480c..c5bb058a3b8 100644 --- a/src/mesa/swrast/s_span.c +++ b/src/mesa/swrast/s_span.c @@ -37,7 +37,7 @@ #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" diff --git a/src/mesa/swrast/s_stencil.c b/src/mesa/swrast/s_stencil.c index ce3d77c79a9..2c59d2e7b3c 100644 --- a/src/mesa/swrast/s_stencil.c +++ b/src/mesa/swrast/s_stencil.c @@ -25,7 +25,7 @@ #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" diff --git a/src/mesa/swrast/s_texcombine.c b/src/mesa/swrast/s_texcombine.c index 743ee4015bb..36574f93610 100644 --- a/src/mesa/swrast/s_texcombine.c +++ b/src/mesa/swrast/s_texcombine.c @@ -26,7 +26,7 @@ #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" diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c index 314170fc751..f73037791de 100644 --- a/src/mesa/swrast/s_texfilter.c +++ b/src/mesa/swrast/s_texfilter.c @@ -26,7 +26,7 @@ #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" diff --git a/src/mesa/swrast/s_triangle.c b/src/mesa/swrast/s_triangle.c index e724367ecf0..65b10a89dfa 100644 --- a/src/mesa/swrast/s_triangle.c +++ b/src/mesa/swrast/s_triangle.c @@ -31,7 +31,7 @@ #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" diff --git a/src/mesa/swrast/s_zoom.c b/src/mesa/swrast/s_zoom.c index 2472aa730f9..973e8cfedce 100644 --- a/src/mesa/swrast/s_zoom.c +++ b/src/mesa/swrast/s_zoom.c @@ -25,7 +25,7 @@ #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" diff --git a/src/mesa/swrast_setup/ss_context.c b/src/mesa/swrast_setup/ss_context.c index ec20d6c35a1..0cddb0f1467 100644 --- a/src/mesa/swrast_setup/ss_context.c +++ b/src/mesa/swrast_setup/ss_context.c @@ -26,7 +26,7 @@ */ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/state.h" #include "tnl/tnl.h" diff --git a/src/mesa/tnl/t_context.c b/src/mesa/tnl/t_context.c index 3383b235250..ed068f708d0 100644 --- a/src/mesa/tnl/t_context.c +++ b/src/mesa/tnl/t_context.c @@ -27,7 +27,7 @@ #include "main/glheader.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/context.h" #include "main/macros.h" #include "main/mtypes.h" diff --git a/src/mesa/tnl/t_context.h b/src/mesa/tnl/t_context.h index eca9f66037a..21a5156708d 100644 --- a/src/mesa/tnl/t_context.h +++ b/src/mesa/tnl/t_context.h @@ -50,7 +50,7 @@ #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" diff --git a/src/mesa/tnl/t_draw.c b/src/mesa/tnl/t_draw.c index ee77e802678..33d39a7bd20 100644 --- a/src/mesa/tnl/t_draw.c +++ b/src/mesa/tnl/t_draw.c @@ -32,7 +32,7 @@ #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" diff --git a/src/mesa/tnl/t_pipeline.c b/src/mesa/tnl/t_pipeline.c index 0adbef01264..b0b46aa2678 100644 --- a/src/mesa/tnl/t_pipeline.c +++ b/src/mesa/tnl/t_pipeline.c @@ -27,7 +27,7 @@ #include "main/glheader.h" #include "main/context.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/mtypes.h" #include "t_context.h" diff --git a/src/mesa/tnl/t_rebase.c b/src/mesa/tnl/t_rebase.c index 54d39df733b..07e603b0107 100644 --- a/src/mesa/tnl/t_rebase.c +++ b/src/mesa/tnl/t_rebase.c @@ -50,7 +50,7 @@ #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" diff --git a/src/mesa/tnl/t_split_copy.c b/src/mesa/tnl/t_split_copy.c index 9d5c324ebef..57ff5bf0e03 100644 --- a/src/mesa/tnl/t_split_copy.c +++ b/src/mesa/tnl/t_split_copy.c @@ -33,7 +33,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_fog.c b/src/mesa/tnl/t_vb_fog.c index c224a4192a4..f6ccd49d6bb 100644 --- a/src/mesa/tnl/t_vb_fog.c +++ b/src/mesa/tnl/t_vb_fog.c @@ -30,7 +30,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_light.c b/src/mesa/tnl/t_vb_light.c index 8d13712e218..cd0a5544c93 100644 --- a/src/mesa/tnl/t_vb_light.c +++ b/src/mesa/tnl/t_vb_light.c @@ -27,7 +27,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_normals.c b/src/mesa/tnl/t_vb_normals.c index 6fc89c23b33..a4fd8e94065 100644 --- a/src/mesa/tnl/t_vb_normals.c +++ b/src/mesa/tnl/t_vb_normals.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_points.c b/src/mesa/tnl/t_vb_points.c index 0f8578daa18..17da53949d8 100644 --- a/src/mesa/tnl/t_vb_points.c +++ b/src/mesa/tnl/t_vb_points.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_program.c b/src/mesa/tnl/t_vb_program.c index 8d8aca614e3..099d37eed72 100644 --- a/src/mesa/tnl/t_vb_program.c +++ b/src/mesa/tnl/t_vb_program.c @@ -33,7 +33,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_render.c b/src/mesa/tnl/t_vb_render.c index 9ff1f18f53b..d58f050e94d 100644 --- a/src/mesa/tnl/t_vb_render.c +++ b/src/mesa/tnl/t_vb_render.c @@ -43,7 +43,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_texgen.c b/src/mesa/tnl/t_vb_texgen.c index bd585324e2b..de0a9995e73 100644 --- a/src/mesa/tnl/t_vb_texgen.c +++ b/src/mesa/tnl/t_vb_texgen.c @@ -37,7 +37,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_texmat.c b/src/mesa/tnl/t_vb_texmat.c index ef034d643bf..49875ead3e8 100644 --- a/src/mesa/tnl/t_vb_texmat.c +++ b/src/mesa/tnl/t_vb_texmat.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/tnl/t_vb_vertex.c b/src/mesa/tnl/t_vb_vertex.c index 4fb3659a358..1a55f7e6957 100644 --- a/src/mesa/tnl/t_vb_vertex.c +++ b/src/mesa/tnl/t_vb_vertex.c @@ -28,7 +28,7 @@ #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" diff --git a/src/mesa/vbo/vbo_exec.h b/src/mesa/vbo/vbo_exec.h index 336765c9117..24f0aa3384a 100644 --- a/src/mesa/vbo/vbo_exec.h +++ b/src/mesa/vbo/vbo_exec.h @@ -35,7 +35,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #define VBO_EXEC_H #include "main/dd.h" -#include "main/imports.h" +#include "util/imports.h" #include "vbo.h" #include "vbo_attrib.h" diff --git a/src/mesa/vbo/vbo_primitive_restart.c b/src/mesa/vbo/vbo_primitive_restart.c index d43d22856ab..830f658d29c 100644 --- a/src/mesa/vbo/vbo_primitive_restart.c +++ b/src/mesa/vbo/vbo_primitive_restart.c @@ -29,7 +29,7 @@ */ #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "main/varray.h" diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c index e193a5a32af..115e9626ade 100644 --- a/src/mesa/vbo/vbo_save_draw.c +++ b/src/mesa/vbo/vbo_save_draw.c @@ -31,7 +31,7 @@ #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" diff --git a/src/mesa/vbo/vbo_save_loopback.c b/src/mesa/vbo/vbo_save_loopback.c index 26a9f94facb..83885922495 100644 --- a/src/mesa/vbo/vbo_save_loopback.c +++ b/src/mesa/vbo/vbo_save_loopback.c @@ -29,7 +29,7 @@ #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" diff --git a/src/mesa/x86/common_x86.c b/src/mesa/x86/common_x86.c index 36b2e82fb63..bdc1417f5ee 100644 --- a/src/mesa/x86/common_x86.c +++ b/src/mesa/x86/common_x86.c @@ -55,7 +55,7 @@ #endif #include "main/errors.h" -#include "main/imports.h" +#include "util/imports.h" #include "common_x86_asm.h" diff --git a/src/mesa/x86/mmx.h b/src/mesa/x86/mmx.h index 0c354907fa8..0befe1de471 100644 --- a/src/mesa/x86/mmx.h +++ b/src/mesa/x86/mmx.h @@ -26,7 +26,7 @@ #ifndef ASM_MMX_H #define ASM_MMX_H -#include "main/compiler.h" +#include "util/compiler.h" #include "main/glheader.h" struct gl_context; diff --git a/src/mesa/x86/rtasm/x86sse.c b/src/mesa/x86/rtasm/x86sse.c index ddb2ec37380..14107bae6c6 100644 --- a/src/mesa/x86/rtasm/x86sse.c +++ b/src/mesa/x86/rtasm/x86sse.c @@ -3,7 +3,7 @@ #include -#include "main/imports.h" +#include "util/imports.h" #include "main/execmem.h" #include "x86sse.h" diff --git a/src/meson.build b/src/meson.build index 53b999ad22a..accb7a9806d 100644 --- a/src/meson.build +++ b/src/meson.build @@ -31,7 +31,7 @@ inc_amd_common_llvm = include_directories('amd/llvm') 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', ), diff --git a/src/panfrost/bifrost/bifrost_compile.c b/src/panfrost/bifrost/bifrost_compile.c index 42ce6a45621..23e451f0761 100644 --- a/src/panfrost/bifrost/bifrost_compile.c +++ b/src/panfrost/bifrost/bifrost_compile.c @@ -27,7 +27,7 @@ #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" diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 5d3bcba15ea..954f073af7c 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -33,7 +33,7 @@ #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" diff --git a/src/util/Makefile.sources b/src/util/Makefile.sources index 575bb5fb6e7..644839bd09a 100644 --- a/src/util/Makefile.sources +++ b/src/util/Makefile.sources @@ -9,6 +9,7 @@ MESA_UTIL_FILES := \ blob.h \ build_id.c \ build_id.h \ + compiler.h \ crc32.c \ crc32.h \ dag.c \ @@ -50,6 +51,8 @@ MESA_UTIL_FILES := \ half_float.h \ hash_table.c \ hash_table.h \ + imports.c \ + imports.h \ list.h \ macros.h \ mesa-sha1.c \ diff --git a/src/util/compiler.h b/src/util/compiler.h new file mode 100644 index 00000000000..43a06b43139 --- /dev/null +++ b/src/util/compiler.h @@ -0,0 +1,76 @@ +/* + * 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 + +#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 +#define CPU_TO_LE32( x ) bswap_32( x ) +#elif defined(__APPLE__) +#include +#define CPU_TO_LE32( x ) CFSwapInt32HostToLittle( x ) +#elif defined(__OpenBSD__) +#include +#define CPU_TO_LE32( x ) htole32( x ) +#else /*__linux__ */ +#include +#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 */ diff --git a/src/util/disk_cache.c b/src/util/disk_cache.c index 74fc51b6305..04320568537 100644 --- a/src/util/disk_cache.c +++ b/src/util/disk_cache.c @@ -51,7 +51,7 @@ #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" diff --git a/src/util/imports.c b/src/util/imports.c new file mode 100644 index 00000000000..f264e725cc4 --- /dev/null +++ b/src/util/imports.c @@ -0,0 +1,232 @@ +/** + * \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 +#include +#include "c99_math.h" +#include "imports.h" + +#ifdef _GNU_SOURCE +#include +#ifdef __APPLE__ +#include +#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; +} + + diff --git a/src/util/imports.h b/src/util/imports.h new file mode 100644 index 00000000000..1e547c3a787 --- /dev/null +++ b/src/util/imports.h @@ -0,0 +1,320 @@ +/* + * 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 +#include +#include +#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 */ diff --git a/src/util/meson.build b/src/util/meson.build index e30029063c0..d6647c0c5c3 100644 --- a/src/util/meson.build +++ b/src/util/meson.build @@ -34,6 +34,7 @@ files_mesa_util = files( 'blob.h', 'build_id.c', 'build_id.h', + 'compiler.h', 'crc32.c', 'crc32.h', 'dag.c', @@ -54,6 +55,8 @@ files_mesa_util = files( 'half_float.h', 'hash_table.c', 'hash_table.h', + 'imports.c', + 'imports.h', 'list.h', 'macros.h', 'mesa-sha1.c', diff --git a/src/util/register_allocate.c b/src/util/register_allocate.c index 4e97d82f23e..9c654080a09 100644 --- a/src/util/register_allocate.c +++ b/src/util/register_allocate.c @@ -73,7 +73,7 @@ #include #include "ralloc.h" -#include "main/imports.h" +#include "util/imports.h" #include "main/macros.h" #include "util/bitset.h" #include "register_allocate.h"