diff options
author | Timothy Arceri <[email protected]> | 2018-01-14 20:43:40 +1100 |
---|---|---|
committer | Timothy Arceri <[email protected]> | 2018-01-31 09:14:07 +1100 |
commit | fea6da9aaa418c40f229db2ca0c85d7aae96cb73 (patch) | |
tree | 46d12e8e84bfd31b18a58a427a0fe2044c1956bd | |
parent | 580f1aa247479b0cd06e94ba09c13317240561be (diff) |
radeonsi/nir: move the interpolation qualifier scanning
We need to collect this when scanning over the instruction rather
than when scanning over the inputs otherwise we might get confliting
values for inputs that are use by the interpolateAt* builtins.
Reviewed-by: Marek Olšák <[email protected]>
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader_nir.c | 52 |
1 files changed, 36 insertions, 16 deletions
diff --git a/src/gallium/drivers/radeonsi/si_shader_nir.c b/src/gallium/drivers/radeonsi/si_shader_nir.c index 6368b712062..e055164dd40 100644 --- a/src/gallium/drivers/radeonsi/si_shader_nir.c +++ b/src/gallium/drivers/radeonsi/si_shader_nir.c @@ -127,6 +127,40 @@ static void scan_instruction(struct tgsi_shader_info *info, case nir_intrinsic_ssbo_atomic_comp_swap: info->writes_memory = true; break; + case nir_intrinsic_load_var: { + nir_variable *var = intr->variables[0]->var; + nir_variable_mode mode = var->data.mode; + enum glsl_base_type base_type = + glsl_get_base_type(glsl_without_array(var->type)); + + if (mode == nir_var_shader_in) { + switch (var->data.interpolation) { + case INTERP_MODE_NONE: + if (glsl_base_type_is_integer(base_type)) + break; + + /* fall-through */ + case INTERP_MODE_SMOOTH: + if (var->data.sample) + info->uses_persp_sample = true; + else if (var->data.centroid) + info->uses_persp_centroid = true; + else + info->uses_persp_center = true; + break; + + case INTERP_MODE_NOPERSPECTIVE: + if (var->data.sample) + info->uses_linear_sample = true; + else if (var->data.centroid) + info->uses_linear_centroid = true; + else + info->uses_linear_center = true; + break; + } + } + break; + } case nir_intrinsic_interp_var_at_centroid: case nir_intrinsic_interp_var_at_sample: case nir_intrinsic_interp_var_at_offset: { @@ -296,34 +330,20 @@ void si_nir_scan_shader(const struct nir_shader *nir, if (semantic_name == TGSI_SEMANTIC_COLOR) { info->input_interpolate[i] = TGSI_INTERPOLATE_COLOR; - goto persp_locations; + break; } /* fall-through */ + case INTERP_MODE_SMOOTH: assert(!glsl_base_type_is_integer(base_type)); info->input_interpolate[i] = TGSI_INTERPOLATE_PERSPECTIVE; - - persp_locations: - if (variable->data.sample) - info->uses_persp_sample = true; - else if (variable->data.centroid) - info->uses_persp_centroid = true; - else - info->uses_persp_center = true; break; case INTERP_MODE_NOPERSPECTIVE: assert(!glsl_base_type_is_integer(base_type)); info->input_interpolate[i] = TGSI_INTERPOLATE_LINEAR; - - if (variable->data.sample) - info->uses_linear_sample = true; - else if (variable->data.centroid) - info->uses_linear_centroid = true; - else - info->uses_linear_center = true; break; case INTERP_MODE_FLAT: |