aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/api/api_sampler.cpp14
-rw-r--r--src/core/sampler.h12
2 files changed, 18 insertions, 8 deletions
diff --git a/src/api/api_sampler.cpp b/src/api/api_sampler.cpp
index 6bee50e..08e5d1c 100644
--- a/src/api/api_sampler.cpp
+++ b/src/api/api_sampler.cpp
@@ -71,12 +71,14 @@ clCreateSampler(cl_context d_context,
return 0;
}
- return (cl_sampler)sampler;
+ return desc(sampler);
}
cl_int
-clRetainSampler(cl_sampler sampler)
+clRetainSampler(cl_sampler d_sampler)
{
+ auto sampler = pobj(d_sampler);
+
if (!sampler->isA(Coal::Object::T_Sampler))
return CL_INVALID_SAMPLER;
@@ -86,8 +88,10 @@ clRetainSampler(cl_sampler sampler)
}
cl_int
-clReleaseSampler(cl_sampler sampler)
+clReleaseSampler(cl_sampler d_sampler)
{
+ auto sampler = pobj(d_sampler);
+
if (!sampler->isA(Coal::Object::T_Sampler))
return CL_INVALID_SAMPLER;
@@ -98,12 +102,14 @@ clReleaseSampler(cl_sampler sampler)
}
cl_int
-clGetSamplerInfo(cl_sampler sampler,
+clGetSamplerInfo(cl_sampler d_sampler,
cl_sampler_info param_name,
size_t param_value_size,
void * param_value,
size_t * param_value_size_ret)
{
+ auto sampler = pobj(d_sampler);
+
if (!sampler->isA(Coal::Object::T_Sampler))
return CL_INVALID_SAMPLER;
diff --git a/src/core/sampler.h b/src/core/sampler.h
index 1ff1f1f..2e3c0fe 100644
--- a/src/core/sampler.h
+++ b/src/core/sampler.h
@@ -35,6 +35,7 @@
#include <CL/cl.h>
#include "object.h"
+#include "icd.h"
// WARNING: Keep in sync with stdlib.h
@@ -54,6 +55,12 @@
namespace Coal
{
+ class Sampler;
+}
+struct _cl_sampler: public Coal::descriptor<Coal::Sampler, _cl_sampler> {};
+
+namespace Coal
+{
class Context;
@@ -64,7 +71,7 @@ class Context;
* host OpenCL constants to constants that will be used by the kernels and
* the image reading and writing built-in functions.
*/
-class Sampler : public Object
+class Sampler : public _cl_sampler, public Object
{
public:
/**
@@ -109,7 +116,4 @@ class Sampler : public Object
}
-struct _cl_sampler : public Coal::Sampler
-{};
-
#endif