Exemple #1
0
        void CreateBuffer(BufferCreateInfo mInfo)
        {
            var info = new VkBufferCreateInfo();

            info.sType       = VkStructureType.BufferCreateInfo;
            info.flags       = mInfo.flags;
            info.size        = mInfo.size;
            info.usage       = mInfo.usage;
            info.sharingMode = mInfo.sharingMode;

            var indicesMarshalled = new NativeArray <uint>(mInfo.queueFamilyIndices);

            info.queueFamilyIndexCount = (uint)indicesMarshalled.Count;
            info.pQueueFamilyIndices   = indicesMarshalled.Address;

            using (indicesMarshalled) {
                var result = Device.Commands.createBuffer(Device.Native, ref info, Device.Instance.AllocationCallbacks, out buffer);
                if (result != VkResult.Success)
                {
                    throw new BufferException(string.Format("Error creating Buffer: {0}", result));
                }
            }

            Flags = mInfo.flags;
            Usage = mInfo.usage;
        }
Exemple #2
0
        public Buffer(Device device, BufferCreateInfo info)
        {
            if (device == null)
            {
                throw new ArgumentNullException(nameof(device));
            }
            if (info == null)
            {
                throw new ArgumentNullException(nameof(info));
            }

            Device = device;

            CreateBuffer(info);

            Device.Commands.getMemoryRequirements(Device.Native, buffer, out requirements);
        }