gpu

package
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 22, 2020 License: BSD-3-Clause Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckExisting

func CheckExisting(actual, required []string) (existing []string, missing int)

func IsError

func IsError(ret vulkan.Result) bool

func NewError

func NewError(ret vulkan.Result) error

func SafeString

func SafeString(s string) string

func SafeStrings

func SafeStrings(list []string) []string

Types

type Context

type Context interface {
	// SetOnPrepare sets callback that will be invoked to initialize and prepare application's vulkan state
	// upon context prepare step. onCreate could create textures and pipelines,
	// descriptor layouts and render passes.
	SetOnPrepare(onPrepare func() error)

	// SetOnCleanup sets callback that will be invoked to cleanup application's vulkan state
	// upon context prepare step. onCreate could destroy textures and pipelines,
	// descriptor layouts and render passes.
	SetOnCleanup(onCleanup func() error)

	// SetOnInvalidate sets callback that will be invoked when context has been invalidated,
	// the application must update its state and prepare the corresponding swapchain image to be presented.
	// onInvalidate could compute new vertex and color data in swapchain image resource buffers.
	SetOnInvalidate(onInvalidate func(imageIdx int) error)

	// Device returns the Vulkan device assigned to the context.
	Device() vulkan.Device

	// GPU returns the current oswin.GPU info (also avail as oswin.TheGPU)
	GPU() oswin.GPU

	// Surface returns the surface to render on
	Surface() vulkan.Surface

	// SetSurface sets the surface to use
	SetSurface(surf vulkan.Surface)

	// CommandBuffer returns a command buffer currently active.
	CommandBuffer() vulkan.CommandBuffer

	// SwapchainDimensions returns the current swapchain dimensions, including pixel format.
	SwapchainDimensions() *SwapchainDimensions

	// SwapchainImageResources exposes the swapchain initialized image resources.
	SwapchainImageResources() []*SwapchainImageResources

	// AcquireNextImage
	AcquireNextImage() (imageIndex int, outdated bool, err error)

	// PresentImage
	PresentImage(imageIdx int) (outdated bool, err error)

	// Destroy frees resources associated with the context
	Destroy()
}

Context provides an OpenGL-style graphical rendering context that is specific to a particular rendering surface

type GPUBase

type GPUBase struct {
	// contains filtered or unexported fields
}

GPUBase provides the base gpu implementation

func (*GPUBase) ActDeviceExts

func (gp *GPUBase) ActDeviceExts() []string

func (*GPUBase) ActInstanceExts

func (gp *GPUBase) ActInstanceExts() []string

func (*GPUBase) ActValidationLayers

func (gp *GPUBase) ActValidationLayers() []string

func (*GPUBase) DestroyBase

func (gp *GPUBase) DestroyBase()

DestroyBase destroys base vars -- actual Destroy() method should call

func (*GPUBase) Device

func (gp *GPUBase) Device() vulkan.Device

func (*GPUBase) DeviceExts

func (gp *GPUBase) DeviceExts() (names []string, err error)

DeviceExts gets a list of instance extensions available on the provided physical device.

func (*GPUBase) GraphicsQueue

func (gp *GPUBase) GraphicsQueue() vulkan.Queue

func (*GPUBase) GraphicsQueueFamilyIndex

func (gp *GPUBase) GraphicsQueueFamilyIndex() uint32

func (*GPUBase) HasSeparatePresentQueue

func (gp *GPUBase) HasSeparatePresentQueue() bool

func (*GPUBase) InitBase

func (gp *GPUBase) InitBase() error

InitBase does all standard initializationn after the required extensions and layers have been set

func (*GPUBase) InitDevice

func (gp *GPUBase) InitDevice() error

InitDevice initializes device

func (*GPUBase) InitInstance

func (gp *GPUBase) InitInstance() error

InitInstance initializes instance

func (*GPUBase) Instance

func (gp *GPUBase) Instance() vulkan.Instance

func (*GPUBase) InstanceExts

