前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >DAY18:阅读纹理内存之Layered Textures

DAY18:阅读纹理内存之Layered Textures

作者头像
GPUS Lady
发布2018-06-22 18:14:34
8820
发布2018-06-22 18:14:34
举报
文章被收录于专栏:GPUS开发者GPUS开发者

3.2.11.1.3. 16-Bit Floating-Point Textures

The 16-bit floating-point or half format supported by CUDA arrays is the same as the IEEE 754-2008 binary2 format.

CUDA C does not support a matching data type, but provides intrinsic functions【内联函数】 to convert to and from the 32-bit floating-point format via the unsigned short type: __float2half_rn(float) and __half2float(unsigned short). These functions are only supported in device code. Equivalent functions【等价函数】 for the host code can be found in the OpenEXR library, for example.

16-bit floating-point components are promoted to 32 bit float during texture fetching before any filtering is performed.

A channel description for the 16-bit floating-point format can be created by calling one of the cudaCreateChannelDescHalf*() functions.

3.2.11.1.4. Layered Textures

A one-dimensional or two-dimensional layered texture (also known as texture array in Direct3D and array texture in OpenGL) is a texture made up of a sequence of layers, all of which are regular textures of same dimensionality, size, and data type.

A one-dimensional layered texture is addressed using an integer index and a floating-point texture coordinate; the index denotes a layer within the sequence and the coordinate addresses a texel within that layer. A two-dimensional layered texture is addressed using an integer index and two floating-point texture coordinates; the index denotes a layer within the sequence and the coordinates address a texel within that layer.

A layered texture can only be a CUDA array by calling cudaMalloc3DArray() with the cudaArrayLayered flag (and a height of zero for one-dimensional layered texture).

Layered textures are fetched using the device functions described in tex1DLayered(), tex1DLayered(), tex2DLayered(), and tex2DLayered(). Texture filtering (see Texture Fetching) is done only within a layer, not across layers.

Layered textures are only supported on devices of compute capability 2.0 and higher.

本文备注/经验分享:

16-Bit Floating-Point Textures 这部分内容因为我们从来没用过,所以没有好补充的...

 Layered Textures——

这个等于纹理数组(某种意义上),和普通的3D的CUDA Array不同。这个层和层之间是独立的。插值的时候不跨层。 而存储的时候也*可能*每层存储为单独的像2D的纹理那样的布局(4个元素临近在一起),而不是3D那样的8个。例如说, 你有一堆图片的时候,例如PhotoShop之类的软件可以用来做多个图层。 可以总是看成是一堆图层的。而直接的3D纹理会导致层与层之前有关系,而这个只是一堆图片而已。

A one-dimensional layered texture is addressed using an integer index and a floating-point texture coordinate; the index denotes a layer within the sequence and the coordinate addresses a texel within that layer. 这个是1D的, 和2D一个道理, 纹理内部(一张图片内部你可以理解)坐标是float的。而层的坐标是整数的,例如: 第3层, 第2层图片,而不会像是普通的2D(相比1D的layered的)或者3D纹理(相比2D的Layered)那样,虽然大家都是2个坐标和3个坐标。 但含有Layered的字样的纹理最后一个坐标不是纹理内部的, 而是代表层次,因为我们普通的2D和3D的可以随时插值, 允许最后一个坐标是1.2, 3.4这种浮点值,而Layered的最后一个坐标是整数值,这首先暗示里这个纹理不同, 最后一个坐标不是纹理内部的坐标, 也不能用来插值,其次说明不存在层次间的关系, 没有第1.5层之类的说法。我建议你总是将Layered的理解成纹理数组,这样好理解很多。

有不明白的地方,请在本文后留言

或者在我们的技术论坛bbs.gpuworld.cn上发帖

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2018-05-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 GPUS开发者 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 3.2.11.1.3. 16-Bit Floating-Point Textures
  • 3.2.11.1.4. Layered Textures
  • 16-Bit Floating-Point Textures 这部分内容因为我们从来没用过,所以没有好补充的...
  •  Layered Textures——
相关产品与服务
图像处理
图像处理基于腾讯云深度学习等人工智能技术,提供综合性的图像优化处理服务,包括图像质量评估、图像清晰度增强、图像智能裁剪等。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档