aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/auxiliary/util
Commit message (Collapse)AuthorAgeFilesLines
* util: Merge util_format_read_4* functions.Eric Anholt2020-07-071-16/+4
| | | | | | | | Everyone wants the same thing: unpack 4-bytes-per-channel data based on the base type of the format. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>
* util: Merge util_format_write_4* functions.Eric Anholt2020-07-071-16/+4
| | | | | | | | Everyone wants the same thing: pack 4-bytes-per-channel data based on the base type of the format. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>
* gallium/util: Move the Z/S handling to the outside of get_tile().Eric Anholt2020-07-071-51/+46
| | | | | | | | This lets us drop the special case for S8_UINT, and makes our read_4 path just like other callers. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>
* gallium/util: Clean up the Z/S tile write path.Eric Anholt2020-07-071-27/+10
| | | | | | | | The switch statement is silly, we have a helper to detect all of Z/S. And, take the time explain why all of Z/S tile writing is unimplemented. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>
* gallium/util: Fix location of the comment about S8_UINT handling.Eric Anholt2020-07-071-4/+4
| | | | | | | | I clearly wrote it in the wrong place in "softpipe: Refactor pipe_get/put_tile_rgba_* paths." Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5728>
* gallium/util: Add a helper function for point sprite handling.Eric Anholt2020-06-291-0/+19
| | | | | | | Many drivers will need to do the same thing here, so consolidate it. Reviewed-by: Jose Maria Casanova Crespo <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2952>
* gallium: Add pipe cap for primitive restart with fixed indexNeil Roberts2020-06-221-0/+1
| | | | | | | | | | | | | | | | | | | | Adds PIPE_CAP_PRIMITIVE_RESTART_FIXED_INDEX which is a subset of the primitive restart cap for when the hardware can only support the fixed indices specified in GLES. The switch statements were automatically modified with this command: find \( \( -name \*.cpp -o -name \*.c \) \! -type l \) \ -exec sed -i -r \ 's/^(\s*case\s+PIPE_CAP_PRIMITIVE_RESTART)\s*:.*$/\0\n\1_FIXED_INDEX:/' \ {} \; v2: Add a note in screen.rst Reviewed-by: Eric Anholt <[email protected]> (v1) Reviewed by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5559>
* gallium/util: add missing includeErik Faye-Lund2020-06-201-0/+1
| | | | | | | | | | | | This source-file uses PIPE_OS_WINDOWS to enable the Windows functionality. But witout including p_config.h, this pre-processor symbol won't be defined at all. Let's fix this by adding the missing include, enabling stack-traces on Windows. Acked-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5497>
* gallium/util: limit STACK_LEN on WindowsErik Faye-Lund2020-06-201-0/+5
| | | | | | | | | | | The Windows implementation of debug_backtrace_capture has a limiation of max 62 frames in total. Subtract a start-frame of 1 and the wrapping functions frame, and we land at 60. So let's lower this number on Windows to avoid triggering an assert. Acked-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5497>
* gallium/u_vbuf: add a faster path for uploading non-interleaved attribsMarek Olšák2020-06-091-34/+83
| | | | | | | +1% higher FPS in torcs. Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5304>
* gallium/u_vbuf: get rid of some pointer dereferencesMarek Olšák2020-06-091-9/+11
| | | | | Reviewed-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5304>
* util: Add util functionality for GL4.1 supportNeha Bhende2020-06-052-0/+117
| | | | | | | | | | | | | | | | | | This patch adds the following tgsi utilities * tgsi_dynamic_indexing: This utility flattens out the dyanamic indexing of constant buffers * tgsi_vpos: This utility writes zeros to position at index 0 in vertex shader. This utility can be used if there is no shader output in vertex shader * util_make_tess_ctrl_passthrough_shader: This adds passthough tessellation control shader. Input of passthrough tess ctrl shader is output of vertex shader and output is input of tessellation eval shader. If program has tessellation eval shader but no tessellation control shader, this utility can be used to create passthrough tessellation control shader. Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Charmaine Lee <[email protected]> Signed-off-by: Neha Bhende <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5317>
* util: Initialize pipe_shader_state for passthrough and transform shadersNeha Bhende2020-05-281-5/+5
| | | | | | | | | | | | | | | mesa/st is initializing pipe_shader_state for user define shaders. This patch intialized pipe_shader_state for all passthough and transform shaders. This fixes crashes for several opengl apps. Issue is found in vmware internal testing Fixes: f01c0565bb9 ("draw: free the NIR IR.") Reviewed-by: Charmaine Lee <[email protected]> Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5240>
* gallium/u_threaded: execute transfer_unmap with THREAD_SAFE directlyMarek Olšák2020-05-151-0/+15
| | | | | | | | | | | | | This was the original intention, but it wasn't fully implemented. Fixes: 7f22e0fd29369f478da1d36520049f001cd698d1 Closes: #2953 Tested by: John Galt <[email protected]> Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5030>
* gallium: change comments to remove 'state tracker'Marek Olšák2020-05-136-6/+6
| | | | | | | Acked-by: Eric Anholt <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]> Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4902>
* gallium: rename 'state tracker' to 'frontend'Marek Olšák2020-05-131-1/+1
| | | | | | | Acked-by: Eric Anholt <[email protected]> Acked-by: Alyssa Rosenzweig <[email protected]> Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4902>
* gallium/util: Fix leak in the live shader cacheAxel Davy2020-05-111-1/+4
| | | | | | | | | | | | | | | | | | | | When the nir backend is used, the create_shader call is supposed to release state->ir.nir. When the cache hits, create_shader is not called, thus state->ir.nir should be freed. There is nothing to be done for the TGSI case as the tokens release is done by the caller. This fixes a leak noticed in: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2931 Fixes: 4bb919b0b8b4ed6f6a7049c3f8d294b74b50e198 Signed-off-by: Axel Davy <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4980>
* gallium/util: split out zstencil clearing code.Dave Airlie2020-05-062-89/+123
| | | | | | | llvmpipe will want to reuse this for it's multisample clears. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
* util: add a resource wrapper to get resource samplesDave Airlie2020-05-061-0/+5
| | | | | | | This return 1 as a baseline and should be used in allocator paths. Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4122>
* gallium: add a new cap PIPE_CAP_GLSL_ZERO_INITPierre-Eric Pelloux-Prayer2020-05-051-0/+1
| | | | | | | Allows driver to select a zero init mode between the 3 possible values. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4607>
* gallium: extract out logicop helperRob Clark2020-04-301-0/+26
| | | | | | Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4826>
* gallium: add pipe cap for scissored clears and pass scissor state to clear() ↵Mike Blumenkrantz2020-04-293-3/+9
| | | | | | | | | | | | | | | | hook this adds a new pipe cap that drivers can support which enables passing buffer clears with scissor test enabled through to be handled by the driver instead of having mesa draw a quad also adjust all existing clear() hooks to have the new parameter Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Vasily Khoruzhick <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4310>
* gallium: add PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE for glthreadMarek Olšák2020-04-271-0/+1
| | | | | | | and add radeonsi support. Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* util/indirect: handle stride less than number of parameters.Dave Airlie2020-04-271-1/+3
| | | | | | | | | | | It's legal to have a stride less than the num of parameters, in this case no need to try and over map the buffer which asserts Fixes: GTF-GL45.gtf43.GL3Tests.multi_draw_indirect.multi_draw_indirect_stride Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4574>
* gallium: prepare framework for supporting AlphaToCoverageDitherControlNVIndrajit Kumar Das2020-04-231-0/+1
| | | | | Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4543>
* gallium: add # of MRT to blend stateRob Clark2020-04-232-1/+3
| | | | | | | | | | | | To make it possible for drivers to avoid unnecessary blend state change for unused MRTs. Otherwise the driver would have to manage different blend CSOs for different potential #s of render targets. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4619>
* mesa/st: avoid u_vbuf for GLESRob Clark2020-04-232-2/+8
| | | | | | | | | | | 64b VBO types are not required for GLES. So avoid u_vbuf if that was otherwise the only reason it was used. Signed-off-by: Rob Clark <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4619>
* gallium/utils: silence strncpy warningPierre-Eric Pelloux-Prayer2020-04-211-1/+1
| | | | | Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4584>
* gallium/u_threaded: flush batch when hitting mapping limitPierre-Eric Pelloux-Prayer2020-04-162-0/+24
| | | | | | | | | | | | | | | tc_transfer_map maps buffers directly, but the unmap operation is executed in the driver thread. When an application does a lot of map/unmap operations, without flushing, this increase the RAM used (and eventually get the app killed by the oom-killer). This commit allows tc to keep track of how many bytes were mapped during the current batch. When this estimation becomes higher than a threshold, we flush the batch. See: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2735 Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4508>
* gallium: add PIPE_CAP_VIEWPORT_MASKIlia Mirkin2020-04-151-0/+1
| | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4529>
* gallium: add PIPE_CAP_SYSTEM_SVMKarol Herbst2020-04-151-0/+3
| | | | | | | | | v2: split enum in specific caps to abstract the CL enum v3: remove BUFFER_SVM caps Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Francisco Jerez <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2076>
* u_blitter: fix stencil blittingDave Airlie2020-04-151-1/+1
| | | | | | | Fixes: KHR-GL45.packed_depth_stencil.blit.depth32f_stencil8 Reviewed-by: Roland Scheidegger <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4560>
* gallium: add viewport swizzling state and capIlia Mirkin2020-04-121-0/+1
| | | | | | Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4519>
* util: move and adjust the vertex upload heuristic equation from u_vbufMarek Olšák2020-04-061-2/+1
| | | | | | | | | | This will also be used by glthread. The new equation is optimized for glthread. Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4466>
* gallium/util: let shader live cache users know if a hit occuredPierre-Eric Pelloux-Prayer2020-04-022-2/+7
| | | | | | | This will be used in next commit. Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4355>
* gallium/llvmpipe: add an optimised 32-bit memsetDave Airlie2020-04-011-7/+3
| | | | | | | | | | | | This might have other users beyond filling/clearing buffers, increase a fullscreen 4k gears from 68->74 fps on my Ryzen since gears is really just a clear benchmark, and this helps clearing. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4394> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4394>
* st/mesa: add environment variable pin_app_thread for faster glthread on AMD ZenMarek Olšák2020-03-301-0/+10
| | | | | | Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4369> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4369>
* gallium/u_threaded: call the driver to pin threads to L3 immediatelyMarek Olšák2020-03-301-6/+14
| | | | | | | | This is thread-safe and we want it to be done immediately for good L3 cache usage. Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4369>
* util: fix u_fifo_pop()Rob Clark2020-03-301-1/+1
| | | | | | | | | Seems like no one ever depended on it to actually return false when fifo is empty. Fixes: 6e61d062093 ("util: Add super simple fifo") Signed-off-by: Rob Clark <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4366>
* util: don't include p_defines.h and u_pointer.h from galliumMarek Olšák2020-03-272-2/+2
| | | | | | | It's a mess, but this is what I arrived at. Reviewed-by: Timothy Arceri <[email protected] Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4324>
* gallium/util: Add back (and rename) util_float_to_half implementationRoland Scheidegger2020-03-251-0/+57
| | | | | | | | | | | | | | | | | | | | | | | | | This implementation was removed by 8b8af6d3 ("gallium/util: Switch util_float_to_half to _mesa_float_to_half()'s impl.") It was not actually broken, but _mesa_float_to_half() implements round-to-nearest-even, whereas util_float_to_half() implemented round-to-zero. So rename it appropriately. GL actually never cares about rounding (except a broken piglit test), however d3d10 very much does and requires RTZ for float to half conversion. Moreover, apparently at least radeon gpus actually always do RTZ when doing RT writes (and I'd suspect for shader image writes as well). Hence it seems appropriate to hook up this rtz function to the format instead. This will cause llvmpipe and softpipe to use rtz rounding for clears with half float formats, and softpipe would use rtz behavior for rt writes as well (llvmpipe has that hardcoded), not sure if "real" hw drivers hit this function for much. (For shader opcodes would still need to figure out what rounding to use appropriately, but this is a question for another day.) Note should probably unify with _mesa_float_to_float16_rtz. Unclear at this point which one is better, so just restore previous function here. Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4312> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4312>
* vbo,gallium: make glBegin/End buffer size configurable by driversMarek Olšák2020-03-211-0/+3
| | | | | | | | The default is 512 KB, but radeonsi wants 4 MB. Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4154> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4154>
* gallium/util: Switch util_float_to_half to _mesa_float_to_half()'s impl.Eric Anholt2020-03-171-52/+2
| | | | | | | | | | | | | | The util_float_to_half() implementation was much smaller, but when trying to switch _mesa_float_to_half to it, many testcases (dEQP-VK.spirv_assembly.instruction.graphics.opquantize.*, piglit.spec.arb_shading_language_packing.*packhalf2x16) start failing on Intel. Replace the broken impl so that people don't have to debug it later. Acked-by: Michel Dänzer <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3699> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3699>
* gallium/u_vbuf: simplify the first if statement in u_vbuf_upload_buffersMarek Olšák2020-03-171-6/+8
| | | | | | | Acked-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4153> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4153>
* gallium/u_threaded: don't sync the thread for all unsychronized mappingsMarek Olšák2020-03-171-0/+3
| | | | | | | | | This was missing for the READ case. This improves glBegin/End performance. (vbo maps with WRITE | READ | UNSYCHRONIZED) Acked-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Mathias Fröhlich <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4153>
* gallium: add PIPE_CAP_DRAW_INFO_START_WITH_USER_INDICESMarek Olšák2020-03-111-0/+1
| | | | | Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3591>
* Revert "gallium: make handles of set_global_binding 64 bit"Karol Herbst2020-03-101-1/+1
| | | This reverts commit e1ffb72a05f9b50ee47767aaadbab3e47896ee14
* gallium: make handles of set_global_binding 64 bitKarol Herbst2020-03-101-1/+1
| | | | | | | | | | needed by CL Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4072> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4072>
* Revert "gallium/swr: Fix min/max range index draw"Krzysztof Raszkowski2020-03-031-9/+0
| | | | | | | This reverts commit 5e9a2c603f38308f7027d6a5e4575e5fc24c1bd5 Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4032> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4032>
* gallium: add PIPE_CAP_PSIZ_CLAMPEDLouis-Francis Ratté-Boulianne2020-03-031-0/+1
| | | | | | | | | | | This new capability indicates that the point size has been clamped. This also means that the gl_PointSize has been modified and that its value should be lowered for transform feedback, if needed. Signed-off-by: Louis-Francis Ratté-Boulianne <[email protected]> Reviewed-by: Alyssa Rosenzweig <[email protected]> Acked-by: Daniel Stone <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/2433>