rusticl/queue: properly implement clCreateCommandQueueWithProperties

It didn't do any of the error checking, but it was supposed to be. Also
the error checking was slightly wrong and we should return
CL_INVALID_QUEUE_PROPERTIES instead of CL_INVALID_VALUE for unsupported
properties.

Signed-off-by: Karol Herbst <git@karolherbst.de>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24991>
This commit is contained in:
Karol Herbst 2023-09-01 11:10:28 +02:00 committed by Marge Bot
parent 969f7b97fd
commit 46c17a8e54

View file

@ -41,8 +41,12 @@ impl CLInfo<cl_command_queue_info> for cl_command_queue {
}
fn valid_command_queue_properties(properties: cl_command_queue_properties) -> bool {
let valid_flags =
cl_bitfield::from(CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE | CL_QUEUE_PROFILING_ENABLE);
let valid_flags = cl_bitfield::from(
CL_QUEUE_OUT_OF_ORDER_EXEC_MODE_ENABLE
| CL_QUEUE_PROFILING_ENABLE
| CL_QUEUE_ON_DEVICE
| CL_QUEUE_ON_DEVICE_DEFAULT,
);
properties & !valid_flags == 0
}
@ -110,9 +114,6 @@ fn create_command_queue_with_properties(
device: cl_device_id,
properties: *const cl_queue_properties,
) -> CLResult<cl_command_queue> {
let c = context.get_arc()?;
let d = device.get_ref()?.to_static().ok_or(CL_INVALID_DEVICE)?;
let mut queue_properties = cl_command_queue_properties::default();
let properties = if properties.is_null() {
None
@ -132,12 +133,7 @@ fn create_command_queue_with_properties(
Some(properties)
};
Ok(cl_command_queue::from_arc(Queue::new(
c,
d,
queue_properties,
properties,
)?))
create_command_queue_impl(context, device, queue_properties, properties)
}
#[cl_entrypoint]