Esempio n. 1
0
        public void Allocate(uint memoryTypeIndex)
        {
            if (imageMemoryBind.memory != VkDeviceMemory.Null)
            {
                return;
            }

            imageMemoryBind = new VkSparseImageMemoryBind();

            var allocInfo = new VkMemoryAllocateInfo();

            allocInfo.sType           = VkStructureType.MemoryAllocateInfo;
            allocInfo.allocationSize  = size;
            allocInfo.memoryTypeIndex = memoryTypeIndex;
            imageMemoryBind.memory    = Device.AllocateMemory(ref allocInfo);

            // Sparse image memory binding
            imageMemoryBind.subresource = new VkImageSubresource
            {
                aspectMask = VkImageAspectFlags.Color,
                mipLevel   = mipLevel,
                arrayLayer = layer,
            };

            imageMemoryBind.extent = extent;
            imageMemoryBind.offset = offset;
        }
Esempio n. 2
0
        VkSparseImageMemoryBind MarshalImage(SparseImageMemoryBind bind)
        {
            var result = new VkSparseImageMemoryBind();

            result.subresource  = bind.subresource;
            result.offset       = bind.offset;
            result.extent       = bind.extent;
            result.memory       = bind.memory.Native;
            result.memoryOffset = bind.memoryOffset;
            result.flags        = bind.flags;

            return(result);
        }
 public VkSparseImageMemoryBindInfo(VkImage image, ref VkSparseImageMemoryBind binds)
 {
     this.image     = image;
     this.bindCount = 1;
     this.pBinds    = (VkSparseImageMemoryBind *)Unsafe.AsPointer(ref binds);
 }