Commit Graph

47054 Commits

Author SHA1 Message Date
Eric Anholt 9837370adf mesa: Remove unused Mesa IR PROGRAM_* register files.
Now that glsl-to-tgsi is gone, a bunch of this is dead.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
2022-05-05 22:25:03 +00:00
Eric Anholt e566b54a59 glsl: Remove UBO reference lowering.
All UBO-supporting drivers now go through the NIR path, which does a
better job of it.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
2022-05-05 22:25:03 +00:00
Eric Anholt 6ffdca73d3 mesa/st: Remove TGSI-only shader lowering code.
These are no longer called.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
2022-05-05 22:25:03 +00:00
Emma Anholt c3001eadcf mesa/st: Drop the attrib remapping in st_prepare_vertex_program().
This was only used in the GLSL-to-TGSI path, which is no longer.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
2022-05-05 22:25:03 +00:00
Emma Anholt 31f5328398 mesa/st: Remove TGSI shader program variant handling.
We no longer have anything generating gl_programs with TGSI in them since
retiring GLSL-to-TGSI.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
2022-05-05 22:25:03 +00:00
Emma Anholt 214c774ba6 mesa/st: Remove st_glsl_to_tgsi.
It is no longer called, and can be retired.

Fixes: #1924, #822, #6073

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
2022-05-05 22:25:03 +00:00
Eric Anholt b167203cfe mesa/st: Always generate NIR from GLSL, and use nir_to_tgsi for TGSI drivers.
The NIR path through the frontend is effectively the only one maintained
for a quite a while now.  We can see that effect with !15540, where the
TGSI generation path was regressed to assertion fail on real-world
shaders, and nobody noticed until I came along trying to test the
NIR-to-TGSI transition.

We already have a nir_to_tgsi() call for translating NIR representation
for ARB programs into TGSI before handing them off to the driver.  This
change makes that path get taken for GLSL programs as well.

This is the minimum change to get all the drivers on NIR from GLSL, to
give a simple commit to bisect too.  The dead code removal comes next.

Now every driver benefits from shared NIR optimizations for GLSL, and we
can start retiring GLSL optimizations.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8044>
2022-05-05 22:25:03 +00:00
Jesse Natalie 53a94fbdd5 mesa: Ensure ARB programs end in a newline
If the last line of an ARB program has a comment, the program will
fail to parse, because the lexer only considers a comment valid if
it ends in a newline, not EOF. The parser then fails on the '#'.

Reviewed-by: Joshua Ashton <joshua@froggi.es>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16230>
2022-05-02 16:02:54 +00:00
Erik Faye-Lund ba9c917149 mesa: add missing error-path
The ARB_shader_objects spec says the following:

> The error INVALID_VALUE is generated by any command that takes one or
> more handles as input, and one or more of these handles are not an
> object handle generated by OpenGL.

And a long, long time ago, we used do to just that for
glDeleteObjectARB... Until 9ac9605de1, all the way back in February 2006,
where the error condition was removed without explanation.

Let's restore it, because it should really be there.

This was noticed by running the tests that are in the mesa-demos
repository, that actually tested this condition.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Cc: mesa-stable
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16211>
2022-04-29 19:57:58 +00:00
Juan A. Suarez Romero a47375d4da mesa: unref syncobj after wait_sync
Before returning the wait_sync() function, the sync object must be
unreferenced.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6377
Fixes: 0af7c1e385 ("mesa/st: merge the syncobj code from st into mesa")
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16242>
2022-04-29 14:36:59 +00:00
Pierre-Eric Pelloux-Prayer bd88bed855 gallium: add PIPE_CAP_ALLOW_DRAW_OUT_OF_ORDER
This way we can make allow_draw_out_of_order true by default for all
apps, iff the driver allows it.

And allow_draw_out_of_order=false can still be used in drirc, for
apps that need this optim to be turned off.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16139>
2022-04-29 07:52:59 +00:00
Italo Nicola 5f6a43cde6 mesa/st: call pipe->link_shader even if ir loaded from cache when linking
Previously, if the shader was already cached, the pipe->link_shader hook
wouldn't be called, and the gallium driver wouldn't know that shaders
were being linked.

This helps VirGL, because sometimes the guest shader cache can be hit,
while the host shader cache would be missed. VirGL uses this hook to
make the host immediately link shaders, instead of lazily linking them
when a draw call happens, which can degrade performance.

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15927>
2022-04-25 14:06:19 +00:00
Mike Blumenkrantz 272f6ede0d mesa/st: clamp GL_RENDERBUFFER to GL_TEXTURE_2D for sparse queries
this is a legal query that cts uses, so don't just abort

Fixes: b1c32a6c8c ("mesa: add ARB_sparse_texture query in glGetInternalformativ")

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16097>
2022-04-24 15:56:05 +00:00
Juan A. Suarez Romero 39cebe24ae gallium: move get_canonical_format hook to pipe_screen
pipe_context shouldn't have functions that return values because this
prevent multithreading.

Move this hook to pipe_screen.

Fixes: 606e42027e ("gallium: add hook on getting canonical format")
Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16078>
2022-04-22 08:51:56 +00:00
Mike Blumenkrantz 0f28da9cd4 gallium: add PIPE_CAP_MULTI_DRAW_INDIRECT_PARTIAL_STRIDE
GL spec states that the stride for indirect multidraws:
* cannot be negative
* can be zero
* must be a multiple of 4

some drivers can't support strides which are not a multiple of the
size of the indirect struct being used, however, so rewrite those to
direct draws

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15963>
2022-04-21 02:29:09 +00:00
Jason Ekstrand 1b8a43a0ba util: Remove util_cpu_detect
util_cpu_detect is an anti-pattern: it relies on callers high up in the call
chain initializing a local implementation detail. As a real example, I added:

...a Mali compiler unit test
...that called bi_imm_f16() to construct an FP16 immediate
...that calls _mesa_float_to_half internally
...that calls util_get_cpu_caps internally, but only on x86_64!
...that relies on util_cpu_detect having been called before.

As a consequence, this unit test:

...crashes on x86_64 with USE_X86_64_ASM set
...passes on every other architecture
...works on my local arm64 workstation and on my test board
...failed CI which runs on x86_64
...needed to have a random util_cpu_detect() call sprinkled in.

This is a bad design decision. It pollutes the tree with magic, it causes
mysterious CI failures especially for non-x86_64 developers, and it is not
justified by a micro-optimization.

Instead, let's call util_cpu_detect directly from util_get_cpu_caps, avoiding
the footgun where it fails to be called.  This cleans up Mesa's design,
simplifies the tree, and avoids a class of a (possibly platform-specific)
failures. To mitigate the added overhead, wrap it all in a (fast) atomic
load check and declare the whole thing as ATTRIBUTE_CONST so the
compiler will CSE calls to util_cpu_detect.

Co-authored-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Marek Olšák <maraeo@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15580>
2022-04-20 18:44:35 +00:00
Yonggang Luo a3a43e5fa8 win32: Do not use BUILD_GL32, we use def file to export win32 dll symbols.
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14041>
2022-04-19 19:38:47 +00:00
Juan A. Suarez Romero 606e42027e gallium: add hook on getting canonical format
On swizzled copies canonical formats are used to reduce the formats to a
simpler subset.

Nevertheless, it is possible that some of the canonical formats defined
in Gallium are actually not supported by the drivers themselves.

This provides a driver-defined hook that can be used to provide an
alternative canonical format in case the canonical one defined by
Gallium is not supported by the driver.

Signed-off-by: Juan A. Suarez Romero <jasuarez@igalia.com>
Reviewed-by: Iago Toral Quiroga <itoral@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15693>
2022-04-19 08:03:42 +00:00
Erik Faye-Lund 7ca1253932 gallium: rename ldexp shader-cap
This is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15922>
2022-04-18 20:43:18 +00:00
Erik Faye-Lund 439c212a3c gallium: rename dfracexp/dldexp shader-cap
This is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15922>
2022-04-18 20:43:18 +00:00
Erik Faye-Lund 3efd6d4bfe gallium: rename dround shader-cap
This is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15922>
2022-04-18 20:43:18 +00:00
Erik Faye-Lund 9b545ea691 gallium: rename continue shader-cap
This is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15922>
2022-04-18 20:43:18 +00:00
Sviatoslav Peleshko dd7278aa10 mesa: flush bitmap caches when changing scissors or window rects state
If we change the sate without flushing the bitmap cache, the cache might be
rendered with the new scissor, which excludes some parts that should've
been rendered with the old state, and vice versa.

Cc: mesa-stable
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6233

Signed-off-by: Sviatoslav Peleshko <sviatoslav.peleshko@globallogic.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15881>
2022-04-18 12:39:03 +00:00
Timothy Arceri 3dae5442ef glsl/st: vectorise interfaces of SSO shader programs
For example the SSO program may consist of just tcs -> gs or even
just a vs. In these cases we want to vectorise the externally
facing shader interfaces just like we would in non SSO programs.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15941>
2022-04-18 02:34:24 +00:00
Mike Blumenkrantz 2058ae7b43 mesa/st: set normalized coords for RECT samplers if rects are unsupported
the shaders will never see these, so set the expected value for 2D

cc: mesa-stable

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15895>
2022-04-14 22:57:23 +00:00
Kenneth Graunke 68ef895674 st/mesa: Transcode ASTC to BC7 (BPTC) where possible
This patch adds support for transcoding ASTC to BC7 (BPTC) and prefers
it over BC3 (DXT5) when hardware supports that format.

BC7 is a much newer format (~2009 vs. ~1999) and offers higher quality
than the older BC3 format.  Furthermore, our encoder seems to be faster.

Tapani put together a small benchmark for transcoding a 1024x1024 ASTC
texture, and switching from BC3 to BC7 improves performance of that
microbenchmark by 25% on my Tigerlake NUC (with hardware ASTC disabled
so we can test this path).  Presumably, this isn't fundamental to the
formats, but rather reflects the speed of our in-tree compressors.

So, we should use BC7 where possible.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15875>
2022-04-13 07:58:11 +00:00
Kenneth Graunke d4521a2515 st/mesa: Make transcode_astc also check for non-SRGB format support
This is probably unnecessary in that all drivers which support the sRGB
format likely also support the non-sRGB format.  But we may as well
check both the formats we use, for documentation if nothing else.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15875>
2022-04-13 07:58:11 +00:00
Timothy Arceri 20ab7046c0 glsl/st: use nir pass to lower indirect rather than GLSL IR
Will allow us to drop more GLSL IR code in future once we switch
all drivers to NIR. Also stops the need for all drivers to call
this pass to remove indirect temps that may have been added during
the NIR varying linking lowering/optimisations.

This patch fixes some tests on i915, d3d12, lima and vc4.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15871>
2022-04-12 06:51:20 +00:00
Mike Blumenkrantz ee29db0270 mesa/st: handle adding pointsize when gl_Position is never written
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15821>
2022-04-10 16:45:15 +00:00
Mike Blumenkrantz cfca760d6e mesa/st: handle copy_deref cases for adding pointsize
these may not have been lowered yet

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15821>
2022-04-10 16:45:15 +00:00
Mike Blumenkrantz a2823747bb mesa/st: fix pointsize adding check
* components is already multiplied by 4
* also verify base maxcomponents for gs

fixes #6282

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15821>
2022-04-10 16:45:15 +00:00
Mike Blumenkrantz 6357ce2b8e mesa: set PointSizeIsOne on context creation
forgot to add this when inverting the flag's meaning previously

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15821>
2022-04-10 16:45:15 +00:00
Emma Anholt 00e9c4f3c9 st/glsl-to-tgsi: Fix handling of csel(bool, vec, vec).
We were throwing an assertion failure across shader-db on nv92.  I'm
guessing this is a regression from !14573.

Cc: mesa-stable
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15540>
2022-04-08 23:56:11 +00:00
Emma Anholt ef9f2e8829 tgsi/transform: Make tgsi_transform_shader() manage token allocation.
Previously, the caller allocated storage and tgsi_transform_shader() would
emit into that, returning how many tokens it emitted.  All the callers had
to guess at how much storage was necessary, trying not to over-allocate
but also getting enough that you wouldn't (effectively) silently run out
of space.

