summaryrefslogtreecommitdiffstats
path: root/src/mesa
Commit message (Collapse)AuthorAgeFilesLines
* mesa: Skip 3-byte array formats in _mesa_array_format_flip_channelsMichel Dänzer2020-04-271-1/+1
| | | | | | | | | | | | | Byte swapping makes no sense for 3-byte formats: Swapping the order of 2 or 4 bytes at a time would inevitably result in bytes getting mixed up between neighbouring pixels. Fixes crash with a debugging build on a big endian machine due hitting the unreachable() at the end of the function. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2665 Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4735>
* mesa: replace GLenum target with gl_shader_stage in NewProgramMarek Olšák2020-04-2711-64/+51
| | | | | | | | So that the GLSL compiler doesn't have to use the GLenum conversion functions. Reviewed-by: Timothy Arceri <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4756>
* mesa: extend _mesa_bind_vertex_buffer to take ownership of the buffer referenceMarek Olšák2020-04-276-17/+28
| | | | | | | | | This reduces overhead of _mesa_reference_buffer_object_ from 6% to 4% with glthread when profiling the game "torcs" with non-VBO data uploaded by glthread. Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* mesa: add offset_is_int32 param into _mesa_bind_vertex_buffer for glthreadMarek Olšák2020-04-276-17/+21
| | | | | | | | glthread will pass signed integer offsets, so don't reset negative offsets to 0 there. Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* mesa: add Const.BufferCreateMapUnsynchronizedThreadSafe & MESA_MAP_THREAD_SAFEMarek Olšák2020-04-274-0/+14
| | | | | Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* glthread: reduce dereferences of the next batchMarek Olšák2020-04-273-4/+9
| | | | | Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* glthread: use 32-bit align instead of 64-bit ALIGNMarek Olšák2020-04-271-1/+1
| | | | | Reviewed-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* mesa: remove exec="dynamic" from Draw functions that are not really dynamicMarek Olšák2020-04-274-115/+151
| | | | | Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* mesa: reset primitive restart state in glClientAttribDefaultEXTMarek Olšák2020-04-271-0/+9
| | | | | Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* mesa: replace _NEW_EVAL with vbo_exec_update_eval_mapsMarek Olšák2020-04-279-34/+52
| | | | | Reviewed-by: Erik Faye-Lund <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4758>
* st/mesa: Treat vertex inputs absent in inputMapping as zero in mesa_to_tgsiDanylo Piliaiev2020-04-271-2/+6
| | | | | | | | | | | | | | | | After updating vertex inputs being read based on optimized NIR, they may go out of sync with inputs in mesa IR. Which is translated to TGSI and used together with NIR if draw doesn't have llvm. It's much easier to treat such inputs as zero because there is no pass to entirely get rid of them and they don't contribute to shader's output. Fixes: d684fb37bfbc47d098158cb03c0672119a4469fe Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2815 Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Jose Maria Casanova Crespo <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4705>
* st/nir: Fix assigning PointCoord location with !PIPE_CAP_TEXCOORDConnor Abbott2020-04-251-0/+2
| | | | | | | | This was trying to emulate the effect of mapping GL -> TGSI -> NIR, but failed to handle VARYING_SLOT_PNTC which led to a kludgy workaround in freedreno. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4732>
* spirv: Use nir_const_value for spec constantsJason Ekstrand2020-04-241-2/+2
| | | | | | | | | | | When we originally wrote spirv_to_nir we didn't have a good scalar value union to handily use so we rolled our own thing for spec constants. Now that we have nir_const_value, we can use that and simplify a bunch of the spec constant logic. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Acked-by: Bas Nieuwenhuizen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4675>
* mesa: add support for AlphaToCoverageDitherControlNVIndrajit Kumar Das2020-04-239-0/+55
| | | | | 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-0/+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-231-2/+14
| | | | | | | | | | | 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>
* mesa: avoid redundant VBO updatesRob Clark2020-04-232-15/+15
| | | | | | | | | | | Avoids re-emitting unchanged VBO state, which is a big chunk of the state updates in gfxbench driver2 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: enable GL_EXT_draw_instanced for gles2Simon Zeni2020-04-231-1/+1
| | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Tapani Pälli <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3204>
* meta,i965: Rip GL_EXT_texture_multisample_blit_scaled support out of metaJason Ekstrand2020-04-226-318/+1
| | | | | | | | | | | i965 is the only driver that ever linked to this code and it's been doing it in BLORP for a long time now. The only possible case where it would have fallen back to meta was for depth/stencil but that should have ended starting with 6cec618e82aa2. Rip out the dead code. Acked-by: Lionel Landwerlin <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4622>
* mesa/gallium: do not use enum for bit-allocated memberErik Faye-Lund2020-04-211-1/+1
| | | | | | | | | | | The signedness of enums are undefined, so on platforms with signed enums, this isn't going to work. One such platform is Microsoft Windows. So let's just use an unsigned here instead. Fixes: b1c4c4c7f53 ("mesa/gallium: automatically lower alpha-testing") Acked-by: Alyssa Rosenzweig <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4648>
* remove final imports.h and imports.c bitsDylan Baker2020-04-21201-838/+866
| | | | | | | | | | | This moves the fi_types to a new mesa_private.h and removes the imports.c file. The vast majority of this patch is just removing pound includes of imports.h and fixing up the recursive includes. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* dri/nouveau: replace assert with unreachableDylan Baker2020-04-211-1/+3
| | | | | | | | | | | I don't know why removing imports.h suddenly makes clang realize that this function can not return in a non-debug build, but it does. Unreachable is better because it doesn't have this problem. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* mesa: move ADD_POINTERS to macros.hDylan Baker2020-04-211-0/+1
| | | | | | | | | | | | I'm not really sure where else to put it. Since imports.h only has two things left in it (neither of which are abstractions for smoothing away libc differences) I'd like to get them out of there. macros.h is the only place I can think of to put this macro. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* mesa|mapi: replace _mesa_[v]snprintf with [v]snprintfDylan Baker2020-04-2115-30/+41
| | | | | | | | | | MSVC 2015 and newer has perfectly valid snprintf and vsnprintf implementations, let's just use those. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace imports memory functions with utils memory functionsDylan Baker2020-04-2116-93/+95
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace malloc macros in imports.h with u_memory.h versionsDylan Baker2020-04-2163-0/+65
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* Replace IS_INF_OR_NAN with util_is_inf_or_nanDylan Baker2020-04-2110-27/+28
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace IROUND with util functionsDylan Baker2020-04-2110-78/+79
| | | | | | | | | | | | This adds two new util functions to rounding.h, _mesa_iroundf and mesa_lround, which are just wrappers around roundf and round, that cast to int and long int respectively. This is possible since mesa recently dropped support for VC2013, since 2015 and 2017 support roundf. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* Replace IROUND_POS with _mesa_roundevenfDylan Baker2020-04-213-14/+11
| | | | | | | | | | | Which has the same behavior as long as you don't change the FPU rounding mode. Other code in mesa makes the same assumption so it should be safe to make that assumption more generally. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace IFLOOR with util_ifloorDylan Baker2020-04-216-46/+47
| | | | | | | | | which are exactly the same function with exactly the same implementation Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace LOG2 with util_fast_log2Dylan Baker2020-04-212-3/+3
| | | | | | | | | | | The implementation is somewhat different, although if you go back in time far enough they're the same, but the one in u_math was changed a long time back to be faster. Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace _mesa_logbase2 with util_logbase2Dylan Baker2020-04-215-10/+10
| | | | | | | Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace _mesa_next_pow_two_* with util_next_power_of_two_*Dylan Baker2020-04-211-1/+1
| | | | | | | | | | The 64 bit variant in imports.h isn't even used. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* replace _mesa_is_pow_two with util_is_power_of_two_*Dylan Baker2020-04-218-27/+27
| | | | | | | | | | | | | Mostly this uses util_is_power_of_two_or_zero, which has the same behavior as _mesa_is_pow_two when the input is zero. In cases where the value is known to be != 0 ahead of time I used the _nonzero variant as it may be faster on some platforms. Reviewed-by: Eric Anholt <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Reviewed-by: Kristian H. Kristensen <[email protected]> Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
* st/mesa: Re-assign vs in locations after updating nir info for ffvp/ARB_vpDanylo Piliaiev2020-04-211-0/+1
| | | | | | | | | | | | | | | | | After call to nir_shader_gather_info - inputs_read may have changed so st_nir_assign_vs_in_locations should be called for shader to remain in sync with vbo state. Fixes piglit tests: gl-1.0-fpexceptions gl-1.1-color-material-unused-normal-array arb_vertex_program-unused-attributes regression on several gallium drivers. Fixes: d684fb37bfbc47d098158cb03c0672119a4469fe Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4645>
* mesa: fix crash in find_valuePierre-Eric Pelloux-Prayer2020-04-211-1/+5
| | | | | Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4584>
* glsl: Hard-code noise to zero in builtin_functions.cppJason Ekstrand2020-04-214-24/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Version 4.4 of the GLSL spec changed the definition of noise*() to always return zero and earlier versions of the spec allowed zero as a valid implementation. All drivers, as far as I can tell, unconditionally call lower_noise() today which turns ir_unop_noise into zero. We've got a 10-year-old comment in there saying "In the future, ir_unop_noise may be replaced by a call to a function that implements noise." Well, it's the future now and we've not yet gotten around to that. In the mean time, the GLSL spec has made doing so illegal. To make things worse, we then pretend to handle the opcode in glsl_to_nir, ir_to_mesa, and st_glsl_to_tgsi even though it should never get there given the lowering. The lowering in st_glsl_to_tgsi defines noise*() to be 0.5 which is an illegal implementation of the noise functions according to pre-4.4 specs. We also have opcodes for this in NIR which are never used because, again, we always call lower_noise(). Let's just kill the whole opcode and make builtin_builder.cpp build a bunch of functions that just return zero. Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Eric Anholt <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4624>
* st/glsl_to_nir: make use of nir linker for linking uniformsTimothy Arceri2020-04-211-10/+9
| | | | | Reviewed-by: Alejandro Piñeiro <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4395>
* i965/bufmgr: Add support for MMAP_OFFSET ioctl.Rafael Antognolli2020-04-201-1/+38
| | | | | | | | | | Use the new DRM_IOCTL_I915_GEM_MMAP_OFFSET ioctl when available. v2: update getparam check (Ken). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>
* i965/bufmgr: Factor out GEM_MMAP ioctl from mmap_cpu and mmap_wc.Rafael Antognolli2020-04-201-26/+29
| | | | | | | | | | | | We want to add a new ioctl for mmap'ing buffers, so let's avoid duplicating that code on both functions by extracting it from them first. v2: Update helper function names (Ken). Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Jordan Justen <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/1675>
* Fix promotion of floats to doublesAlbert Astals Cid2020-04-184-4/+4
| | | | | | | | | Use the f variants of the math functions if the input parameter is a float, saves converting from float to double and running the double variant of the math function for gaining no precision at all Reviewed-by: Matt Turner <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3969>
* st/mesa: Update shader info of ffvp/ARB_vp after translation to NIRDanylo Piliaiev2020-04-171-3/+20
| | | | | | | | | | | | | | | | | | We must update stp->Base.info after translation and before st_prepare_vertex_program is called, because inputs_read may become outdated after NIR optimization passes. For ffvp/ARB_vp inputs_read is populated based on declared attributes without taking their usage into consideration. When creating shader variants we expect that their inputs_read would match the base ones for input mapping to work properly. Cc: <[email protected]> Fixes: 8a0dd0af3f1a6c0310a08daf4220132ec6815b31 Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/2758 Signed-off-by: Danylo Piliaiev <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4598>
* mesa: add interaction between compute derivatives and variable local sizesIlia Mirkin2020-04-171-0/+31
| | | | | | | | | This is an added interaction in NV_compute_shader_derivatives added in Sep 2019. Signed-off-by: Ilia Mirkin <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4583>
* st/mesa: properly guard fallback_copy_texsubimage aginst failed mapsKarol Herbst2020-04-171-1/+10
| | | | | | | | Fixes random crashes in some packed_pixel GLES CTS tests Signed-off-by: Karol Herbst <[email protected]> Reviewed-by: Marek Olšák <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4592>
* vbo: avoid including wingdi.h on win32Erik Faye-Lund2020-04-161-0/+3
| | | | | | | | | | | | On Windows, main/glheader.h ends up including windows.h which in turn includes wingdi.h unless the NOGDI macro is defined. And wingdi.h defines a macro called "ERROR", which we end up redefining below. To avoid a warning on the redefinition, we can define NOGDI to prevent wingdi.h from implicitly being included. Reviewed-by: Brian Paul <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4577>
* mesa: fixup cast expressionErik Faye-Lund2020-04-161-1/+1
| | | | | | | | | This cast-expression was meant to cast the result of the terniary expression, but it just casted the condition expression instead. Let's correct this, to silence a compiler-warning. Reviewed-by: Brian Paul <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4577>
* st/mesa: fix a crash due to passing a draw vertex shader into the driverMarek Olšák2020-04-161-1/+2
| | | | | | | | Fixes: bc99b22a305be5e5a5f Closes: #2754 Acked-by: Pierre-Eric Pelloux-Prayer <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4527>
* mesa/st: initialize all winsys_handle fields for memory objectsTapani Pälli2020-04-161-7/+11
| | | | | | | | | Signed-off-by: Tapani Pälli <[email protected]> Reported-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Eduardo Lima Mitev <[email protected]> Reviewed-by: Lionel Landwerlin <[email protected]> Cc: <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4547>
* st/mesa: add support for GL_NV_viewport_array2Ilia Mirkin2020-04-153-1/+6
| | | | | | 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>
* mesa: add NV_viewport_array2 enable, attach to glslIlia Mirkin2020-04-152-0/+2
| | | | | | 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>