mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 09:18:04 +02:00
rusticl/kernel: assign sampler locations before DCEing variables
This fixes an issue hit by one of darktable's kernels, where the sampler argument got assigned the location of a dead kernel parameter turning it into a zombie and leading us to trash the kernel input buffer's layout. Fixes:25b8a34b48("rusticl/kernel: inline samplers") Signed-off-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28121> (cherry picked from commit2df640c4f6)
This commit is contained in:
parent
29afc1c53e
commit
84abf14d9c
2 changed files with 18 additions and 17 deletions
|
|
@ -1304,7 +1304,7 @@
|
||||||
"description": "rusticl/kernel: assign sampler locations before DCEing variables",
|
"description": "rusticl/kernel: assign sampler locations before DCEing variables",
|
||||||
"nominated": true,
|
"nominated": true,
|
||||||
"nomination_type": 1,
|
"nomination_type": 1,
|
||||||
"resolution": 0,
|
"resolution": 1,
|
||||||
"main_sha": null,
|
"main_sha": null,
|
||||||
"because_sha": "25b8a34b48fce99164f1cb853bcde86d1cf6cba5",
|
"because_sha": "25b8a34b48fce99164f1cb853bcde86d1cf6cba5",
|
||||||
"notes": null
|
"notes": null
|
||||||
|
|
|
||||||
|
|
@ -458,22 +458,8 @@ fn lower_and_optimize_nir(
|
||||||
let mut args = KernelArg::from_spirv_nir(args, nir);
|
let mut args = KernelArg::from_spirv_nir(args, nir);
|
||||||
let mut internal_args = Vec::new();
|
let mut internal_args = Vec::new();
|
||||||
|
|
||||||
let dv_opts = nir_remove_dead_variables_options {
|
// asign locations for inline samplers.
|
||||||
can_remove_var: Some(can_remove_var),
|
// IMPORTANT: this needs to happen before nir_remove_dead_variables.
|
||||||
can_remove_var_data: ptr::null_mut(),
|
|
||||||
};
|
|
||||||
nir_pass!(
|
|
||||||
nir,
|
|
||||||
nir_remove_dead_variables,
|
|
||||||
nir_variable_mode::nir_var_uniform
|
|
||||||
| nir_variable_mode::nir_var_image
|
|
||||||
| nir_variable_mode::nir_var_mem_constant
|
|
||||||
| nir_variable_mode::nir_var_mem_shared
|
|
||||||
| nir_variable_mode::nir_var_function_temp,
|
|
||||||
&dv_opts,
|
|
||||||
);
|
|
||||||
|
|
||||||
// asign locations for inline samplers
|
|
||||||
let mut last_loc = -1;
|
let mut last_loc = -1;
|
||||||
for v in nir
|
for v in nir
|
||||||
.variables_with_mode(nir_variable_mode::nir_var_uniform | nir_variable_mode::nir_var_image)
|
.variables_with_mode(nir_variable_mode::nir_var_uniform | nir_variable_mode::nir_var_image)
|
||||||
|
|
@ -501,6 +487,21 @@ fn lower_and_optimize_nir(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let dv_opts = nir_remove_dead_variables_options {
|
||||||
|
can_remove_var: Some(can_remove_var),
|
||||||
|
can_remove_var_data: ptr::null_mut(),
|
||||||
|
};
|
||||||
|
nir_pass!(
|
||||||
|
nir,
|
||||||
|
nir_remove_dead_variables,
|
||||||
|
nir_variable_mode::nir_var_uniform
|
||||||
|
| nir_variable_mode::nir_var_image
|
||||||
|
| nir_variable_mode::nir_var_mem_constant
|
||||||
|
| nir_variable_mode::nir_var_mem_shared
|
||||||
|
| nir_variable_mode::nir_var_function_temp,
|
||||||
|
&dv_opts,
|
||||||
|
);
|
||||||
|
|
||||||
nir_pass!(nir, nir_lower_readonly_images_to_tex, true);
|
nir_pass!(nir, nir_lower_readonly_images_to_tex, true);
|
||||||
nir_pass!(
|
nir_pass!(
|
||||||
nir,
|
nir,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue