[Mesa-dev] [PATCH 22/20] radeonsi: disable early Z if the fragment shader writes to memory
Marek Olšák
maraeo at gmail.com
Sat Mar 19 22:55:33 UTC 2016
I made comments on patches 17 & 18.
With those addressed, patches 13-22 including 15 v2 are:
Reviewed-by: Marek Olšák <marek.olsak at amd.com>
Marek
On Wed, Mar 16, 2016 at 4:09 AM, Nicolai Hähnle <nhaehnle at gmail.com> wrote:
> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>
> Empirically, both the EXEC_ON_* flags and LATE_Z are necessary.
> ---
> src/gallium/drivers/radeonsi/si_state_shaders.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
> index 5fe1f79..7251092 100644
> --- a/src/gallium/drivers/radeonsi/si_state_shaders.c
> +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
> @@ -794,9 +794,15 @@ static void si_shader_ps(struct si_shader *shader)
> * - the shader uses at least 2 VMEM instructions, or
> * - the code size is at least 50 2-dword instructions or 100 1-dword
> * instructions.
> + *
> + * Shaders with side effects that must execute independently of the
> + * depth test require LATE_Z.
> */
> - if (info->num_memory_instructions >= 2 ||
> - shader->binary.code_size > 100*4)
> + if (info->writes_memory &&
> + !info->properties[TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL])
> + shader->z_order = V_02880C_LATE_Z;
> + else if (info->num_memory_instructions >= 2 ||
> + shader->binary.code_size > 100*4)
> shader->z_order = V_02880C_EARLY_Z_THEN_RE_Z;
> else
> shader->z_order = V_02880C_EARLY_Z_THEN_LATE_Z;
> @@ -1157,6 +1163,10 @@ static void *si_create_shader_selector(struct pipe_context *ctx,
> if (sel->info.properties[TGSI_PROPERTY_FS_EARLY_DEPTH_STENCIL])
> sel->db_shader_control |= S_02880C_DEPTH_BEFORE_SHADER(1);
>
> + if (sel->info.writes_memory)
> + sel->db_shader_control |= S_02880C_EXEC_ON_HIER_FAIL(1) |
> + S_02880C_EXEC_ON_NOOP(1);
> +
> /* Compile the main shader part for use with a prolog and/or epilog. */
> if (sel->type != PIPE_SHADER_GEOMETRY &&
> !sscreen->use_monolithic_shaders) {
> --
> 2.5.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list