lavapipe: don't unnecessarily flag dsa states for updating

these force a new dsa state to be created and bound, which isn't necessary
if the same value is being reset

Reviewed-by: Dave Airlie <airlied@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10625>
This commit is contained in:
Mike Blumenkrantz 2021-05-05 09:26:57 -04:00 committed by Marge Bot
parent 2b1711c8fd
commit 4d60a646b0
1 changed files with 10 additions and 6 deletions

View File

@ -43,6 +43,8 @@
#include "vk_util.h"
#define DOUBLE_EQ(a, b) (fabs((a) - (b)) < DBL_EPSILON)
struct rendering_state {
struct pipe_context *pctx;
@ -1654,9 +1656,10 @@ static void handle_set_blend_constants(struct lvp_cmd_buffer_entry *cmd,
static void handle_set_depth_bounds(struct lvp_cmd_buffer_entry *cmd,
struct rendering_state *state)
{
state->dsa_dirty |= !DOUBLE_EQ(state->dsa_state.depth_bounds_min, cmd->u.set_depth_bounds.min_depth);
state->dsa_dirty |= !DOUBLE_EQ(state->dsa_state.depth_bounds_max, cmd->u.set_depth_bounds.max_depth);
state->dsa_state.depth_bounds_min = cmd->u.set_depth_bounds.min_depth;
state->dsa_state.depth_bounds_max = cmd->u.set_depth_bounds.max_depth;
state->dsa_dirty = true;
}
static void handle_set_stencil_compare_mask(struct lvp_cmd_buffer_entry *cmd,
@ -2868,37 +2871,38 @@ static void handle_set_primitive_topology(struct lvp_cmd_buffer_entry *cmd,
static void handle_set_depth_test_enable(struct lvp_cmd_buffer_entry *cmd,
struct rendering_state *state)
{
state->dsa_dirty |= state->dsa_state.depth_enabled != cmd->u.set_depth_test_enable.depth_test_enable;
state->dsa_state.depth_enabled = cmd->u.set_depth_test_enable.depth_test_enable;
state->dsa_dirty = true;
}
static void handle_set_depth_write_enable(struct lvp_cmd_buffer_entry *cmd,
struct rendering_state *state)
{
state->dsa_dirty |= state->dsa_state.depth_writemask != cmd->u.set_depth_write_enable.depth_write_enable;
state->dsa_state.depth_writemask = cmd->u.set_depth_write_enable.depth_write_enable;
state->dsa_dirty = true;
}
static void handle_set_depth_compare_op(struct lvp_cmd_buffer_entry *cmd,
struct rendering_state *state)
{
state->dsa_dirty |= state->dsa_state.depth_func != cmd->u.set_depth_compare_op.depth_op;
state->dsa_state.depth_func = cmd->u.set_depth_compare_op.depth_op;
state->dsa_dirty = true;
}
static void handle_set_depth_bounds_test_enable(struct lvp_cmd_buffer_entry *cmd,
struct rendering_state *state)
{
state->dsa_dirty |= state->dsa_state.depth_bounds_test != cmd->u.set_depth_bounds_test_enable.depth_bounds_test_enable;
state->dsa_state.depth_bounds_test = cmd->u.set_depth_bounds_test_enable.depth_bounds_test_enable;
state->dsa_dirty = true;
}
static void handle_set_stencil_test_enable(struct lvp_cmd_buffer_entry *cmd,
struct rendering_state *state)
{
state->dsa_dirty |= state->dsa_state.stencil[0].enabled != cmd->u.set_stencil_test_enable.stencil_test_enable ||
state->dsa_state.stencil[1].enabled != cmd->u.set_stencil_test_enable.stencil_test_enable;
state->dsa_state.stencil[0].enabled = cmd->u.set_stencil_test_enable.stencil_test_enable;
state->dsa_state.stencil[1].enabled = cmd->u.set_stencil_test_enable.stencil_test_enable;
state->dsa_dirty = true;
}
static void handle_set_stencil_op(struct lvp_cmd_buffer_entry *cmd,