mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 16:48:07 +02:00
rusticl/spirv: do not pass a NULL pointer to slice::from_raw_parts
Fixes:e8de580998("rusticl/kernel: basic implementation") Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29604> (cherry picked from commite522c91d5c)
This commit is contained in:
parent
d831d3f386
commit
cc10f7ae64
2 changed files with 14 additions and 12 deletions
|
|
@ -644,7 +644,7 @@
|
|||
"description": "rusticl/spirv: do not pass a NULL pointer to slice::from_raw_parts",
|
||||
"nominated": true,
|
||||
"nomination_type": 1,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "e8de580998fb48bda58e35150614996b8573ba08",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -285,17 +285,19 @@ impl SPIRVBin {
|
|||
|
||||
pub fn args(&self, name: &str) -> Vec<SPIRVKernelArg> {
|
||||
match self.kernel_info(name) {
|
||||
None => Vec::new(),
|
||||
Some(info) => unsafe { slice::from_raw_parts(info.args, info.num_args) }
|
||||
.iter()
|
||||
.map(|a| SPIRVKernelArg {
|
||||
name: c_string_to_string(a.name),
|
||||
type_name: c_string_to_string(a.type_name),
|
||||
access_qualifier: clc_kernel_arg_access_qualifier(a.access_qualifier),
|
||||
address_qualifier: a.address_qualifier,
|
||||
type_qualifier: clc_kernel_arg_type_qualifier(a.type_qualifier),
|
||||
})
|
||||
.collect(),
|
||||
Some(info) if info.num_args > 0 => {
|
||||
unsafe { slice::from_raw_parts(info.args, info.num_args) }
|
||||
.iter()
|
||||
.map(|a| SPIRVKernelArg {
|
||||
name: c_string_to_string(a.name),
|
||||
type_name: c_string_to_string(a.type_name),
|
||||
access_qualifier: clc_kernel_arg_access_qualifier(a.access_qualifier),
|
||||
address_qualifier: a.address_qualifier,
|
||||
type_qualifier: clc_kernel_arg_type_qualifier(a.type_qualifier),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
_ => Vec::new(),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue