diff options
author | Zoltan Gilian <[email protected]> | 2015-07-30 23:35:09 +0200 |
---|---|---|
committer | Zoltan Gilian <[email protected]> | 2015-08-03 13:50:38 +0200 |
commit | be3622dce383cb930a233b88bb056adb026dce1f (patch) | |
tree | 28a60f1d68b7045488c52cd04be47b8af0715898 | |
parent | aa46fba7e61a77bb3b029c7a483b5a2a2a73ff4d (diff) |
clover: handle setKernelArg errors
-rw-r--r-- | src/gallium/state_trackers/clover/core/kernel.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
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); |