示例#1
0
        public uint CalculateArrayIndex(GLUniformBlockEntry entry)
        {
            uint bindingPoint = 0U;

            var mapGroup = mGroups[entry.Token.BindingIndex];

            // ROW-ORDER
            bindingPoint += entry.Token.X;
            bindingPoint += (mapGroup.ArrayStride * entry.Token.Y);
            bindingPoint += (mapGroup.MatrixStride * entry.Token.Z);

            var arrayOffset = mLayout.Ranges[entry.Token.BindingIndex];

            bindingPoint += arrayOffset.First;
            return(bindingPoint);
        }
示例#2
0
        public GLUniformBlockEntry[] Inspect(int programId)
        {
            var count   = mUniformBlocks.GetNoOfActiveUniformBlocks(programId);
            var entries = new List <GLUniformBlockEntry>();

            for (var i = 0; i < count; i += 1)
            {
                string blockName = mUniformBlocks.GetActiveUniformBlockName(programId, i);
                var    token     = mParser.Parse(blockName);
                var    blockInfo = mUniformBlocks.GetActiveUniformBlockInfo(programId, i);
                token.BindingIndex = blockInfo.BindingIndex;

                var entry = new GLUniformBlockEntry
                {
                    BlockName   = blockName,
                    ActiveIndex = i,
                    Stride      = blockInfo.Stride,
                    Token       = token,
                };
                entries.Add(entry);
            }
            return(entries.ToArray());
        }