[Mesa-dev] [PATCH] clover: handle setKernelArg errors
Francisco Jerez
currojerez at riseup.net
Fri Jul 31 06:55:20 PDT 2015
Zoltan Gilian <zoltan.gilian at gmail.com> writes:
> ---
> src/gallium/state_trackers/clover/core/kernel.cpp | 15 +++++++++++++++
> 1 file changed, 15 insertions(+)
>
> diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp
> index a23cd2b..820a80a 100644
> --- a/src/gallium/state_trackers/clover/core/kernel.cpp
> +++ b/src/gallium/state_trackers/clover/core/kernel.cpp
> @@ -366,6 +366,9 @@ kernel::scalar_argument::scalar_argument(size_t size) : size(size) {
>
> void
> kernel::scalar_argument::set(size_t size, const void *value) {
> + if (!value)
> + throw error(CL_INVALID_ARG_VALUE);
> +
> if (size != this->size)
> throw error(CL_INVALID_ARG_SIZE);
>
> @@ -434,6 +437,9 @@ kernel::local_argument::set(size_t size, const void *value) {
> if (value)
> throw error(CL_INVALID_ARG_VALUE);
>
> + if (!size)
> + throw error(CL_INVALID_ARG_SIZE);
> +
> _storage = size;
> _set = true;
> }
> @@ -493,6 +499,9 @@ kernel::constant_argument::unbind(exec_context &ctx) {
>
> void
> kernel::image_rd_argument::set(size_t size, const void *value) {
> + if (!value)
> + throw error(CL_INVALID_ARG_VALUE);
> +
> if (size != sizeof(cl_mem))
> throw error(CL_INVALID_ARG_SIZE);
>
> @@ -521,6 +530,9 @@ kernel::image_rd_argument::unbind(exec_context &ctx) {
>
> void
> kernel::image_wr_argument::set(size_t size, const void *value) {
> + if (!value)
> + throw error(CL_INVALID_ARG_VALUE);
> +
> if (size != sizeof(cl_mem))
> throw error(CL_INVALID_ARG_SIZE);
>
> @@ -549,6 +561,9 @@ kernel::image_wr_argument::unbind(exec_context &ctx) {
>
> void
> kernel::sampler_argument::set(size_t size, const void *value) {
> + if (!value)
> + throw error(CL_INVALID_SAMPLER);
> +
> if (size != sizeof(cl_sampler))
> throw error(CL_INVALID_ARG_SIZE);
>
> --
> 2.4.6
Reviewed-by: Francisco Jerez <currojerez at riseup.net>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 212 bytes
Desc: not available
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150731/802af5af/attachment.sig>
More information about the mesa-dev
mailing list