utils

package
v0.0.0-...-0931f86 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2022 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PreferredSurfaceFormat core1_0.Format           = core1_0.FormatB8G8R8A8UnsignedNormalized
	NumSamples             core1_0.SampleCountFlags = core1_0.Samples1

	FenceTimeout      = 100 * time.Millisecond
	NumDescriptorSets = 1
)

Variables

View Source
var VBSolidFaceColorsData = []Vertex{

	{-1, -1, 1, 1, 1, 0, 0, 1},
	{-1, 1, 1, 1, 1, 0, 0, 1},
	{1, -1, 1, 1, 1, 0, 0, 1},
	{1, -1, 1, 1, 1, 0, 0, 1},
	{-1, 1, 1, 1, 1, 0, 0, 1},
	{1, 1, 1, 1, 1, 0, 0, 1},

	{-1, -1, -1, 1, 0, 1, 0, 1},
	{1, -1, -1, 1, 0, 1, 0, 1},
	{-1, 1, -1, 1, 0, 1, 0, 1},
	{-1, 1, -1, 1, 0, 1, 0, 1},
	{1, -1, -1, 1, 0, 1, 0, 1},
	{1, 1, -1, 1, 0, 1, 0, 1},

	{-1, 1, 1, 1, 0, 0, 1, 1},
	{-1, -1, 1, 1, 0, 0, 1, 1},
	{-1, 1, -1, 1, 0, 0, 1, 1},
	{-1, 1, -1, 1, 0, 0, 1, 1},
	{-1, -1, 1, 1, 0, 0, 1, 1},
	{-1, -1, -1, 1, 0, 0, 1, 1},

	{1, 1, 1, 1, 1, 1, 0, 1},
	{1, 1, -1, 1, 1, 1, 0, 1},
	{1, -1, 1, 1, 1, 1, 0, 1},
	{1, -1, 1, 1, 1, 1, 0, 1},
	{1, 1, -1, 1, 1, 1, 0, 1},
	{1, -1, -1, 1, 1, 1, 0, 1},

	{1, 1, 1, 1, 1, 0, 1, 1},
	{-1, 1, 1, 1, 1, 0, 1, 1},
	{1, 1, -1, 1, 1, 0, 1, 1},
	{1, 1, -1, 1, 1, 0, 1, 1},
	{-1, 1, 1, 1, 1, 0, 1, 1},
	{-1, 1, -1, 1, 1, 0, 1, 1},

	{1, -1, 1, 1, 0, 1, 1, 1},
	{1, -1, -1, 1, 0, 1, 1, 1},
	{-1, -1, 1, 1, 0, 1, 1, 1},
	{-1, -1, 1, 1, 0, 1, 1, 1},
	{1, -1, -1, 1, 0, 1, 1, 1},
	{-1, -1, -1, 1, 0, 1, 1, 1},
}
View Source
var VBTextureData = []VertexUV{

	{-1, -1, -1, 1, 1, 0},
	{-1, 1, 1, 1, 0, 1},
	{-1, -1, 1, 1, 0, 0},
	{-1, 1, 1, 1, 0, 1},
	{-1, -1, -1, 1, 1, 0},
	{-1, 1, -1, 1, 1, 1},

	{-1, -1, -1, 1, 0, 0},
	{1, -1, -1, 1, 1, 0},
	{1, 1, -1, 1, 1, 1},
	{-1, -1, -1, 1, 0, 0},
	{1, 1, -1, 1, 1, 1},
	{-1, 1, -1, 1, 0, 1},

	{-1, -1, -1, 1, 0, 1},
	{1, -1, 1, 1, 1, 0},
	{1, -1, -1, 1, 1, 1},
	{-1, -1, -1, 1, 0, 1},
	{-1, -1, 1, 1, 0, 0},
	{1, -1, 1, 1, 1, 0},

	{-1, 1, -1, 1, 0, 0},
	{1, 1, 1, 1, 1, 1},
	{-1, 1, 1, 1, 0, 1},
	{-1, 1, -1, 1, 0, 0},
	{1, 1, -1, 1, 1, 0},
	{1, 1, 1, 1, 1, 1},

	{1, 1, -1, 1, 0, 1},
	{1, -1, 1, 1, 1, 0},
	{1, 1, 1, 1, 1, 1},
	{1, -1, 1, 1, 1, 0},
	{1, 1, -1, 1, 0, 1},
	{1, -1, -1, 1, 0, 0},

	{-1, 1, 1, 1, 1, 1},
	{1, 1, 1, 1, 0, 1},
	{-1, -1, 1, 1, 1, 0},
	{-1, -1, 1, 1, 1, 0},
	{1, 1, 1, 1, 0, 1},
	{1, -1, 1, 1, 0, 0},
}

