mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-01-24 06:00:22 +01:00
nir: fix slot calculations for compact variables with location_frac
a variable with a component offset may span multiple slots, and this cannot
be inferred from its type alone (e.g., compacted clip+cull distances)
cc: mesa-stable
Reviewed-by: Connor Abbott <cwabbott0@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24163>
(cherry picked from commit 59396eefe6)
This commit is contained in:
parent
6fd9633b57
commit
4ce8ed7bbe
6 changed files with 8 additions and 8 deletions
|
|
@ -22594,7 +22594,7 @@
|
|||
"description": "nir: fix slot calculations for compact variables with location_frac",
|
||||
"nominated": true,
|
||||
"nomination_type": 0,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": null,
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -211,7 +211,7 @@ mark_whole_variable(nir_shader *shader, nir_variable *var,
|
|||
}
|
||||
|
||||
const unsigned slots =
|
||||
var->data.compact ? DIV_ROUND_UP(glsl_get_length(type), 4)
|
||||
var->data.compact ? DIV_ROUND_UP(var->data.location_frac + glsl_get_length(type), 4)
|
||||
: glsl_count_attribute_slots(type, false);
|
||||
|
||||
set_io_mask(shader, var, 0, slots, deref, is_output_read);
|
||||
|
|
@ -288,7 +288,7 @@ try_mask_partial_io(nir_shader *shader, nir_variable *var,
|
|||
return false;
|
||||
|
||||
const unsigned slots =
|
||||
var->data.compact ? DIV_ROUND_UP(glsl_get_length(type), 4)
|
||||
var->data.compact ? DIV_ROUND_UP(var->data.location_frac + glsl_get_length(type), 4)
|
||||
: glsl_count_attribute_slots(type, false);
|
||||
|
||||
if (offset >= slots) {
|
||||
|
|
|
|||
|
|
@ -927,7 +927,7 @@ tu_gather_xfb_info(nir_shader *nir, struct ir3_stream_output_info *info)
|
|||
|
||||
nir_foreach_shader_out_variable(var, nir) {
|
||||
unsigned slots =
|
||||
var->data.compact ? DIV_ROUND_UP(glsl_get_length(var->type), 4)
|
||||
var->data.compact ? DIV_ROUND_UP(var->data.location_frac + glsl_get_length(var->type), 4)
|
||||
: glsl_count_attribute_slots(var->type, false);
|
||||
for (unsigned i = 0; i < slots; i++)
|
||||
output_map[var->data.location + i] = var->data.driver_location + i;
|
||||
|
|
|
|||
|
|
@ -477,7 +477,7 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
|
|||
type = glsl_get_array_element(type);
|
||||
}
|
||||
|
||||
unsigned attrib_count = variable->data.compact ? DIV_ROUND_UP(glsl_get_length(type), 4) :
|
||||
unsigned attrib_count = variable->data.compact ? DIV_ROUND_UP(variable->data.location_frac + glsl_get_length(type), 4) :
|
||||
glsl_count_attribute_slots(type, nir->info.stage == MESA_SHADER_VERTEX);
|
||||
|
||||
i = variable->data.driver_location;
|
||||
|
|
@ -577,7 +577,7 @@ void nir_tgsi_scan_shader(const struct nir_shader *nir,
|
|||
type = glsl_get_array_element(type);
|
||||
}
|
||||
|
||||
unsigned attrib_count = variable->data.compact ? DIV_ROUND_UP(glsl_get_length(type), 4) :
|
||||
unsigned attrib_count = variable->data.compact ? DIV_ROUND_UP(variable->data.location_frac + glsl_get_length(type), 4) :
|
||||
glsl_count_attribute_slots(type, false);
|
||||
for (unsigned k = 0; k < attrib_count; k++, i++) {
|
||||
|
||||
|
|
|
|||
|
|
@ -527,7 +527,7 @@ lvp_shader_xfb_init(struct lvp_shader *shader)
|
|||
memset(output_mapping, 0, sizeof(output_mapping));
|
||||
|
||||
nir_foreach_shader_out_variable(var, shader->pipeline_nir->nir) {
|
||||
unsigned slots = var->data.compact ? DIV_ROUND_UP(glsl_get_length(var->type), 4)
|
||||
unsigned slots = var->data.compact ? DIV_ROUND_UP(var->data.location_frac + glsl_get_length(var->type), 4)
|
||||
: glsl_count_attribute_slots(var->type, false);
|
||||
for (unsigned i = 0; i < slots; i++)
|
||||
output_mapping[var->data.location + i] = var->data.driver_location + i;
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ fs_visitor::nir_setup_outputs()
|
|||
nir_foreach_shader_out_variable(var, nir) {
|
||||
const int loc = var->data.driver_location;
|
||||
const unsigned var_vec4s =
|
||||
var->data.compact ? DIV_ROUND_UP(glsl_get_length(var->type), 4)
|
||||
var->data.compact ? DIV_ROUND_UP(var->data.location_frac + glsl_get_length(var->type), 4)
|
||||
: type_size_vec4(var->type, true);
|
||||
vec4s[loc] = MAX2(vec4s[loc], var_vec4s);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue