From: Zoltan Gilian Date: Thu, 30 Jul 2015 21:35:09 +0000 (+0200) Subject: clover: handle setKernelArg errors X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=be3622dce383cb930a233b88bb056adb026dce1f;p=mesa.git clover: handle setKernelArg errors --- diff --git a/src/gallium/state_trackers/clover/core/kernel.cpp b/src/gallium/state_trackers/clover/core/kernel.cpp index 955ff7b3955..a226ec1a752 100644 --- a/src/gallium/state_trackers/clover/core/kernel.cpp +++ b/src/gallium/state_trackers/clover/core/kernel.cpp @@ -367,6 +367,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); @@ -435,6 +438,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; } @@ -494,6 +500,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); @@ -522,6 +531,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); @@ -550,6 +562,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);