sampler 用法 OpenCL
来源:互联网 发布:php获取本机ip 编辑:程序博客网 时间:2024/06/05 19:52
sampler_t
A type used to control how elements of a 2D or 3D image object are read by read_image{f|i|ui}
.
Description
The image read functions take a sampler argument. The sampler can be passed as an argument to the kernel using clSetKernelArg, or it can be a constant variable of type sampler_t declared in the program source.
Sampler variables in a program are declared to be of type sampler_t. The sampler_t type is a 32-bit unsigned int constant and is interpreted as a bit-field that specifies the following properties:
Addressing Mode
Filter Mode
Normalized Coordinates
These properties control how elements of a 2D or 3D image object are read by read_image{f|i|ui}.
Samplers can also be declared as global constants in the program source using the syntax shown at the top of this page.
The sampler fields are described in the table below:
<normalized coords>
Specifies whether the x
, y
and z
coordinates are passed in as normalized or unnormalized values. This must be one of the following predefined enums:
CLK_NORMALIZED_COORDS_TRUE or
CLK_NORMALIZED_COORDS_FALSE.
In OpenCL 1.0, the samplers specified with an image in multiple read_image{f|i|ui}
calls declared in a kernel must use the same value for <normalized coords>
.
<address mode>
Specifies the image addressing-mode i.e. how out-of-range image coordinates are handled. This must be a literal value and can be one of the following predefined enums:
CLK_ADDRESS_REPEAT - out-of-range image coordinates are wrapped to the valid range. This address mode
can only be used with normalized coordinates. If normalized coordinates are not used, this addressing mode may generate image coordinates that are undefined.
CLK_ADDRESS_CLAMP_TO_EDGE - out-of-range image coordinates are clamped to the extent.
CLK_ADDRESS_CLAMP32 - out-of-range image coordinates will return a border color. The border color is (0.0f
, 0.0f
, 0.0f
, 0.0f
) if image channel order is CL_A, CL_INTENSITY, CL_RA, CL_ARGB, CL_BGRA or CL_RGBA and is (0.0f
, 0.0f
, 0.0f
, 1.0f
) if image channel order is CL_R, CL_RG, CL_RGB or CL_LUMINANCE.
CLK_ADDRESS_NONE - for this address mode the programmer guarantees that the image coordinates used to sample elements of the image refer to a location inside the image; otherwise the results are undefined.
<filter mode>
Specifies the filtering mode to use. This must be a literal value and can be one of the following predefined enums: CLK_FILTER_NEAREST or CLK_FILTER_LINEAR.
Refer to section on Image Addressing and Filtering in the OpenCL specification for a description of these filtering modes.
Samplers cannot be declared as arrays, pointers, or be used as the type for local variables inside a function or as the return value of a function defined in a program. Samplers cannot be passed as arguments to functions called by a __kernel function. A sampler argument to a __kernel function cannot be modified.
Notes
The maximum number of samplers that can be declared in a kernel can be queried using the CL_DEVICE_MAX_SAMPLERS
token in the table of OpenCL Device Queries for clGetDeviceInfo.
Example
samplerA specifies a sampler that uses normalized coordinates, the repeat addressing mode and a nearest filter.
- sampler 用法 OpenCL
- JMeter-Sampler-Debug Sampler
- OpenCL
- OpenCL
- OpenCL
- OpenCL
- opencl
- OpenCL
- OpenCL
- OpenCL
- OpenCl
- OpenCL
- RenderMonkey Sampler
- Gibbs sampler
- iOS8-Sampler
- 纹理过滤器 Texture Sampler
- jmeter之BeanShell Sampler
- JMeter-Sampler-HTTP请求
- Android Studio 2.2 Preview - New UI Designer & Constraint Layout
- Eclipse控制台不限日志行数
- lua 闭包
- python学习
- NOJ 2082 football
- sampler 用法 OpenCL
- 【网络编程3】Java组播套接字
- Eclipse去除js(JavaScript)验证错误
- 避免Android中Context引起的内存泄露
- 统计学 分布篇 - Poisson Distribution(泊松分布)
- eclipse去掉警告波浪线
- CSS学习7(颜色和背景)
- FMDB源码分析
- Eclipse中修改SVN用户名和密码方法