Clover Git
OpenCL 1.1 software implementation
|
00001 /* 00002 * Copyright (c) 2011, Denis Steckelmacher <steckdenis@yahoo.fr> 00003 * All rights reserved. 00004 * 00005 * Redistribution and use in source and binary forms, with or without 00006 * modification, are permitted provided that the following conditions are met: 00007 * * Redistributions of source code must retain the above copyright 00008 * notice, this list of conditions and the following disclaimer. 00009 * * Redistributions in binary form must reproduce the above copyright 00010 * notice, this list of conditions and the following disclaimer in the 00011 * documentation and/or other materials provided with the distribution. 00012 * * Neither the name of the copyright holder nor the 00013 * names of its contributors may be used to endorse or promote products 00014 * derived from this software without specific prior written permission. 00015 * 00016 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 00017 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00018 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 00019 * DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY 00020 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 00021 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 00022 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 00023 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 00024 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 00025 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00033 #ifndef __SAMPLER_H__ 00034 #define __SAMPLER_H__ 00035 00036 #include <CL/cl.h> 00037 #include "object.h" 00038 00039 // WARNING: Keep in sync with stdlib.h 00040 00041 #define CLK_NORMALIZED_COORDS_FALSE 0x00000000 00042 #define CLK_NORMALIZED_COORDS_TRUE 0x00000001 00043 #define CLK_ADDRESS_NONE 0x00000000 00044 #define CLK_ADDRESS_MIRRORED_REPEAT 0x00000010 00045 #define CLK_ADDRESS_REPEAT 0x00000020 00046 #define CLK_ADDRESS_CLAMP_TO_EDGE 0x00000030 00047 #define CLK_ADDRESS_CLAMP 0x00000040 00048 #define CLK_FILTER_NEAREST 0x00000000 00049 #define CLK_FILTER_LINEAR 0x00000100 00050 00051 #define CLK_NORMALIZED_COORDS_MASK 0x0000000f 00052 #define CLK_ADDRESS_MODE_MASK 0x000000f0 00053 #define CLK_FILTER_MASK 0x00000f00 00054 00055 namespace Coal 00056 { 00057 00058 class Context; 00059 00067 class Sampler : public Object 00068 { 00069 public: 00079 Sampler(Context *ctx, 00080 cl_bool normalized_coords, 00081 cl_addressing_mode addressing_mode, 00082 cl_filter_mode filter_mode, 00083 cl_int *errcode_ret); 00084 00090 Sampler(Context *ctx, 00091 unsigned int bitfield); 00092 00093 unsigned int bitfield() const; 00099 cl_int info(cl_sampler_info param_name, 00100 size_t param_value_size, 00101 void *param_value, 00102 size_t *param_value_size_ret) const; 00103 00104 private: 00105 unsigned int p_bitfield; 00106 00107 cl_int checkImageAvailability() const; 00108 }; 00109 00110 } 00111 00112 struct _cl_sampler : public Coal::Sampler 00113 {}; 00114 00115 #endif