Functions

This section is empty.

Types

type LayerProperties

type LayerProperties struct {
	Properties         *core1_0.LayerProperties
	InstanceExtensions []*core1_0.ExtensionProperties
	DeviceExtensions   []*core1_0.ExtensionProperties
}

type SampleInfo

type SampleInfo struct {
	Loader           core.Loader
	Window           *sdl.Window
	Surface          khr_surface.Surface
	Prepared         bool
	UseStagingBuffer bool
	SaveImages       bool

	InstanceLayerNames          []string
	InstanceExtensionNames      []string
	InstanceLayerProperties     []*LayerProperties
	InstanceExtensionProperties []*core1_0.ExtensionProperties
	Instance                    core1_0.Instance

	DeviceExtensionNames      []string
	DeviceExtensionProperties []*core1_0.ExtensionProperties
	Gpus                      []core1_0.PhysicalDevice
	Device                    core1_0.Device
	GraphicsQueue             core1_0.Queue
	PresentQueue              core1_0.Queue
	GraphicsQueueFamilyIndex  int
	PresentQueueFamilyIndex   int
	GpuProps                  *core1_0.PhysicalDeviceProperties
	QueueProps                []*core1_0.QueueFamily
	MemoryProperties          *core1_0.PhysicalDeviceMemoryProperties

	Framebuffer   []core1_0.Framebuffer
	Width, Height int
	Format        core1_0.Format

	SwapchainImageCount    int
	SwapchainExtension     khr_swapchain.Extension
	Swapchain              khr_swapchain.Swapchain
	Buffers                []SwapchainBuffer
	ImageAcquiredSemaphore core1_0.Semaphore

	CmdPool core1_0.CommandPool

	Depth struct {
		Format core1_0.Format
		Image  core1_0.Image
		Mem    core1_0.DeviceMemory
		View   core1_0.ImageView
	}

	Textures []*TextureObject

	UniformData struct {
		Buf        core1_0.Buffer
		Mem        core1_0.DeviceMemory
		BufferInfo core1_0.DescriptorBufferInfo
	}

	TextureData struct {
		ImageInfo core1_0.DescriptorImageInfo
	}

	VertexBuffer struct {
		Buf        core1_0.Buffer
		Mem        core1_0.DeviceMemory
		BufferInfo core1_0.DescriptorBufferInfo
	}

	VertexBinding    core1_0.VertexInputBindingDescription
	VertexAttributes []core1_0.VertexInputAttributeDescription

	Projection mgl32.Mat4
	View       mgl32.Mat4
	Model      mgl32.Mat4
	Clip       mgl32.Mat4
	MVP        mgl32.Mat4

	Cmd            core1_0.CommandBuffer // BUffer for initialization commands
	PipelineLayout core1_0.PipelineLayout
	DescLayout     []core1_0.DescriptorSetLayout
	PipelineCache  core1_0.PipelineCache
	RenderPass     core1_0.RenderPass
	Pipeline       core1_0.Pipeline

	ShaderStages []core1_0.PipelineShaderStageCreateInfo

	DescPool core1_0.DescriptorPool
	DescSet  []core1_0.DescriptorSet

	CurrentBuffer    int
	QueueFamilyCount int

	Viewport core1_0.Viewport
	Scissor  core1_0.Rect2D
}

func (*SampleInfo) DestroyCommandBuffer

func (i *SampleInfo) DestroyCommandBuffer()

func (*SampleInfo) DestroyCommandPool

func (i *SampleInfo) DestroyCommandPool()

func (*SampleInfo) DestroyDepthBuffer

func (i *SampleInfo) DestroyDepthBuffer()

func (*SampleInfo) DestroyDescriptorAndPipelineLayouts

func (i *SampleInfo) DestroyDescriptorAndPipelineLayouts()

