Beispiel #1
0
 public GLInternalCache
 (
     IGLPipelineLayout pipelineLayout,
     GLUniformBlockEntry[] blockEntries,
     GLInternalCacheArrayMapper arrayMapper
 )
 {
     mArrayMapper = arrayMapper;
     SetupBlockBindings(blockEntries, mArrayMapper);
     //SetupStrides(blockEntries, pipelineLayout, mArrayMapper);
 }
Beispiel #2
0
        public GLInternalCacheArrayMapper(IGLPipelineLayout layout, GLUniformBlockEntry[] blockEntries)
        {
            mLayout = layout;

            mCollator = new GLUniformBlockGroupCollator();
            foreach (var entry in blockEntries)
            {
                mCollator.Add(entry.Token);
            }

            mGroups = mCollator.Collate();

            DeriveFirstBindings(blockEntries);
        }
Beispiel #3
0
        public GLInternalCacheArrayMapper(IGLPipelineLayout layout, GLUniformBlockEntry[] blockEntries)
        {
            mLayout = layout;

            var collator = new GLUniformBlockGroupCollator();

            foreach (var entry in blockEntries)
            {
                collator.Add(entry.Token);
            }

            var groups = collator.Collate();

            mGroups = groups;
        }
Beispiel #4
0
        public void SetProgramID(MgPipelineBindPoint bindpoint, int programId, GLInternalCache layoutCache, IGLPipelineLayout pipelineLayout)
        {
            if (mProgramID != programId)
            {
                mProgramID = programId;
                mEntrypoint.BindProgram(mProgramID);
                BoundInternalCache  = layoutCache;
                BoundPipelineLayout = pipelineLayout;

                SetupPipelineUniformBlocks();
                SetupUniformBufferSlots();

                var index = GetDescriptorSetIndex(bindpoint);
                BindDescriptorSets(mBoundDescriptorSets[index]);
            }
        }
Beispiel #5
0
        void SetupStrides(
            GLUniformBlockEntry[] blockEntries
            , IGLPipelineLayout layout
            , GLInternalCacheArrayMapper arrayMapper)
        {
            Strides = new int[layout.NoOfBindingPoints];
            for (var i = 0; i < layout.NoOfBindingPoints; i += 1)
            {
                Strides[i] = 0;
            }

            foreach (var entry in blockEntries)
            {
                var arrayIndex = arrayMapper.CalculateArrayIndex(entry);
                Strides[arrayIndex] = entry.Stride;
            }
        }
Beispiel #6
0
        public GLGraphicsPipeline(
            IGLGraphicsPipelineEntrypoint entrypoint,
            int programId,
            MgGraphicsPipelineCreateInfo info,
            GLInternalCache internalCache,
            IGLPipelineLayout layout
            )
        {
            mEntrypoint = entrypoint;

            if (info.VertexInputState == null)
            {
                throw new ArgumentNullException("info.VertexInputState");
            }

            if (info.InputAssemblyState == null)
            {
                throw new ArgumentNullException("info.InputAssemblyState");
            }

            if (info.RasterizationState == null)
            {
                throw new ArgumentNullException("info.RasterizationState");
            }

            ProgramID     = programId;
            InternalCache = internalCache;
            Layout        = layout;

            PopulateVertexDefinition(info.VertexInputState);

            PopulatePipelineConstants(info.RasterizationState);

            PopulateCmdFallbacks(info.RasterizationState);

            PopulateInputAssembly(info.InputAssemblyState);

            PopulateDepthStencilState(info.DepthStencilState);

            PopulateDynamicStates(info.DynamicState);

            PopulateColorBlend(info.ColorBlendState);

            PopulateViewports(info.ViewportState);
        }
Beispiel #7
0
        public bool Equals(IGLPipelineLayout other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            if (NoOfBindingPoints != other.NoOfBindingPoints)
            {
                return(false);
            }

            if (NoOfExpectedDynamicOffsets != other.NoOfExpectedDynamicOffsets)
            {
                return(false);
            }

            if (NoOfStorageBuffers != other.NoOfStorageBuffers)
            {
                return(false);
            }

            if (Bindings != null && other.Bindings == null)
            {
                return(false);
            }

            if (Bindings == null && other.Bindings != null)
            {
                return(false);
            }

            if (OffsetDestinations != null && other.OffsetDestinations == null)
            {
                return(false);
            }

            if (OffsetDestinations == null && other.OffsetDestinations != null)
            {
                return(false);
            }

            if (Ranges != null && other.Ranges == null)
            {
                return(false);
            }

            if (Ranges == null && other.Ranges != null)
            {
                return(false);
            }

            if (Bindings.Length != other.Bindings.Length)
            {
                return(false);
            }

            {
                var count = Bindings.Length;
                for (var i = 0; i < count; i += 1)
                {
                    var left  = Bindings[i];
                    var right = other.Bindings[i];

                    if (!left.Equals(right))
                    {
                        return(false);
                    }
                }
            }

            if (OffsetDestinations.Length != other.OffsetDestinations.Length)
            {
                return(false);
            }

            {
                var count = OffsetDestinations.Length;
                for (var i = 0; i < count; i += 1)
                {
                    var left  = OffsetDestinations[i];
                    var right = other.OffsetDestinations[i];

                    if (!left.Equals(right))
                    {
                        return(false);
                    }
                }
            }

            if (Ranges.Count != other.Ranges.Count)
            {
                return(false);
            }

            return(Ranges.Equals(other.Ranges));
        }
Beispiel #8
0
 public bool Equals(IGLPipelineLayout other)
 {
     return(ReferenceEquals(this, other));
 }
Beispiel #9
0
 public bool Equals(IGLPipelineLayout other)
 {
     throw new NotImplementedException();
 }