zoukankan      html  css  js  c++  java
  • std140

    Members of type bool, int, uint, float, and double are respectively
    extracted from a buffer object by reading a single
                             uint, int, uint, float, or   double value at the specified offset.
     
    Vectors with N elements with basic data types of bool, int, uint, float,
    or double are extracted as N values in consecutive memory locations beginning
    at the specified offset, with components stored in order with the first
    (X) component at the lowest offset. The GL data type used for component
    extraction is derived according to the rules for scalar members above.  
     
    If the member is a scalar consuming N basic machine units, the base alignment is N.
     
    If the member is a two- or four-component vector with components consuming
    N basic machine units, the base alignment is 2N or 4N, respectively.
     
    If the member is a three-component vector with components consuming N
    basic machine units, the base alignment is 4N.
     
    If the member is an array of scalars or vectors, the base alignment and array
    stride are set to match the base alignment of a single array element, according
    to rules (1), (2), and (3), and rounded up to the base alignment of a vec4. The
    array may have padding at the end; the base offset of the member following
    the array is rounded up to the next multiple of the base alignment.
     
    If the member is a structure, the base alignment of the structure is N, where
    N is the largest base alignment value of any of its members,
    and rounded up to the base alignment of a vec4. The individual members of this substructure
    are then assigned offsets by applying this set of rules recursively,
    where the base offset of the first member of the sub-structure is equal to the
    aligned offset of the structure. The structure may have padding at the end;
    the base offset of the member following the sub-structure is rounded up to
    the next multiple of the base alignment of the structure.
     
    If the member is an array of S structures, the S elements of the array are laid
    out in order, according to rule (9).
     
    A structure and each structure member have
    a base offset and a base alignment,
    from which
    an aligned offset is computed by
    rounding the base offset up to a multiple of the base alignment.
     从第16个字节开始,到第27个字节,为translation的存储。(闭区间)
    所以接下来的rotation的base offset 为27+1 -> 28。
    rotation的base alignment为16,所以28近似为16的倍数,得出32。
    base alignment 表示单个元素的字节对齐。
    base offset 表示本成员对象可使用的内存初始位置。
    aligned offset 表示本成员实际使用的内存初始位置。

  • 相关阅读:
    366. Find Leaves of Binary Tree输出层数相同的叶子节点
    716. Max Stack实现一个最大stack
    515. Find Largest Value in Each Tree Row查找一行中的最大值
    364. Nested List Weight Sum II 大小反向的括号加权求和
    156. Binary Tree Upside Down反转二叉树
    698. Partition to K Equal Sum Subsets 数组分成和相同的k组
    244. Shortest Word Distance II 实现数组中的最短距离单词
    187. Repeated DNA Sequences重复的DNA子串序列
    java之hibernate之基于主键的双向一对一关联映射
    java之hibernate之基于主键的单向一对一关联映射
  • 原文地址:https://www.cnblogs.com/Searchor/p/9002692.html
Copyright © 2011-2022 走看看