diff options
author | Samuel Pitoiset <[email protected]> | 2017-12-14 13:51:46 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-12-14 22:23:25 +0100 |
commit | 45872a0a6d99d3f7704d9539f215eb0004c1e576 (patch) | |
tree | 76e907a8b6717ebdb0751e2c07e9d2cce2bc4d11 | |
parent | 91f4d746e41b1c74daf917486c8b5fc64492d39a (diff) |
radeonsi: make use of ac_get_spi_shader_z_format()
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 22 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.h | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_state_shaders.c | 3 |
3 files changed, 4 insertions, 23 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index 00770547499..5e49d655fc6 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -37,6 +37,7 @@ #include "ac_binary.h" #include "ac_llvm_util.h" #include "ac_exp_param.h" +#include "ac_shader_util.h" #include "si_shader_internal.h" #include "si_pipe.h" #include "sid.h" @@ -3419,25 +3420,6 @@ struct si_ps_exports { struct ac_export_args args[10]; }; -unsigned si_get_spi_shader_z_format(bool writes_z, bool writes_stencil, - bool writes_samplemask) -{ - if (writes_z) { - /* Z needs 32 bits. */ - if (writes_samplemask) - return V_028710_SPI_SHADER_32_ABGR; - else if (writes_stencil) - return V_028710_SPI_SHADER_32_GR; - else - return V_028710_SPI_SHADER_32_R; - } else if (writes_stencil || writes_samplemask) { - /* Both stencil and sample mask need only 16 bits. */ - return V_028710_SPI_SHADER_UINT16_ABGR; - } else { - return V_028710_SPI_SHADER_ZERO; - } -} - static void si_export_mrt_z(struct lp_build_tgsi_context *bld_base, LLVMValueRef depth, LLVMValueRef stencil, LLVMValueRef samplemask, struct si_ps_exports *exp) @@ -3446,7 +3428,7 @@ static void si_export_mrt_z(struct lp_build_tgsi_context *bld_base, struct lp_build_context *base = &bld_base->base; struct ac_export_args args; unsigned mask = 0; - unsigned format = si_get_spi_shader_z_format(depth != NULL, + unsigned format = ac_get_spi_shader_z_format(depth != NULL, stencil != NULL, samplemask != NULL); diff --git a/src/gallium/drivers/radeonsi/si_shader.h b/src/gallium/drivers/radeonsi/si_shader.h index bcb5c9da4ce..c981d3562e2 100644 --- a/src/gallium/drivers/radeonsi/si_shader.h +++ b/src/gallium/drivers/radeonsi/si_shader.h @@ -647,8 +647,6 @@ void si_shader_apply_scratch_relocs(struct si_shader *shader, void si_shader_binary_read_config(struct ac_shader_binary *binary, struct si_shader_config *conf, unsigned symbol_offset); -unsigned si_get_spi_shader_z_format(bool writes_z, bool writes_stencil, - bool writes_samplemask); const char *si_get_shader_name(const struct si_shader *shader, unsigned processor); /* si_shader_nir.c */ diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c index 4f683b85144..25854a1fde1 100644 --- a/src/gallium/drivers/radeonsi/si_state_shaders.c +++ b/src/gallium/drivers/radeonsi/si_state_shaders.c @@ -37,6 +37,7 @@ #include "util/disk_cache.h" #include "util/mesa-sha1.h" #include "ac_exp_param.h" +#include "ac_shader_util.h" /* SHADER_CACHE */ @@ -1123,7 +1124,7 @@ static void si_shader_ps(struct si_shader *shader) si_pm4_set_reg(pm4, R_0286D8_SPI_PS_IN_CONTROL, spi_ps_in_control); si_pm4_set_reg(pm4, R_028710_SPI_SHADER_Z_FORMAT, - si_get_spi_shader_z_format(info->writes_z, + ac_get_spi_shader_z_format(info->writes_z, info->writes_stencil, info->writes_samplemask)); |