Instead, make tgsi_transform_shader() do the allocation for you, taking
just a hint of how much space you think you need, and internally double
size when necessary.  Fixes failures on virgl with fp64 since we've added
more fp64 virglrenderer workarounds and its old "XXX: is this enough?"
allocation wasn't any more.

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15782>
2022-04-08 21:31:44 +00:00
Mike Blumenkrantz 80683943d1 mesa/st: simplify st_can_add_pointsize_to_program iterator
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:10 -04:00
Mike Blumenkrantz 16f08ad469 mesa/st: don't precompile the pointsize upload variant anymore
this is no longer likely to be used, so precompile the base variant now

also delete some now-unused code

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:10 -04:00
Mike Blumenkrantz 4f027fbff2 mesa/st: only flag pointsize constant uploads if they're needed
now that shaders are guaranteed to have a pointsize export, the only time
the variant using the uploaded constant is needed is when pointsize != 1.0

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:10 -04:00
Mike Blumenkrantz f964881fcc mesa/st: only use constant upload pointsize variants if pointsize != 1.0
it's not that common for apps to need varying pointsize, so now that shaders
are guaranteed to have the export in the shader, the constant version is almost
never used

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:10 -04:00
Mike Blumenkrantz 2b626af110 mesa/st: also add pointsize to fixedfunction vertex shaders as needed
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:10 -04:00
Mike Blumenkrantz d773055d92 mesa/st: always inject a 1.0 pointsize for vertex stages
since 1.0 is used in nearly every case, drivers requiring this exporting
can avoid potential shader variants by adding a 1.0 export to the base
shader variant and the only using the ubo upload when pointsize is explicitly
set for wide point functionality

drivers can then be responsible for removing unused pointsize exports
as needed (or desired)

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:09 -04:00
Mike Blumenkrantz 3aa449ff72 mesa/st: declare added pointsize var as hidden
ensure this isn't counted as part of the shader and ignored for e.g.,
glGetProgramInterfaceiv

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:09 -04:00
Mike Blumenkrantz 02b573e03e mesa: add a bool indicating when pointsize == 1.0
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15699>
2022-04-07 21:56:09 -04:00
Mike Blumenkrantz 3883ca5ea7 st/manager: update framebuffer size if texture has been resized
zink/kopper can and does expect this when resizing swapchains,
so don't ignore it

Reviewed-by: Adam Jackson <ajax@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14541>
2022-04-07 00:17:40 +00:00
Yonggang Luo b2ece67f11 util: Rename PIPE_DEBUG_TYPE to UTIL_DEBUG_TYPE
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15657>
2022-04-01 01:52:43 +00:00
Yonggang Luo ab225a1e36 util: Rename pipe_debug_type to util_debug_type
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15657>
2022-04-01 01:52:43 +00:00
Yonggang Luo 2ca6ef22f7 util: Rename pipe_debug_callback to util_debug_callback
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15657>
2022-04-01 01:52:43 +00:00
Erik Faye-Lund 83ed40cdcd vbo/dlist: do not try to pad an empty draw
In the case where u_index_generator returns zero new vertices, we never
filled tmp_indices before trying to duplicate the last veretx. This
causes us to read unitialized memory.

This fixes a Valgrind issue triggering in glxgears on Zink:

---8<---
==296461== Invalid read of size 2
==296461==    at 0x570F335: compile_vertex_list (vbo_save_api.c:733)
==296461==    by 0x570FEFB: wrap_buffers (vbo_save_api.c:1021)
==296461==    by 0x571050A: upgrade_vertex (vbo_save_api.c:1134)
==296461==    by 0x571050A: fixup_vertex (vbo_save_api.c:1251)
==296461==    by 0x57114D1: _save_Normal3f (vbo_attrib_tmp.h:315)
==296461==    by 0x10B750: ??? (in /usr/bin/glxgears)
==296461==    by 0x10A2CC: ??? (in /usr/bin/glxgears)
==296461==    by 0x4B3F30F: (below main) (in /usr/lib/libc.so.6)
==296461==  Address 0x11ca23de is 2 bytes before a block of size 1,968 alloc'd
==296461==    at 0x4845899: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==296461==    by 0x570E647: compile_vertex_list (vbo_save_api.c:604)
==296461==    by 0x570FEFB: wrap_buffers (vbo_save_api.c:1021)
==296461==    by 0x571050A: upgrade_vertex (vbo_save_api.c:1134)
==296461==    by 0x571050A: fixup_vertex (vbo_save_api.c:1251)
==296461==    by 0x57114D1: _save_Normal3f (vbo_attrib_tmp.h:315)
==296461==    by 0x10B750: ??? (in /usr/bin/glxgears)
==296461==    by 0x10A2CC: ??? (in /usr/bin/glxgears)
==296461==    by 0x4B3F30F: (below main) (in /usr/lib/libc.so.6)
---8<---

Fixes: dcbf2423d2 ("vbo/dlist: add vertices to incomplete primitives")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15633>
2022-03-31 13:21:13 +02:00
Emma Anholt 97f17d4b38 glsl: Delete dont_lower_swz path of lower_quadop_vector.
This was last used with Mesa classic, in _mesa_ir_link_shader().

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15623>
2022-03-30 22:26:15 +00:00
Emma Anholt 761eb7e539 glsl: Delete unused EmitNoPow path.
This was last used with i915c, now lower_fpow covers this class of
lowering.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15623>
2022-03-30 22:26:15 +00:00
Mike Blumenkrantz 6cfde0abe9 mesa/st: don't add pointsize to ES programs if it already exists
an obvious missed case from the previous series, but there's no need
to-readd an output if it already exists here

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15590>
2022-03-30 03:49:36 +00:00
Mike Blumenkrantz 2b22485702 mesa/st: rework pointsize constant uploads
this now has a flag that is toggled when the last vertex stage changes,
and this will trigger the appropriate updates during state validation

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15590>
2022-03-30 03:49:36 +00:00
Mike Blumenkrantz 0108323996 mesa/st: always flag last vertex stage constants for upload on pointsize change
if the driver requires pointsize uploads, the pointsize has to actually be uploaded
whenever the pointsize changes

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15590>
2022-03-30 03:49:36 +00:00
Mike Blumenkrantz 452d4d00df mesa/st: rework atom flagging when pointsize changes
if the driver requires pointsize uploads, only flag the last vertex
stage for updates, not all vertex stages

