aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util/u_math.h
Commit message (Collapse)AuthorAgeFilesLines
* util: Do not use __builtin_clrsb with Intel C++ Compiler.Vinson Lee2014-05-301-1/+1
| | | | | | | | | | | This patch fixes this build error with icc 14.0.2. In file included from state_tracker/st_glsl_to_tgsi.cpp(63): ../../src/gallium/auxiliary/util/u_math.h(583): error: identifier "__builtin_clrsb" is undefined return 31 - __builtin_clrsb(i); ^ Signed-off-by: Vinson Lee <[email protected]>
* util: Don't attempt to redefine INFINITY/NAN on VS 2013.José Fonseca2014-05-021-0/+5
| | | | | | | There are now provided by VS. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* gallium/util: add helpers for bitfield manipulationIlia Mirkin2014-04-281-0/+31
| | | | | | | | Add bitwise reversing and signed MSB helpers for software implementation of the new TGSI opcodes. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* util: don't define isfinite(), isnan() for MSVC >= 1800Hans2014-03-031-0/+4
| | | | | Signed-off-by: Brian Paul <[email protected]> Cc: "10.0" "10.1" <[email protected]>
* util: Add util_cpu_to_le* helpersTom Stellard2014-02-241-0/+3
| | | | | Reviewed-by: Michel Dänzer <[email protected]> Reviewed-by: Francisco Jerez <[email protected]>
* util: Add util_bswap64() v3Tom Stellard2014-02-241-0/+16
| | | | | | | | | | | | v2: - Use __builtin_bswap64() - Remove unnecessary mask - Add util_le64_to_cpu() helper v3: - Remove unnecessary AC_SUBST Reviewed-by: Michel Dänzer <[email protected]>
* configure.ac: Use AX_GCC_BUILTIN to check availability of __builtin_bswap32 v2Tom Stellard2014-02-241-1/+2
| | | | | | | v2: - Remove unnecessary AC_SUBST Reviewed-by: Matt Turner <[email protected]>
* s/Tungsten Graphics/VMware/José Fonseca2014-01-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Tungsten Graphics Inc. was acquired by VMware Inc. in 2008. Leaving the old copyright name is creating unnecessary confusion, hence this change. This was the sed script I used: $ cat tg2vmw.sed # Run as: # # git reset --hard HEAD && find include scons src -type f -not -name 'sed*' -print0 | xargs -0 sed -i -f tg2vmw.sed # # Rename copyrights s/Tungsten Gra\(ph\|hp\)ics,\? [iI]nc\.\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./g /Copyright/s/Tungsten Graphics\(,\? [iI]nc\.\)\?\(, Cedar Park\)\?\(, Austin\)\?\(, \(Texas\|TX\)\)\?\.\?/VMware, Inc./ s/TUNGSTEN GRAPHICS/VMWARE/g # Rename emails s/[email protected]/[email protected]/ s/[email protected]/[email protected]/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\[email protected]/[email protected]/g s/keithw\[email protected]/[email protected]/g s/[email protected]/[email protected]/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/[email protected]/[email protected]/ # Remove dead links s@Tungsten Graphics (http://www.tungstengraphics.com)@Tungsten Graphics@g # C string src/gallium/state_trackers/vega/api_misc.c s/"Tungsten Graphics, Inc"/"VMware, Inc"/ Reviewed-by: Brian Paul <[email protected]>
* draw,llvmpipe,util: add depth bias calculation for arb_depth_buffer_floatMatthew McClure2013-11-071-0/+13
| | | | | | | | | | | | | | | With this patch, the llvmpipe and draw modules will calculate the depth bias according to floating point depth buffer semantics described in the arb_depth_buffer_float specification, when the driver has a z buffer bound with a format type of UTIL_FORMAT_TYPE_FLOAT. By default, the driver will use the existing UNORM calculation for depth bias. A new function, draw_set_zs_format, was added to calculate the Minimum Resolvable Depth value and floating point depth sense for the draw module. Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* util: Fix MinGW build.José Fonseca2013-10-091-1/+1
| | | | | _GNU_SOURCE appears to not be used reliably. Use _MSC_VER instead so that MSVC alone is affected.
* util/u_math: Fix C++ include of u_math.h on MSVC.José Fonseca2013-10-101-1/+1
| | | | | | | GNU C++ compiler declares the C99 lrint, etc. when _GNU_SOURCE is defined, but MSVC does not. Trivial.
* util: when packing depth values, round to nearest.Matthew McClure2013-10-041-0/+52
| | | | | | | This patch adds the lrint, lrintf, llrint, and llrintf rounding utility functions. When packing unorm depth values, we will round to nearest. Reviewed-by: Roland Scheidegger <[email protected]>
* util/u_math: Define NAN/INFINITY macros for MSVC.José Fonseca2013-07-201-0/+4
| | | | Untested. But should hopefully fix the build.
* util: treat denorm'ed floats like zeroZack Rusin2013-07-091-0/+7
| | | | | | | | | | | | | The D3D10 spec is very explicit about treatment of denorm floats and the behavior is exactly the same for them as it would be for -0 or +0. This makes our shading code match that behavior, since OpenGL doesn't care and on a few cpu's it's faster (worst case the same). Float16 conversions will likely break but we'll fix them in a follow up commit. Signed-off-by: Zack Rusin <[email protected]> Reviewed-by: Jose Fonseca <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]>
* mesa: Fix bug in unclamped float to ubyte conversion.Manfred Ernst2013-06-121-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The IEEE float optimized version of UNCLAMPED_FLOAT_TO_UBYTE in macros.h computed incorrect results for inputs in the range 0x3f7f0000 (=0.99609375) to 0x3f7f7f80 (=0.99803924560546875) inclusive. 0x3f7f7f80 is the IEEE float value that results in 254.5 when multiplied by 255. With rounding mode "round to closest even integer", this is the largest float in the range 0.0-1.0 that is converted to 254 by the generic implementation of UNCLAMPED_FLOAT_TO_UBYTE. The IEEE float optimized version incorrectly defined the cut-off for mapping to 255 as 0x3f7f0000 (=255.0/256.0). The same bug was present in the function float_to_ubyte in u_math.h. Fix: The proposed fix replaces the incorrect cut-off value by 0x3f800000, which is the IEEE float representation of 1.0f. 0x3f7f7f81 (or any value in between) would also work, but 1.0f is probably cleaner. The patch does not regress piglit on llvmpipe and on i965 on sandy bridge. Tested-by Stéphane Marchesin <[email protected]> Reviewed-by Stéphane Marchesin <[email protected]> Reviewed-by: Brian Paul <[email protected]>
* gallium: add start_slot parameter to set_vertex_buffersMarek Olšák2012-10-311-0/+4
| | | | | | | | | | | | | | | | | | | | | This allows updating only a subrange of buffer bindings. set_vertex_buffers(pipe, start_slot, count, NULL) unbinds buffers in that range. Binding NULL resources unbinds buffers too (both buffer and user_buffer must be NULL). The meta ops are adapted to only save, change, and restore the single slot they use. The cso_context can save and restore only one vertex buffer slot. The clients can query which one it is using cso_get_aux_vertex_buffer_slot. It's currently set to 0. (the Draw module breaks if it's set to non-zero) It should decrease the CPU overhead when using a lot of meta ops, but the drivers must be able to treat each vertex buffer slot as a separate state (only r600g does so at the moment). I can imagine this also being useful for optimizing some OpenGL use cases. Reviewed-by: Brian Paul <[email protected]>
* util: remove u_debug.h from u_math.hBrian Paul2012-09-011-1/+0
| | | | No debug code is used in u_math.h
* gallium/util: add util_bit_last - finds the last bit set in a wordMarek Olšák2012-07-171-0/+14
|
* gallium/util: Add ULL suffix to large constants.José Fonseca2012-07-021-3/+3
| | | | | As suggested by Andy Furniss: it looks like some old gcc versions require it.
* util: Added functions for checking NaN / Inf for double and half-floats.James Benton2012-06-291-2/+102
| | | | Reviewed-by: Jose Fonseca <[email protected]>
* mesa/gallium: add FFS_DEFINED to protect ffs() from multiple definitionsBrian Paul2012-01-121-0/+5
| | | | | | | | We include both imports.h and u_math.h in the state tracker. This leads to multiple, conflicting definitions of ffs() with MSVC. Use FFS_DEFINED to skip the ffs() in u_math.h. Reviewed-by: José Fonseca <[email protected]>
* util: Add strings.h include on unicesJosé Fonseca2011-12-091-0/+4
| | | | | Fixes -Wimplicit-function-declaration for ffs with GCC. Spotted/tested by Kai Wasserbäch.
* Remove windows kernel support code.José Fonseca2011-11-291-67/+1
| | | | | | Not actively used. Reviewed-by: Brian Paul <[email protected]>
* util: add log2f for AndroidChia-I Wu2011-11-071-0/+11
| | | | | | | | | It is needed for nv50's new shader backend. With this change, both u_math.h and imports.h in core mesa define the same function. I have to #undef log2f here to avoid the conflict. Not sure if there is a better way to deal with the situation. Acked-by: José Fonseca <[email protected]>
* gallium/util: Add macros for converting from little endian to CPU byte order.Michel Dänzer2011-11-021-0/+13
| | | | | Signed-off-by: Michel Dänzer <[email protected]> Reviewed-by: Jose Fonseca <[email protected]>
* util: add u_bit_scan helperKeith Whitwell2011-09-221-0/+16
|
* gallium: add PIPE_OS_ANDROID supportChia-I Wu2011-08-211-1/+11
| | | | | | | Android uses Linux kernel and its own C runtime. It resembles PIPE_OS_LINUX a lot with some minor exceptions. Reviewed-by: Brian Paul <[email protected]>
* util: add gcc version check for builtinsRoland Scheidegger2011-06-091-3/+3
| | | | | Looks like only next_power_of_two, logbase2 and bitcount use builtins requiring gcc 3.4, so maybe everything else compiles with older gcc.
* util: better logbase2/next_power_of_two implementationsBenjamin Bellec2011-06-091-8/+24
| | | | | Use __builtin_clz when available for logbase/next_power_of_two, and replace next_power_of_two with faster implementation otherwise.
* util: faster logbase2Brian Paul2011-06-021-4/+7
|
* Remove redundant util_unsigned_logbase2Matt Turner2011-05-121-12/+0
| | | | | | | util_logbase2 is exactly the same function. Signed-off-by: Matt Turner <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* u_math.h: Remove redundant mingw32 ffs definitionMatt Turner2011-05-121-4/+0
| | | | | Signed-off-by: Matt Turner <[email protected]> Signed-off-by: Brian Paul <[email protected]>
* util: make macros MIN3, MAX3, MIN4, MAX4 little more efficientMarek Olšák2011-04-271-4/+4
|
* gallium: add RGTC UNORM support to u_format.Dave Airlie2011-03-021-0/+11
| | | | | | | | SNORM needs a bit of work in the state tracker in order for mipmap generation to work I believe. I'm also not sure that having unorm fetches for an snorm format is sane.
* util: Define round and roundf on MSVC.José Fonseca2011-02-111-1/+13
|
* util: Defined M_SQRT2 when not available.José Fonseca2010-10-091-0/+5
|
* util: remove util_is_pot in favor of util_is_power_of_twoMarek Olšák2010-08-291-10/+0
| | | | The function was duplicated.
* util: fix typo in MAX4Keith Whitwell2010-08-271-1/+1
| | | | Thanks to Michal for spotting it.
* util: add MIN4, MAX4Keith Whitwell2010-08-271-0/+3
|
* u_math: Add align function npot alignmentsJakob Bornecrantz2010-06-221-0/+14
|
* gallium/util: Define isfinite and isnan for MSVC.Chia-I Wu2010-05-311-0/+3
| | | | | Define isfinite and isnan to _finite and _isnan respectively for MSVC. Those macros are needed by st/vega.
* util: Add inline function for approximate floating point comparison.José Fonseca2010-05-301-0/+9
|
* util: Add util_bswap16.José Fonseca2010-02-261-0/+11
|
* util: Silent potential loss of precision warnings.José Fonseca2010-01-021-3/+2
| | | | Also ensure multiplication doesn't happen for negative numbers.
* Merge branch 'i965g-restart'Keith Whitwell2009-12-221-0/+13
|\ | | | | | | | | Conflicts: configure.ac
| * Merge commit 'origin/master' into i965g-restartKeith Whitwell2009-12-211-2/+46
| |\ | | | | | | | | | | | | | | | | | | Conflicts: SConstruct configs/default configs/linux-dri
| * | i965g: more work on compilationKeith Whitwell2009-10-311-0/+13
| | |
* | | gallium/util: __builtin_bswap32() is in only gcc 4.3 or laterBrian Paul2009-12-021-1/+1
| |/ |/|
* | util: Fix bad code.Corbin Simpson2009-11-281-1/+1
| | | | | | | | Uf. How embarrassing.
* | util: Improve bitcount.Corbin Simpson2009-11-281-4/+8
| | | | | | | | Sorry for not pushing this before, it got lost in stashes.