diff options
author | Samuel Pitoiset <[email protected]> | 2017-12-15 15:37:18 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-12-18 11:50:48 +0100 |
commit | 55f8431c76adcfb91d644edbbe57be6a15a04654 (patch) | |
tree | 36d397ceb5bf36b4b164db5dd7b22f5ff8910801 /src/amd/common | |
parent | bb01661918119f00dbef1ea07a3af3ebea537114 (diff) |
amd/common: add ac_get_cb_shader_mask() helper
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/common')
-rw-r--r-- | src/amd/common/ac_shader_util.c | 35 | ||||
-rw-r--r-- | src/amd/common/ac_shader_util.h | 3 |
2 files changed, 38 insertions, 0 deletions
diff --git a/src/amd/common/ac_shader_util.c b/src/amd/common/ac_shader_util.c index 9d33a465591..ab8d3ed49bc 100644 --- a/src/amd/common/ac_shader_util.c +++ b/src/amd/common/ac_shader_util.c @@ -21,6 +21,8 @@ * IN THE SOFTWARE. */ +#include <assert.h> + #include "ac_shader_util.h" #include "sid.h" @@ -43,3 +45,36 @@ ac_get_spi_shader_z_format(bool writes_z, bool writes_stencil, return V_028710_SPI_SHADER_ZERO; } } + +unsigned +ac_get_cb_shader_mask(unsigned spi_shader_col_format) +{ + unsigned i, cb_shader_mask = 0; + + for (i = 0; i < 8; i++) { + switch ((spi_shader_col_format >> (i * 4)) & 0xf) { + case V_028714_SPI_SHADER_ZERO: + break; + case V_028714_SPI_SHADER_32_R: + cb_shader_mask |= 0x1 << (i * 4); + break; + case V_028714_SPI_SHADER_32_GR: + cb_shader_mask |= 0x3 << (i * 4); + break; + case V_028714_SPI_SHADER_32_AR: + cb_shader_mask |= 0x9 << (i * 4); + break; + case V_028714_SPI_SHADER_FP16_ABGR: + case V_028714_SPI_SHADER_UNORM16_ABGR: + case V_028714_SPI_SHADER_SNORM16_ABGR: + case V_028714_SPI_SHADER_UINT16_ABGR: + case V_028714_SPI_SHADER_SINT16_ABGR: + case V_028714_SPI_SHADER_32_ABGR: + cb_shader_mask |= 0xf << (i * 4); + break; + default: + assert(0); + } + } + return cb_shader_mask; +} diff --git a/src/amd/common/ac_shader_util.h b/src/amd/common/ac_shader_util.h index 1f971e76f16..d3804b8fb13 100644 --- a/src/amd/common/ac_shader_util.h +++ b/src/amd/common/ac_shader_util.h @@ -30,4 +30,7 @@ unsigned ac_get_spi_shader_z_format(bool writes_z, bool writes_stencil, bool writes_samplemask); +unsigned +ac_get_cb_shader_mask(unsigned spi_shader_col_format); + #endif |