this should be functionally equivalent but without the unnecessary overhead
of also scanning the other stages

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15590>
2022-03-30 03:49:36 +00:00
Mike Blumenkrantz eaf3c72a83 mesa/st: add special casing for pointsize constant updating during validate
the previous method of using affected_states to trigger constant updates
was ineffectual in the scenario where a ubo pointsize was needed on
the first time a non-precompiled shader was used after being the not-last
vertex stage:

* have vs+gs -> gs precompiles with pointsize lowering -> gs constants get updated
* remove gs -> vs was precompiled without pointsize lowering -> vs constants broken

now just do a quick check as in st_atom_shader.c and set the flag manually to
ensure the update is done correctly every time

cc: mesa-stable

fixes #6207

fixes (radv):
KHR-GL46.texture_cube_map_array.image_op_fragment_sh
KHR-GL46.texture_cube_map_array.sampling
KHR-GL46.texture_cube_map_array.texture_size_fragment_sh
KHR-GL46.constant_expressions*

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15570>
2022-03-25 04:03:23 +00:00
Erik Faye-Lund d5ed8d4126 gallium: rename image atomic inc-wrap cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15448>
2022-03-23 08:54:06 +00:00
Erik Faye-Lund 880d848b7d gallium: rename image atomic float-add cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15448>
2022-03-23 08:54:06 +00:00
Dylan Baker 6d4eb4a72e mesa/main: replace use of simple_list with util/list
Because really, do we want simple_list?

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14983>
2022-03-17 18:25:55 +00:00
Erik Faye-Lund 115298b71e gallium: rename ballot cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund b3ce733da9 gallium: rename clock cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 7984c5884c gallium: rename group-vote cap
This cap is no longer TGSI specific, so let's rename it to reflect
reality.

Because the name got a bit vague when removing the TGSI-bits, let's add
some more details to the name.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund a6d7ead686 gallium: rename texture query samples cap
This isn't specific to TGSI, so let's update the name to reflect
reality.

Because the name of the opcode was TGSI specific, let's pick a new one,
based on the naming of the PIPE_CAP_TEXTURE_QUERY_LOD cap.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 930b38e7cd gallium: rename read-outputs cap
This cap is no longer TGSI-specific, so let's update the name to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 2dff9bea4f gallium: rename array-components cap
This cap is no longer TGSI specific, so let's update the name to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 350329feb1 gallium: rename sysval caps
These aren't spiecic to TGSI any more, so let's rename them to reflect
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund df40de91d9 gallium: rename fine derivative cap
This is no longer TGSI specific, so let's rename it to reflect the
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 2a8e11e101 gallium: rename pixel-coord caps
These aren't specific to TGSI, so let's rename them to reflect the
reality.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:42 +00:00
Erik Faye-Lund 89797fac56 gallium: rename layer-viewport caps
Similar to the previous commits, these aren't TGSI specific, so let's
drop TGSI from their name.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:41 +00:00
Erik Faye-Lund 8ac7dc9cf6 gallium: rename vs instance id cap
This cap is no longer specific to TGSI, so let's rename it and update
the documentation to reflect that.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:41 +00:00
Erik Faye-Lund f8809fbdb8 gallium: rename pack half-float cap
This cap no longer has anything to do with TGSI, as the lowering happens
on GLSL IR, and applies just as much to NIR drivers. So let's rename
this cap and update the docs to reflect the current situation.

Reviewed-by: Adam Jackson <ajax@redhat.com>
Acked-by: Ian Romanick <ian.d.romanick@intel.com>
Reviewed-by: Juan A. Suarez <jasuarez@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15316>
2022-03-17 16:44:41 +00:00
Mike Blumenkrantz 65bf1cbc26 gallium: add flag to draw info to indicate converted draws
this draw mode in particular requires driver-specific conversions
for queries (e.g., number of vertices), so pass that info through

the only limitation is that it doesn't work for dlists,
but I have yet to see a real use case of a statistics query being used with dlists

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15326>
2022-03-16 01:45:48 +00:00
Rob Clark 5f6dce05c3 mesa: Easier shader capture for android
I've typed this patch a few times already.. lets just add some debug
code which can be easily switched on so I don't have to type it again.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15336>
2022-03-12 16:41:59 +00:00
Alyssa Rosenzweig e0b6493c49 mesa: Remove unused framebuffer validation
Probably unused since we deleted classic.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15255>
2022-03-11 22:02:23 -05:00
Tapani Pälli 2a14baab85 mesa: check for valid internalformat with glTex[Sub]Image
This changes our error handling to be compatible with upcoming
specification change that unifies glTex[Sub]Image error handling
between OpenGL ES 2.0 vs ES 3.0+ specifications, see:

https://gitlab.khronos.org/opengl/API/-/issues/147

OpenGL ES 2.0.25 spec states:

   "Specifying a value for internalformat that is not one of
    the above values generates the error INVALID_VALUE. If
    internalformat does not match format, the error
    INVALID_OPERATION is generated."

This fixes following new tests:

    KHR-GLES31.core.compressed_format.*
    KHR-GLES32.core.compressed_format.*

v2: GL_INVALID_OPERATION -> GL_INVALID_VALUE in extension
    checks, remove (now overlapping) extension checks from
    _mesa_gles_error_check_format_and_type (Eric Anholt)

v3: take GLES version in to account in internalformat checks

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12936>
2022-03-11 09:58:28 +00:00
Rob Clark f4ec900953 mesa: Fix discard_framebuffer for fbo vs winsys
GL is annoying when it comes to having different enums for winsys vs
fbo.

Note that the issue this closes was only accidentially exposed by a
change the resulted in sysmem vs GMEM path taken.

