[Beignet] [PATCH 5/5] Refine retain/release sampler API
junyan.he at inbox.com
junyan.he at inbox.com
Thu Oct 13 08:40:57 UTC 2016
From: Junyan He <junyan.he at intel.com>
Signed-off-by: Junyan He <junyan.he at intel.com>
---
src/cl_api.c | 20 --------------------
src/cl_api_sampler.c | 22 ++++++++++++++++++++++
2 files changed, 22 insertions(+), 20 deletions(-)
diff --git a/src/cl_api.c b/src/cl_api.c
index 96aebc2..d80335e 100644
--- a/src/cl_api.c
+++ b/src/cl_api.c
@@ -369,26 +369,6 @@ error:
return err;
}
-cl_int
-clRetainSampler(cl_sampler sampler)
-{
- cl_int err = CL_SUCCESS;
- CHECK_SAMPLER (sampler);
- cl_sampler_add_ref(sampler);
-error:
- return err;
-}
-
-cl_int
-clReleaseSampler(cl_sampler sampler)
-{
- cl_int err = CL_SUCCESS;
- CHECK_SAMPLER (sampler);
- cl_sampler_delete(sampler);
-error:
- return err;
-}
-
cl_program
clCreateProgramWithSource(cl_context context,
cl_uint count,
diff --git a/src/cl_api_sampler.c b/src/cl_api_sampler.c
index ffdcebb..3999ad4 100644
--- a/src/cl_api_sampler.c
+++ b/src/cl_api_sampler.c
@@ -102,3 +102,25 @@ clGetSamplerInfo(cl_sampler sampler,
return cl_get_info_helper(src_ptr, src_size,
param_value, param_value_size, param_value_size_ret);
}
+
+cl_int
+clRetainSampler(cl_sampler sampler)
+{
+ if (!CL_OBJECT_IS_SAMPLER(sampler)) {
+ return CL_INVALID_SAMPLER;
+ }
+
+ cl_sampler_add_ref(sampler);
+ return CL_SUCCESS;
+}
+
+cl_int
+clReleaseSampler(cl_sampler sampler)
+{
+ if (!CL_OBJECT_IS_SAMPLER(sampler)) {
+ return CL_INVALID_SAMPLER;
+ }
+
+ cl_sampler_delete(sampler);
+ return CL_SUCCESS;
+}
--
2.7.4
More information about the Beignet
mailing list