summaryrefslogtreecommitdiff
path: root/src/mesa/main/imports.h
AgeCommit message (Collapse)AuthorFilesLines
2020-03-27Move compiler.h and imports.h/c from src/mesa/main into src/utilMarek Olšák1-321/+0
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
2019-11-05mesa/imports: let the build system detect strtok_r()Eric Engestrom1-1/+1
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2013 Signed-off-by: Eric Engestrom <eric.engestrom@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com> Tested-by: Prodea Alexandru-Liviu <liviuprodea@yahoo.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
2019-11-05mesa/main: delete now unused _mesa_little_endianDylan Baker1-12/+0
Reviewed-by: Eric Engestrom <eric@engestrom.ch>
2019-08-15win32: unify strcasecmp definitionsErik Faye-Lund1-3/+0
There was two incompatible definitions of strcasecmp, which lead to a compiler warning. Let's clean this up by only leaving one of them, and using that one all the time. Signed-off-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Reviewed-by: Eric Anholt <eric@anholt.net>
2018-09-07Replace uses of _mesa_bitcount with util_bitcountDylan Baker1-15/+0
and _mesa_bitcount_64 with util_bitcount_64. This fixes a build problem in nir for platforms that don't have popcount or popcountll, such as 32bit msvc. v2: - Fix additional uses of _mesa_bitcount added after this was originally written Acked-by: Eric Engestrom <eric.engestrom@intel.com> (v1) Acked-by: Eric Anholt <eric@anholt.net> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2018-04-13mesa: remove snprintf macro in imports.h to fix MSVC buildBrian Paul1-4/+0
snprintf is a macro in the MSVC stdio.h header and we needed to include that header before imports.h where we also defined an snprintf macro. Otherwise, the MSVC build would fail. The recent mtypes.h removal patches seems to have exposed this issue. This patch simply removes our snprintf macro and replaces one use of it in teximage.c with _mesa_snprintf(). There are other calls to snprintf() in DRI drivers, but none of them are built on Windows. Reviewed-by: Charmaine Lee <charmainel@vmware.com> Reviewed-by: Neha Bhende <bhenden@vmware.com>
2018-04-12mesa: include mtypes.h lessMarek Olšák1-1/+0
- remove mtypes.h from most header files - add main/menums.h for often used definitions - remove main/core.h v2: fix radv build Reviewed-by: Brian Paul <brianp@vmware.com>
2017-10-10mesa: move _mesa_half_is_negative() to half_float.hBrian Paul1-6/+0
v2: use !! in the function to be explicit about type conversion. Though, gcc generates the same code with or without the logical !!. Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
2017-10-10mesa: move _mesa_exec_malloc/free() prototypes to their own headerBrian Paul1-7/+0
Try to start removing things from the cluttered imports.h file. v2: add new header to Makefile.sources Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2016-11-22mesa: use util_hash_crc32 instead of _mesa_str_checksumMarek Olšák1-3/+0
Reviewed-by: Timothy Arceri <timothy.arceri@collabora.com>
2016-08-09util: Move _mesa_fsl/util_last_bit into util/bitscan.hMathias Fröhlich1-45/+0
As requested with the initial creation of util/bitscan.h now move other bitscan related functions into util. v2: Split into two patches. Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de> Tested-by: Brian Paul <brianp@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2016-06-23Remove wrongly repeated words in commentsGiuseppe Bilotta1-1/+1
Clean up misrepetitions ('if if', 'the the' etc) found throughout the comments. This has been done manually, after grepping case-insensitively for duplicate if, is, the, then, do, for, an, plus a few other typos corrected in fly-by v2: * proper commit message and non-joke title; * replace two 'as is' followed by 'is' to 'as-is'. v3: * 'a integer' => 'an integer' and similar (originally spotted by Jason Ekstrand, I fixed a few other similar ones while at it) Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Reviewed-by: Chad Versace <chad.versace@intel.com>
2016-06-14mesa/gallium: Move u_bit_scan{,64} from gallium to util.Mathias Fröhlich1-16/+1
The functions are also useful for mesa. Introduce src/util/bitscan.{h,c}. Move ffs function implementations from src/mesa/main/imports.{h,c}. Move bit scan related functions from src/gallium/auxiliary/util/u_math.h. Merge platform handling with what is available from within mesa. v2: Try to fix MSVC compile. Reviewed-by: Brian Paul <brianp@vmware.com> Tested-by: Brian Paul <brianp@vmware.com> Signed-off-by: Mathias Fröhlich <Mathias.Froehlich@web.de>
2016-02-12mesa: Remove support for MSVC2008.Jose Fonseca1-3/+0
Spotted by Emil Velikov. Trivial.
2016-01-11mesa/uniform_query: add IROUNDD and use for doubles->ints (v2)Dave Airlie1-0/+7
For the case where we convert a double to an int, we should round the same as we do for floats. This fixes GL41-CTS.gpu_shader_fp64.state_query v2: add IROUNDD (Ilia) Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu> Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-10-16glsl: move half<->float convertion to utilRob Clark1-7/+0
Needed in NIR too, so move out of mesa/main/imports.c Reviewed-by: Jason Ekstrand <jason@jlekstrand.net> Reviewed-by: Emil Velikov <emil.velikov@collabora.com> Signed-off-by: Rob Clark <robclark@freedesktop.org>
2015-10-01mesa: use strtok_s for strtok_r on windowsTapani Pälli1-0/+3
https://msdn.microsoft.com/en-us/library/ftsafwz3.aspx v2: use _WIN32 instead of _MSC_VER (Brian Paul) Signed-off-by: Tapani Pälli <tapani.palli@intel.com> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92183 Reviewed-by: Brian Paul <brianp@vmware.com>
2015-08-03mesa: Replace F_TO_I() with _mesa_lroundevenf().Matt Turner1-28/+0
I'm not sure what the true meaning of "The rounding mode may vary." is, but it is the case that the IROUND() path rounds differently than the other paths (and does it wrong, at that). Like _mesa_roundeven{f,}(), just add an use _mesa_lroundeven{f,}() that has known semantics. Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2015-06-23mesa: Delete unused ICEIL().Matt Turner1-32/+0
Can't find any uses of it in git history. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
2015-04-01mesa: Implement _mesa_flsll().Kenneth Graunke1-0/+24
This is _mesa_fls() for 64-bit values. Signed-off-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-03-18mesa: Replace _mesa_round_to_even() with _mesa_roundeven().Matt Turner1-3/+0
Eric's initial patch adding constant expression evaluation for ir_unop_round_even used nearbyint. The open-coded _mesa_round_to_even implementation came about without much explanation after a reviewer asked whether nearbyint depended on the application not modifying the rounding mode. Of course (as Eric commented) we rely on the application not changing the rounding mode from its default (round-to-nearest) in many other places, including the IROUND function used by _mesa_round_to_even! Worse, IROUND() is implemented using the trunc(x + 0.5) trick which fails for x = nextafterf(0.5, 0.0). Still worse, _mesa_round_to_even unexpectedly returns an int. I suspect that could cause problems when rounding large integral values not representable as an int in ir_constant_expression.cpp's ir_unop_round_even evaluation. Its use of _mesa_round_to_even is clearly broken for doubles (as noted during review). The constant expression evaluation code for the packing built-in functions also mistakenly assumed that _mesa_round_to_even returned a float, as can be seen by the cast through a signed integer type to an unsigned (since negative float -> unsigned conversions are undefined). rint() and nearbyint() implement the round-half-to-even behavior we want when the rounding mode is set to the default round-to-nearest. The only difference between them is that nearbyint() raises the inexact exception. This patch implements _mesa_roundeven{f,}, a function similar to the roundeven function added by a yet unimplemented technical specification (ISO/IEC TS 18661-1:2014), with a small difference in behavior -- we don't bother raising the inexact exception, which I don't think we care about anyway. At least recent Intel CPUs can quickly change a subset of the bits in the x87 floating-point control register, but the exception mask bits are not included. rint() does not need to change these bits, but nearbyint() does (twice: save old, set new, and restore old) in order to raise the inexact exception, which would incur some penalty. Reviewed-by: Carl Worth <cworth@cworth.org>
2015-03-11mesa: use strdup() instead of _mesa_strdup()Brian Paul1-3/+0
We were already using strdup() in various places in Mesa. Get rid of the _mesa_strdup() wrapper. All the callers pass a non-NULL argument so the NULL check isn't needed either. Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-02-28mesa: move finite macro to imports.hBrian Paul1-0/+8
Move it to the only place it's used. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2015-02-27mesa: restore #include stdarg.h in imports.hBrian Paul1-0/+1
https://bugs.freedesktop.org/show_bug.cgi?id=89345 Signed-off-by: Brian Paul <brianp@vmware.com>
2015-02-26mesa: trim down #includes in compiler.hBrian Paul1-0/+2
Don't include stuff we don't need. Fix a few #includes elsewhere to keep thing building. Reviewed-by: Matt Turner <mattst88@gmail.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2015-02-24mesa: remove DEG2RAD macroBrian Paul1-8/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove MAX_GLUSHORT, move MAX_GLUINTBrian Paul1-3/+0
The later is only used in one place in swrast. Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: move signbit() macro to c99_math.hBrian Paul1-8/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove unused isblank() functionBrian Paul1-1/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove sqrtf macroBrian Paul1-11/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove INV_SQRTF() macroBrian Paul1-9/+0
Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove ceilf, floorf macrosBrian Paul1-2/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove expf macroBrian Paul1-1/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove logf macroBrian Paul1-1/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove powf macroBrian Paul1-1/+0
Use the wrapper in c99_math.h if needed. Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove unused exp2f, log2f, truncf wrappersBrian Paul1-10/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove unused acosf, asinf, atan2f, etc. macrosBrian Paul1-16/+0
Not used anywhere. If any of these are needed, they should be added to c99_math.h Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: replace FABSF with fabsfBrian Paul1-11/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: replace FLOORF with floorfBrian Paul1-3/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: remove unused CEILF macroBrian Paul1-3/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: replace LOGF, EXPF with logf, expfBrian Paul1-6/+0
Reviewed-by: Matt Turner <mattst88@gmail.com>
2015-02-24mesa: replace FREXPF, LDEXPF with frexpf, ldexpfBrian Paul1-6/+0
Start getting rid of some imports.h macros. Use the c99 functions instead. Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-10-30util: add _mesa_strtod and _mesa_strtofChia-I Wu1-3/+0
Both core mesa and glsl have their own wrappers for strtof_l. Merge and move them to util/. They are compiled with a C++ compiler so that we can make them thread-safe in a following commit. Signed-off-by: Chia-I Wu <olv@lunarg.com> Reviewed-by: Kenneth Graunke <kenneth@whiteacpe.org>
2014-09-25mesa: Replace a priori knowledge of gcc builtins with configure tests.Matt Turner1-16/+19
Presumbly this will let clang and other compilers use the built-ins as well. Notice two changes specifically: - in _mesa_next_pow_two_64(), always use __builtin_clzll and add a static assertion that this is safe. - in macros.h, remove the clang-specific definition since it should be able to detect __builtin_unreachable in configure. Reviewed-by: Jason Ekstrand <jason.ekstrand@intel.com> [C bits] Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-09-24mesa: Drop _mesa_getenv() wrapper.Matt Turner1-3/+0
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-24mesa: Drop _mesa_bsearch() wrapper.Matt Turner1-4/+0
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>
2014-09-24mesa: Use realloc() instead of _mesa_realloc() and remove the latter.Matt Turner1-3/+0
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
2014-08-07mesa: Drop USE_IEEE define.Matt Turner1-24/+3
I think OpenVMS was the only platform that Mesa ran on that used a non-IEEE representation for floats. We removed OpenVMS support a while back, and this should alleviate the need to continue updating the this-platform-uses-IEEE list. The one bit of this patch that needs review is the IS_INF_OR_NAN, because I'm not sure if MSVC supports isfinite. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82268 Reviewed-by: Brian Paul <brianp@vmware.com>
2014-08-05mesa/imports: Add a _mesa_half_is_negative helper functionJason Ekstrand1-0/+5
Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
2014-07-24Add an accelerated version of F_TO_I for x86_64Jason Ekstrand1-1/+5
According to a quick micro-benchmark, this new version is 20% faster on my Haswell laptop. v2: Removed the XXX note about x86_64 from the comment v3: Use an intrinsic instead of an __asm__ block. This should give us MSVC support for free. v4: Enable it for all x86_64 builds, not just with USE_X86_64_ASM Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Matt Turner <mattst88@gmail.com>