Fixes: db2ae51121 ("mesa: Skip partial InvalidateFramebuffer of packed depth/stencil.")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/6103
Signed-off-by: Rob Clark <robdclark@chromium.org>
Reviewed-by: Matt Turner <mattst88@gmail.com>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15308>
2022-03-09 20:40:53 +00:00
Mike Blumenkrantz fa323cb93a mesa/st: make export_point_size shader key clobber existing psiz
this is necessary to upload the API value using the uniform constant

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 9ae0cdc453 mesa/st: check max output components for adding pointsize during precompile
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 070a7b506d mesa/st: count FF shaders as needing psiz export for precompile
this is consistent with logic for regular compiles

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 1183988d74 mesa/st: precompile with API pointsize only if the shader doesn't have pointsize
this is a more accurate hint, and maintains the existing behavior given
subsequent changes to this area

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 96098d7c25 mesa/st: simplify pointsize precompile conditional
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 882abacde3 mesa/st: simplify pointsize shader update conditional
ES contexts have no API toggle for this, so it will never be flagged

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz b73663c51e mesa: always set PointSizeEnabled for API_OPENGLES2
this is implicit, so make it explicit

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 9d98bc238e mesa/st: only add pointsize output if it doesn't exceed max component limit
fixes (zink-nvidia):
dEQP-GLES31.functional.geometry_shading.basic*

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz fdee7240ff mesa/st: conditionally add pointsize outputs to ES tess/geom shaders
if the driver requires this value to be set, add it if the shader doesn't
use the ext to allow exporting it

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 597bd11b7b mesa/st: add a gl_program struct flag to skip psiz exports for xfb
if this output did not exist in the original shader,
then it must not be exported in xfb

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Mike Blumenkrantz 53cbba83eb glsl: store OES/EXT point_size extension enablement to shader struct
Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15228>
2022-03-09 05:10:21 +00:00
Ilia Mirkin 897a7fbbf1 mesa: enable GL_EXT_texture_sRGB_RG8 on desktop
Looks like an extension number was assigned in late 2020. This makes it
possible to hook up this format to teximage-colors without teaching it
about ES.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15211>
2022-03-03 04:37:12 +00:00
Marek Olšák 5ca7c20cf7 st/mesa: do nir_lower_io() for inputs & outputs with transform feedback info
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14388>
2022-03-01 21:59:56 +00:00
Timothy Arceri 6eec8fcbfa glsl/nir: free GLSL IR right after we convert to NIR
Gives us memory back faster which is useful for pathalogical CTS
tests.

The GLSL IR was previously used after converting to NIR for things
like building the GL resource list but we have had a NIR version
for this for some time and I don't believe there are any other
use cases left for keeping the old IR hanging around this long.

Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15127>
2022-02-24 01:10:49 +00:00
Adam Jackson 2eb644e470 mesa: Enable GL_NV_pack_subimage
This just legalizes a few of the pixelstore pack parameters in GLES2
that are already legal in desktop and GLES3. glamor takes advantage of
this in the GetImage and software-fallback paths.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14977>
2022-02-22 10:45:28 -05:00
Jiadong Zhu 10e4bad803 st/mesa: set GL_DYNAMIC_STORAGE_BIT for GL-VK interop buffers
GL_DYNAMIC_STORAGE_BIT needs to be set to make glBufferSubData work.

Reviewed-by: Tapani Pälli <tapani.palli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14750>
2022-02-21 21:42:04 +00:00
Alyssa Rosenzweig 7ec1d96e5e nir: Set internal=true in nir_builder_init_simple_shader
Matches the expected use by callers. We do need to fix up a few callers which
use this call for external shaders.

v2: Fix up a radv call site (Rhys).

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Reviewed-by: Emma Anholt <emma@anholt.net> [v1]
Acked-by: Rhys Perry <pendingchaos02@gmail.com>
Acked-by: Jason Ekstrand <jason.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14936>
2022-02-17 23:30:46 +00:00
Tapani Pälli d3b4202b63 mesa/st: always use DXT5 when transcoding ASTC format
This fixes artifacts seen in games when using ASTC transcoding,
we need to use DXT5 for proper alpha channel support.

Number of components is a block specific property, there is no easy
way to see if we will require >1bit alpha support or not, so simply
use DXT5 to have support in place.

Fixes: 91cbe8d855 ("gallium: Add a transcode_astc driconf option")
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Nanley Chery <nanley.g.chery@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15029>
2022-02-16 08:50:28 +00:00
Dave Airlie 127bcbed18 gallivm/st/lvp: add flags arg to get_query_result_resource api.
Currently this just has wait, but in order to get the right answer
for vulkan partial, lavapipe/llvmpipe need to pass a partial flag
through here in the future.

This just changes the API so that's possible.

v2: use an enum (zmike)

Acked-by: Ilia Mirkin <imirkin@alum.mit.edu>
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15009>
2022-02-15 10:12:01 +10:00
Ian Romanick 59889eb3ae Re-indentation after the previous commit
Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14573>
2022-02-11 17:25:34 +00:00
Ian Romanick 912299cb39 glsl: Eliminate ir_assignment::condition
Reformatting is left for the next commit.

v2: Remove assignments from the contructors. :face_palm:

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14573>
2022-02-11 17:25:33 +00:00
Ian Romanick fb630cd783 glsl: Make ir_assignment::condition private
And add get_condition().

This proof that nothing remains that could possibly set ::condition to
anything other than NULL.

v2: Fix bad rebase.

Reviewed-by: Matt Turner <mattst88@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14573>
2022-02-11 17:25:33 +00:00
Ilia Mirkin 86eaff29c0 st/mesa: only enable ARB_enhanced_layouts if there are xfb buffers
It really doesn't make sense without any xfb support. One could limp
along, but our validation does not work as-is. Doesn't seem important to
support this use-case.

This disables GL_ARB_enhanced_layouts on crocus with gen4/5.

Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14869>
2022-02-09 03:31:16 +00:00
Charles Baker 1895e17591 mesa: align constant/uniform uploads to driver expected alignment
This fixed a problem for Zink where uniform buffer alignment varies by
GPU, e.g. 64 bytes for an RTX 2070 SUPER but 256 bytes for a GTX 1070
Ti.

