Documentation
¶
Index ¶
- Constants
- type ColorSpace
- type CompositeAlphaFlags
- type Extension
- type PresentMode
- type Surface
- type SurfaceCapabilities
- type SurfaceFormat
- type SurfaceTransformFlags
- type VulkanExtension
- type VulkanSurface
- func (s *VulkanSurface) Destroy(callbacks *driver.AllocationCallbacks)
- func (s *VulkanSurface) Handle() ext_driver.VkSurfaceKHR
- func (s *VulkanSurface) PhysicalDeviceSurfaceCapabilities(device core1_0.PhysicalDevice) (*SurfaceCapabilities, common.VkResult, error)
- func (s *VulkanSurface) PhysicalDeviceSurfaceFormats(device core1_0.PhysicalDevice) ([]SurfaceFormat, common.VkResult, error)
- func (s *VulkanSurface) PhysicalDeviceSurfacePresentModes(device core1_0.PhysicalDevice) ([]PresentMode, common.VkResult, error)
- func (s *VulkanSurface) PhysicalDeviceSurfaceSupport(physicalDevice core1_0.PhysicalDevice, queueFamilyIndex int) (bool, common.VkResult, error)
Constants ¶
const ( // ExtensionName is "VK_KHR_surface" // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html ExtensionName string = C.VK_KHR_SURFACE_EXTENSION_NAME // ObjectTypeSurface specifies a Surface handle // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkObjectType.html ObjectTypeSurface core1_0.ObjectType = C.VK_OBJECT_TYPE_SURFACE_KHR // TransformIdentity specifies that Image content is presented without being transformed // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformIdentity SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR // TransformRotate90 specifies that Image content is rotated 90 degrees clockwise // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformRotate90 SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR // TransformRotate180 specifies that Image content is rotated 180 degrees clockwise // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformRotate180 SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR // TransformRotate270 specifies that Image content is rotated 270 degrees clockwise // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformRotate270 SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR // TransformHorizontalMirror specifies that Image content is mirrored horizontally // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformHorizontalMirror SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR // TransformHorizontalMirrorRotate90 specifies that Image content is mirrored horizontally, then rotated 90 // degrees clockwise // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformHorizontalMirrorRotate90 SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR // TransformHorizontalMirrorRotate180 specifies that Image content is mirrored horizontally, then rotated 180 // degrees clockwise // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformHorizontalMirrorRotate180 SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR // TransformHorizontalMirrorRotate270 specifies that Image content is mirrored horizontally, then rotated 270 // degrees clockwise // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformHorizontalMirrorRotate270 SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR // TransformInherit specifies that the presentation transform is not specified, and is instead determined // by platform-specific considerations and mechanisms outside Vulkan // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html TransformInherit SurfaceTransformFlags = C.VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR // CompositeAlphaOpaque indicates that the Image is treated as if it has a constant alpha of 1.0 // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkCompositeAlphaFlagBitsKHR.html CompositeAlphaOpaque CompositeAlphaFlags = C.VK_COMPOSITE_ALPHA_OPAQUE_BIT_KHR // CompositeAlphaPreMultiplied indicates that the alpha component of the Image is respected in // the compositing process. The non-alpha components of the Image are expected to already be // multiplied by the alpha component by the application // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkCompositeAlphaFlagBitsKHR.html CompositeAlphaPreMultiplied CompositeAlphaFlags = C.VK_COMPOSITE_ALPHA_PRE_MULTIPLIED_BIT_KHR // CompositeAlphaPostMultiplied indicates that the alpha component of the Image is respected in // the compositing process. The non-alpha components of the Image are not expected to already be // multiplied by the alpha component in the application; the compositor will multiply the non-alpha // components of the Image by the alpha component during compositing // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkCompositeAlphaFlagBitsKHR.html CompositeAlphaPostMultiplied CompositeAlphaFlags = C.VK_COMPOSITE_ALPHA_POST_MULTIPLIED_BIT_KHR // CompositeAlphaInherit indicates that the application is responsible for setting the composite alpha // blending mode using native window system commands // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkCompositeAlphaFlagBitsKHR.html CompositeAlphaInherit CompositeAlphaFlags = C.VK_COMPOSITE_ALPHA_INHERIT_BIT_KHR // PresentModeImmediate specifies that the presentation engine does not wait for a vertical blanking // period to update the current Image, meaning this mode may result in visible tearing. The requests // are applied immediately. // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html PresentModeImmediate PresentMode = C.VK_PRESENT_MODE_IMMEDIATE_KHR // PresentModeMailbox specifies that the presentation engine waits for the next vertical blanking period // to update the current Image. Tearing cannot be observed. An internal single-entry queue is used to // hold pending presentation requests. If the queue is full when a new presentation request is received, // the new request replaces the existing entry // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html PresentModeMailbox PresentMode = C.VK_PRESENT_MODE_MAILBOX_KHR // PresentModeFIFO specifies that the presentation engine waits for the next vertical blanking period to // update the current Image. Tearing cannot be observed. An internal queue is used to hold pending presentation // requests. New requests are appended to the end of the queue, and one request is removed from the beginning of // the queue during each vertical blanking period in which the queue is non-empty. This value is required // to be supported. // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html PresentModeFIFO PresentMode = C.VK_PRESENT_MODE_FIFO_KHR // PresentModeFIFORelaxed specifies that the presentation engine generally waits for the next vertical // blanking period to update the current Image. If a vertical blanking period has already passed since // the last update of the current Image, then the presentation engine does not wait for another // vertical blanking period for the update, meaning this mode may result in visible tearing in this // case. This mode is useful for reducing visual stutter with an application that will mostly // present a new Image before the next vertical blanking period, but may occasionally be late, and // present a new Image just after the next vertical blanking period. An internal queue is used to hold // pending presentation requests. PresentModeFIFORelaxed PresentMode = C.VK_PRESENT_MODE_FIFO_RELAXED_KHR // ColorSpaceSRGBNonlinear specifies support for the sRGB color space // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkColorSpaceKHR.html ColorSpaceSRGBNonlinear ColorSpace = C.VK_COLOR_SPACE_SRGB_NONLINEAR_KHR // VKErrorSurfaceLost indicates a surface is no longer available // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkResult.html VKErrorSurfaceLost common.VkResult = C.VK_ERROR_SURFACE_LOST_KHR // VKErrorNativeWindowInUse indicates the requested window is already in use by Vulkan or // another API in a manner which prevents it from being used again // // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkResult.html VKErrorNativeWindowInUse common.VkResult = C.VK_ERROR_NATIVE_WINDOW_IN_USE_KHR )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ColorSpace ¶
type ColorSpace int32
ColorSpace represents the supported color space of the presentation engine
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkColorSpaceKHR.html
func (ColorSpace) Register ¶
func (e ColorSpace) Register(str string)
func (ColorSpace) String ¶
func (e ColorSpace) String() string
type CompositeAlphaFlags ¶
type CompositeAlphaFlags int32
CompositeAlphaFlags represents alpha-compositing modes supported on a Device
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkCompositeAlphaFlagBitsKHR.html
func (CompositeAlphaFlags) Register ¶
func (e CompositeAlphaFlags) Register(str string)
func (CompositeAlphaFlags) String ¶
func (e CompositeAlphaFlags) String() string
type Extension ¶ added in v0.2.0
type Extension interface {
// CreateSurfaceFromHandle is used to create a Surface object from native platform or window data.
// Generally, this method should be called from an integration for a windowing system that produces
// Surface handles, and not by end users
//
// surfaceHandle - A surface handle produced by a windowing system
CreateSurfaceFromHandle(surfaceHandle khr_surface_driver.VkSurfaceKHR) (Surface, error)
}
Extension contains all commands for the khr_surface extension
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VK_KHR_surface.html
type PresentMode ¶
type PresentMode int32
PresentMode represents presentation modes supported for a Surface
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkPresentModeKHR.html
func (PresentMode) Register ¶
func (e PresentMode) Register(str string)
func (PresentMode) String ¶
func (e PresentMode) String() string
type Surface ¶
type Surface interface {
// Handle is the internal Vulkan object handle for this Surface
Handle() ext_driver.VkSurfaceKHR
// Destroy deletes this Surface and underlying structures from the device. **Warning**
// after destruction, this object will still exist, but the Vulkan object handle
// that backs it will be invalid. Do not call further methods on this object.
//
// callbacks - A set of allocation callbacks to control the memory free behavior of this command
//
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkDestroySurfaceKHR.html
Destroy(callbacks *driver.AllocationCallbacks)
// PhysicalDeviceSurfaceSupport queries if presentation of this Surface is supported on the specified PhysicalDevice
//
// physicalDevice - The PhysicalDevice to query for support
//
// queueFamilyIndex - The Queue family to be used to present the Surface
//
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceSupportKHR.html
PhysicalDeviceSurfaceSupport(physicalDevice core1_0.PhysicalDevice, queueFamilyIndex int) (bool, common.VkResult, error)
// PhysicalDeviceSurfaceCapabilities queries Surface capabilities on the specified PhysicalDevice
//
// device - The PhysicalDevice to query for capabilities
//
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceCapabilitiesKHR.html
PhysicalDeviceSurfaceCapabilities(device core1_0.PhysicalDevice) (*SurfaceCapabilities, common.VkResult, error)
// PhysicalDeviceSurfaceFormats queries color formats supported by Surface on the specified PhysicalDevice
//
// device - The PhysicalDevice to query for supported Surface formats
//
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfaceFormatsKHR.html
PhysicalDeviceSurfaceFormats(device core1_0.PhysicalDevice) ([]SurfaceFormat, common.VkResult, error)
// PhysicalDeviceSurfacePresentModes queries supported presentation modes on the specified PhysicalDevice
//
// device - The PhysicalDevice to query for supported presentation modes
//
// https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/vkGetPhysicalDeviceSurfacePresentModesKHR.html
PhysicalDeviceSurfacePresentModes(device core1_0.PhysicalDevice) ([]PresentMode, common.VkResult, error)
}
Surface abstracts native platform surface or window objects
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceKHR.html
type SurfaceCapabilities ¶ added in v0.2.0
type SurfaceCapabilities struct {
// MinImageCount is the minimum number of Image objects the specified Device supports for a khr_swapchain.Swapchain
// created for the Surface, and will be at least one
MinImageCount int
// MaxImageCount is the maximum number of Image objects the specified Device supports for a
// khr_swapchain.Swapchain created for the Surface, and will either be 0, or greater than or equal to
// MinImageCount. A value of 0 means that there is no limit on the number of Image objects, though
// there may be limits on memory used
MaxImageCount int
// CurrentExtent is the current width and height of the Surface, or the special values -1, -1 indicating
// that the Surface size will be determined by the extent of a khr_swapchain.Swapchain targeting the
// Surface
CurrentExtent core1_0.Extent2D
// MinImageExtent contains the smallest valid khr_swapchain.Swapchain extent for the Surface on the
// specified Device
MinImageExtent core1_0.Extent2D
// MaxImageExtent contains the largest valid khr_swapchain.Swapchain extent for the Surface on the
// specified Device
MaxImageExtent core1_0.Extent2D
// MaxImageArrayLayers is the maximum number of layers presentable Image objects can have for a
// khr_swapchain.Swapchain created for this Device and Surface, and will be at least 1
MaxImageArrayLayers int
// SupportedTransforms indicates the presentation transforms supported for the Surface on the
// specified Device. At least one bit will be set
SupportedTransforms SurfaceTransformFlags
// CurrentTransform indicates the Surface object's current transform relative to the presentation
// engine's natural orientation
CurrentTransform SurfaceTransformFlags
// SupportedCompositeAlpha represents the alpha compositing modes supported by the presentation
// engine for the Surface on the specified Device, and at least one will be set
SupportedCompositeAlpha CompositeAlphaFlags
// SupportedUsageFlags represents the ways the application can use the presentable Image objects
// of a khr_swapchain.Swapchain created with PresentMode set to PresentModeImmediate, PresentModeMailbox,
// PresentModeFIFO, or PresentModeFIFORelaxed for the Surface on the specified Device
SupportedUsageFlags core1_0.ImageUsageFlags
}
SurfaceCapabilities describes capabilities of a Surface
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceCapabilitiesKHR.html
type SurfaceFormat ¶ added in v0.2.0
type SurfaceFormat struct {
// Format is a core1_0.Format compatible with the specified Surface
Format core1_0.Format
// ColorSpace is a presentation ColorSpace that is compatible with the Surface
ColorSpace ColorSpace
}
SurfaceFormat describes a supported khr_swapchain.Swapchain format-color space pair
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceFormatKHR.html
type SurfaceTransformFlags ¶
type SurfaceTransformFlags int32
SurfaceTransformFlags represents presentation transforms supported on a Device
https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkSurfaceTransformFlagBitsKHR.html
func (SurfaceTransformFlags) Register ¶
func (f SurfaceTransformFlags) Register(str string)
func (SurfaceTransformFlags) String ¶
func (f SurfaceTransformFlags) String() string
type VulkanExtension ¶ added in v0.2.0
type VulkanExtension struct {
// contains filtered or unexported fields
}
VulkanExtension is an implementation of the Extension interface that actually communicates with Vulkan. This is the default implementation. See the interface for more documentation.
func CreateExtensionFromDriver ¶ added in v0.2.0
func CreateExtensionFromDriver(driver khr_surface_driver.Driver, instance core1_0.Instance) *VulkanExtension
CreateExtensionFromDriver generates an Extension from a driver.Driver object- this is usually used in tests to build an Extension from mock drivers
func CreateExtensionFromInstance ¶ added in v0.2.0
func CreateExtensionFromInstance(instance core1_0.Instance) *VulkanExtension
CreateExtensionFromInstance produces an Extension object from an Insstance with khr_surface loaded
func (*VulkanExtension) CreateSurface ¶ added in v0.2.0
func (e *VulkanExtension) CreateSurface(surfaceHandle khr_surface_driver.VkSurfaceKHR) (Surface, error)
type VulkanSurface ¶ added in v0.2.0
type VulkanSurface struct {
// contains filtered or unexported fields
}
VulkanSurface is an implementation of the Surface interface that actually communicates with Vulkan. This is the default implementation. See the interface for more documentation.
func (*VulkanSurface) Destroy ¶ added in v0.2.0
func (s *VulkanSurface) Destroy(callbacks *driver.AllocationCallbacks)
func (*VulkanSurface) Handle ¶ added in v0.2.0
func (s *VulkanSurface) Handle() ext_driver.VkSurfaceKHR
func (*VulkanSurface) PhysicalDeviceSurfaceCapabilities ¶ added in v0.2.0
func (s *VulkanSurface) PhysicalDeviceSurfaceCapabilities(device core1_0.PhysicalDevice) (*SurfaceCapabilities, common.VkResult, error)
func (*VulkanSurface) PhysicalDeviceSurfaceFormats ¶ added in v0.2.0
func (s *VulkanSurface) PhysicalDeviceSurfaceFormats(device core1_0.PhysicalDevice) ([]SurfaceFormat, common.VkResult, error)
func (*VulkanSurface) PhysicalDeviceSurfacePresentModes ¶ added in v0.2.0
func (s *VulkanSurface) PhysicalDeviceSurfacePresentModes(device core1_0.PhysicalDevice) ([]PresentMode, common.VkResult, error)
func (*VulkanSurface) PhysicalDeviceSurfaceSupport ¶ added in v0.2.0
func (s *VulkanSurface) PhysicalDeviceSurfaceSupport(physicalDevice core1_0.PhysicalDevice, queueFamilyIndex int) (bool, common.VkResult, error)