summaryrefslogtreecommitdiffstats
path: root/src/amd/common/ac_shader_util.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/amd/common/ac_shader_util.c')
-rw-r--r--src/amd/common/ac_shader_util.c35
1 files changed, 35 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;
+}