mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-23 17:40:11 +01:00
panfrost: Skip rasterizer discard draws without side effects
Minor optimization, but more importantly fixes an interaction of IDVS with rasterizer discard. Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14154>
This commit is contained in:
parent
f5412409db
commit
79356b2e5f
1 changed files with 16 additions and 0 deletions
|
|
@ -3106,6 +3106,22 @@ panfrost_draw_vbo(struct pipe_context *pipe,
|
||||||
/* Do some common setup */
|
/* Do some common setup */
|
||||||
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
|
struct panfrost_batch *batch = panfrost_get_batch_for_fbo(ctx);
|
||||||
|
|
||||||
|
/* If rasterization discard is enabled but the vertex shader does not
|
||||||
|
* have side effects (including transform feedback), skip the draw
|
||||||
|
* altogether. This is always an optimization. Additionally, this is
|
||||||
|
* required for Index-Driven Vertex Shading, since IDVS always
|
||||||
|
* rasterizes. The compiler will not use IDVS if the vertex shader has
|
||||||
|
* side effects. So the only problem case is rasterizer discard with a
|
||||||
|
* shader without side effects -- but these draws are useless.
|
||||||
|
*/
|
||||||
|
if (panfrost_batch_skip_rasterization(batch)) {
|
||||||
|
struct panfrost_shader_state *vs =
|
||||||
|
panfrost_get_shader_state(ctx, PIPE_SHADER_VERTEX);
|
||||||
|
|
||||||
|
if (!vs->info.writes_global)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
/* Don't add too many jobs to a single batch. Hardware has a hard limit
|
/* Don't add too many jobs to a single batch. Hardware has a hard limit
|
||||||
* of 65536 jobs, but we choose a smaller soft limit (arbitrary) to
|
* of 65536 jobs, but we choose a smaller soft limit (arbitrary) to
|
||||||
* avoid the risk of timeouts. This might not be a good idea. */
|
* avoid the risk of timeouts. This might not be a good idea. */
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue