cf4ocl (C Framework for OpenCL)  v2.1.0
Object-oriented framework for developing and benchmarking OpenCL projects in C/C++
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ccl_sampler_wrapper.h
Go to the documentation of this file.
1 /*
2  * This file is part of cf4ocl (C Framework for OpenCL).
3  *
4  * cf4ocl is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, either version 3 of the
7  * License, or (at your option) any later version.
8  *
9  * cf4ocl is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with cf4ocl. If not, see
16  * <http://www.gnu.org/licenses/>.
17  * */
18 
29 #ifndef _CCL_SAMPLER_WRAPPER_H_
30 #define _CCL_SAMPLER_WRAPPER_H_
31 
32 #include "ccl_abstract_wrapper.h"
33 #include "ccl_context_wrapper.h"
34 
86 /* Get the sampler wrapper for the given OpenCL sampler. */
87 CCL_EXPORT
88 CCLSampler* ccl_sampler_new_wrap(cl_sampler sampler);
89 
90 /* Decrements the reference count of the wrapper object. If it
91  * reaches 0, the wrapper object is destroyed. */
92 CCL_EXPORT
93 void ccl_sampler_destroy(CCLSampler* smplr);
94 
95 /* Create a new sampler wrapper object by specifying a basic set of
96  * sampler properties. */
97 CCL_EXPORT
98 CCLSampler* ccl_sampler_new(CCLContext* ctx, cl_bool normalized_coords,
99  cl_addressing_mode addressing_mode, cl_filter_mode filter_mode,
100  CCLErr** err);
101 
102 /* Create a new sampler wrapper object using a list of properties. */
103 CCL_EXPORT
105  const cl_sampler_properties *sampler_properties, CCLErr** err);
106 
118 #define ccl_sampler_get_info(smplr, param_name, err) \
119  ccl_wrapper_get_info((CCLWrapper*) smplr, NULL, param_name, 0, \
120  CCL_INFO_SAMPLER, CL_FALSE, err)
121 
138 #define ccl_sampler_get_info_scalar(smplr, param_name, param_type, err) \
139  *((param_type*) ccl_wrapper_get_info_value((CCLWrapper*) smplr, \
140  NULL, param_name, sizeof(param_type), CCL_INFO_SAMPLER, CL_FALSE, err))
141 
161 #define ccl_sampler_get_info_array(smplr, param_name, param_type, err) \
162  (param_type) ccl_wrapper_get_info_value((CCLWrapper*) smplr, \
163  NULL, param_name, sizeof(param_type), CCL_INFO_SAMPLER, CL_FALSE, err)
164 
170 #define ccl_sampler_ref(smplr) \
171  ccl_wrapper_ref((CCLWrapper*) smplr)
172 
179 #define ccl_sampler_unref(smplr) ccl_sampler_destroy(smplr)
180 
187 #define ccl_sampler_unwrap(smplr) \
188  ((cl_sampler) ccl_wrapper_unwrap((CCLWrapper*) smplr))
189 
192 #endif
CCLSampler * ccl_sampler_new_full(CCLContext *ctx, const cl_sampler_properties *sampler_properties, CCLErr **err)
Create a new sampler wrapper object using a list of properties.
Definition of a wrapper class and its methods for OpenCL context objects.
The context wrapper class.
void ccl_sampler_destroy(CCLSampler *smplr)
Decrements the reference count of the wrapper object.
CCLSampler * ccl_sampler_new(CCLContext *ctx, cl_bool normalized_coords, cl_addressing_mode addressing_mode, cl_filter_mode filter_mode, CCLErr **err)
Create a new sampler wrapper object by specifying a basic set of sampler properties.
Definition of an abstract wrapper class and its methods for OpenCL objects.
Sampler wrapper class.
GError CCLErr
Error handling class.
Definition: ccl_common.h:291
CCLSampler * ccl_sampler_new_wrap(cl_sampler sampler)
Get the sampler wrapper for the given OpenCL sampler.