Commit graph

135167 commits

Author SHA1 Message Date
Mike Blumenkrantz
a14610281a features: mark off GL 4.6 and ES 3.1 for zink
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:30 +00:00
Mike Blumenkrantz
0960938d86 zink: GLSL 460
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:30 +00:00
Mike Blumenkrantz
efc219f1c4 zink: PIPE_CAP_GL_SPIRV
still needs a bunch of fixing, but 75% of tests pass

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz
cb5957e13d zink: enable pipeline statistics cap
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz
5a4f5d1bb5 zink: enable PIPE_CAP_QUERY_SO_OVERFLOW
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz
3d7d55c2cf zink: enable PIPE_CAP_POLYGON_OFFSET_CLAMP
this is already handled

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz
670b79ffd5 zink: enable PIPE_CAP_DRAW_PARAMETERS
Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz
75baabf9fb zink: enable PIPE_CAP_TGSI_VOTE
ARB_shader_group_vote

Acked-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9072>
2021-02-16 01:16:29 +00:00
Mike Blumenkrantz
759a71b67d zink: add util function for submitting the compute batch
sometimes we just want to submit this and not wait on it

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9063>
2021-02-16 01:05:07 +00:00
Mike Blumenkrantz
f1bc95bfa5 zink: rewrite drawid based on shader key value
same as basevertex

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
7fad9d647a zink: break out push constant creation in compiler and add drawid value
Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
a0911f825d zink: add a vs shader key for rewriting gl_DrawID
if we get a direct draw, we have to rewrite the drawid for it to work as expected

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
165a940fc2 zink: add a draw_id param to vs push constants
gallium always gives us multidraws as individual draws, so we need to feed
this through to the shader

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
55abc1202c zink: wrap shader gl_BaseVertex access with a bcsel based on push constant state
vulkan has different mechanics than gl for this variable based on whether the
current draw is indexed, so we need to rewrite the access here for that case

this also requires that we add some padding to the tcs shader injection to
account for new members being added to the push constant

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
bf4fac51ee zink: add push constant value to indicate whether the current draw is indexed
due to semantic differences between gl and vk variables, this is going to be
necessary for gl_BaseVertex

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
59aae6db9f zink: rework tcs injection to be more compatible with new push const struct
we can simplify the push constant loader to directly take the struct member
index here and then pass that directly to simplify things for future use

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
00642ab6ed zink: create a struct for tracking push constant layout
it'll be helpful to update this as we add more values here so we can
avoid having to update all the users

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
c28bc38f94 zink: add handling for ARB_shader_draw_parameters variables in ntv
* gl_DrawID
* gl_BaseVertex
* gl_BaseInstance (was already semi-handled)

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8971>
2021-02-16 00:52:32 +00:00
Mike Blumenkrantz
8300bc1f16 zink: handle 1bit undef values in ntv
spirv requires that 1bit values be bool types, not uints

Fixes: 93af00502e ("zink: use uvec for undefs")

Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9059>
2021-02-15 21:17:07 +00:00
Mike Blumenkrantz
e3428419fb zink: fix slot mapping for legacy gl io with tess stages
e.g., gl_BackColor is a thing

Fixes: aec03553e1 ("zink: fix tess shader i/o variables")

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9019>
2021-02-15 20:47:14 +00:00
Mike Blumenkrantz
2b6950c3fd zink: add support for pipeline statistics queries
so easy!

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9010>
2021-02-15 20:37:22 +00:00
Mike Blumenkrantz
ff0233353a zink: hook up cs invocation queries to the compute batch
compute batches are separate, so we have to run these queries on the
appropriate batch to see the expected results

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9010>
2021-02-15 20:37:22 +00:00
Mike Blumenkrantz
942ba4e341 zink: unset generated TCS if its parent TESS is unset
ensure this doesn't get pulled in during the next program update

Fixes: 334759d850 ("zink: implement passthrough tcs shader injection")

Reviewed-by: Hoe Hao Cheng <haochengho12907@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9057>
2021-02-15 20:03:23 +00:00
Daniel Schürmann
fc6b5be666 aco: fix assertion in insert_exec_mask pass
Fixes: a56ddca4e8 ('aco: make all exec accesses non-temporaries ')
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9047>
2021-02-15 19:50:16 +00:00
Rhys Perry
ddce1ec5f5 aco: fix transition_to_{WQM,Exact} if exec.back() is not in exec
This can happen at merge blocks.

fossil-db (GFX10.3):
Totals from 25229 (17.25% of 146267) affected shaders:
CodeSize: 58575920 -> 58571376 (-0.01%); split: -0.01%, +0.00%
Instrs: 10979245 -> 10978109 (-0.01%); split: -0.01%, +0.00%
SClause: 591817 -> 591816 (-0.00%)
Copies: 604987 -> 603851 (-0.19%); split: -0.19%, +0.00%
Cycles: 96088796 -> 96084252 (-0.00%); split: -0.00%, +0.00%
VMEM: 10470372 -> 10470368 (-0.00%)

Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Fixes: a56ddca4e8 ("aco: make all exec accesses non-temporaries")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/4299
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9047>
2021-02-15 19:50:16 +00:00
Marek Olšák
f0d17aa88c mesa: add debug code to catch missing _mesa_update_valid_to_render_state calls
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
743b912f9d mesa: inline draw validate functions
This just moves the functions to draw.c.

