gallium: Add cap to request state validation for all dirty state
Withaaa4b0e6
state validation is no longer called for all changed states, but only for states that will be active with a new shader program. Not all drivers support this and might prefer if the state validation is emitted for all states that might be changed. So add a cap that the driver can signal one or the other preference, and default to the new behavior. Fixes:aaa4b0e6
st/mesa: move check_program_state code into _mesa_update_state v2: - Rename cap and and invert its meaning, query the cap only once and store it in st, handle the mask update when updating the shader i.e. not in st_validate_state (Marek) Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20493>
This commit is contained in:
@@ -639,6 +639,7 @@ The integer capabilities:
|
|||||||
* ``PIPE_CAP_HARDWARE_GL_SELECT``: Enable hardware accelerated GL_SELECT for this driver.
|
* ``PIPE_CAP_HARDWARE_GL_SELECT``: Enable hardware accelerated GL_SELECT for this driver.
|
||||||
* ``PIPE_CAP_DEVICE_PROTECTED_CONTEXT``: Whether the device supports protected / encrypted context which can manipulate protected / encrypted content (some devices might need protected contexts to access protected content, whereas ``PIPE_CAP_DEVICE_PROTECTED_SURFACE`` does not require any particular context to do so).
|
* ``PIPE_CAP_DEVICE_PROTECTED_CONTEXT``: Whether the device supports protected / encrypted context which can manipulate protected / encrypted content (some devices might need protected contexts to access protected content, whereas ``PIPE_CAP_DEVICE_PROTECTED_SURFACE`` does not require any particular context to do so).
|
||||||
* ``PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT``: Whether to allow glthread to convert glBufferSubData to glCopyBufferSubData. This may improve or worsen performance depending on your driver.
|
* ``PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT``: Whether to allow glthread to convert glBufferSubData to glCopyBufferSubData. This may improve or worsen performance depending on your driver.
|
||||||
|
* ``PIPE_CAP_VALIDATE_ALL_DIRTY_STATES`` : Whether state validation must also validate the state changes for resources types used in the previous shader but not in the current shader.
|
||||||
|
|
||||||
.. _pipe_capf:
|
.. _pipe_capf:
|
||||||
|
|
||||||
|
@@ -523,6 +523,9 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
|||||||
case PIPE_CAP_QUERY_TIMESTAMP_BITS:
|
case PIPE_CAP_QUERY_TIMESTAMP_BITS:
|
||||||
return 64;
|
return 64;
|
||||||
|
|
||||||
|
case PIPE_CAP_VALIDATE_ALL_DIRTY_STATES:
|
||||||
|
return 0;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
unreachable("bad PIPE_CAP_*");
|
unreachable("bad PIPE_CAP_*");
|
||||||
}
|
}
|
||||||
|
@@ -1016,6 +1016,7 @@ enum pipe_cap
|
|||||||
PIPE_CAP_DEVICE_PROTECTED_CONTEXT,
|
PIPE_CAP_DEVICE_PROTECTED_CONTEXT,
|
||||||
PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT,
|
PIPE_CAP_ALLOW_GLTHREAD_BUFFER_SUBDATA_OPT,
|
||||||
|
|
||||||
|
PIPE_CAP_VALIDATE_ALL_DIRTY_STATES,
|
||||||
PIPE_CAP_LAST,
|
PIPE_CAP_LAST,
|
||||||
/* XXX do not add caps after PIPE_CAP_LAST! */
|
/* XXX do not add caps after PIPE_CAP_LAST! */
|
||||||
};
|
};
|
||||||
|
@@ -397,6 +397,11 @@ update_program(struct gl_context *ctx)
|
|||||||
tcp_changed || cp_changed) {
|
tcp_changed || cp_changed) {
|
||||||
/* This will mask out unused shader resources. */
|
/* This will mask out unused shader resources. */
|
||||||
st->active_states = _mesa_get_active_states(ctx);
|
st->active_states = _mesa_get_active_states(ctx);
|
||||||
|
|
||||||
|
/* Some drivers need to clean up previous states too */
|
||||||
|
if (st->validate_all_dirty_states)
|
||||||
|
st->active_states |= dirty;
|
||||||
|
|
||||||
return _NEW_PROGRAM;
|
return _NEW_PROGRAM;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -639,6 +639,10 @@ st_create_context_priv(struct gl_context *ctx, struct pipe_context *pipe,
|
|||||||
PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS)
|
PIPE_SHADER_CAP_MAX_HW_ATOMIC_COUNTERS)
|
||||||
? true : false;
|
? true : false;
|
||||||
|
|
||||||
|
st->validate_all_dirty_states =
|
||||||
|
screen->get_param(screen, PIPE_CAP_VALIDATE_ALL_DIRTY_STATES)
|
||||||
|
? true : false;
|
||||||
|
|
||||||
util_throttle_init(&st->throttle,
|
util_throttle_init(&st->throttle,
|
||||||
screen->get_param(screen,
|
screen->get_param(screen,
|
||||||
PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET));
|
PIPE_CAP_MAX_TEXTURE_UPLOAD_MEMORY_BUDGET));
|
||||||
|
@@ -206,6 +206,7 @@ struct st_context
|
|||||||
boolean draw_needs_minmax_index;
|
boolean draw_needs_minmax_index;
|
||||||
boolean has_hw_atomics;
|
boolean has_hw_atomics;
|
||||||
|
|
||||||
|
boolean validate_all_dirty_states;
|
||||||
|
|
||||||
/* driver supports scissored clears */
|
/* driver supports scissored clears */
|
||||||
boolean can_scissor_clear;
|
boolean can_scissor_clear;
|
||||||
|
Reference in New Issue
Block a user