示例#1
0
        uint BindStorageBuffer(IGLDescriptorSet ds, GLDescriptorPoolResourceInfo resource, uint[] dynamicOffsets, uint offsetIndex)
        {
            IGLNextDescriptorPool parentPool = ds.Parent;

            Debug.Assert(parentPool != null);

            // BIND SSBOS
            if (resource.DescriptorCount > 1)
            {
                throw new InvalidOperationException("Mg.GL : only one storage buffer per a binding allowed.");
            }

            for (var i = resource.Ticket.First; i <= resource.Ticket.Last; i += 1)
            {
                var buffer = parentPool.StorageBuffers.Items[i];

                var offset = buffer.Offset;
                // WHAT ABOUT THE DYNAMIC OFFSET
                if (buffer.IsDynamic)
                {
                    offset += AdjustOffset(dynamicOffsets, ref offsetIndex);
                }

                mEntrypoint.BindStorageBuffer(
                    resource.Binding,
                    buffer.BufferId,
                    new IntPtr(offset),
                    new IntPtr(buffer.Size));
            }

            return(offsetIndex);
        }
示例#2
0
 public void Clear()
 {
     IsInvalid           = false;
     BoundPipelineLayout = null;
     BoundDynamicOffsets = null;
     BoundDescriptorSet  = null;
 }
示例#3
0
        public bool Equals(IGLDescriptorSet other)
        {
            if (other == null)
            {
                return(false);
            }

            if (!ReferenceEquals(Parent, other.Parent))
            {
                return(false);
            }

            return(Key == other.Key);
        }
示例#4
0
        void BindCombinedSampler(IGLDescriptorSet ds, GLDescriptorPoolResourceInfo resource)
        {
            IGLNextDescriptorPool parentPool = ds.Parent;

            Debug.Assert(parentPool != null);

            for (var i = resource.Ticket.First; i <= resource.Ticket.Last; i += 1)
            {
                var image = parentPool.CombinedImageSamplers.Items[i];

                if (image.SamplerHandle.HasValue)
                {
                    mEntrypoint.BindCombinedImageSampler(ProgramID, (int)resource.Binding, image.SamplerHandle.Value);
                }
            }
        }
示例#5
0
        uint BindUniformBuffer(IGLDescriptorSet ds, GLDescriptorPoolResourceInfo resource, uint[] dynamicOffsets, uint offsetIndex)
        {
            // do diff
            if (BoundPipelineLayout != null)
            {
                IGLNextDescriptorPool parentPool = ds.Parent;
                Debug.Assert(parentPool != null);

                // for each active uniform block
                var uniformGroup = BoundPipelineLayout.Ranges[(int)resource.Binding];

                var srcIndex = resource.Ticket.First;
                var dstIndex = uniformGroup.First;

                for (var j = 0; j < resource.DescriptorCount; j += 1)
                {
                    var buffer = parentPool.UniformBuffers.Items[srcIndex];

                    mUniformBuffers[dstIndex] = buffer.BufferId;

                    var offset = buffer.Offset;

                    // WHAT DYNAMIC
                    if (buffer.IsDynamic)
                    {
                        offset += AdjustOffset(dynamicOffsets, ref offsetIndex);
                    }

                    mUniformOffsets[dstIndex] = new IntPtr(offset);

                    mUniformSizes[dstIndex] = new IntPtr(buffer.Size);

                    srcIndex += 1;
                    dstIndex += 1;
                }

                return(offsetIndex);
            }
            else
            {
                return(offsetIndex);
            }
        }
示例#6
0
 public bool TryTake(out IGLDescriptorSet result)
 {
     return(mAvailableSets.TryTake(out result));
 }
示例#7
0
 public bool TryTake(out IGLDescriptorSet result)
 {
     result = CurrentDescriptorSet;
     return(true);
 }
示例#8
0
 public void Clear()
 {
     BoundPipelineLayout = null;
     BoundDynamicOffsets = null;
     BoundDescriptorSet  = null;
 }
示例#9
0
 public bool Equals(IGLDescriptorSet other)
 {
     return(ReferenceEquals(this, other));
 }