/// <summary> /// Initializes a new instance of the <see cref="SwapchainCreateInfoKhr"/> structure. /// </summary> /// <param name="surface"> /// The <see cref="SurfaceKhr"/> that the swapchain will present images to. /// </param> /// <param name="imageExtent"> /// The size (in pixels) of the swapchain. /// <para> /// Behavior is platform-dependent when the image extent does not match the surface's <see /// cref="SurfaceCapabilitiesKhr.CurrentExtent"/> as returned by <see cref="PhysicalDeviceExtensions.GetSurfaceCapabilitiesKhr"/>. /// </para> /// </param> /// <param name="preTransform"> /// A bitmask describing the transform, relative to the presentation engine's natural /// orientation, applied to the image content prior to presentation. /// <para> /// If it does not match the <see cref="SurfaceCapabilitiesKhr.CurrentTransform"/> value /// returned by <see cref="PhysicalDeviceExtensions.GetSurfaceCapabilitiesKhr"/>, the /// presentation engine will transform the image content as part of the presentation operation. /// </para> /// </param> /// <param name="imageUsage"> /// A bitmask indicating how the application will use the swapchain's presentable images. /// </param> /// <param name="flags">A bitmask indicating parameters of swapchain creation.</param> /// <param name="minImageCount"> /// The minimum number of presentable images that the application needs. The platform will /// either create the swapchain with at least that many images, or will fail to create the swapchain. /// </param> /// <param name="imageFormat">A format that is valid for swapchains on the specified surface.</param> /// <param name="compositeAlpha"> /// A bitmask indicating the alpha compositing mode to use when this surface is composited /// together with other surfaces on certain window systems. /// </param> /// <param name="imageArrayLayers"> /// The number of views in a multiview/stereo surface. For non-stereoscopic-3D applications, /// this value is 1. /// </param> /// <param name="presentMode"> /// The presentation mode the swapchain will use. /// <para> /// A swapchain's present mode determines how incoming present requests will be processed and /// queued internally. /// </para> /// </param> /// <param name="clipped"> /// Indicates whether the Vulkan implementation is allowed to discard rendering operations /// that affect regions of the surface which are not visible. /// </param> /// <param name="oldSwapchain">Existing swapchain to replace, if any.</param> public SwapchainCreateInfoKhr( SurfaceKhr surface, Format imageFormat, Extent2D imageExtent, SurfaceTransformsKhr preTransform, PresentModeKhr presentMode, SwapchainCreateFlagsKhr flags = 0, int minImageCount = 2, ImageUsages imageUsage = ImageUsages.ColorAttachment | ImageUsages.TransferDst, CompositeAlphasKhr compositeAlpha = CompositeAlphasKhr.Opaque, int imageArrayLayers = 1, bool clipped = true, SwapchainKhr oldSwapchain = null) { Flags = flags; Surface = surface; ImageUsage = imageUsage; MinImageCount = minImageCount; ImageFormat = imageFormat; ImageColorSpace = 0; ImageExtent = imageExtent; ImageArrayLayers = imageArrayLayers; ImageSharingMode = 0; QueueFamilyIndices = null; PreTransform = preTransform; CompositeAlpha = compositeAlpha; PresentMode = presentMode; Clipped = clipped; OldSwapchain = oldSwapchain; }
/// <summary> /// Initializes a new instance of the <see cref="SwapchainCreateInfoKhr"/> structure. /// </summary> /// <param name="surface"> /// The <see cref="SurfaceKhr"/> that the swapchain will present images to. /// </param> /// <param name="imageFormat">A format that is valid for swapchains on the specified surface.</param> /// <param name="imageExtent"> /// The size (in pixels) of the swapchain. /// <para> /// Behavior is platform-dependent when the image extent does not match the surface's <see /// cref="SurfaceCapabilitiesKhr.CurrentExtent"/> as returned by <see cref="PhysicalDeviceExtensions.GetSurfaceCapabilitiesKhr"/>. /// </para> /// </param> /// <param name="minImageCount"> /// The minimum number of presentable images that the application needs. The platform will /// either create the swapchain with at least that many images, or will fail to create the swapchain. /// </param> /// <param name="imageColorSpace">Color space value specifying the way the swapchain interprets image data.</param> /// <param name="imageArrayLayers"> /// The number of views in a multiview/stereo surface. /// <para>For non-stereoscopic-3D applications, this value is 1.</para> /// </param> /// <param name="imageUsage">A bitmask describing the intended usage of the (acquired) swapchain images.</param> /// <param name="imageSharingMode">The sharing mode used for the image(s) of the swapchain.</param> /// <param name="queueFamilyIndices"> /// Queue family indices having access to the image(s) of the swapchain when <see /// cref="ImageSharingMode"/> is <see cref="SharingMode.Concurrent"/>. /// </param> /// <param name="preTransform"> /// A value describing the transform, relative to the presentation engine's natural /// orientation, applied to the image content prior to presentation. /// <para> /// If it does not match the <see cref="SurfaceCapabilitiesKhr.CurrentTransform"/> value /// returned by <see cref="PhysicalDeviceExtensions.GetSurfaceCapabilitiesKhr"/>, the /// presentation engine will transform the image content as part of the presentation operation. /// </para> /// </param> /// <param name="compositeAlpha"> /// A bitmask indicating the alpha compositing mode to use when this surface is composited /// together with other surfaces on certain window systems. /// </param> /// <param name="presentMode"> /// The presentation mode the swapchain will use. /// <para> /// A swapchain's present mode determines how incoming present requests will be processed and /// queued internally. /// </para> /// </param> /// <param name="clipped"> /// Indicates whether the Vulkan implementation is allowed to discard rendering operations /// that affect regions of the surface which are not visible.</param> /// <param name="oldSwapchain">Existing swapchain to replace, if any.</param> public SwapchainCreateInfoKhr( SurfaceKhr surface, Format imageFormat, Extent2D imageExtent, int minImageCount = 2, ColorSpaceKhr imageColorSpace = ColorSpaceKhr.SRgbNonlinear, int imageArrayLayers = 1, ImageUsages imageUsage = ImageUsages.ColorAttachment | ImageUsages.TransferDst, SharingMode imageSharingMode = SharingMode.Exclusive, int[] queueFamilyIndices = null, SurfaceTransformsKhr preTransform = SurfaceTransformsKhr.Identity, CompositeAlphasKhr compositeAlpha = CompositeAlphasKhr.Opaque, PresentModeKhr presentMode = PresentModeKhr.Fifo, bool clipped = true, SwapchainKhr oldSwapchain = null) { Flags = SwapchainCreateFlagsKhr.None; Surface = surface; MinImageCount = minImageCount; ImageFormat = imageFormat; ImageColorSpace = imageColorSpace; ImageExtent = imageExtent; ImageArrayLayers = imageArrayLayers; ImageUsage = imageUsage; ImageSharingMode = imageSharingMode; QueueFamilyIndices = queueFamilyIndices; PreTransform = preTransform; CompositeAlpha = compositeAlpha; PresentMode = presentMode; Clipped = clipped; OldSwapchain = oldSwapchain; }
/// <param name="Size">Specified in bytes</param> /// <param name="Usage">Buffer usage flags</param> public BufferCreateInfo(DeviceSize Size, BufferUsageFlags Usage, SharingMode SharingMode, UInt32[] QueueFamilyIndices) : this() { this.Size = Size; this.Usage = Usage; this.SharingMode = SharingMode; this.QueueFamilyIndices = QueueFamilyIndices; }
public ImageCreateInfo ( StructureType sType = StructureType.ImageCreateInfo, void *pNext = default, ImageCreateFlags flags = default, ImageType imageType = default, Format format = default, Extent3D extent = default, uint mipLevels = default, uint arrayLayers = default, SampleCountFlags samples = default, ImageTiling tiling = default, ImageUsageFlags usage = default, SharingMode sharingMode = default, uint queueFamilyIndexCount = default, uint *pQueueFamilyIndices = default, ImageLayout initialLayout = default ) { SType = sType; PNext = pNext; Flags = flags; ImageType = imageType; Format = format; Extent = extent; MipLevels = mipLevels; ArrayLayers = arrayLayers; Samples = samples; Tiling = tiling; Usage = usage; SharingMode = sharingMode; QueueFamilyIndexCount = queueFamilyIndexCount; PQueueFamilyIndices = pQueueFamilyIndices; InitialLayout = initialLayout; }
public VKBuffer( string name, Graphics graphics, long count, BufferUsages usages, MemoryProperties memoryProperties, BufferCreateFlags flags = BufferCreateFlags.None, SharingMode sharingMode = SharingMode.Exclusive, int[] queueFamilyIndices = null ) { Name = name; Graphics = graphics; Count = count; Size = count * Interop.SizeOf <T>(); Usages = usages; Buffer = Graphics.Device.CreateBuffer(new BufferCreateInfo( size: Size, usages: usages, flags: flags, sharingMode: sharingMode, queueFamilyIndices: queueFamilyIndices )); var reqs = Buffer.GetMemoryRequirements(); DeviceMemory = Graphics.Device.AllocateMemory(new MemoryAllocateInfo( reqs.Size, graphics.GetMemoryTypeIndex(reqs.MemoryTypeBits, memoryProperties) )); Buffer.BindMemory(DeviceMemory); }
private static ShareAccess ToShareAccess(SharingMode sharingMode) { if (sharingMode == SharingMode.Compatibility) { return(ShareAccess.FILE_SHARE_READ); } else if (sharingMode == SharingMode.DenyReadWriteExecute) { return(0); } else if (sharingMode == SharingMode.DenyWrite) { return(ShareAccess.FILE_SHARE_READ); } else if (sharingMode == SharingMode.DenyReadExecute) { return(ShareAccess.FILE_SHARE_WRITE); } else if (sharingMode == SharingMode.DenyNothing) { return(ShareAccess.FILE_SHARE_READ | ShareAccess.FILE_SHARE_WRITE); } else if (sharingMode == (SharingMode)0xFF) { return(0); } else { throw new ArgumentException("Invalid SharingMode value"); } }
public AccessModeOptions(byte[] buffer, int offset) { AccessMode = (AccessMode)(buffer[offset + 0] & 0x07); SharingMode = (SharingMode)((buffer[offset + 0] & 0x70) >> 4); ReferenceLocality = (ReferenceLocality)(buffer[offset + 1] & 0x07); CachedMode = (CachedMode)((buffer[offset + 1] & 0x10) >> 4); WriteThroughMode = (WriteThroughMode)((buffer[offset + 1] & 0x40) >> 6); }
public unsafe UniformBuffer(T myManagedArray, SharingMode myMode = SharingMode.Exclusive, AllocationCallbacks pAllocator = null) { int mySize = Marshal.SizeOf(typeof(T)); BufferCreateInfo myBuffer = new BufferCreateInfo { Size = mySize, Usage = BufferUsageFlags.UniformBuffer, SharingMode = myMode, QueueFamilyIndices = new uint[] { VulkanRenderer.ActiveGraphicsFamilyQueueIndex } }; CreateBuffer(VulkanRenderer.SelectedPhysicalDevice, myBuffer, pAllocator); CopyFromMemory <T>(myManagedArray); }
public unsafe VertexBuffer(T[] myManagedArray, uint[] QueueFamilyIndices, SharingMode myMode = SharingMode.Exclusive, AllocationCallbacks pAllocator = null) { int mySize = Marshal.SizeOf(typeof(T)); BufferCreateInfo myBuffer = new BufferCreateInfo { Size = myManagedArray.Length * mySize, Usage = BufferUsageFlags.VertexBuffer, SharingMode = myMode, QueueFamilyIndices = QueueFamilyIndices }; CreateBuffer(VulkanRenderer.SelectedPhysicalDevice, myBuffer, pAllocator); CopyFromMemory <T>(myManagedArray); }
public void CreateBuffer(int sizeInBytes, string name, BufferUsages usage, SharingMode sm, int [] famIndexes = null) { BufferCreateInfo bci = new BufferCreateInfo(sizeInBytes, usage, BufferCreateFlags.None, sm, famIndexes); Buffer buf = mLogical.CreateBuffer(bci); mBuffers.Add(name, buf); }
/// <summary> /// Initializes a new instance of the <see cref="BufferCreateInfo"/> structure. /// </summary> /// <param name="size">The size in bytes of the buffer to be created.</param> /// <param name="usages">The bitmask describing the allowed usages of the buffer.</param> /// <param name="flags">Additional parameters of the buffer.</param> /// <param name="sharingMode"> /// The sharing mode of the buffer when it will be accessed by multiple queue families. /// </param> /// <param name="queueFamilyIndices"> /// A list of queue families that will access this buffer (ignored if <see /// cref="SharingMode"/> is not <see cref="VulkanCore.SharingMode.Concurrent"/>). /// </param> /// <param name="next"> /// Is <see cref="IntPtr.Zero"/> or a pointer to an extension-specific structure. /// </param> public BufferCreateInfo( long size, BufferUsages usages, BufferCreateFlags flags = 0, SharingMode sharingMode = SharingMode.Exclusive, int[] queueFamilyIndices = null, IntPtr next = default(IntPtr)) { Next = next; Size = size; Usages = usages; Flags = flags; SharingMode = sharingMode; QueueFamilyIndices = queueFamilyIndices; }
public PhysicalDeviceImageDrmFormatModifierInfoEXT ( StructureType sType = StructureType.PhysicalDeviceImageDrmFormatModifierInfoExt, void *pNext = default, ulong drmFormatModifier = default, SharingMode sharingMode = default, uint queueFamilyIndexCount = default, uint *pQueueFamilyIndices = default ) { SType = sType; PNext = pNext; DrmFormatModifier = drmFormatModifier; SharingMode = sharingMode; QueueFamilyIndexCount = queueFamilyIndexCount; PQueueFamilyIndices = pQueueFamilyIndices; }
public SwapchainCreateInfoKHR ( StructureType sType = StructureType.SwapchainCreateInfoKhr, void *pNext = default, SwapchainCreateFlagsKHR flags = default, SurfaceKHR surface = default, uint minImageCount = default, Format imageFormat = default, ColorSpaceKHR imageColorSpace = default, Extent2D imageExtent = default, uint imageArrayLayers = default, ImageUsageFlags imageUsage = default, SharingMode imageSharingMode = default, uint queueFamilyIndexCount = default, uint *pQueueFamilyIndices = default, SurfaceTransformFlagsKHR preTransform = default, CompositeAlphaFlagsKHR compositeAlpha = default, PresentModeKHR presentMode = default, Bool32 clipped = default, SwapchainKHR oldSwapchain = default ) { SType = sType; PNext = pNext; Flags = flags; Surface = surface; MinImageCount = minImageCount; ImageFormat = imageFormat; ImageColorSpace = imageColorSpace; ImageExtent = imageExtent; ImageArrayLayers = imageArrayLayers; ImageUsage = imageUsage; ImageSharingMode = imageSharingMode; QueueFamilyIndexCount = queueFamilyIndexCount; PQueueFamilyIndices = pQueueFamilyIndices; PreTransform = preTransform; CompositeAlpha = compositeAlpha; PresentMode = presentMode; Clipped = clipped; OldSwapchain = oldSwapchain; }
public BufferCreateInfo ( StructureType sType = StructureType.BufferCreateInfo, void *pNext = default, BufferCreateFlags flags = default, ulong size = default, BufferUsageFlags usage = default, SharingMode sharingMode = default, uint queueFamilyIndexCount = default, uint *pQueueFamilyIndices = default ) { SType = sType; PNext = pNext; Flags = flags; Size = size; Usage = usage; SharingMode = sharingMode; QueueFamilyIndexCount = queueFamilyIndexCount; PQueueFamilyIndices = pQueueFamilyIndices; }
public _SwapchainCreateInfoKHR(SwapchainCreateInfoKHR info) { SType = info.type; Next = info.next; Flags = info.flags; Surface = info.surface; MinImageCount = info.minImageCount; ImageFormat = info.imageFormat; ImageColorSpace = info.imageColorSpace; ImageExtent = info.imageExtent; ImageArrayLayers = info.imageArrayLayers; ImageUsage = info.imageUsage; ImageSharingMode = info.imageSharingMode; QueueFamilyIndexCount = (UInt32)(info.queueFamilyIndices?.Count ?? 0); QueueFamilyIndices = info.queueFamilyIndices != null?Alloc.alloc(info.queueFamilyIndices) : IntPtr.Zero; PreTransform = info.preTransform; CompositeAlpha = info.compositeAlpha; PresentMode = info.presentMode; Clipped = info.clipped; OldSwapchain = info.oldSwapchain; }
public static extern void AAudioStreamBuilder_setSharingMode(IntPtr builder, SharingMode sharingMode);
internal static string TokenizeSharingMode(SharingMode mode) { return("M" + (int)mode); }
public static object Share(Content content, string token, SharingLevel level, SharingMode mode, bool sendNotification) { var gc = EnsureContent(content); return(SafeSharingData.Create(gc.Sharing.Share(token, level, mode, sendNotification))); }
/// <param name="Surface">The swapchain's target surface</param> /// <param name="MinImageCount">Minimum number of presentation images the application needs</param> /// <param name="ImageFormat">Format of the presentation images</param> /// <param name="ImageColorSpace">Colorspace of the presentation images</param> /// <param name="ImageExtent">Dimensions of the presentation images</param> /// <param name="ImageArrayLayers">Determines the number of views for multiview/stereo presentation</param> /// <param name="ImageUsage">Bits indicating how the presentation images will be used</param> /// <param name="ImageSharingMode">Sharing mode used for the presentation images</param> /// <param name="QueueFamilyIndices">Array of queue family indices having access to the images in case of concurrent sharing mode</param> /// <param name="PreTransform">The transform, relative to the device's natural orientation, applied to the image content prior to presentation</param> /// <param name="CompositeAlpha">The alpha blending mode used when compositing this surface with other surfaces in the window system</param> /// <param name="PresentMode">Which presentation mode to use for presents on this swap chain</param> /// <param name="Clipped">Specifies whether presentable images may be affected by window clip regions</param> public SwapchainCreateInfoKHR(SurfaceKHR Surface, UInt32 MinImageCount, Format ImageFormat, ColorSpaceKHR ImageColorSpace, Extent2D ImageExtent, UInt32 ImageArrayLayers, ImageUsageFlags ImageUsage, SharingMode ImageSharingMode, UInt32[] QueueFamilyIndices, SurfaceTransformFlagsKHR PreTransform, CompositeAlphaFlagsKHR CompositeAlpha, PresentModeKHR PresentMode, Bool32 Clipped) : this() { this.Surface = Surface; this.MinImageCount = MinImageCount; this.ImageFormat = ImageFormat; this.ImageColorSpace = ImageColorSpace; this.ImageExtent = ImageExtent; this.ImageArrayLayers = ImageArrayLayers; this.ImageUsage = ImageUsage; this.ImageSharingMode = ImageSharingMode; this.QueueFamilyIndices = QueueFamilyIndices; this.PreTransform = PreTransform; this.CompositeAlpha = CompositeAlpha; this.PresentMode = PresentMode; this.Clipped = Clipped; }
public unsafe StagingBuffer(T[] myManagedArray, VulkanPhysicalDevice myDevice, uint[] VisibleToQueueFamilyIndices, SharingMode myMode = SharingMode.Exclusive, AllocationCallbacks pAllocator = null) { int mySize = Marshal.SizeOf(typeof(T)); BufferCreateInfo myBuffer = new BufferCreateInfo { Size = myManagedArray.Length * mySize, Usage = BufferUsageFlags.TransferSrc, SharingMode = myMode, QueueFamilyIndices = VisibleToQueueFamilyIndices }; CreateBuffer(myDevice, myBuffer, pAllocator); CopyFromMemory <T>(myManagedArray); }
public unsafe UniformBuffer(T myManagedArray, VulkanPhysicalDevice myDevice, uint[] QueueFamilyIndices, SharingMode myMode = SharingMode.Exclusive, AllocationCallbacks pAllocator = null) { int mySize = Marshal.SizeOf(typeof(T)); BufferCreateInfo myBuffer = new BufferCreateInfo { Size = mySize, Usage = BufferUsageFlags.UniformBuffer, SharingMode = myMode, QueueFamilyIndices = QueueFamilyIndices }; CreateBuffer(myDevice, myBuffer, pAllocator); CopyFromMemory <T>(myManagedArray); }
/// <param name="Usage">Image usage flags</param> /// <param name="SharingMode">Cross-queue-family sharing mode</param> /// <param name="QueueFamilyIndices">Array of queue family indices to share across</param> /// <param name="InitialLayout">Initial image layout for all subresources</param> public ImageCreateInfo(ImageType ImageType, Format Format, Extent3D Extent, UInt32 MipLevels, UInt32 ArrayLayers, SampleCountFlags Samples, ImageTiling Tiling, ImageUsageFlags Usage, SharingMode SharingMode, UInt32[] QueueFamilyIndices, ImageLayout InitialLayout) : this() { this.ImageType = ImageType; this.Format = Format; this.Extent = Extent; this.MipLevels = MipLevels; this.ArrayLayers = ArrayLayers; this.Samples = Samples; this.Tiling = Tiling; this.Usage = Usage; this.SharingMode = SharingMode; this.QueueFamilyIndices = QueueFamilyIndices; this.InitialLayout = InitialLayout; }