func (*SampleInfo) DestroyDescriptorPool

func (i *SampleInfo) DestroyDescriptorPool()

func (*SampleInfo) DestroyDevice

func (i *SampleInfo) DestroyDevice() error

func (*SampleInfo) DestroyFramebuffers

func (i *SampleInfo) DestroyFramebuffers()

func (*SampleInfo) DestroyInstance

func (i *SampleInfo) DestroyInstance()

func (*SampleInfo) DestroyPipeline

func (i *SampleInfo) DestroyPipeline()

func (*SampleInfo) DestroyPipelineCache

func (i *SampleInfo) DestroyPipelineCache()

func (*SampleInfo) DestroyRenderpass

func (i *SampleInfo) DestroyRenderpass()

func (*SampleInfo) DestroyShaders

func (i *SampleInfo) DestroyShaders()

func (*SampleInfo) DestroySwapchain

func (i *SampleInfo) DestroySwapchain()

func (*SampleInfo) DestroyTextures

func (i *SampleInfo) DestroyTextures()

func (*SampleInfo) DestroyUniformBuffer

func (i *SampleInfo) DestroyUniformBuffer()

func (*SampleInfo) DestroyVertexBuffer

func (i *SampleInfo) DestroyVertexBuffer()

func (*SampleInfo) ExecuteBeginCommandBuffer

func (i *SampleInfo) ExecuteBeginCommandBuffer() error

func (*SampleInfo) ExecuteEndCommandBuffer

func (i *SampleInfo) ExecuteEndCommandBuffer() error

func (*SampleInfo) ExecutePresentImage

func (i *SampleInfo) ExecutePresentImage() error

func (*SampleInfo) ExecuteQueueCmdBuf

func (i *SampleInfo) ExecuteQueueCmdBuf(cmdBufs []core1_0.CommandBuffer, fence core1_0.Fence) error

func (*SampleInfo) InitClearColorAndDepth

func (i *SampleInfo) InitClearColorAndDepth() []core1_0.ClearValue

func (*SampleInfo) InitCommandBuffer

func (i *SampleInfo) InitCommandBuffer() error

func (*SampleInfo) InitCommandPool

func (i *SampleInfo) InitCommandPool() error

func (*SampleInfo) InitDepthBuffer

func (i *SampleInfo) InitDepthBuffer() error

func (*SampleInfo) InitDescriptorAndPipelineLayouts

func (i *SampleInfo) InitDescriptorAndPipelineLayouts(useTexture bool) error

func (*SampleInfo) InitDescriptorPool

func (i *SampleInfo) InitDescriptorPool(useTexture bool) error

func (*SampleInfo) InitDescriptorSet

func (i *SampleInfo) InitDescriptorSet(useTexture bool) error

func (*SampleInfo) InitDevice

func (i *SampleInfo) InitDevice() error

func (*SampleInfo) InitDeviceExtensionNames

func (i *SampleInfo) InitDeviceExtensionNames() error

func (*SampleInfo) InitDeviceExtensionProperties

func (i *SampleInfo) InitDeviceExtensionProperties(layerProps *LayerProperties) error

func (*SampleInfo) InitDeviceQueue

func (i *SampleInfo) InitDeviceQueue() error

func (*SampleInfo) InitEnumerateDevice

func (i *SampleInfo) InitEnumerateDevice() error

func (*SampleInfo) InitFence

func (i *SampleInfo) InitFence() (core1_0.Fence, error)

func (*SampleInfo) InitFramebuffers

func (i *SampleInfo) InitFramebuffers(depthPresent bool) error

func (*SampleInfo) InitGlobalExtensionProperties

func (i *SampleInfo) InitGlobalExtensionProperties(layerProps *LayerProperties) error

func (*SampleInfo) InitGlobalLayerProperties

func (i *SampleInfo) InitGlobalLayerProperties() error

func (*SampleInfo) InitImage

func (i *SampleInfo) InitImage(textureReader io.Reader, extraUsages core1_0.ImageUsageFlags, extraFeatures core1_0.FormatFeatureFlags) (*TextureObject, error)

func (*SampleInfo) InitInstance

func (i *SampleInfo) InitInstance(appShortName string, next common.Options) error

func (*SampleInfo) InitInstanceExtensionNames

