mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 00:58:05 +02:00
gallium + mesa/st: Add PIPE_CAP_NIR_ATOMICS_AS_DEREF and use it
This cap is useful for drivers that support hardware atomics and need special handling to resolve their addresses. Signed-off-by: Gert Wollny <gert.wollny@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6025>
This commit is contained in:
parent
dd003abd2f
commit
a03e24aa7f
4 changed files with 8 additions and 2 deletions
|
|
@ -589,6 +589,7 @@ The integer capabilities:
|
||||||
* ``PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE``: Whether mapping a buffer as unsynchronized from any thread is safe.
|
* ``PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE``: Whether mapping a buffer as unsynchronized from any thread is safe.
|
||||||
* ``PIPE_CAP_GLSL_ZERO_INIT``: Choose a default zero initialization some glsl variables. If `1`, then all glsl shader variables and gl_FragColor are initialized to zero. If `2`, then shader out variables are not initialized but function out variables are.
|
* ``PIPE_CAP_GLSL_ZERO_INIT``: Choose a default zero initialization some glsl variables. If `1`, then all glsl shader variables and gl_FragColor are initialized to zero. If `2`, then shader out variables are not initialized but function out variables are.
|
||||||
* ``PIPE_CAP_BLEND_EQUATION_ADVANCED``: Driver supports blend equation advanced without necessarily supporting FBFETCH.
|
* ``PIPE_CAP_BLEND_EQUATION_ADVANCED``: Driver supports blend equation advanced without necessarily supporting FBFETCH.
|
||||||
|
* ``PIPE_CAP_NIR_ATOMICS_AS_DEREF``: Whether NIR atomics instructions should reference atomics as NIR derefs instead of by indices.
|
||||||
|
|
||||||
.. _pipe_capf:
|
.. _pipe_capf:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -294,6 +294,7 @@ u_pipe_screen_get_param_defaults(struct pipe_screen *pscreen,
|
||||||
case PIPE_CAP_TGSI_TES_LAYER_VIEWPORT:
|
case PIPE_CAP_TGSI_TES_LAYER_VIEWPORT:
|
||||||
case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
|
case PIPE_CAP_CAN_BIND_CONST_BUFFER_AS_VERTEX:
|
||||||
case PIPE_CAP_TGSI_DIV:
|
case PIPE_CAP_TGSI_DIV:
|
||||||
|
case PIPE_CAP_NIR_ATOMICS_AS_DEREF:
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
|
case PIPE_CAP_ALLOW_MAPPED_BUFFERS_DURING_EXECUTION:
|
||||||
|
|
|
||||||
|
|
@ -954,6 +954,7 @@ enum pipe_cap
|
||||||
PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE,
|
PIPE_CAP_MAP_UNSYNCHRONIZED_THREAD_SAFE,
|
||||||
PIPE_CAP_GLSL_ZERO_INIT,
|
PIPE_CAP_GLSL_ZERO_INIT,
|
||||||
PIPE_CAP_BLEND_EQUATION_ADVANCED,
|
PIPE_CAP_BLEND_EQUATION_ADVANCED,
|
||||||
|
PIPE_CAP_NIR_ATOMICS_AS_DEREF,
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -432,6 +432,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
|
||||||
struct gl_shader_program *shader_program)
|
struct gl_shader_program *shader_program)
|
||||||
{
|
{
|
||||||
nir_shader *nir = prog->nir;
|
nir_shader *nir = prog->nir;
|
||||||
|
struct pipe_screen *screen = st->pipe->screen;
|
||||||
|
|
||||||
/* Make a pass over the IR to add state references for any built-in
|
/* Make a pass over the IR to add state references for any built-in
|
||||||
* uniforms that are used. This has to be done now (during linking).
|
* uniforms that are used. This has to be done now (during linking).
|
||||||
|
|
@ -486,7 +487,9 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
|
||||||
!st->ctx->Const.PackedDriverUniformStorage)
|
!st->ctx->Const.PackedDriverUniformStorage)
|
||||||
NIR_PASS_V(nir, st_nir_lower_builtin);
|
NIR_PASS_V(nir, st_nir_lower_builtin);
|
||||||
|
|
||||||
NIR_PASS_V(nir, gl_nir_lower_atomics, shader_program, true);
|
if (!screen->get_param(screen, PIPE_CAP_NIR_ATOMICS_AS_DEREF))
|
||||||
|
NIR_PASS_V(nir, gl_nir_lower_atomics, shader_program, true);
|
||||||
|
|
||||||
NIR_PASS_V(nir, nir_opt_intrinsics);
|
NIR_PASS_V(nir, nir_opt_intrinsics);
|
||||||
|
|
||||||
/* Lower 64-bit ops. */
|
/* Lower 64-bit ops. */
|
||||||
|
|
@ -508,7 +511,7 @@ st_glsl_to_nir_post_opts(struct st_context *st, struct gl_program *prog,
|
||||||
(nir_var_shader_in | nir_var_shader_out | nir_var_function_temp );
|
(nir_var_shader_in | nir_var_shader_out | nir_var_function_temp );
|
||||||
nir_remove_dead_variables(nir, mask, NULL);
|
nir_remove_dead_variables(nir, mask, NULL);
|
||||||
|
|
||||||
if (!st->has_hw_atomics)
|
if (!st->has_hw_atomics && !screen->get_param(screen, PIPE_CAP_NIR_ATOMICS_AS_DEREF))
|
||||||
NIR_PASS_V(nir, nir_lower_atomics_to_ssbo);
|
NIR_PASS_V(nir, nir_lower_atomics_to_ssbo);
|
||||||
|
|
||||||
st_finalize_nir_before_variants(nir);
|
st_finalize_nir_before_variants(nir);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue