专栏首页吉浦迅科技DAY18:阅读纹理内存之Layered Textures

DAY18:阅读纹理内存之Layered Textures

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上发帖

本文分享自微信公众号 - 吉浦迅科技(gpusolution),作者:GPU世界论坛

原文出处及转载信息见文内详细说明,如有侵权,请联系 yunjia_community@tencent.com 删除。

原始发表时间:2018-05-24

本文参与腾讯云自媒体分享计划,欢迎正在阅读的你也加入,一起分享。

我来说两句

0 条评论
登录 后参与评论

相关文章

  • DAY15:阅读CUDA C runtime之纹理内存

    GPUS Lady
  • DAY39:阅读扩展数据类型

    GPUS Lady
  • DAY19:阅读纹理内存之Texture Gather

    GPUS Lady
  • 图像拼接--Coarse-to-fine Seam Estimation for Image Stitching

    Coarse-to-fine Seam Estimation for Image Stitching https://arxiv.org/abs/1805.0...

    用户1148525
  • PHP优化设置

    Zach
  • 可输出sql的PrepareStatement封装

    WindWant
  • MotherBoard JCOM to DB9 female By HKL,

    Since there is a project to deploy an x86 VyOS as the router, After I install th...

    hiplon
  • 在GO中编写一个简单的shell

    In this post, we will write a minimalistic shell for UNIX(-like) operating syste...

    李海彬
  • Python Unicode HOWTO

    character, code point, glyph[glɪf], encoding

    py3study
  • Code Forces 645B Mischievous Mess Makers

    It is a balmy spring afternoon, and Farmer John’s n cows are ruminating about li...

    ShenduCC

扫码关注云+社区

领取腾讯云代金券