func (i *SampleInfo) InitInstanceExtensionNames() error

func (*SampleInfo) InitPipeline

func (i *SampleInfo) InitPipeline(depthPresent bool, vertexPresent bool) error

func (*SampleInfo) InitPipelineCache

func (i *SampleInfo) InitPipelineCache() error

func (*SampleInfo) InitPresentInfo

func (i *SampleInfo) InitPresentInfo() khr_swapchain.PresentInfo

func (*SampleInfo) InitPresentableImage

func (i *SampleInfo) InitPresentableImage() error

func (*SampleInfo) InitRenderPass

func (i *SampleInfo) InitRenderPass(depthPresent, clear bool, finalLayout, initialLayout core1_0.ImageLayout) error

func (*SampleInfo) InitRenderPassBeginInfo

func (i *SampleInfo) InitRenderPassBeginInfo() core1_0.RenderPassBeginInfo

func (*SampleInfo) InitSampler

func (i *SampleInfo) InitSampler() (core1_0.Sampler, error)

func (*SampleInfo) InitScissors

func (i *SampleInfo) InitScissors()

func (*SampleInfo) InitShaders

func (i *SampleInfo) InitShaders(vertShaderBytes []byte, fragShaderBytes []byte) error

func (*SampleInfo) InitSubmitInfo

func (i *SampleInfo) InitSubmitInfo(stageFlags core1_0.PipelineStageFlags) *core1_0.SubmitInfo

func (*SampleInfo) InitSwapchain

func (i *SampleInfo) InitSwapchain(usage core1_0.ImageUsageFlags) error

func (*SampleInfo) InitSwapchainExtension

func (i *SampleInfo) InitSwapchainExtension() error

func (*SampleInfo) InitTexture

func (i *SampleInfo) InitTexture(textureReader io.Reader, extraUsages core1_0.ImageUsageFlags, extraFeatures core1_0.FormatFeatureFlags) error

func (*SampleInfo) InitTextureBuffer

func (i *SampleInfo) InitTextureBuffer(textureObj *TextureObject) error

func (*SampleInfo) InitUniformBuffer

func (i *SampleInfo) InitUniformBuffer() error

func (*SampleInfo) InitVertexBuffers

func (i *SampleInfo) InitVertexBuffers(vertexData any, dataSize int, dataStride int, useTexture bool) error

func (*SampleInfo) InitViewports

func (i *SampleInfo) InitViewports()

func (*SampleInfo) InitWindow

func (i *SampleInfo) InitWindow() error

func (*SampleInfo) InitWindowSize

func (i *SampleInfo) InitWindowSize(defaultWidth, defaultHeight int) error

func (*SampleInfo) MemoryTypeFromProperties

func (i *SampleInfo) MemoryTypeFromProperties(memoryType uint32, flags core1_0.MemoryPropertyFlags) (int, error)

func (*SampleInfo) ProcessCommandLineArgs

func (i *SampleInfo) ProcessCommandLineArgs() error

func (*SampleInfo) SetImageLayout

func (i *SampleInfo) SetImageLayout(image core1_0.Image, aspectMask core1_0.ImageAspectFlags, oldImageLayout core1_0.ImageLayout, newImageLayout core1_0.ImageLayout, sourceStages core1_0.PipelineStageFlags, destStages core1_0.PipelineStageFlags) error

func (*SampleInfo) WritePNG

func (i *SampleInfo) WritePNG(baseName string) error

type SwapchainBuffer

type SwapchainBuffer struct {
	Image core1_0.Image
	View  core1_0.ImageView
}

type TextureObject

type TextureObject struct {
	Sampler core1_0.Sampler

	Image       core1_0.Image
	ImageLayout core1_0.ImageLayout

	NeedsStaging bool
	Buffer       core1_0.Buffer
	BufferSize   int

	ImageMemory         core1_0.DeviceMemory
	BufferMemory        core1_0.DeviceMemory
	View                core1_0.ImageView
	TexWidth, TexHeight int
}

type Vertex

type Vertex struct {
	PosX, PosY, PosZ, PosW float32
	R, G, B, A             float32
}

type VertexUV

type VertexUV struct {
	PosX, PosY, PosZ, PosW float32
	U, V                   float32
}

Jump to

Keyboard shortcuts

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