return dim;
}
+unsigned
+ac_get_fs_input_vgpr_cnt(const struct ac_shader_config *config,
+ signed char *face_vgpr_index_ptr,
+ signed char *ancillary_vgpr_index_ptr)
+{
+ unsigned num_input_vgprs = 0;
+ signed char face_vgpr_index = -1;
+ signed char ancillary_vgpr_index = -1;
+
+ if (G_0286CC_PERSP_SAMPLE_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 2;
+ if (G_0286CC_PERSP_CENTER_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 2;
+ if (G_0286CC_PERSP_CENTROID_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 2;
+ if (G_0286CC_PERSP_PULL_MODEL_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 3;
+ if (G_0286CC_LINEAR_SAMPLE_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 2;
+ if (G_0286CC_LINEAR_CENTER_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 2;
+ if (G_0286CC_LINEAR_CENTROID_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 2;
+ if (G_0286CC_LINE_STIPPLE_TEX_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 1;
+ if (G_0286CC_POS_X_FLOAT_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 1;
+ if (G_0286CC_POS_Y_FLOAT_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 1;
+ if (G_0286CC_POS_Z_FLOAT_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 1;
+ if (G_0286CC_POS_W_FLOAT_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 1;
+ if (G_0286CC_FRONT_FACE_ENA(config->spi_ps_input_addr)) {
+ face_vgpr_index = num_input_vgprs;
+ num_input_vgprs += 1;
+ }
+ if (G_0286CC_ANCILLARY_ENA(config->spi_ps_input_addr)) {
+ ancillary_vgpr_index = num_input_vgprs;
+ num_input_vgprs += 1;
+ }
+ if (G_0286CC_SAMPLE_COVERAGE_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 1;
+ if (G_0286CC_POS_FIXED_PT_ENA(config->spi_ps_input_addr))
+ num_input_vgprs += 1;
+
+ if (face_vgpr_index_ptr)
+ *face_vgpr_index_ptr = face_vgpr_index;
+ if (ancillary_vgpr_index_ptr)
+ *ancillary_vgpr_index_ptr = ancillary_vgpr_index;
+
+ return num_input_vgprs;
+}
#include <stdint.h>
#include "amd_family.h"
+#include "ac_binary.h"
#include "compiler/nir/nir.h"
enum ac_image_dim {
ac_get_image_dim(enum chip_class chip_class, enum glsl_sampler_dim sdim,
bool is_array);
+unsigned
+ac_get_fs_input_vgpr_cnt(const struct ac_shader_config *config,
+ signed char *face_vgpr_index,
+ signed char *ancillary_vgpr_index);
+
#endif
unsigned num_input_vgprs = info->num_input_vgprs;
if (stage == MESA_SHADER_FRAGMENT) {
- num_input_vgprs = 0;
- if (G_0286CC_PERSP_SAMPLE_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 2;
- if (G_0286CC_PERSP_CENTER_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 2;
- if (G_0286CC_PERSP_CENTROID_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 2;
- if (G_0286CC_PERSP_PULL_MODEL_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 3;
- if (G_0286CC_LINEAR_SAMPLE_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 2;
- if (G_0286CC_LINEAR_CENTER_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 2;
- if (G_0286CC_LINEAR_CENTROID_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 2;
- if (G_0286CC_LINE_STIPPLE_TEX_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_POS_X_FLOAT_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_POS_Y_FLOAT_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_POS_Z_FLOAT_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_POS_W_FLOAT_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_FRONT_FACE_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_ANCILLARY_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_SAMPLE_COVERAGE_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
- if (G_0286CC_POS_FIXED_PT_ENA(config_in->spi_ps_input_addr))
- num_input_vgprs += 1;
+ num_input_vgprs = ac_get_fs_input_vgpr_cnt(config_in, NULL, NULL);
}
unsigned num_vgprs = MAX2(config_in->num_vgprs, num_input_vgprs);
/* Calculate the number of fragment input VGPRs. */
if (ctx.type == PIPE_SHADER_FRAGMENT) {
- shader->info.num_input_vgprs = 0;
- shader->info.face_vgpr_index = -1;
- shader->info.ancillary_vgpr_index = -1;
-
- if (G_0286CC_PERSP_SAMPLE_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 2;
- if (G_0286CC_PERSP_CENTER_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 2;
- if (G_0286CC_PERSP_CENTROID_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 2;
- if (G_0286CC_PERSP_PULL_MODEL_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 3;
- if (G_0286CC_LINEAR_SAMPLE_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 2;
- if (G_0286CC_LINEAR_CENTER_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 2;
- if (G_0286CC_LINEAR_CENTROID_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 2;
- if (G_0286CC_LINE_STIPPLE_TEX_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 1;
- if (G_0286CC_POS_X_FLOAT_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 1;
- if (G_0286CC_POS_Y_FLOAT_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 1;
- if (G_0286CC_POS_Z_FLOAT_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 1;
- if (G_0286CC_POS_W_FLOAT_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 1;
- if (G_0286CC_FRONT_FACE_ENA(shader->config.spi_ps_input_addr)) {
- shader->info.face_vgpr_index = shader->info.num_input_vgprs;
- shader->info.num_input_vgprs += 1;
- }
- if (G_0286CC_ANCILLARY_ENA(shader->config.spi_ps_input_addr)) {
- shader->info.ancillary_vgpr_index = shader->info.num_input_vgprs;
- shader->info.num_input_vgprs += 1;
- }
- if (G_0286CC_SAMPLE_COVERAGE_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 1;
- if (G_0286CC_POS_FIXED_PT_ENA(shader->config.spi_ps_input_addr))
- shader->info.num_input_vgprs += 1;
+ shader->info.num_input_vgprs = ac_get_fs_input_vgpr_cnt(&shader->config,
+ &shader->info.face_vgpr_index,
+ &shader->info.ancillary_vgpr_index);
}
si_calculate_max_simd_waves(shader);