Our CPU overhead is so low now that this increases performance by a few %.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
de2f0b7ce3 mesa: inline _mesa_set_draw_vao and set_varying_vp_inputs for draw calls
This just moves the functions to draw.c. It's inlined because the function
name disappears in the profiler. It improves performance.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
7079190149 mesa: gather errors and call _mesa_error only once in validate_Draw
This mainly skips all the jumping around various _mesa_error calls that
are never taken. There is a tiny measurable improvement in CPU overhead.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
37beefe601 mesa: precompute draw time determination of enabled vertex arrays
Another draw time optimization that precomputes the value only when
_VPMode is changed.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
306f1ef417 mesa: precompute _mesa_get_vao_vp_inputs
It's called for every draw, so this is important.

All inputs of _mesa_get_vao_vp_inputs are changed when
update_attribute_map_mode is called, so we can just compute
the value there.

The assertion ensures correct behavior in debug builds.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
40b8838a5a mesa: set _DrawVAOEnabledAttribs only when it changes
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
ba29044fba mesa: move gl_context::varying_vp_inputs into ctx->VertexProgram._VaryingInputs
This is where it belongs.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
99e25d183d mesa: optimize set_varying_vp_inputs by precomputing the conditions
set_varying_vp_inputs is called every draw call, which checks
_Maintain*Program. Let's move that checking out of there.

This adds a new flag that determines whether set_varying_vp_inputs
should do anything.

All code that changes _Maintain*Program must now reinitialize the new
flag. This is done by new function _mesa_reset_vertex_processing_mode.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
4cea48437d mesa: validate numInstances in common functions to unify code
Just a cleanup.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
3f64f3338a mesa: move disallowed TFB in DrawElements on GLES from draws to state changes
glDrawElements is disallowed by GLES when transform feedback is active
and GS is not supported.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
1488d0a9b1 mesa: add a separate valid primitive mask just for glDrawElements
No change in behavior.

This will be used for draw validation required by glDrawElements but not
glDrawArrays.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
820dec3f7c mesa: don't skip draws with count == 0 or numInstances == 0
These are checked by drivers (all gallium drivers and
_mesa_draw_gallium_fallback), so they are redundant here.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
4975a89f38 mesa: skip MultiDrawArrays with primcount == 0
This is the only zero parameter that gallium can't handle.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
9bd4755410 mesa: remove an optional GL error about mapped buffers during execution
Not having this here, even if the branch is not taken, increases
CPU performance by 2% on radeonsi. If some drivers need this, the spec
does allow GL termination, meaning abort(), which is a more effective
alternative given that this never happens.

You may ask, do we really pay a 2% performance hit for every conditional
not taken? For some of them, we do.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
7794305f0d mesa: call _mesa_update_state() before validation
It's called in both the no_error path and the draw validation path, so we
might as well call it before the no_error conditional.

This decreases CPU overhead a lot, which I'm unable to explain. It seems
to be random gcc behavior, which I've seen quite a lot now.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
6daa113c39 mesa: remove optional draw validation code to increase performance
Some drivers do similar validation in their draw calls.

If drivers need some of this, we can do it in the drivers or even in
_mesa_draw_gallium_fallback for classic drivers.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
0551290298 mesa: remove VERBOSE_DRAW
Let's declutter the code.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
9ee052eb73 mesa: optimize the dual source blend error checking using a bitmask
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
ad057b7f60 mesa: inline _mesa_valid_to_render now that it doesn't do validation
Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
bf9d61a3d4 mesa: move blending validation from draws to state changes
This is a step towards removing _mesa_valid_to_render.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
40341c5118 mesa: move GL_FILL_RECTANGLE validation from draws to state changes
This is a step towards removing _mesa_valid_to_render.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
a22e719661 mesa: move ARB program and integer FBO validation from draws to state changes
This is a step towards removing _mesa_valid_to_render.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
7c35ec4d2f mesa: move FBO completeness checking from draws to state changes
_mesa_update_framebuffer_visual already calls _mesa_update_valid_to_render-
_state, so we just need to call it where FBOs are marked incomplete.

This is a step towards removing _mesa_valid_to_render.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00
Marek Olšák
8e747d9af0 mesa: move some uniform debug code from draws to state changes
This is a step towards removing _mesa_valid_to_render.

I don't know what this code does. This commit probably breaks it, but it
doesn't seem important. We could remove the code.

Reviewed-by: Zoltán Böszörményi <zboszor@gmail.com>
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8798>
2021-02-15 19:29:09 +00:00