radeonsi: make use of ac_get_spi_shader_z_format()

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Samuel Pitoiset 2017-12-14 13:51:46 +01:00
parent 91f4d746e4
commit 45872a0a6d
3 changed files with 4 additions and 23 deletions

View File

@ -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);

View File

@ -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 */

View File

@ -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));