Tested running Superposition on Windows 10 with Nvidia 1070 Ti with
496.13 driver.  Without the fix Superposition soft locks on its splash
screen.  With the fix Superposition runs through its benchmark.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14674>
2022-02-08 15:08:21 +00:00
Mike Blumenkrantz 7e9481eaac gallium: add PIPE_CAP_CULL_DISTANCE_NOCOMBINE
for drivers where separate cull distance variables are required, this
lets them avoid having to write yet another pass to undo gallium's mangling
of shader info

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14878>
2022-02-08 14:03:09 +00:00
Charmaine Lee 945a1e0b8c mesa: fix misaligned pointer returned by dlist_alloc
In cases where the to-be-allocated node size with padding exceeds BLOCK_SIZE
but without padding doesn't, a new block is not created and no padding is done
to the previous instruction, causing a misaligned pointer to be returned.

v2: Per Ilia Mirkin's suggestion, remove the extra condition in the first
    if statement, let it unconditionally pad the last instruction if needed.
    The updated currentPos will then be taken into account in the
    block size checking.

This fixes crash seen with lightsmark and Optuma apitraces

Fixes:  05605d7f53 (' mesa: remove display list OPCODE_NOP')

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Neha Bhende <bhenden@vmware.com>
Tested-by: Neha Bhende <bhenden@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14871>
2022-02-05 22:45:01 +00:00
Qiang Yu 3729c3fa30 mesa: add ARB_sparse_texture_clamp extension
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14488>
2022-02-01 10:28:05 +00:00
Mike Blumenkrantz 061bf72a4f mesa: stop truncating MESA_GLSL=dump
this adds a new helper function that can be used to directly dump longer
strings to the log file, such as shaders

fixes #5614

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14755>
2022-02-01 04:05:58 +00:00
Timothy Arceri bfa096a0b9 glsl/st: move st_nir_opts() into gl compiler common code
This will allow us to use this in future NIR linker work. It also makes
more sense to move it here as the classic drivers are gone, tgsi is
going away and we are merging more of the st into the gl common code.

Reviewed-by: Emma Anholt <emma@anholt.net>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14785>
2022-01-31 11:49:21 +00:00
Dave Airlie 9b961b9d1d mesa/st: refactor program translation into one file.
This moves the notify callback into the file where it's all called
from.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14700>
2022-01-26 00:42:59 +00:00
Dave Airlie 8dfe3c83b6 mesa/st: move program new/delete into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14700>
2022-01-26 00:42:59 +00:00
Dave Airlie afce8654df mesa/st: move st_vertex_program to gl_vertex_program in mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14700>
2022-01-26 00:42:59 +00:00
Dave Airlie 5730772e36 mesa/st: move new ati fragment shader to mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14700>
2022-01-26 00:42:59 +00:00
Dave Airlie 3faa21bda7 mesa/st: collapse st_program into gl_program object.
Remove the subclass for this.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14700>
2022-01-26 00:42:59 +00:00
Dave Airlie 06504fb9e2 mesa: consolidate setting no error state and checking suid.
This makes MESA_NO_ERROR and mesa_no_error via drirc do the same thing.

Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14701>
2022-01-26 05:30:35 +10:00
Tapani Pälli 05e7e2245b mesa: change GetProgramiv name length queries to use program resources
Program resource queries provide equivalent code, gl_resource_name
introduced by commit dea558cbd2 takes care of ARB_gl_spirv special
case where name information is not available.

Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14636>
2022-01-25 06:30:44 +00:00
Tapani Pälli 1b898d78d8 mesa: move GetProgramInterfaceiv as a shader_query function
This matches how _mesa_get_program_resourceiv was done and this
makes it possible to skip some validation and shader program lookup
when calling it from glGetProgramiv.

Cc: mesa-stable
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14636>
2022-01-25 06:30:44 +00:00
Dave Airlie f6926efaad mesa/st: move st_fb_orientation into a mesa function
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:27 +10:00
Dave Airlie 840aabe752 mesa/st: move invalidate_on_gl_viewport to ctx
This is cleaner in the gl context now.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:23 +10:00
Dave Airlie 0ba5def21a mesa/st: move manager colorbuffer interface to gl_context.
This just avoids some st_context in main.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:19 +10:00
Dave Airlie 2f14e0d695 mesa/st: move renderbuffer format choosing wrapper into mesa.
This moves this and cleans up the results.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:16 +10:00
Dave Airlie f74648f912 mesa/st: move last of renderbuffer functionality into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:12 +10:00
Dave Airlie 98df4f7a83 mesa/st: migrate blit code into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:09 +10:00
Dave Airlie 5f675630d9 mesa/st: fixup viewport drawable invalidation
This moves the code into more appropriate places

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:04 +10:00
Dave Airlie 018251908e mesa/st: move some fbo helpers around.
This inlines one, and moves the other to a more appropriate place

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:04:01 +10:00
Dave Airlie 9c7e79c4b7 mesa/st: move st_new_renderbuffer_fb to manager
This is st_manager code really.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:57 +10:00
Dave Airlie b70b738bd1 mesa/st: move map/unmap renderbuffer code into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:55 +10:00
Dave Airlie 90e4e7cf74 mesa/st: move st renderbuffer code into mesa renderbuffer
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:49 +10:00
Dave Airlie f88fb21885 mesa/st: move DrawBufferAllocate into mesa.
Little bit of refactoring here.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:45 +10:00
Dave Airlie 57dcaac31d mesa/st: move st_ReadBuffer functionality into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:42 +10:00
Dave Airlie e9b12fe20e mesa/st: move validate/discard framebuffer into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:39 +10:00
Dave Airlie caa7009cff mesa/st: move render/finish_render texture in to mesa.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:36 +10:00
Dave Airlie 7645e24045 mesa/st: merge framebuffer objects from st to mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:32 +10:00
Dave Airlie 21d4dd8c39 mesa/st: move some renderbuffer code into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:27 +10:00
Dave Airlie 527b6ca412 mesa/st: merge st_renderbuffer into gl_renderbuffer.
This touches lots of places

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14675>
2022-01-25 07:03:23 +10:00
Jesse Natalie 0b6caed85c mesa/st: Lower user clip planes for tess eval too
The logic in st_atom_shader.c leads me to believe this was supposed
to work, but was incomplete to actually finish it. This fixes
compatibility tess tests on d3d12.

Reviewed-by: Ilia Mirkin <imirkin@alum.mit.edu>
Reviewed-by: Emma Anholt <emma@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14662>
2022-01-24 09:13:57 -08:00
Rob Clark 26d591a669 mesa/st: Lowered ucp should still mark rast state dirty
Lowered clip planes should respect the enabled/disabled GL_CLIP_PLANEn
(aka GL_CLIP_DISTANCEn), which means updating the rast state as well.

Signed-off-by: Rob Clark <robdclark@chromium.org>
Acked-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14643>
2022-01-24 15:51:47 +00:00
Ian Romanick 4d2937ff92 mesa: OpenGL ES 1.1 is not optional
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
2022-01-21 22:08:33 +00:00
Ian Romanick b04a186296 mesa: OpenGL 1.4 feature GL_EXT_point_parameters is not optional
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
2022-01-21 22:08:33 +00:00
Ian Romanick 577b438f98 mesa: OpenGL 1.4 feature GL_EXT_blend_minmax is not optional
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
2022-01-21 22:08:33 +00:00
Ian Romanick d45cb3b440 mesa: OpenGL 1.4 feature GL_EXT_blend_func_separate is not optional
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
2022-01-21 22:08:33 +00:00
Ian Romanick fbd17ede10 mesa: OpenGL 1.4 feature GL_EXT_blend_color is not optional
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
2022-01-21 22:08:33 +00:00
Ian Romanick 86db69e7e8 mesa: OpenGL 1.4 feature GL_ARB_texture_env_crossbar is not optional
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
2022-01-21 22:08:33 +00:00
Ian Romanick f80d45c515 mesa: OpenGL 1.4 feature GL_ARB_depth_texture is not optional
Cheatsheet:

_mesa_has_ARB_depth_texture() becomes (true && ctx->Extensions.Version
>= _mesa_extension_table[...].version[ctx->API]).  The last value is 0
when ctx->API is API_OPENGL_COMPAT and ~0 otherwise.  The whole function
effectively becomes (ctx->API == API_OPENGL_COMPAT).

_mesa_has_OES_depth_texture() becomes (true && ctx->Extensions.Version
>= _mesa_extension_table[...].version[ctx->API]).  The last value is 0
when ctx->API is API_OPENGLES2 and ~0 otherwise.  The whole function
effectively becomes (ctx->API == API_OPENGLES2).

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14213>
2022-01-21 22:08:33 +00:00
Pierre-Eric Pelloux-Prayer 3b4d4c7d84 mesa: use less temporaries in build_lighting
Preallocating temporaries can cause "out of temporaries" error.
Switch to on-demand allocation.

Growing temp_in_use would be an alternative, but some drivers
support less than 64 temps (see PIPE_SHADER_CAP_MAX_TEMPS) so
this wouldn't help them.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5777
Fixes: 272acbed0e ("mesa: merge STATE_LIGHTPROD parameters")
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14590>
2022-01-21 09:59:16 +00:00
Dave Airlie 5decf569fc mesa/st: move perf query test to st_context, drop files.
This removes the unused cb perf query files

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:20 +00:00
Dave Airlie 3f8e7b8735 mesa/st: drop lots of perfquery wrappers
Just direct call into pipe driver.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 78d13fdbb2 mesa/st: drop some bindless wrappers
Just call directly into pipe

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 8467047f6d mesa/st: move memory query into mesa.
Drop the gl_memory_info type as it's equiv to the pipe one, and
internal

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 6e99b10632 mesa/st: move shader completion into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 03f180d88b mesa/st: inline st_max_shader_compiler_threads
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 74d40c68dc mesa/ctx: store screen pointer in ctx as well
This is actually useful to have.

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie df9d5795c1 mesa/st: move evaluate depth values into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie a64e5c02bd mesa/st/vdpau: direct call the vdpau functions.
This provides versions when vdpau is turned off, removes dd.h entries

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 0f8a3a7175 mesa/st: drop release all sampler views wrapper
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 31d3e3ebeb mesa/st: move st_TexParameter into mesa
Some places this just passes an always true pname, so just call
sampler view invalidate directly

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 96b57faf35 mesa/st: drop useless tex parameter calls.
st_TexParameter never does anything for these

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 9244c792f9 mesa/dd: drop GetProgramBinaryDriverSHA1
Just call direct into state tracker

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 4a055c1940 mesa/st: move pin l3 cache to direct check/call.
Drop another dd.h entry

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 10ac88b72f mesa/st: drop emit string marker device table entry.
Just check for the gallium callback instead

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 5618fac786 mesa/st: directly call the uuid get funcs.
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie ec0d62ceb5 mesa/st: drop last user of st_Enable.
Move the debug output piece into mesa

Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie 84fe99b2a0 mesa/st: migrate debug callback code into mesa
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie bc122e0769 mesa/st: remove st_context from debug callback
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Dave Airlie e344a117af mesa/st: move intel blackhole noop enable to frontend
Reviewed-by: Kristian H. Kristensen <hoegsberg@google.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14632>
2022-01-21 01:18:19 +00:00
Tapani Pälli 521ede8451 mesa: refactor GetProgramiv to use program resource list
This way we make sure glGetActiveUniform and glGetProgramiv
are in sync about active uniform count.

Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5885
Cc: mesa-stable
Signed-off-by: Tapani Pälli <tapani.palli@intel.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14589>
2022-01-20 05:52:53 +00:00
Dave Airlie 4b8d84f71a mesa/st: merge texture obj/image alloc/free into mesa
This just drops the st wrappers for alloc/free of texture images
and objects.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:54:08 +10:00
Dave Airlie cd0961dce2 mesa/st: merge texture object/image structs into mesa
This just merges the subclasses into main class

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:54:03 +10:00
Dave Airlie ea3e700e35 mesa/st: cleanup last bits of st perfmon code.
Just some small cleanups left to finish perfmon code movement.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:54:01 +10:00
Dave Airlie bc9b176aef mesa/st: move perfmon code from st into mesa
This merges the perfmon code after the objects have been merged.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:58 +10:00
Dave Airlie 1e2ded21ba mesa/st: merge perfmon groups init/cleanup from st into mesa
This moves the init/cleanup code from st into mesa.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:55 +10:00
Dave Airlie 350dbb000e mesa/st: merge perfmon counters/groups objects from st into mesa
This merges subclassed or side allocated objects into the main
ones.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:50 +10:00
Dave Airlie a3099f885e mesa/st: merge perfmon object from st into mesa
This just merges the perf mon subclass into the base class,
and cleans up the result.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:48 +10:00
Dave Airlie 0fb946da94 mesa/st: merge transform feedback code from st into mesa
After the objects are merged, this moves the rest of the code
from the state tracker into mesa.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:44 +10:00
Dave Airlie ecb99724a3 mesa/st: merge st transform feedback object into gl one.
This just merges the object subclass into the main class,
this was left separate to ease review.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:42 +10:00
Dave Airlie b6710b6549 mesa/st: merge condrender code from st into mesa.
This merges conditional render code from state tracker into mesa.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:36 +10:00
Dave Airlie 1c73afa462 mesa/st: merge queryobj code from st into mesa.
This merges all the query object code from st into mesa.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:33 +10:00
Dave Airlie 0af7c1e385 mesa/st: merge the syncobj code from st into mesa
This merges all the syncobj code into the mesa from the state tracker.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:30 +10:00
Dave Airlie adf0dc7801 mesa/st: merge semaphore objects from st into mesa
Take all the semaphore objects code from state tracker and merge it
into mesa.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:27 +10:00
Dave Airlie addcc24f77 mesa/st: merge memoryobjects code from st into mesa
This takes all the memory object code from state tracker and
merges it into mesa, cleaning it up on the way.