func (gp *GPUBase) InstanceExts() (names []string, err error)

InstanceExts gets a list of instance extensions available on the platform.

func (*GPUBase) MemoryProperties

func (gp *GPUBase) MemoryProperties() vulkan.PhysicalDeviceMemoryProperties

func (*GPUBase) PhysicalDevice

func (gp *GPUBase) PhysicalDevice() vulkan.PhysicalDevice

func (*GPUBase) PhysicalDeviceProperies

func (gp *GPUBase) PhysicalDeviceProperies() vulkan.PhysicalDeviceProperties

func (*GPUBase) PresentQueue

func (gp *GPUBase) PresentQueue() vulkan.Queue

func (*GPUBase) PresentQueueFamilyIndex

func (gp *GPUBase) PresentQueueFamilyIndex() uint32

func (*GPUBase) ReqDeviceExts

func (gp *GPUBase) ReqDeviceExts() []string

func (*GPUBase) ReqInstanceExts

func (gp *GPUBase) ReqInstanceExts() []string

func (*GPUBase) ReqValidationLayers

func (gp *GPUBase) ReqValidationLayers() []string

func (*GPUBase) SetReqDeviceExts

func (gp *GPUBase) SetReqDeviceExts(exts []string)

func (*GPUBase) SetReqInstanceExts

func (gp *GPUBase) SetReqInstanceExts(exts []string)

func (*GPUBase) SetReqValidationLayers

func (gp *GPUBase) SetReqValidationLayers(lays []string)

func (*GPUBase) ValidationLayers

func (gp *GPUBase) ValidationLayers() (names []string, err error)

ValidationLayers gets a list of validation layers available on the platform.

func (*GPUBase) VulkanAPIVersion

func (gp *GPUBase) VulkanAPIVersion() vulkan.Version

func (*GPUBase) VulkanAppVersion

func (gp *GPUBase) VulkanAppVersion() vulkan.Version

type SwapchainDimensions

type SwapchainDimensions struct {
	// Width of the swapchain.
	Width uint32
	// Height of the swapchain.
	Height uint32
	// Format is the pixel format of the swapchain.
	Format vulkan.Format
}

SwapchainDimensions describes the size and format of the swapchain.

type SwapchainImageResources

type SwapchainImageResources struct {
	// contains filtered or unexported fields
}

SwapchainImageResources holds onto image resources

func (*SwapchainImageResources) CommandBuffer

func (s *SwapchainImageResources) CommandBuffer() vulkan.CommandBuffer

func (*SwapchainImageResources) DescriptorSet

func (s *SwapchainImageResources) DescriptorSet() vulkan.DescriptorSet

func (*SwapchainImageResources) Destroy

func (s *SwapchainImageResources) Destroy(dev vulkan.Device, cmdPool ...vulkan.CommandPool)

func (*SwapchainImageResources) Framebuffer

func (s *SwapchainImageResources) Framebuffer() vulkan.Framebuffer

func (*SwapchainImageResources) Image

func (*SwapchainImageResources) SetDescriptorSet

func (s *SwapchainImageResources) SetDescriptorSet(set vulkan.DescriptorSet)

func (*SwapchainImageResources) SetFramebuffer

func (s *SwapchainImageResources) SetFramebuffer(fb vulkan.Framebuffer)

func (*SwapchainImageResources) SetImageOwnership

func (s *SwapchainImageResources) SetImageOwnership(graphicsQueueFamilyIndex, presentQueueFamilyIndex uint32)

func (*SwapchainImageResources) SetUniformBuffer

func (s *SwapchainImageResources) SetUniformBuffer(buffer vulkan.Buffer, mem vulkan.DeviceMemory)

func (*SwapchainImageResources) UniformBuffer

func (s *SwapchainImageResources) UniformBuffer() vulkan.Buffer

func (*SwapchainImageResources) UniformMemory

func (s *SwapchainImageResources) UniformMemory() vulkan.DeviceMemory

func (*SwapchainImageResources) View

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL