mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-09 08:58:02 +02:00
nir: Get correct number of components
The code wants the number of components used by the variable in the current attribute slot, not the total number of components. For e.g. a 4x3 matrix, glsl_get_components() returns 12, leading to the following error reported by AddressSanitizer: ``` Test case 'dEQP-VK.tessellation.shader_input_output.cross_invocation_per_patch_mat4x3'.. ../src/compiler/nir/nir_lower_io_to_vector.c:265:16: runtime error: index 4 out of bounds for type 'nir_variable *[4]' ``` Fixes:5ef2b8f1f2("nir: Add a pass for lowering IO back to vector when possible") (cherry picked from commitba5c65f10b) Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32261>
This commit is contained in:
parent
5cb4c5bd47
commit
5ad7548183
2 changed files with 2 additions and 2 deletions
|
|
@ -174,7 +174,7 @@
|
|||
"description": "nir: Get correct number of components",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "5ef2b8f1f2ebcdb4ffe5c98b3f4f48e584cb4b22",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -253,7 +253,7 @@ create_new_io_vars(nir_shader *shader, nir_variable_mode mode,
|
|||
}
|
||||
|
||||
const unsigned num_components =
|
||||
glsl_get_components(glsl_without_array(var->type));
|
||||
glsl_get_vector_elements(glsl_without_array(var->type));
|
||||
if (!num_components) {
|
||||
assert(frac == 0);
|
||||
frac++;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue