예제 #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));
 }