rusticl: correctly check global argument size

As the spec that is quoted in the comment says, if the argument is a
memory object, arg_size should be different than sizeof(cl_mem). The
previous verification only worked if the underlying type has the same
size as sizeof(cl_mem).

Signed-off-by: Italo Nicola <italonicola@collabora.com>
Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18985>
This commit is contained in:
Italo Nicola
2022-10-06 12:32:03 +00:00
committed by Marge Bot
parent c935232822
commit b0d698c532

View File

@@ -240,6 +240,11 @@ pub fn set_kernel_arg(
return Err(CL_INVALID_ARG_SIZE);
}
}
KernelArgType::MemGlobal => {
if arg_size != std::mem::size_of::<cl_mem>() {
return Err(CL_INVALID_ARG_SIZE);
}
}
_ => {
if arg.size != arg_size {
return Err(CL_INVALID_ARG_SIZE);