diff options
author | Samuel Pitoiset <[email protected]> | 2017-12-15 15:37:19 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2017-12-18 11:50:50 +0100 |
commit | 79b34d083219473340d605b857274d1f8ba4fc37 (patch) | |
tree | 280bf6d4c5b06e2aa54669b276adc084ad071839 /src/amd/common | |
parent | 55f8431c76adcfb91d644edbbe57be6a15a04654 (diff) |
amd/common: add ac_vgt_gs_mode() 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 | 27 | ||||
-rw-r--r-- | src/amd/common/ac_shader_util.h | 6 |
2 files changed, 33 insertions, 0 deletions
diff --git a/src/amd/common/ac_shader_util.c b/src/amd/common/ac_shader_util.c index ab8d3ed49bc..12f86dc677c 100644 --- a/src/amd/common/ac_shader_util.c +++ b/src/amd/common/ac_shader_util.c @@ -78,3 +78,30 @@ ac_get_cb_shader_mask(unsigned spi_shader_col_format) } return cb_shader_mask; } + +/** + * Calculate the appropriate setting of VGT_GS_MODE when \p shader is a + * geometry shader. + */ +uint32_t +ac_vgt_gs_mode(unsigned gs_max_vert_out, enum chip_class chip_class) +{ + unsigned cut_mode; + + if (gs_max_vert_out <= 128) { + cut_mode = V_028A40_GS_CUT_128; + } else if (gs_max_vert_out <= 256) { + cut_mode = V_028A40_GS_CUT_256; + } else if (gs_max_vert_out <= 512) { + cut_mode = V_028A40_GS_CUT_512; + } else { + assert(gs_max_vert_out <= 1024); + cut_mode = V_028A40_GS_CUT_1024; + } + + return S_028A40_MODE(V_028A40_GS_SCENARIO_G) | + S_028A40_CUT_MODE(cut_mode)| + S_028A40_ES_WRITE_OPTIMIZE(chip_class <= VI) | + S_028A40_GS_WRITE_OPTIMIZE(1) | + S_028A40_ONCHIP(chip_class >= GFX9 ? 1 : 0); +} diff --git a/src/amd/common/ac_shader_util.h b/src/amd/common/ac_shader_util.h index d3804b8fb13..1bdf909e099 100644 --- a/src/amd/common/ac_shader_util.h +++ b/src/amd/common/ac_shader_util.h @@ -25,6 +25,9 @@ #define AC_SHADER_UTIL_H #include <stdbool.h> +#include <stdint.h> + +#include "amd_family.h" unsigned ac_get_spi_shader_z_format(bool writes_z, bool writes_stencil, @@ -33,4 +36,7 @@ ac_get_spi_shader_z_format(bool writes_z, bool writes_stencil, unsigned ac_get_cb_shader_mask(unsigned spi_shader_col_format); +uint32_t +ac_vgt_gs_mode(unsigned gs_max_vert_out, enum chip_class chip_class); + #endif |