Ejemplo n.º 1
0
 /// <summary>
 ///
 /// </summary>
 internal unsafe void MarshalTo(SharpVk.Interop.SubpassDescription *pointer)
 {
     if (this.Flags != null)
     {
         pointer->Flags = this.Flags.Value;
     }
     else
     {
         pointer->Flags = default(SharpVk.SubpassDescriptionFlags);
     }
     pointer->PipelineBindPoint    = this.PipelineBindPoint;
     pointer->InputAttachmentCount = (uint)(Interop.HeapUtil.GetLength(this.InputAttachments));
     if (this.InputAttachments != null)
     {
         var fieldPointer = (SharpVk.AttachmentReference *)(Interop.HeapUtil.AllocateAndClear <SharpVk.AttachmentReference>(this.InputAttachments.Length).ToPointer());
         for (int index = 0; index < (uint)(this.InputAttachments.Length); index++)
         {
             fieldPointer[index] = this.InputAttachments[index];
         }
         pointer->InputAttachments = fieldPointer;
     }
     else
     {
         pointer->InputAttachments = null;
     }
     pointer->ColorAttachmentCount = (uint)(Interop.HeapUtil.GetLength(this.ColorAttachments));
     if (this.ColorAttachments != null)
     {
         var fieldPointer = (SharpVk.AttachmentReference *)(Interop.HeapUtil.AllocateAndClear <SharpVk.AttachmentReference>(this.ColorAttachments.Length).ToPointer());
         for (int index = 0; index < (uint)(this.ColorAttachments.Length); index++)
         {
             fieldPointer[index] = this.ColorAttachments[index];
         }
         pointer->ColorAttachments = fieldPointer;
     }
     else
     {
         pointer->ColorAttachments = null;
     }
     if (this.ResolveAttachments != null)
     {
         var fieldPointer = (SharpVk.AttachmentReference *)(Interop.HeapUtil.AllocateAndClear <SharpVk.AttachmentReference>(this.ResolveAttachments.Length).ToPointer());
         for (int index = 0; index < (uint)(this.ResolveAttachments.Length); index++)
         {
             fieldPointer[index] = this.ResolveAttachments[index];
         }
         pointer->ResolveAttachments = fieldPointer;
     }
     else
     {
         pointer->ResolveAttachments = null;
     }
     if (this.DepthStencilAttachment != null)
     {
         pointer->DepthStencilAttachment = (SharpVk.AttachmentReference *)(Interop.HeapUtil.Allocate <SharpVk.AttachmentReference>());
         *pointer->DepthStencilAttachment = this.DepthStencilAttachment.Value;
     }
     else
     {
         pointer->DepthStencilAttachment = default(SharpVk.AttachmentReference *);
     }
     pointer->PreserveAttachmentCount = (uint)(Interop.HeapUtil.GetLength(this.PreserveAttachments));
     if (this.PreserveAttachments != null)
     {
         var fieldPointer = (uint *)(Interop.HeapUtil.AllocateAndClear <uint>(this.PreserveAttachments.Length).ToPointer());
         for (int index = 0; index < (uint)(this.PreserveAttachments.Length); index++)
         {
             fieldPointer[index] = this.PreserveAttachments[index];
         }
         pointer->PreserveAttachments = fieldPointer;
     }
     else
     {
         pointer->PreserveAttachments = null;
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pointer">
        /// </param>
        internal static unsafe SubpassDescription MarshalFrom(SharpVk.Interop.SubpassDescription *pointer)
        {
            SubpassDescription result = default(SubpassDescription);

            result.Flags             = pointer->Flags;
            result.PipelineBindPoint = pointer->PipelineBindPoint;
            if (pointer->InputAttachments != null)
            {
                var fieldPointer = new SharpVk.AttachmentReference[(uint)(pointer->InputAttachmentCount)];
                for (int index = 0; index < (uint)(pointer->InputAttachmentCount); index++)
                {
                    fieldPointer[index] = pointer->InputAttachments[index];
                }
                result.InputAttachments = fieldPointer;
            }
            else
            {
                result.InputAttachments = null;
            }
            if (pointer->ColorAttachments != null)
            {
                var fieldPointer = new SharpVk.AttachmentReference[(uint)(pointer->ColorAttachmentCount)];
                for (int index = 0; index < (uint)(pointer->ColorAttachmentCount); index++)
                {
                    fieldPointer[index] = pointer->ColorAttachments[index];
                }
                result.ColorAttachments = fieldPointer;
            }
            else
            {
                result.ColorAttachments = null;
            }
            if (pointer->ResolveAttachments != null)
            {
                var fieldPointer = new SharpVk.AttachmentReference[(uint)(pointer->ColorAttachmentCount)];
                for (int index = 0; index < (uint)(pointer->ColorAttachmentCount); index++)
                {
                    fieldPointer[index] = pointer->ResolveAttachments[index];
                }
                result.ResolveAttachments = fieldPointer;
            }
            else
            {
                result.ResolveAttachments = null;
            }
            if (pointer->DepthStencilAttachment != null)
            {
                result.DepthStencilAttachment = *pointer->DepthStencilAttachment;
            }
            else
            {
                result.DepthStencilAttachment = null;
            }
            if (pointer->PreserveAttachments != null)
            {
                var fieldPointer = new uint[(uint)(pointer->PreserveAttachmentCount)];
                for (int index = 0; index < (uint)(pointer->PreserveAttachmentCount); index++)
                {
                    fieldPointer[index] = pointer->PreserveAttachments[index];
                }
                result.PreserveAttachments = fieldPointer;
            }
            else
            {
                result.PreserveAttachments = null;
            }
            return(result);
        }