Acked-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14327>
2022-01-20 10:53:18 +10:00
Dave Airlie 16fa442057 mesa: split struct gl_config into it's own header.
avoids context.h/mtypes.h deps.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 4346f39299 mesa: more mtypes.h cleanups
Add more from pepp

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 07edaa1409 vbo: drop unused mtypes.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 7b7f627600 glsl/fp64: move context.h dependent checks into main.
allows dropping context.h include.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie a7b9b4086c mtypes: move gl_shader_variable to shader_types.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 79834f4def mtypes: move bindless image/sampler objects to shader_types.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 0506c99ccd mtypes: move uniform shader types to shader_types.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 57a7915fac mtypes: move transform feedback internal structs to shader_types.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie cc38e6e7d3 mtypes: more gl_active_atomic_buffer to shader_types.h
allows dropping mtypes.h in glsl compiler

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 0eb50f738d mtypes: move gl_program to shader_types.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie d6dfa370ee mtypes: move gl_linked_shader and gl_shader_program to new shader_types.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 74fa9c0620 glsl: move ast_function.cpp off mtypes.h
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 72123213ce mesa: move some gl shader types to shader_types.h.
This moves some of these to further removes mtypes.h from the GLSL compiler.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 02bab148f9 mesa/mtypes: move matrix enums to shader_enums.h
These are used in the compiler backend also.

Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 379fc6b269 mtypes: split gl extensions and consts out into a separate header
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie 717a720e9c mesa: drop unused context parameter to shader program data reference.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14437>
2022-01-20 00:20:06 +00:00
Dave Airlie ccbf700d6c nir: remove gl.h include from nir headers.
This saves a lot of pointless gl.h includes across the board,
it moves the one place that needs GLenum into a separate file
only used in those passes that require it.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
2022-01-19 21:54:58 +00:00
Dave Airlie 1352e0ba0c mesa/*: add a shader primitive type to get away from GL types.
This creates an internal shader_prim enum, I've fixed up most
users to use it instead of GL types.

don't store the enum in shader_info as it changes size, and confuses
other things.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
2022-01-19 21:54:58 +00:00
Dave Airlie d54c07b4c4 mesa/*: use an internal enum for tessellation primitive types.
To avoid dragging gl.h into places it has no business being,
defined tessellation primitive mode to an enum.

This has a lot of fallout all over the place.

Reviewed-by: Kenneth Graunke <kenneth@whitecape.org>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14605>
2022-01-19 21:54:58 +00:00
Dave Airlie 7b6cd912a5 mesa/st: get rid of ST_CALLOC_STRUCT use CALLOC_STRUCT
Just tie in the CALLOC_STRUCT/FREE mechanism.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14325>
2022-01-18 22:20:18 +00:00
Dave Airlie 05c8fb6335 mesa/st/perfmon: rebalance CALLOC_STRUCT/FREE
this was using FREE but ST_CALLOC_STRUCT, so fix the other way.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14325>
2022-01-18 22:20:18 +00:00
Dave Airlie 7c79c9bfb1 mesa: rebalance the CALLOC_STRUCT/FREE force.
There were some CALLOC_STRUCT that were using free, rebalance this.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14325>
2022-01-18 22:20:18 +00:00
Dave Airlie 3b26dbf8f1 mesa/program: don't use CALLOC_STRUCT for instructions.
Figuring out the frees here was too much for me.

Reviewed-by: Jose Fonseca <jfonseca@vmware.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14325>
2022-01-18 22:20:18 +00:00
Qiang Yu 485ceb5c51 gallium: add multi_sample parameter to get_sparse_texture_virtual_page_size
Instead of using actual sample count as parameter, we only use a bool
to indicate if the target is multi sample. This is because we don't
know the sample count when glGetInternalformativ() case.

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362>
2022-01-18 16:10:36 +08:00
Qiang Yu 2c994e17c1 mesa/main: export _is_multisample_target for external usage
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362>
2022-01-18 16:10:36 +08:00
Qiang Yu 91661a3938 mesa/main: allow multi sample sparse texture
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Signed-off-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14362>
2022-01-18 16:10:36 +08:00