summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/macros.h
Commit message (Collapse)AuthorAgeFilesLines
* mesa: fix a couple issues with U_FIXED, I_FIXED macrosBrian Paul2013-10-221-3/+3
| | | | | | | | | | Silence a bunch of MSVC type conversion warnings. Changed return type of S_FIXED to int32_t (signed). The result is the same. It just seems more intuitive that a signed conversion function should return a signed value. Reviewed-by: Jose Fonseca <[email protected]>
* mesa: Move U_FIXED/S_FIXED macros from i965 to macros.h.Kenneth Graunke2013-10-131-0/+22
| | | | | | | | | | | | | | | | | These make it easy to convert a floating point value to a fixed point numbers. The second parameter is the number of bits used for the fractional part of the number. It looks like core Mesa has similar functions already, but none that allows an arbitrary number of fractional bits. The more generic version is probably useful to everyone. r600g apparently has an identical copy of the S_FIXED macro, but doesn't include this file. I'm not sure what to do about that, so I'm just going to leave it for now. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Move ROUND_DOWN_TO() macro from i915/i965 to macros.h.Kenneth Graunke2013-10-131-0/+12
| | | | | | | | | | This seems generally useful, so it may as well live in core Mesa. In fact, the comment for ALIGN() in macros.h actually says to "see also" ROUND_DOWN_TO, which...was in a driver somewhere. Signed-off-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: Fix compiler warnings when ALIGN's alignment is "1 << value".Eric Anholt2013-10-091-1/+1
| | | | | | | | | | | We hadn't run into order of operation warnings before, apparently, since addition is so low on the order. Cc: "9.1 9.2" <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Chad Versace <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
* mesa: init dst values in COPY_CLEAN_4V_TYPE_AS_FLOAT()Brian Paul2013-08-261-1/+2
| | | | | | to silence gcc 4.8.1 warnings. And improve the ASSERT(0) call. Reviewed-by: Chad Versace <[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]>
* mesa: remove outdated version lines in commentsRico Schüller2013-06-051-1/+0
| | | | Signed-off-by: Brian Paul <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* 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 <[email protected]>
* mesa: Introduce a globally-available minify() macro.Eric Anholt2013-04-211-0/+6
| | | | | | This matches u_minify()'s behavior, for consistency. Reviewed-by: Brian Paul <[email protected]>
* Consolidate some redundant definitions of ARRAY_SIZE() macro.Paul Berry2013-02-081-0/+3
| | | | | | | | | | | | | | | | | | | | | Previous to this patch, there were 13 identical definitions of this macro in Mesa source. That's ridiculous. This patch consolidates 6 of them to a single definition in src/mesa/main/macros.h. Unfortunately, I wasn't able to eliminate the remaining definitions, since they occur in places that don't include src/mesa/main/macros.h: - include/pci_ids/pci_id_driver_map.h - src/egl/drivers/dri2/egl_dri2.h - src/egl/main/egldefines.h - src/gbm/main/backend.c - src/gbm/main/gbm.c - src/glx/glxclient.h - src/mapi/mapi/stub.c I'm open to suggestions as to how to deal with the remaining redundancy. Reviewed-by: Kenneth Graunke <[email protected]>
* mesa: Add ALIGN() macro to main/macros.h.Paul Berry2013-01-081-0/+13
| | | | | | | | | Previously this macro existed in 3 separate places, some inside the intel driver and some outside of it. It makes more sense to have it in main/macros.h Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
* vbo: fix glVertexAttribI* functionsMarek Olšák2012-11-061-0/+39
| | | | | | | | | | | | | | | | | | | | | | The functions were broken, because they converted ints to floats. Now we can finally advertise OpenGL 3.0. ;) In this commit, the vbo module also tracks the type for each attrib in addition to the size. It can be one of FLOAT, INT, UNSIGNED_INT. The little ugliness is the vertex attribs are declared as floats even though there may be integer values. The code just copies integer values into them without any conversion. This implementation passes the glVertexAttribI piglit test which I am going to commit in piglit soon. The test covers vertex arrays, immediate mode and display lists. NOTE: This is a candidate for the stable branches. Reviewed-by: Brian Paul <[email protected]> v2: cosmetic changes as suggested by Brian
* Use signbit() in IS_NEGATIVE and DIFFERENT_SIGNSMatt Turner2012-09-241-19/+2
| | | | | | | | | | signbit() appears to be available everywhere (even MSVC according to MSDN), so let's use it instead of open-coding some messy and confusing bit twiddling macros. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=54805 Reviewed-by: Paul Berry <[email protected]> Suggested-by: Ian Romanick <[email protected]>
* mesa: fix DIFFERENT_SIGNS() functionBrian Paul2012-09-041-1/+1
| | | | | | | | | | Looks like converting this to a macro, returning bool, caused us to lose the high (31st) bit result. Fixes piglit fbo-1d test. Strange that none of the other tests I ran caught this. Fixes https://bugs.freedesktop.org/show_bug.cgi?id=54365 Tested-by: Vinson Lee <[email protected]>
* mesa: remove SQRTF, use sqrtf. Convert INV_SQRT() to inline function.Brian Paul2012-09-031-2/+2
| | | | | | | We were already defining sqrtf where we don't have the C99 version. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Matt Turner <[email protected]>
* mesa: move IS_NEGATIVE() and DIFFERENT_SIGNS() to macros.hBrian Paul2012-09-011-0/+32
|
* mesa: convert a few more macros to inline functionsBrian Paul2012-08-291-22/+21
|
* mesa: remove COPY_4V_CAST() macroBrian Paul2012-08-291-9/+0
| | | | Only used in one place, and not really needed.
* mesa: convert a bunch of math macros to inline functionsBrian Paul2012-08-291-56/+86
|
* mesa: use F_TO_I() instead of IROUND()Brian Paul2012-05-191-5/+5
| | | | | | | | Use it where performance matters more and the exact method of float->int conversion/rounding isn't terribly important. There should no net change here since F_TO_I() is the new name of the old IROUND() function. Reviewed-by: José Fonseca <[email protected]>
* mesa: new BYTE/SHORT_TO_FLOATZ() macrosBrian Paul2011-11-151-0/+7
| | | | | | | Rather than redefining the BYTE/SHORT_TO_FLOAT macros, just define new ones with different names. These macros preserve zero when converting. Reviewed-by: Eric Anholt <[email protected]>
* mesa: move CEILING() macro into macros.hBrian Paul2011-11-151-0/+4
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused macros in macros.hBrian Paul2011-11-151-26/+0
| | | | Reviewed-by: Eric Anholt <[email protected]>
* mesa: remove unused interp/stride chan macrosBrian Paul2011-09-201-27/+0
|
* mesa: add macros MIN3 and MAX3Marek Olšák2011-04-271-0/+4
|
* mesa: initial EXT_texture_snorm supportMarek Olšák2011-03-291-2/+1
| | | | | The component ordering of some formats has been been reversed to match Gallium types.
* mesa: Move [UN]CLAMPED_FLOAT_TO_UBYTE from imports.h to macros.h.Vinson Lee2010-07-091-0/+35
| | | | The other similar integer/float conversion macros are in macros.h.
* mesa: added UNCLAMPED_FLOAT_TO_SHORT macroBrian Paul2010-05-091-0/+3
|
* Remove _mesa_memcpy in favor of plain memcpy.Kenneth Graunke2010-02-191-1/+1
| | | | This may break the SUNOS4 build, but it's no longer relevant.
* mesa: Fix compiler warningsKarl Schultz2010-02-131-2/+2
| | | | | Add explicit casts, fix constant types, fix variable types. Fixes about 340 warnings in MSFT Visual Studio.
* mesa: Replace CLAMP_SELF() macro with more obvious CLAMP() usage.Eric Anholt2009-12-221-6/+0
| | | | | The same code is generated, and readers and static analyzers are happier.
* mesa: use _mesa_memcpy for COPY_4FV macroRoland Scheidegger2009-12-031-8/+3
| | | | | | | Gets rid of one of the worst strict-aliasing offenders, and actually produces faster code (at least in some cases, when compiler can use for instance 64bit moves for memcpy). (note _mesa_memcpy should get inlined)
* ARB sync: Add infrastructure for glGetInteger64vIan Romanick2009-09-031-0/+3
|
* mesa: From float type modifier from values to large for singlesIan Romanick2009-06-221-7/+7
| | | | | | | | The values 2147483648.0 and 4294967294.0 are too larget to be stored in single precision floats. Forcing these to be singles causes bits to be lost, which results in errors in some pixel transfer tests. This fixes bug #22344.
* mesa: Use type modifier for float constants.José Fonseca2009-06-151-7/+7
|
* mesa: add new signed rgba texture formatRoland Scheidegger2009-03-281-0/+22
| | | | | This is a (partial) backport of the signed texture format support in OGL 3.1. Since it wasn't promoted from an existing extension roll our own.
* mesa: add support for ATI_envmap_bumpmapRoland Scheidegger2009-03-121-2/+5
| | | | | | | | add new entrypoints, new texture format, etc translate in texenvprogram.c for drivers using the mesa-generated tex env fragment program also handled in swrast, but not tested (cannot work due to negative texel results not handled correctly)
* mesa: refactor: move various ENUM_TO_x macros into macros.hBrian Paul2008-09-211-0/+7
|
* minor re-org, doxygen commentsBrian Paul2006-10-181-11/+13
|
* Bug 4996.Brian Paul2005-11-091-3/+0
| | | | | Replace use of FLOAT_TO_USHORT with either CLAMPED_FLOAT_TO_USHORT or UNCLAMPED_FLOAT_TO_USHORT. Same should be done for UBYTE, UINT, etc.
* Move COPY_FLOAT() macro down into glide driver.Brian Paul2005-11-091-10/+14
| | | | | Rewrite COPY_4FV() macro to not use COPY_FLOAT(), and use integer moves as originally intended.
* Update the doxygen configuration file.Jose Fonseca2004-09-091-3/+0
| | | | Minor updates/fixes to the source documentation.
* minor doxygen updatesBrian Paul2004-05-141-0/+2
|
* whitespace changes and new commentsBrian Paul2004-01-011-86/+87
|
* Merge vtx-0-2-branchKeith Whitwell2003-11-241-0/+2
|
* Added GLAPIENTRY decorations for all first level OpenGL API function entryKendall Bennett2003-10-211-301/+300
| | | | | points so that the calling conventions will work correctly with the assembler stubs with the Open Watcom compiler.
* Silence compiler warnings about implicit casts or conversions by supplying ↵Karl Schultz2003-08-301-0/+9
| | | | explicit casts and/or tweaking constant and variable definitions.
* Re-org of register files for vertex/fragment programs. Will be easier toBrian Paul2003-08-171-9/+0
| | | | hook in global state references, etc. for ARB programs.