예제 #1
0
        public void CmdBindPipeline(MgPipelineBindPoint pipelineBindPoint, IMgPipeline pipeline)
        {
            var bPipeline = (VkPipeline)pipeline;

            Debug.Assert(bPipeline != null);

            Interops.vkCmdBindPipeline(this.Handle, (VkPipelineBindPoint)pipelineBindPoint, bPipeline.Handle);
        }
예제 #2
0
        public void CmdBindPipeline(MgPipelineBindPoint pipelineBindPoint, IMgPipeline pipeline)
        {
            if (pipeline == null)
            {
                throw new ArgumentNullException(nameof(pipeline));
            }

            if (pipelineBindPoint == MgPipelineBindPoint.COMPUTE)
            {
                mCommandEncoder.Compute.BindPipeline(pipeline);
            }
            else
            {
                mCommandEncoder.Graphics.BindPipeline(pipeline);
            }
        }
예제 #3
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]);
            }
        }
예제 #4
0
 public void CmdBindDescriptorSets(
     MgPipelineBindPoint pipelineBindPoint,
     IMgPipelineLayout layout,
     uint firstSet,
     uint descriptorSetCount,
     IMgDescriptorSet[] pDescriptorSets,
     uint[] pDynamicOffsets)
 {
     if (pipelineBindPoint == MgPipelineBindPoint.GRAPHICS)
     {
         mCommandEncoder.Graphics.BindDescriptorSets(layout,
                                                     firstSet,
                                                     descriptorSetCount,
                                                     pDescriptorSets,
                                                     pDynamicOffsets);
     }
 }
예제 #5
0
        public void CmdBindDescriptorSets(MgPipelineBindPoint pipelineBindPoint, IMgPipelineLayout layout, UInt32 firstSet, UInt32 descriptorSetCount, IMgDescriptorSet[] pDescriptorSets, UInt32[] pDynamicOffsets)
        {
            var bLayout = (VkPipelineLayout)layout;

            Debug.Assert(bLayout != null);

            var    stride = Marshal.SizeOf(typeof(IntPtr));
            IntPtr sets   = Marshal.AllocHGlobal((int)(stride * descriptorSetCount));

            var src = new ulong[descriptorSetCount];

            for (uint i = 0; i < descriptorSetCount; ++i)
            {
                var bDescSet = (VkDescriptorSet)pDescriptorSets[i];
                Debug.Assert(bDescSet != null);
                src[i] = bDescSet.Handle;
            }

            Interops.vkCmdBindDescriptorSets(this.Handle, (VkPipelineBindPoint)pipelineBindPoint, bLayout.Handle, firstSet, descriptorSetCount, src, (uint)pDynamicOffsets.Length, pDynamicOffsets);
        }
예제 #6
0
        public void Bind(MgPipelineBindPoint pipelineBindPoint, IMgPipelineLayout layout, uint firstSet,
                         uint descriptorSetCount, IMgDescriptorSet[] pDescriptorSets, uint[] pDynamicOffsets)
        {
            if (layout == null)
            {
                throw new ArgumentNullException(nameof(layout));
            }

            if (pDescriptorSets == null)
            {
                throw new ArgumentNullException(nameof(pDescriptorSets));
            }

            if (firstSet != 0)
            {
                throw new ArgumentException("Mg.GL : only descriptor set 0 can be bound.");
            }

            var bLayout = (IGLPipelineLayout)layout;

            IsInvalid = false;
            if (!bLayout.Equals(BoundPipelineLayout))
            {
                BoundPipelineLayout = bLayout;
                IsInvalid           = true;
            }

            var isArrayDifferent = CopyDynamicOffsetsIfDifferent(pDynamicOffsets);

            IsInvalid = IsInvalid && isArrayDifferent;

            var bDescSet = (IGLDescriptorSet)pDescriptorSets[0];

            // EXACT DSET ONLY
            if (!bDescSet.Equals(BoundDescriptorSet))
            {
                BoundDescriptorSet = bDescSet;
                IsInvalid          = true;
            }
        }
예제 #7
0
 public void CmdBindDescriptorSets(
     MgPipelineBindPoint pipelineBindPoint,
     IMgPipelineLayout layout,
     uint firstSet,
     uint descriptorSetCount,
     IMgDescriptorSet[] pDescriptorSets,
     uint[] pDynamicOffsets)
 {
     //var parameter = new AmtDescriptorSetRecordingState();
     //parameter.Bindpoint = pipelineBindPoint;
     //parameter.Layout = layout;
     //parameter.FirstSet = firstSet;
     //parameter.DynamicOffsets = pDynamicOffsets;
     //parameter.DescriptorSets = pDescriptorSets;
     //mRepository.DescriptorSets.Add(parameter);
     if (pipelineBindPoint == MgPipelineBindPoint.GRAPHICS)
     {
         mCommandEncoder.Graphics.BindDescriptorSets(layout,
                                                     firstSet,
                                                     descriptorSetCount,
                                                     pDescriptorSets,
                                                     pDynamicOffsets);
     }
 }
예제 #8
0
 public void CmdBindPipeline(MgPipelineBindPoint pipelineBindPoint, IMgPipeline pipeline)
 {
     throw new NotImplementedException();
 }
예제 #9
0
 public void CmdBindDescriptorSets(MgPipelineBindPoint pipelineBindPoint, IMgPipelineLayout layout, uint firstSet, uint descriptorSetCount, IMgDescriptorSet[] pDescriptorSets, uint[] pDynamicOffsets)
 {
     mBinder.Bind(pipelineBindPoint, layout, firstSet, descriptorSetCount, pDescriptorSets, pDynamicOffsets);
 }
예제 #10
0
 private static int GetDescriptorSetIndex(MgPipelineBindPoint bindpoint)
 {
     return((bindpoint == MgPipelineBindPoint.GRAPHICS) ? 0 : 1);
 }