summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/imports.h
Commit message (Collapse)AuthorAgeFilesLines
* util: Move _mesa_fsl/util_last_bit into util/bitscan.hMathias Fröhlich2016-08-091-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>
* Remove wrongly repeated words in commentsGiuseppe Bilotta2016-06-231-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>
* mesa/gallium: Move u_bit_scan{,64} from gallium to util.Mathias Fröhlich2016-06-141-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>
* mesa: Remove support for MSVC2008.Jose Fonseca2016-02-121-3/+0
| | | | | | Spotted by Emil Velikov. Trivial.
* mesa/uniform_query: add IROUNDD and use for doubles->ints (v2)Dave Airlie2016-01-111-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>
* glsl: move half<->float convertion to utilRob Clark2015-10-161-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>
* mesa: use strtok_s for strtok_r on windowsTapani Pälli2015-10-011-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>
* mesa: Replace F_TO_I() with _mesa_lroundevenf().Matt Turner2015-08-031-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>
* mesa: Delete unused ICEIL().Matt Turner2015-06-231-32/+0
| | | | | | Can't find any uses of it in git history. Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
* mesa: Implement _mesa_flsll().Kenneth Graunke2015-04-011-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>
* mesa: Replace _mesa_round_to_even() with _mesa_roundeven().Matt Turner2015-03-181-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>
* mesa: use strdup() instead of _mesa_strdup()Brian Paul2015-03-111-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>
* mesa: move finite macro to imports.hBrian Paul2015-02-281-0/+8
| | | | | | Move it to the only place it's used. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: restore #include stdarg.h in imports.hBrian Paul2015-02-271-0/+1
| | | | | https://bugs.freedesktop.org/show_bug.cgi?id=89345 Signed-off-by: Brian Paul <brianp@vmware.com>
* mesa: trim down #includes in compiler.hBrian Paul2015-02-261-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>
* mesa: remove DEG2RAD macroBrian Paul2015-02-241-8/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove MAX_GLUSHORT, move MAX_GLUINTBrian Paul2015-02-241-3/+0
| | | | | | The later is only used in one place in swrast. Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: move signbit() macro to c99_math.hBrian Paul2015-02-241-8/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove unused isblank() functionBrian Paul2015-02-241-1/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove sqrtf macroBrian Paul2015-02-241-11/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove INV_SQRTF() macroBrian Paul2015-02-241-9/+0
| | | | | Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove ceilf, floorf macrosBrian Paul2015-02-241-2/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove expf macroBrian Paul2015-02-241-1/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove logf macroBrian Paul2015-02-241-1/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove powf macroBrian Paul2015-02-241-1/+0
| | | | | | Use the wrapper in c99_math.h if needed. Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove unused exp2f, log2f, truncf wrappersBrian Paul2015-02-241-10/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove unused acosf, asinf, atan2f, etc. macrosBrian Paul2015-02-241-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>
* mesa: replace FABSF with fabsfBrian Paul2015-02-241-11/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: replace FLOORF with floorfBrian Paul2015-02-241-3/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: remove unused CEILF macroBrian Paul2015-02-241-3/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: replace LOGF, EXPF with logf, expfBrian Paul2015-02-241-6/+0
| | | | Reviewed-by: Matt Turner <mattst88@gmail.com>
* mesa: replace FREXPF, LDEXPF with frexpf, ldexpfBrian Paul2015-02-241-6/+0
| | | | | | Start getting rid of some imports.h macros. Use the c99 functions instead. Reviewed-by: Matt Turner <mattst88@gmail.com>
* util: add _mesa_strtod and _mesa_strtofChia-I Wu2014-10-301-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>
* mesa: Replace a priori knowledge of gcc builtins with configure tests.Matt Turner2014-09-251-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>
* mesa: Drop _mesa_getenv() wrapper.Matt Turner2014-09-241-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>
* mesa: Drop _mesa_bsearch() wrapper.Matt Turner2014-09-241-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>
* mesa: Use realloc() instead of _mesa_realloc() and remove the latter.Matt Turner2014-09-241-3/+0
| | | | Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: Drop USE_IEEE define.Matt Turner2014-08-071-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>
* mesa/imports: Add a _mesa_half_is_negative helper functionJason Ekstrand2014-08-051-0/+5
| | | | | Signed-off-by: Jason Ekstrand <jason.ekstrand@intel.com> Reviewed-by: Brian Paul <brianp@vmware.com>
* Add an accelerated version of F_TO_I for x86_64Jason Ekstrand2014-07-241-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>
* mesa: VS 2013 does not provide strcasecmp.José Fonseca2014-05-021-1/+3
| | | | | | | A define is necessary, like for earlier VS versions. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
* mesa: remove the MALLOC, CALLOC and FREE macrosBrian Paul2014-04-101-6/+0
| | | | | | | | | | No longer used anywhere. These also caused trouble in the Gallium state tracker code where we include both core Mesa and Gallium util headers (and the macros were defined differently in each world.) Removing these macros should help avoid macro mix-ups in the future. Reviewed-by: Jakob Bornecrantz <jakob@vmware.com> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
* mesa: don't define c99 math functions for MSVC >= 1800Hans2014-03-031-1/+1
| | | | | Signed-off-by: Brian Paul <brianp@vmware.com> Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
* glsl: Generalize MSVC fix for strcasecmp().Paul Berry2013-10-291-0/+1
| | | | | | | | This will let us use strcasecmp() from anywhere inside Mesa without having to worry about the fact that it doesn't exist in MSVC. Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <brianp@vmware.com>
* mesa: Restore 78-column wrapping of license text in C-style comments.Kenneth Graunke2013-04-231-3/+4
| | | | | | | | | | | | | | The previous commit introduced extra words, breaking the formatting. This text transformation was done automatically via the following shell command: $ git grep 'THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY' | sed 's/:.*$//' | xargs -I {} sh -c 'vim -e -s {} < vimscript where 'vimscript' is a file containing: /THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY/;/\*\// !fmt -w 78 -p ' * ' :wq Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Add "OR COPYRIGHT HOLDERS" to license text disclaiming liability.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | This brings the license text in line with the MIT License as published on the Open Source Initiative website: http://opensource.org/licenses/mit-license.php Generated automatically be the following shell command: $ git grep 'THE AUTHORS BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/THE AUTHORS/THE AUTHORS OR COPYRIGHT HOLDERS/' {} This introduces some wrapping issues, to be fixed in the next commit. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: Change "BRIAN PAUL" to "THE AUTHORS" in license text.Kenneth Graunke2013-04-231-1/+1
| | | | | | | | | | | | | | | | Generated automatically be the following shell command: $ git grep 'BRIAN PAUL BE LIABLE' | sed 's/:.*$//g' | xargs -I '{}' \ sed -i 's/BRIAN PAUL/THE AUTHORS/' {} The intention here is to protect all authors, not just Brian Paul. I believe that was already the sensible interpretation, but spelling it out is probably better. More practically, it also prevents people from accidentally copy & pasting the license into a new file which says Brian is not liable when he isn't even one of the authors. Reviewed-by: Brian Paul <brianp@vmware.com>
* mesa: remove platform checks around __builtin_ffs, __builtin_ffsllBrian Paul2013-04-011-6/+0
| | | | | | | | | | | Use the __builtin_ffs, __builtin_ffsll functions whenever we have GCC, not just for specific platforms. Fixes Solaris build. Note: This is a candidate for the stable branches. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=62868 Signed-off-by: Brian Paul <brianp@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
* mesa,glsl: Move round_to_even() from glsl to mesa/main (v2)Chad Versace2013-01-241-0/+3
| | | | | | | | | | | | | Move round_to_even's definition to mesa/main so that _mesa_float_to_half() can use it in order to eliminate rounding bias. In additon to moving the fuction definition, prefix its name with "_mesa", just as all other functions in mesa/main are prefixed. v2: Fix Android build. Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Chad Versace <chad.versace@linux.intel.com>