summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/util
AgeCommit message (Collapse)AuthorFilesLines
2014-07-30gallium/util: add a helper for calculating primitive count from vertex countMarek Olšák1-0/+15
This is needed by the following commit which is a candidate for stable too. Cc: mesa-stable@lists.freedesktop.org (cherry picked from commit c7407b94a8eb329a45cdd0acb5255670d4c0e041)
2014-07-10gallium/u_blitter: fix some shader memory leaksBrian Paul1-0/+9
The _msaa shaders weren't getting freed. Cc: "10.2" <mesa-stable@lists.freedesktop.org> Reviewed-by: Marek Olšák <marek.olsak@amd.com> (cherry picked from commit 378fa34c7b8ea29672deea7563c552a8e2742809)
2014-07-10gallium: fix u_default_transfer_inline_write for texturesMarek Olšák1-2/+2
This doesn't fix any known issue. In fact, radeon drivers ignore all the discard flags for textures and implicitly do "discard range" for any write transfer. Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Roland Scheidegger <sroland@vmware.com> (cherry picked from commit fe6be9926f63e68d9007571956bed0687003e932)
2014-05-02util: Don't attempt to redefine INFINITY/NAN on VS 2013.José Fonseca1-0/+5
There are now provided by VS. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-05-02util/u_debug_flush: Use util_snprintf.José Fonseca1-2/+3
Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-04-28gallium/util: add helpers for bitfield manipulationIlia Mirkin1-0/+31
Add bitwise reversing and signed MSB helpers for software implementation of the new TGSI opcodes. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-04-28util: Fix cross-compiles between endiannessesRichard Sandiford2-32/+46
The old python code used sys.is_big_endian to select between little-endian and big-endian formats, which meant that the build and host endiannesses needed to be the same. This patch instead generates both big- and little- endian layouts, using PIPE_ARCH_BIG_ENDIAN to select between them. Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com> Signed-off-by: José Fonseca <jfonseca@vmware.com>
2014-04-28util: Split out channel-parsing Python codeRichard Sandiford1-46/+50
Splits out the code that parses the channel list, so that we can have different lists for little and big endian. There is no change to the generated u_format_table.c. Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com> Signed-off-by: José Fonseca <jfonseca@vmware.com>
2014-04-28util: Split out channel-printing Python codeRichard Sandiford2-41/+69
Rather than iterate over format.channels and format.swizzles directly, use Python subfunctions that take the channel and swizzle lists as arguments. This allow the channel and swizzle lists to depend on endianness. There is no change to the generated u_format_table.c. Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com> Signed-off-by: José Fonseca <jfonseca@vmware.com>
2014-04-28util: Turn inv_swizzle into a global functionRichard Sandiford2-11/+11
With the big-endian changes, there can be two swizzle orders for each format. This patch turns Format.inv_swizzle() into a global function that takes the swizzle list as a parameter. There is no change to the generated u_format_table.c. Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com> Signed-off-by: José Fonseca <jfonseca@vmware.com>
2014-04-28util: Add more query methods to u_format_parse.FormatRichard Sandiford3-36/+51
The main aim is to reduce the number of places that access channels[0], swizzles[0] and swizzles[1] directly. There is no change to the generated u_format_table.c. Signed-off-by: Richard Sandiford <rsandifo@linux.vnet.ibm.com> Signed-off-by: José Fonseca <jfonseca@vmware.com>
2014-04-26mesa/st: add support for ARB_sample_shadingIlia Mirkin1-0/+3
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-04-25gallium/util: use ui[4] instead of ui in union util_colorRoland Scheidegger2-20/+20
util_color often merely represents a collection of bytes, however it is inconvenient if those bytes can only be accessed as floats/doubles for int formats exceeding 32bits. (Note that since rgba8 formats use one uint, not 4 bytes, hence the byte and short member were left as is.)
2014-04-23util/u_debug: Pass correct size to strncat.José Fonseca1-4/+4
Courtesy of Clang static analyzer. Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com>
2014-04-17util: Add __declspec(noreturn) to _debug_assert_fail().José Fonseca1-0/+3
Mostly for consistency; as MSVC's static source code analysis doesn't seem to rely on assertions, but instead on different kind of source annotations( http://msdn.microsoft.com/en-us/library/hh916383.aspx ). Reviewed-by: Brian Paul <brianp@vmware.com>
2014-04-17auxiliary/os,auxiliary/util: Fix the `‘noreturn’ function does return` ↵José Fonseca1-4/+1
warning. Now that _debug_assert_fail() has the noreturn attribute, it is better that execution truly never returns. Not just for sake of silencing the warning, but because the code at the return IP address may be invalid or lead to inconsistent results. This removes support for the GALLIUM_ABORT_ON_ASSERT debugging environment variable, but between the usefulness of GALLIUM_ABORT_ON_ASSERT and better static code analysis I think better static code analysis wins. Reviewed-by: Brian Paul <brianp@vmware.com>
2014-04-16util/u_debug: Add noreturn attribute to _debug_assert_fail().José Fonseca1-1/+5
As recommended by http://clang-analyzer.llvm.org/annotations.html#attr_noreturn Reviewed-by: Brian Paul <brianp@vmware.com>
2014-04-10gallium/u_gen_mipmap: rewrite using pipe->blit (v2)Marek Olšák2-493/+70
This replaces u_gen_mipmap with an extremely simple implementation based on pipe->blit. st/mesa is also cleaned up. Pros: - less code - correct mipmap generation for NPOT 3D textures (u_blitter uses a better formula) - queries are not affected by mipmap generation if drivers disable them v2: add "first_layer", "last_layer" parameters, drop "face" v2.1: add format v2.2: document the format parameter
2014-04-04gallium/u_blitter: implement scaled blitting in the Z directionMarek Olšák1-9/+31
So that pipe->blit can be used for 3D mipmap generation.
2014-04-04gallium/u_blitter: don't adjust cubemap coordinates by a small numberMarek Olšák1-1/+1
It may cause issues with mipmap generation. I think it was used to make some piglit tests pass on r300g.
2014-03-21gallium: add b5g6r5 srgb formatRoland Scheidegger3-4/+19
GL generally doesn't seem to allow srgb formats with less (or more) than 8 bit for the rgb channels, though some hw could easily do it (typically for formats with up to 10 bits for the rgb channels, at least for formats with less than 8 bits support is likely widespread even). While it may be true there aren't really any benefits for such formats, we need for it for d3d, though luckily only for b5g6r5_srgb it seems. So add this format along with the util code for conversion - since that util code is heavily tuned for 8bit srgb this isn't really all that well optimized and rounding doesn't seem right but at least it should give some halfway meaningful results. Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-03-21gallium/u_gen_mipmap: remove the software fallbackMarek Olšák1-1160/+2
The last changes to it are from 2008 and 2009. It doesn't support most texture formats and some texture targets. Nobody can possibly be using this. Reviewed-by: Brian Paul <brianp@vmware.com>
2014-03-21st/mesa: fix generating mipmaps for cube arraysMarek Olšák1-28/+20
Cc: mesa-stable@lists.freedesktop.org Reviewed-by: Brian Paul <brianp@vmware.com>
2014-03-07gallium: allow setting of the internal stream output offsetZack Rusin3-6/+11
D3D10 allows setting of the internal offset of a buffer, which is in general only incremented via actual stream output writes. By allowing setting of the internal offset draw_auto is capable of rendering from buffers which have not been actually streamed out to. Our interface didn't allow. This change functionally shouldn't make any difference to OpenGL where instead of an append_bitmask you just get a real array where -1 means append (like in D3D) and 0 means do not append. Signed-off-by: Zack Rusin <zackr@vmware.com> Reviewed-by: Roland Scheidegger <sroland@vmware.com> Reviewed-by: Jose Fonseca <jfonseca@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-03-07gallium: rename R4A4 and A4R4 formats to match their swizzleMarek Olšák2-4/+3
Like L4A4. Reviewed-by: Brian Paul <brianp@vmware.com>
2014-03-06gallium/util: Fix memory leakAaron Watry1-0/+2
Fix a leaked vertex shader in u_blitter.c Signed-off-by: Aaron Watry <awatry@gmail.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Marek Olšák <marek.olsak@amd.com> CC: "10.1" <mesa-stable@lists.freedesktop.org>
2014-03-03util: don't define isfinite(), isnan() for MSVC >= 1800Hans1-0/+4
Signed-off-by: Brian Paul <brianp@vmware.com> Cc: "10.0" "10.1" <mesa-stable@lists.freedesktop.org>
2014-02-28gallium/util: add missing u_math includeIlia Mirkin1-0/+2
This is needed for MIN2/MAX2 Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-02-27util/u_format: don't crash in util_format_translate if we can't do translationRoland Scheidegger2-6/+17
Some formats can't be handled - in particular cannot handle ints/uints formats, which lack the pack_rgba_float/unpack_rgba_float functions. Instead of trying to call these (and crash) return an error (I'm not sure yet if we should try to translate such formats too here might not make much sense). v2: suggested by Jose, use separate checks for pack/unpack of rgba_8unorm and rgba_float functions (right now if one exists the other should as well). Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
2014-02-25gallium/upload_mgr: remove useless variable "size"Marek Olšák1-6/+4
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
2014-02-25gallium/upload_mgr: don't unmap buffers if persistent mappings are supportedMarek Olšák1-14/+51
Reviewed-by: Fredrik Höglund <fredrik@kde.org>
2014-02-24util: Add util_cpu_to_le* helpersTom Stellard1-0/+3
Reviewed-by: Michel Dänzer <michel.daenzer@amd.com> Reviewed-by: Francisco Jerez <currojerez@riseup.net>
2014-02-24util: Add util_bswap64() v3Tom Stellard1-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 <michel.daenzer@amd.com>
2014-02-24configure.ac: Use AX_GCC_BUILTIN to check availability of __builtin_bswap32 v2Tom Stellard1-1/+2
v2: - Remove unnecessary AC_SUBST Reviewed-by: Matt Turner <mattst88@gmail.com>
2014-02-14gallium/util: Add flush/map debug utility codeThomas Hellstrom2-0/+529
Signed-off-by: Thomas Hellstrom <thellstrom@vmware.com> Reviewed-by: Brian Paul <brianp@vmware.com> Cc: "10.1" <mesa-stable@lists.freedesktop.org>
2014-02-06gallium: remove PIPE_USAGE_STATICMarek Olšák1-3/+3
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-27util/u_vbuf: correct map offset calculation for crazy offsetsIlia Mirkin1-1/+1
When the min_index is very large (or very negative), the multipliation can overflow 32 bits and result in an incorrect map pointer modification. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Marek Olšák <marek.olsak@amd.com>
2014-01-23gallium/util: util_format_srgb should not return FORMAT_NONE for sRGB formatsMarek Olšák1-0/+3
This fixes a serious regression introduced in 4e549ddb500cf677b6fa16d9ebdfa67cc23da097. Cc: 9.2 10.0 <mesa-stable@lists.freedesktop.org> Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-23gallium/u_upload_mgr: don't expose u_upload_flushMarek Olšák2-22/+4
It's unused and shouldn't be used at all in my opinion. If some driver doesn't support the unsynchronized flag, u_upload_mgr should avoid the synchronization by other means, e.g. by using the DONTBLOCK flag.
2014-01-17s/Tungsten Graphics/VMware/José Fonseca40-82/+82
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/alanh@tungstengraphics.com/alanh@vmware.com/ s/jens@tungstengraphics.com/jowen@vmware.com/g s/jrfonseca-at-tungstengraphics-dot-com/jfonseca-at-vmware-dot-com/ s/jrfonseca\?@tungstengraphics.com/jfonseca@vmware.com/g s/keithw\?@tungstengraphics.com/keithw@vmware.com/g s/michel@tungstengraphics.com/daenzer@vmware.com/g s/thomas-at-tungstengraphics-dot-com/thellstom-at-vmware-dot-com/ s/zack@tungstengraphics.com/zackr@vmware.com/ # 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 <brianp@vmware.com>
2014-01-13gallium/util: easy fixes for NULL colorbuffersMarek Olšák2-1/+7
Reviewed-by: Brian Paul <brianp@vmware.com>
2014-01-13st/mesa: bind NULL colorbuffers as specified by glDrawBuffersMarek Olšák2-0/+25
An example why it is required: Let's say there's a fragment shader writing to gl_FragData[0..1]. The user calls: glDrawBuffers(2, {GL_NONE, GL_COLOR_ATTACHMENT0}); That means gl_FragData[0] is unused and gl_FragData[1] is written to GL_COLOR_ATTACHMENT0. st/mesa was skipping the GL_NONE draw buffer, therefore gl_FragData[0] was written to GL_COLOR_ATTACHMENT0, which was wrong. This commit fixes it, but drivers must also be fixed not to crash when binding NULL colorbuffers. There is also a new set of piglit tests for this. The MSAA state also had to be fixed not to crash when reading fb->cbufs[0]. Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-14gallium/u_blitter: implement shader-based MSAA resolve with bilinear filteringMarek Olšák3-31/+149
For scaled resolve. The filter is only good for magnification. If somebody has an idea how to implement a good filter for minification, I'm all ears. I'd have to use derivatives probably. Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-14gallium/u_blitter: implement shader-based MSAA resolveMarek Olšák3-23/+158
We need this for integer formats and upside-down blits, which Radeons don't support for MSAA resolving. It can be used by calling util_blitter_blit. Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-14gallium/u_blitter: remove useless parameters from some functionsMarek Olšák2-22/+13
Reviewed-by: Brian Paul <brianp@vmware.com>
2013-12-12util: fix compile breakageBrian Paul1-1/+1
D'oh!
2013-12-12util: move variable declaration out of for-loopBrian Paul1-1/+3
To fix MSVC build.
2013-12-12gallium/util: implement new color clear API in u_blitterMarek Olšák1-3/+42
2013-12-12gallium: allow choosing which colorbuffers to clearMarek Olšák1-3/+4
Required for glClearBuffer, which only clears one colorbuffer attachment. Example: If the first colorbuffer is float and the second one is int: pipe->clear(pipe, PIPE_CLEAR_COLOR0, float_clear_color, ...); pipe->clear(pipe, PIPE_CLEAR_COLOR1, int_clear_color, ...); This doesn't need any driver changes yet, because all drivers just use: if (flags & PIPE_CLEAR_COLOR) .. The drivers which support GL 3.0 will have to implement it properly though.
2013-12-03gallium/util: implement layered framebuffer clear in u_blitterMarek Olšák6-25/+106
All bound layers (from first_layer to last_layer) should be cleared. This uses a vertex shader which outputs gl_Layer = gl_InstanceID, so each instance goes to a different layer. By rendering a quad and setting the instance count to the number of layers, it will trivially clear all layers. This requires AMD_vertex_shader_layer (or PIPE_CAP_TGSI_VS_LAYER), which only radeonsi supports at the moment. r600 could do this too. Standard DX11 hardware will have to use a geometry shader though, which has higher overhead.