Skip to content

package rendering

import "kaiju/rendering"

Constants

FontJustifyLeft

FontJustify(iota)

FontJustifyCenter

FontJustifyRight

FontBaselineBottom

FontBaseline(iota)

FontBaselineCenter

FontBaselineTop

FontCondensedBold

FontFace("fonts/OpenSans_Condensed-Bold")

FontCondensedBoldItalic

FontFace("fonts/OpenSans_Condensed-BoldItalic")

FontCondensedExtraBold

FontFace("fonts/OpenSans_Condensed-ExtraBold")

FontCondensedExtraBoldItalic

FontFace("fonts/OpenSans_Condensed-ExtraBoldItalic")

FontCondensedItalic

FontFace("fonts/OpenSans_Condensed-Italic")

FontCondensedLight

FontFace("fonts/OpenSans_Condensed-Light")

FontCondensedLightItalic

FontFace("fonts/OpenSans_Condensed-LightItalic")

FontCondensedMedium

FontFace("fonts/OpenSans_Condensed-Medium")

FontCondensedMediumItalic

FontFace("fonts/OpenSans_Condensed-MediumItalic")

FontCondensedRegular

FontFace("fonts/OpenSans_Condensed-Regular")

FontCondensedSemiBold

FontFace("fonts/OpenSans_Condensed-SemiBold")

FontCondensedSemiBoldItalic

FontFace("fonts/OpenSans_Condensed-SemiBoldItalic")

FontSemiCondensedBold

FontFace("fonts/OpenSans_SemiCondensed-Bold")

FontSemiCondensedBoldItalic

FontFace("fonts/OpenSans_SemiCondensed-BoldItalic")

FontSemiCondensedExtraBold

FontFace("fonts/OpenSans_SemiCondensed-ExtraBold")

FontSemiCondensedExtraBoldItalic

FontFace("fonts/OpenSans_SemiCondensed-ExtraBoldItalic")

FontSemiCondensedItalic

FontFace("fonts/OpenSans_SemiCondensed-Italic")

FontSemiCondensedLight

FontFace("fonts/OpenSans_SemiCondensed-Light")

FontSemiCondensedLightItalic

FontFace("fonts/OpenSans_SemiCondensed-LightItalic")

FontSemiCondensedMedium

FontFace("fonts/OpenSans_SemiCondensed-Medium")

FontSemiCondensedMediumItalic

FontFace("fonts/OpenSans_SemiCondensed-MediumItalic")

FontSemiCondensedRegular

FontFace("fonts/OpenSans_SemiCondensed-Regular")

FontSemiCondensedSemiBold

FontFace("fonts/OpenSans_SemiCondensed-SemiBold")

FontSemiCondensedSemiBoldItalic

FontFace("fonts/OpenSans_SemiCondensed-SemiBoldItalic")

FontBold

FontFace("fonts/OpenSans-Bold")

FontBoldItalic

FontFace("fonts/OpenSans-BoldItalic")

FontExtraBold

FontFace("fonts/OpenSans-ExtraBold")

FontExtraBoldItalic

FontFace("fonts/OpenSans-ExtraBoldItalic")

FontItalic

FontFace("fonts/OpenSans-Italic")

FontLight

FontFace("fonts/OpenSans-Light")

FontLightItalic

FontFace("fonts/OpenSans-LightItalic")

FontMedium

FontFace("fonts/OpenSans-Medium")

FontMediumItalic

FontFace("fonts/OpenSans-MediumItalic")

FontRegular

FontFace("fonts/OpenSans-Regular")

FontSemiBold

FontFace("fonts/OpenSans-SemiBold")

FontSemiBoldItalic

FontFace("fonts/OpenSans-SemiBoldItalic")

DefaultFontEMSize

14.0

MaxJoints

50

MaxSkinInstances

50

QuadPivotCenter

QuadPivot(iota)

QuadPivotLeft

QuadPivotTop

QuadPivotRight

QuadPivotBottom

QuadPivotBottomLeft

QuadPivotBottomRight

QuadPivotTopLeft

QuadPivotTopRight

QuaternionSize

[int(unsafe](../int(unsafe).[Sizeof(matrix](../int(unsafe#Sizeof(matrix)

CubeMapSides

6

BytesInPixel

4

MaxCommandPools

5

MaxSecondaryCommands

25

Variables

StringVkFormat

map[string]vk.Format{

StringVkBlendFactor

map[string]vk.BlendFactor{

StringVkBlendOp

map[string]vk.BlendOp{

StringVkLogicOp

map[string]vk.LogicOp{

StringVkCompareOp

map[string]vk.CompareOp{

StringVkStencilOp

map[string]vk.StencilOp{

StringVkPrimitiveTopology

map[string]vk.PrimitiveTopology{

StringVkPolygonMode

map[string]vk.PolygonMode{

StringVkCullModeFlagBits

map[string]vk.CullModeFlagBits{

StringVkFrontFace

map[string]vk.FrontFace{

StringVkSampleCountFlagBits

map[string]vk.SampleCountFlagBits{

StringVkPatchControlPoints

map[string]uint32{

StringVkAttachmentLoadOp

map[string]vk.AttachmentLoadOp{

StringVkAttachmentStoreOp

map[string]vk.AttachmentStoreOp{

StringVkImageLayout

map[string]vk.ImageLayout{

StringVkPipelineStageFlagBits

map[string]vk.PipelineStageFlagBits{

StringVkAccessFlagBits

map[string]vk.AccessFlagBits{

StringVkPipelineBindPoint

map[string]vk.PipelineBindPoint{

StringVkDependencyFlagBits

map[string]vk.DependencyFlagBits{

StringVkColorComponentFlagBits

map[string]vk.ColorComponentFlagBits{

StringVkPipelineCreateFlagBits

map[string]vk.PipelineCreateFlagBits{

StringVkImageTiling

map[string]vk.ImageTiling{

StringVkFilter

map[string]vk.Filter{

StringVkImageUsageFlagBits

map[string]vk.ImageUsageFlagBits{

StringVkMemoryPropertyFlagBits

map[string]vk.MemoryPropertyFlagBits{

StringVkImageAspectFlagBits

map[string]vk.ImageAspectFlagBits{

StringVkMap

map[string]any{

Functions

TextureKeys

func TextureKeys(textures []*Texture) []string

VertexFaceNormal

func VertexFaceNormal(verts [3]Vertex) matrix.Vec3

Types

CommandRecorder

struct

type CommandRecorder struct {
    // Has unexported fields.
}

NewCommandRecorder

func NewCommandRecorder(vr *Vulkan) (CommandRecorder, error)

CommandRecorder.Begin

func (c *CommandRecorder) Begin()

CommandRecorder.Destroy

func (c *CommandRecorder) Destroy(vr *Vulkan)

CommandRecorder.End

func (c *CommandRecorder) End()

CommandRecorder.Reset

func (c *CommandRecorder) Reset()

CommandRecorderSecondary

struct

type CommandRecorderSecondary struct {
    CommandRecorder

    // Has unexported fields.
}

NewCommandRecorderSecondary

func NewCommandRecorderSecondary(vr *Vulkan, rp *RenderPass, subpassIdx int) (CommandRecorderSecondary, error)

CommandRecorderSecondary.Begin

func (c *CommandRecorderSecondary) Begin(viewport vk.Viewport, scissor vk.Rect2D)

DescriptorSetLayoutStructure

struct

type DescriptorSetLayoutStructure struct {
    Types []DescriptorSetLayoutStructureType
}

DescriptorSetLayoutStructureType

struct

type DescriptorSetLayoutStructureType struct {
    Type           vk.DescriptorType
    Flags          vk.ShaderStageFlagBits
    Count, Binding uint32
}

DrawInstance

interface

type DrawInstance interface {
    Destroy()
    IsDestroyed() bool
    Activate()
    Deactivate()
    IsActive() bool
    Size() int
    SetModel(model matrix.Mat4)
    UpdateModel()
    DataPointer() unsafe.Pointer
    // Returns true if it should write the data, otherwise false
    UpdateNamedData(index, capacity int, name string) bool
    NamedDataPointer(name string) unsafe.Pointer
    NamedDataInstanceSize(name string) int
    // Has unexported methods.
}

ReflectDuplicateDrawInstance

func ReflectDuplicateDrawInstance(target DrawInstance) DrawInstance

DrawInstanceGroup

struct

type DrawInstanceGroup struct {
    Mesh *Mesh
    InstanceDriverData
    MaterialInstance *Material
    Instances        []DrawInstance

    // Has unexported fields.
}

NewDrawInstanceGroup

func NewDrawInstanceGroup(mesh *Mesh, dataSize int) DrawInstanceGroup

DrawInstanceGroup.AddInstance

func (d *DrawInstanceGroup) AddInstance(instance DrawInstance)

DrawInstanceGroup.AlterPadding

func (d *DrawInstanceGroup) AlterPadding(blockSize int)

DrawInstanceGroup.AnyVisible

func (d *DrawInstanceGroup) AnyVisible() bool

DrawInstanceGroup.Clear

func (d *DrawInstanceGroup) Clear(renderer Renderer)

DrawInstanceGroup.Destroy

func (d *DrawInstanceGroup) Destroy(renderer Renderer)

DrawInstanceGroup.IsEmpty

func (d *DrawInstanceGroup) IsEmpty() bool

DrawInstanceGroup.IsReady

func (d *DrawInstanceGroup) IsReady() bool

DrawInstanceGroup.TotalSize

func (d *DrawInstanceGroup) TotalSize() int

DrawInstanceGroup.UpdateData

func (d *DrawInstanceGroup) UpdateData(renderer Renderer)

DrawInstanceGroup.VisibleCount

func (d *DrawInstanceGroup) VisibleCount() int

DrawInstanceGroup.VisibleSize

func (d *DrawInstanceGroup) VisibleSize() int

Drawing

struct

type Drawing struct {
    Renderer   Renderer
    Material   *Material
    Mesh       *Mesh
    ShaderData DrawInstance
    Transform  *matrix.Transform
}

Drawing.IsValid

func (d *Drawing) IsValid() bool

Drawings

struct

type Drawings struct {
    // Has unexported fields.
}

NewDrawings

func NewDrawings() Drawings

Drawings.AddDrawing

func (d *Drawings) AddDrawing(drawing Drawing)

Drawings.AddDrawings

func (d *Drawings) AddDrawings(drawings []Drawing)

Drawings.Destroy

func (d *Drawings) Destroy(renderer Renderer)

Drawings.HasDrawings

func (d *Drawings) HasDrawings() bool

Drawings.PreparePending

func (d *Drawings) PreparePending()

Drawings.Render

func (d *Drawings) Render(renderer Renderer)

FontBaseline

int

type FontBaseline int

FontCache

struct

type FontCache struct {
    FaceMutex sync.RWMutex
    // Has unexported fields.
}

NewFontCache

func NewFontCache(renderer Renderer, assetDb *assets.Database) FontCache

FontCache.Destroy

func (cache *FontCache) Destroy()

FontCache.EMSize

func (cache *FontCache) EMSize(face FontFace) float32

FontCache.Init

func (cache *FontCache) Init(renderer Renderer, assetDb *assets.Database, caches RenderCaches) error

FontCache.LineCountWithin

func (cache *FontCache) LineCountWithin(face FontFace, text string, scale, maxWidth float32) int

FontCache.MeasureCharacter

func (cache *FontCache) MeasureCharacter(face string, r rune, pixelSize float32) matrix.Vec2

FontCache.MeasureString

func (cache *FontCache) MeasureString(face FontFace, text string, scale float32) float32

FontCache.MeasureStringWithin

func (cache *FontCache) MeasureStringWithin(face FontFace, text string, scale, maxWidth float32, lineHeight float32) matrix.Vec2

FontCache.PointOffsetWithin

func (cache *FontCache) PointOffsetWithin(face FontFace, text string, point matrix.Vec2, scale, maxWidth float32) int

FontCache.RenderMeshes

func (cache *FontCache) RenderMeshes(caches RenderCaches,

text string, x, y, z, scale, maxWidth float32, fgColor, bgColor matrix.Color, justify FontJustify, baseline FontBaseline, rootScale matrix.Vec3, instanced, is3D bool, face FontFace, lineHeight float32) []Drawing

FontCache.StringRectsWithinNew

func (cache *FontCache) StringRectsWithinNew(face FontFace, text string, scale, maxWidth float32) []matrix.Vec4

FontCache.TransparentMaterial

func (cache *FontCache) TransparentMaterial(target *Material) *Material

FontFace

string

type FontFace string

FontFace.IsBold

func (f FontFace) IsBold() bool

FontFace.IsExtraBold

func (f FontFace) IsExtraBold() bool

FontFace.IsItalic

func (f FontFace) IsItalic() bool

FontJustify

int

type FontJustify int

FuncPipeline

func

type FuncPipeline func(renderer Renderer, shader *Shader, shaderStages []vk.PipelineShaderStageCreateInfo) bool

GlobalShaderData

struct

type GlobalShaderData struct {
    View             matrix.Mat4
    Projection       matrix.Mat4
    UIView           matrix.Mat4
    UIProjection     matrix.Mat4
    CameraPosition   matrix.Vec4
    UICameraPosition matrix.Vec3

    ScreenSize matrix.Vec2
    Time       float32
    // Has unexported fields.
}

InstanceCopyData

struct

type InstanceCopyData struct {
    // Has unexported fields.
}

InstanceCopyDataNew

func InstanceCopyDataNew(padding int) InstanceCopyData

InstanceDriverData

struct

type InstanceDriverData struct {
    // Has unexported fields.
}

InstanceGroupSkinningData

struct

type InstanceGroupSkinningData struct {
}

Material

struct

type Material struct {
    Name string

    Shader    *Shader
    Textures  []*Texture
    Instances map[string]*Material
    Root      weak.Pointer[Material]
    // Has unexported fields.
}

Material.CreateInstance

func (m *Material) CreateInstance(textures []*Texture) *Material

Material.Destroy

func (m *Material) Destroy(renderer Renderer)

Material.SelectRoot

func (m *Material) SelectRoot() *Material

MaterialCache

struct

type MaterialCache struct {
    // Has unexported fields.
}

NewMaterialCache

func NewMaterialCache(renderer Renderer, assetDatabase *assets.Database) MaterialCache

MaterialCache.AddMaterial

func (m *MaterialCache) AddMaterial(material *Material) *Material

MaterialCache.Destroy

func (m *MaterialCache) Destroy()

MaterialCache.FindMaterial

func (m *MaterialCache) FindMaterial(key string) (*Material, bool)

MaterialCache.Material

func (m *MaterialCache) Material(key string) (*Material, error)

MaterialData

struct

type MaterialData struct {
    Name           string
    Shader         string `options:""` // Blank = fallback
    RenderPass     string `options:""` // Blank = fallback
    ShaderPipeline string `options:""` // Blank = fallback
    Textures       []MaterialTextureData
}

MaterialData.Compile

func (d *MaterialData) Compile(assets *assets.Database, renderer Renderer) (*Material, error)

MaterialTextureData

struct

type MaterialTextureData struct {
    Texture string `options:""` // Blank = fallback
    Filter  string `options:"StringVkFilter"`
}

MaterialTextureData.FilterToVK

func (d *MaterialTextureData) FilterToVK() TextureFilter

Mesh

struct

type Mesh struct {
    MeshId MeshId

    Details meshDetails
    // Has unexported fields.
}

NewMesh

func NewMesh(key string, verts []Vertex, indexes []uint32) *Mesh

NewMeshCube

func NewMeshCube(cache *MeshCache) *Mesh

NewMeshCubeInverse

func NewMeshCubeInverse(cache *MeshCache) *Mesh

NewMeshFrustum

func NewMeshFrustum(cache *MeshCache, key string, inverseProjection matrix.Mat4) *Mesh

NewMeshGrid

func NewMeshGrid(cache *MeshCache, key string, points []matrix.Vec3, vertColor matrix.Color) *Mesh

NewMeshLine

func NewMeshLine(cache *MeshCache, key string, p0, p1 matrix.Vec3, vertColor matrix.Color) *Mesh

NewMeshOffsetQuad

func NewMeshOffsetQuad(cache *MeshCache, key string, sideOffsets matrix.Vec4) *Mesh

NewMeshPlane

func NewMeshPlane(cache *MeshCache) *Mesh

NewMeshPoint

func NewMeshPoint(cache *MeshCache, key string, position matrix.Vec3, vertColor matrix.Color) *Mesh

NewMeshQuad

func NewMeshQuad(cache *MeshCache) *Mesh

NewMeshQuadAnchored

func NewMeshQuadAnchored(anchor QuadPivot, cache *MeshCache) *Mesh

NewMeshScreenQuad

func NewMeshScreenQuad(cache *MeshCache) *Mesh

NewMeshSkyboxCube

func NewMeshSkyboxCube(cache *MeshCache) *Mesh

NewMeshTexturableCube

func NewMeshTexturableCube(cache *MeshCache) *Mesh

NewMeshTriangle

func NewMeshTriangle(cache *MeshCache) *Mesh

NewMeshUnitQuad

func NewMeshUnitQuad(cache *MeshCache) *Mesh

NewMeshWireCube

func NewMeshWireCube(cache *MeshCache, key string, vertColor matrix.Color) *Mesh

NewMeshWireQuad

func NewMeshWireQuad(cache *MeshCache, key string, vertColor matrix.Color) *Mesh

Mesh.BVH

func (m *Mesh) BVH() *collision.BVH

Mesh.DelayedCreate

func (m *Mesh) DelayedCreate(renderer Renderer)

Mesh.Destroy

func (m *Mesh) Destroy(renderer Renderer)

Mesh.IsReady

func (m Mesh) IsReady() bool

Mesh.Key

func (m Mesh) Key() string

Mesh.SetKey

func (m *Mesh) SetKey(key string)

MeshCache

struct

type MeshCache struct {
    // Has unexported fields.
}

NewMeshCache

func NewMeshCache(renderer Renderer, assetDatabase *assets.Database) MeshCache

MeshCache.AddMesh

func (m *MeshCache) AddMesh(mesh *Mesh) *Mesh

Try to add the mesh to the cache, if it already exists, return the existing mesh

MeshCache.CreatePending

func (m *MeshCache) CreatePending()

MeshCache.Destroy

func (m *MeshCache) Destroy()

MeshCache.FindMesh

func (m *MeshCache) FindMesh(key string) (*Mesh, bool)

MeshCache.Mesh

func (m *MeshCache) Mesh(key string, verts []Vertex, indexes []uint32) *Mesh

MeshCullMode

int

type MeshCullMode = int

const ( MeshCullModeBack MeshCullMode = iota MeshCullModeFront MeshCullModeNone )

MeshDrawMode

int

type MeshDrawMode = int

const ( MeshDrawModePoints MeshDrawMode = iota MeshDrawModeLines MeshDrawModeTriangles MeshDrawModePatches )

MeshId

struct

type MeshId struct {
    // Has unexported fields.
}

MeshId.IsValid

func (m MeshId) IsValid() bool

QuadPivot

int32

type QuadPivot = int32

RenderCaches

interface

type RenderCaches interface {
    ShaderCache() *ShaderCache
    TextureCache() *TextureCache
    MeshCache() *MeshCache
    FontCache() *FontCache
    MaterialCache() *MaterialCache
    AssetDatabase() *assets.Database
}

RenderPass

struct

type RenderPass struct {
    Handle vk.RenderPass
    Buffer vk.Framebuffer

    // Has unexported fields.
}

NewRenderPass

func NewRenderPass(vr *Vulkan, setup *RenderPassDataCompiled) (*RenderPass, error)

RenderPass.CreateFrameBuffer

func (p *RenderPass) CreateFrameBuffer(vr *Vulkan,

imageViews []vk.ImageView, width, height int) error

RenderPass.Destroy

func (p *RenderPass) Destroy(vr *Vulkan)

RenderPass.ExecuteSecondaryCommands

func (r *RenderPass) ExecuteSecondaryCommands()

RenderPass.Recontstruct

func (p *RenderPass) Recontstruct(vr *Vulkan) error

RenderPass.SelectOutputAttachment

func (r *RenderPass) SelectOutputAttachment(vr *Vulkan) *Texture

RenderPassAttachmentDescription

struct

type RenderPassAttachmentDescription struct {
    Format         string `options:"StringVkFormat"`
    Samples        string `options:"StringVkSampleCountFlagBits"`
    LoadOp         string `options:"StringVkAttachmentLoadOp"`
    StoreOp        string `options:"StringVkAttachmentStoreOp"`
    StencilLoadOp  string `options:"StringVkAttachmentLoadOp"`
    StencilStoreOp string `options:"StringVkAttachmentStoreOp"`
    InitialLayout  string `options:"StringVkImageLayout"`
    FinalLayout    string `options:"StringVkImageLayout"`
    Image          RenderPassAttachmentImage
}

RenderPassAttachmentDescription.FinalLayoutToVK

func (ad *RenderPassAttachmentDescription) FinalLayoutToVK() vk.ImageLayout

RenderPassAttachmentDescription.FormatToVK

func (ad *RenderPassAttachmentDescription) FormatToVK(vr *Vulkan) vk.Format

RenderPassAttachmentDescription.InitialLayoutToVK

func (ad *RenderPassAttachmentDescription) InitialLayoutToVK() vk.ImageLayout

RenderPassAttachmentDescription.LoadOpToVK

func (ad *RenderPassAttachmentDescription) LoadOpToVK() vk.AttachmentLoadOp

RenderPassAttachmentDescription.SamplesToVK

func (ad *RenderPassAttachmentDescription) SamplesToVK(vr *Vulkan) vk.SampleCountFlagBits

RenderPassAttachmentDescription.StencilLoadOpToVK

func (ad *RenderPassAttachmentDescription) StencilLoadOpToVK() vk.AttachmentLoadOp

RenderPassAttachmentDescription.StencilStoreOpToVK

func (ad *RenderPassAttachmentDescription) StencilStoreOpToVK() vk.AttachmentStoreOp

RenderPassAttachmentDescription.StoreOpToVK

func (ad *RenderPassAttachmentDescription) StoreOpToVK() vk.AttachmentStoreOp

RenderPassAttachmentDescriptionCompiled

struct

type RenderPassAttachmentDescriptionCompiled struct {
    Format         vk.Format
    Samples        vk.SampleCountFlagBits
    LoadOp         vk.AttachmentLoadOp
    StoreOp        vk.AttachmentStoreOp
    StencilLoadOp  vk.AttachmentLoadOp
    StencilStoreOp vk.AttachmentStoreOp
    InitialLayout  vk.ImageLayout
    FinalLayout    vk.ImageLayout
    Image          RenderPassAttachmentImageCompiled
}

RenderPassAttachmentDescriptionCompiled.IsDepthFormat

func (p *RenderPassAttachmentDescriptionCompiled) IsDepthFormat() bool

RenderPassAttachmentImage

struct

type RenderPassAttachmentImage struct {
    Name           string
    ExistingImage  string
    MipLevels      uint32
    LayerCount     uint32
    Tiling         string                         `options:"StringVkImageTiling"`
    Filter         string                         `options:"StringVkFilter"`
    Usage          []string                       `options:"StringVkImageUsageFlagBits"`
    MemoryProperty []string                       `options:"StringVkMemoryPropertyFlagBits"`
    Aspect         []string                       `options:"StringVkImageAspectFlagBits"`
    Access         []string                       `options:"StringVkAccessFlagBits"`
    Clear          RenderPassAttachmentImageClear `tip:"AttachmentImageClear"`
}

RenderPassAttachmentImage.AccessToVK

func (ai *RenderPassAttachmentImage) AccessToVK() vk.AccessFlags

RenderPassAttachmentImage.AspectToVK

func (ai *RenderPassAttachmentImage) AspectToVK() vk.ImageAspectFlags

RenderPassAttachmentImage.FilterToVK

func (ai *RenderPassAttachmentImage) FilterToVK() vk.Filter

RenderPassAttachmentImage.IsInvalid

func (img *RenderPassAttachmentImage) IsInvalid() bool

RenderPassAttachmentImage.MemoryPropertyToVK

func (ai *RenderPassAttachmentImage) MemoryPropertyToVK() vk.MemoryPropertyFlags

RenderPassAttachmentImage.TilingToVK

func (ai *RenderPassAttachmentImage) TilingToVK() vk.ImageTiling

RenderPassAttachmentImage.UsageToVK

func (ai *RenderPassAttachmentImage) UsageToVK() vk.ImageUsageFlags

RenderPassAttachmentImageClear

struct

type RenderPassAttachmentImageClear struct {
    R       float32
    G       float32
    B       float32
    A       float32
    Depth   float32
    Stencil uint32
}

RenderPassAttachmentImageCompiled

struct

type RenderPassAttachmentImageCompiled struct {
    Name           string
    ExistingImage  string
    MipLevels      uint32
    LayerCount     uint32
    Tiling         vk.ImageTiling
    Filter         vk.Filter
    Usage          vk.ImageUsageFlags
    MemoryProperty vk.MemoryPropertyFlags
    Aspect         vk.ImageAspectFlags
    Access         vk.AccessFlags
}

RenderPassAttachmentImageCompiled.IsInvalid

func (img *RenderPassAttachmentImageCompiled) IsInvalid() bool

RenderPassAttachmentReference

struct

type RenderPassAttachmentReference struct {
    Attachment uint32
    Layout     string `options:"StringVkImageLayout"`
}

RenderPassAttachmentReference.LayoutToVK

func (ad *RenderPassAttachmentReference) LayoutToVK() vk.ImageLayout

RenderPassAttachmentReferenceCompiled

struct

type RenderPassAttachmentReferenceCompiled struct {
    Attachment uint32
    Layout     vk.ImageLayout
}

RenderPassData

struct

type RenderPassData struct {
    Name                   string
    Sort                   int
    AttachmentDescriptions []RenderPassAttachmentDescription
    SubpassDescriptions    []RenderPassSubpassDescription
    SubpassDependencies    []RenderPassSubpassDependency
}

NewRenderPassData

func NewRenderPassData(src string) (RenderPassData, error)

RenderPassData.Compile

func (d *RenderPassData) Compile(vr *Vulkan) RenderPassDataCompiled

RenderPassDataCompiled

struct

type RenderPassDataCompiled struct {
    Name                   string
    Sort                   int
    AttachmentDescriptions []RenderPassAttachmentDescriptionCompiled
    SubpassDescriptions    []RenderPassSubpassDescriptionCompiled
    SubpassDependencies    []RenderPassSubpassDependencyCompiled
    ImageClears            []vk.ClearValue
    Subpass                []RenderPassSubpassDataCompiled
}

RenderPassDataCompiled.ConstructRenderPass

func (r *RenderPassDataCompiled) ConstructRenderPass(renderer Renderer) (*RenderPass, bool)

RenderPassGroup

struct

type RenderPassGroup struct {
    // Has unexported fields.
}

RenderPassSubpass

struct

type RenderPassSubpass struct {
    // Has unexported fields.
}

RenderPassSubpassData

struct

type RenderPassSubpassData struct {
    Shader         string `options:""`
    ShaderPipeline string `options:""`
    SampledImages  []RenderPassSubpassImageData
}

RenderPassSubpassDataCompiled

struct

type RenderPassSubpassDataCompiled struct {
    Shader         string
    ShaderPipeline string
    SampledImages  []int
}

RenderPassSubpassDependency

struct

type RenderPassSubpassDependency struct {
    SrcSubpass      int64
    DstSubpass      int64
    SrcStageMask    []string `options:"StringVkPipelineStageFlagBits"`
    DstStageMask    []string `options:"StringVkPipelineStageFlagBits"`
    SrcAccessMask   []string `options:"StringVkAccessFlagBits"`
    DstAccessMask   []string `options:"StringVkAccessFlagBits"`
    DependencyFlags []string `options:"StringVkDependencyFlagBits"`
}

RenderPassSubpassDependency.DependencyFlagsToVK

func (sd *RenderPassSubpassDependency) DependencyFlagsToVK() vk.DependencyFlags

RenderPassSubpassDependency.DstAccessMaskToVK

func (sd *RenderPassSubpassDependency) DstAccessMaskToVK() vk.AccessFlags

RenderPassSubpassDependency.DstStageMaskToVK

func (sd *RenderPassSubpassDependency) DstStageMaskToVK() vk.PipelineStageFlags

RenderPassSubpassDependency.SrcAccessMaskToVK

func (sd *RenderPassSubpassDependency) SrcAccessMaskToVK() vk.AccessFlags

RenderPassSubpassDependency.SrcStageMaskToVK

func (sd *RenderPassSubpassDependency) SrcStageMaskToVK() vk.PipelineStageFlags

RenderPassSubpassDependencyCompiled

struct

type RenderPassSubpassDependencyCompiled struct {
    SrcSubpass      uint32
    DstSubpass      uint32
    SrcStageMask    vk.PipelineStageFlags
    DstStageMask    vk.PipelineStageFlags
    SrcAccessMask   vk.AccessFlags
    DstAccessMask   vk.AccessFlags
    DependencyFlags vk.DependencyFlags
}

RenderPassSubpassDescription

struct

type RenderPassSubpassDescription struct {
    PipelineBindPoint         string `options:"StringVkPipelineBindPoint"`
    ColorAttachmentReferences []RenderPassAttachmentReference
    InputAttachmentReferences []RenderPassAttachmentReference
    ResolveAttachments        []RenderPassAttachmentReference
    DepthStencilAttachment    []RenderPassAttachmentReference // 1 max
    PreserveAttachments       []uint32                        // TODO
    Subpass                   RenderPassSubpassData
}

RenderPassSubpassDescription.PipelineBindPointToVK

func (ad *RenderPassSubpassDescription) PipelineBindPointToVK() vk.PipelineBindPoint

RenderPassSubpassDescriptionCompiled

struct

type RenderPassSubpassDescriptionCompiled struct {
    PipelineBindPoint         vk.PipelineBindPoint
    ColorAttachmentReferences []RenderPassAttachmentReferenceCompiled
    InputAttachmentReferences []RenderPassAttachmentReferenceCompiled
    ResolveAttachments        []RenderPassAttachmentReferenceCompiled
    DepthStencilAttachment    []RenderPassAttachmentReferenceCompiled // 1 max
    PreserveAttachments       []uint32                                // TODO
}

RenderPassSubpassImageData

struct

type RenderPassSubpassImageData struct {
    SampledImage string
}

Renderer

interface

type Renderer interface {
    Initialize(caches RenderCaches, width, height int32) error
    ReadyFrame(camera cameras.Camera, uiCamera cameras.Camera, runtime float32) bool
    CreateShader(shader *Shader, assetDatabase *assets.Database) error
    CreateMesh(mesh *Mesh, verts []Vertex, indices []uint32)
    CreateTexture(texture *Texture, textureData *TextureData)
    TextureReadPixel(texture *Texture, x, y int) matrix.Color
    TextureWritePixels(texture *Texture, x, y, width, height int, pixels []byte)
    Draw(renderPass *RenderPass, drawings []ShaderDraw) bool
    BlitTargets(passes []*RenderPass)
    SwapFrame(width, height int32) bool
    Resize(width, height int)
    AddPreRun(preRun func())
    DestroyGroup(group *DrawInstanceGroup)
    DestroyTexture(texture *Texture)
    DestroyShader(shader *Shader)
    DestroyMesh(mesh *Mesh)
    Destroy()
    WaitForRender()
}

RenderingContainer

interface

type RenderingContainer interface {
    GetDrawableSize() (int32, int32)
    GetInstanceExtensions() []string
    PlatformWindow() unsafe.Pointer
    PlatformInstance() unsafe.Pointer
}

Shader

struct

type Shader struct {
    RenderId ShaderId

    Material   MaterialData
    DriverData ShaderDriverData

    // Has unexported fields.
}

NewShader

func NewShader(shaderData ShaderDataCompiled) *Shader

Shader.AddSubShader

func (s *Shader) AddSubShader(key string, shader *Shader)

Shader.DelayedCreate

func (s *Shader) DelayedCreate(renderer Renderer, assetDatabase *assets.Database)

Shader.Destroy

func (s *Shader) Destroy(renderer Renderer)

Shader.RemoveSubShader

func (s *Shader) RemoveSubShader(key string)

Shader.SubShader

func (s *Shader) SubShader(key string) *Shader

ShaderBuffer

struct

type ShaderBuffer struct {
    // Has unexported fields.
}

ShaderCache

struct

type ShaderCache struct {
    // Has unexported fields.
}

NewShaderCache

func NewShaderCache(renderer Renderer, assetDatabase *assets.Database) ShaderCache

ShaderCache.CreatePending

func (s *ShaderCache) CreatePending()

ShaderCache.Destroy

func (s *ShaderCache) Destroy()

ShaderCache.Shader

func (s *ShaderCache) Shader(shaderData ShaderDataCompiled) (shader *Shader, isNew bool)

ShaderData

struct

type ShaderData struct {
    Name                        string
    EnableDebug                 bool
    Vertex                      string              `options:""`
    VertexFlags                 string              `tip:"CompileFlags"`
    Fragment                    string              `options:""`
    FragmentFlags               string              `tip:"CompileFlags"`
    Geometry                    string              `options:""`
    GeometryFlags               string              `tip:"CompileFlags"`
    TessellationControl         string              `options:""`
    TessellationControlFlags    string              `tip:"CompileFlags"`
    TessellationEvaluation      string              `options:""`
    TessellationEvaluationFlags string              `tip:"CompileFlags"`
    LayoutGroups                []ShaderLayoutGroup `visible:"false"`
}

ShaderData.Compile

func (d *ShaderData) Compile() ShaderDataCompiled

ShaderData.CompileVariantName

func (d *ShaderData) CompileVariantName(path, flags string) string

ShaderDataBase

struct

type ShaderDataBase struct {
    InitModel matrix.Mat4
    // Has unexported fields.
}

NewShaderDataBase

func NewShaderDataBase() ShaderDataBase

ShaderDataBase.Activate

func (s *ShaderDataBase) Activate()

ShaderDataBase.CancelDestroy

func (s *ShaderDataBase) CancelDestroy()

ShaderDataBase.DataPointer

func (s *ShaderDataBase) DataPointer() unsafe.Pointer

ShaderDataBase.Deactivate

func (s *ShaderDataBase) Deactivate()

ShaderDataBase.Destroy

func (s *ShaderDataBase) Destroy()

ShaderDataBase.IsActive

func (s *ShaderDataBase) IsActive() bool

ShaderDataBase.IsDestroyed

func (s *ShaderDataBase) IsDestroyed() bool

ShaderDataBase.Model

func (s *ShaderDataBase) Model() matrix.Mat4

ShaderDataBase.NamedDataInstanceSize

func (s *ShaderDataBase) NamedDataInstanceSize(name string) int

ShaderDataBase.NamedDataPointer

func (s *ShaderDataBase) NamedDataPointer(name string) unsafe.Pointer

ShaderDataBase.SetModel

func (s *ShaderDataBase) SetModel(model matrix.Mat4)

ShaderDataBase.Setup

func (s *ShaderDataBase) Setup()

ShaderDataBase.Size

func (s *ShaderDataBase) Size() int

ShaderDataBase.UpdateModel

func (s *ShaderDataBase) UpdateModel()

ShaderDataBase.UpdateNamedData

func (s *ShaderDataBase) UpdateNamedData(index, capacity int, name string) bool

ShaderDataBasic

struct

type ShaderDataBasic struct {
    ShaderDataBase
    Color matrix.Color
}

ShaderDataBasic.Size

func (t ShaderDataBasic) Size() int

ShaderDataCompiled

struct

type ShaderDataCompiled struct {
    Name                   string
    Vertex                 string
    Fragment               string
    Geometry               string
    TessellationControl    string
    TessellationEvaluation string
    LayoutGroups           []ShaderLayoutGroup
}

ShaderDataCompiled.SelectLayout

func (s *ShaderDataCompiled) SelectLayout(stage string) *ShaderLayoutGroup

ShaderDataCompiled.Stride

func (sd *ShaderDataCompiled) Stride() uint32

ShaderDataCompiled.ToAttributeDescription

func (sd *ShaderDataCompiled) ToAttributeDescription(locationStart uint32) []vk.VertexInputAttributeDescription

ShaderDataCompiled.ToDescriptorSetLayoutStructure

func (sd *ShaderDataCompiled) ToDescriptorSetLayoutStructure() DescriptorSetLayoutStructure

ShaderDraw

struct

type ShaderDraw struct {
    // Has unexported fields.
}

NewShaderDraw

func NewShaderDraw(material *Material) ShaderDraw

ShaderDraw.AddInstanceGroup

func (s *ShaderDraw) AddInstanceGroup(group DrawInstanceGroup)

ShaderDraw.Destroy

func (s *ShaderDraw) Destroy(renderer Renderer)

ShaderDraw.Filter

func (s *ShaderDraw) Filter(filter func(*DrawInstanceGroup) bool) []*DrawInstanceGroup

ShaderDraw.SolidGroups

func (s *ShaderDraw) SolidGroups() []*DrawInstanceGroup

ShaderDraw.TransparentGroups

func (s *ShaderDraw) TransparentGroups() []*DrawInstanceGroup

ShaderDriverData

struct

type ShaderDriverData struct {
    DescriptorSetLayoutStructure
    Stride                uint32
    AttributeDescriptions []vk.VertexInputAttributeDescription
}

NewShaderDriverData

func NewShaderDriverData() ShaderDriverData

ShaderId

struct

type ShaderId struct {
    // Has unexported fields.
}

ShaderId.IsValid

func (s ShaderId) IsValid() bool

ShaderLayout

struct

type ShaderLayout struct {
    Location        int    // -1 if not set
    Binding         int    // -1 if not set
    Set             int    // -1 if not set
    InputAttachment int    // -1 if not set
    Type            string // float, vec3, mat4, etc.
    Name            string
    Source          string // in, out, uniform
    Fields          []ShaderLayoutStructField
}

ShaderLayout.Capacity

func (l *ShaderLayout) Capacity() int

ShaderLayout.DescriptorType

func (l *ShaderLayout) DescriptorType() vk.DescriptorType

ShaderLayout.FullName

func (l *ShaderLayout) FullName() string

ShaderLayout.IsBuffer

func (l *ShaderLayout) IsBuffer() bool

ShaderLayout.Stride

func (l *ShaderLayout) Stride() int

ShaderLayoutGroup

struct

type ShaderLayoutGroup struct {
    Type    string
    Layouts []ShaderLayout
}

ShaderLayoutGroup.DescriptorFlag

func (g *ShaderLayoutGroup) DescriptorFlag() vk.ShaderStageFlagBits

ShaderLayoutStructField

struct

type ShaderLayoutStructField struct {
    Type string // float, vec3, mat4, etc.
    Name string
}

ShaderPipelineColorBlend

struct

type ShaderPipelineColorBlend struct {
    LogicOpEnable   bool
    LogicOp         string  `options:"StringVkLogicOp"`
    BlendConstants0 float32 `tip:"BlendConstants"`
    BlendConstants1 float32 `tip:"BlendConstants"`
    BlendConstants2 float32 `tip:"BlendConstants"`
    BlendConstants3 float32 `tip:"BlendConstants"`
}

ShaderPipelineColorBlend.LogicOpToVK

func (s *ShaderPipelineColorBlend) LogicOpToVK() vk.LogicOp

ShaderPipelineColorBlendAttachments

struct

type ShaderPipelineColorBlendAttachments struct {
    BlendEnable         bool
    SrcColorBlendFactor string   `options:"StringVkBlendFactor"`
    DstColorBlendFactor string   `options:"StringVkBlendFactor"`
    ColorBlendOp        string   `options:"StringVkBlendOp"`
    SrcAlphaBlendFactor string   `options:"StringVkBlendFactor"`
    DstAlphaBlendFactor string   `options:"StringVkBlendFactor"`
    AlphaBlendOp        string   `options:"StringVkBlendOp"`
    ColorWriteMask      []string `options:"StringVkColorComponentFlagBits"`
}

ShaderPipelineColorBlendAttachments.AlphaBlendOpToVK

func (a *ShaderPipelineColorBlendAttachments) AlphaBlendOpToVK() vk.BlendOp

ShaderPipelineColorBlendAttachments.BlendEnableToVK

func (a *ShaderPipelineColorBlendAttachments) BlendEnableToVK() vk.Bool32

ShaderPipelineColorBlendAttachments.ColorBlendOpToVK

func (a *ShaderPipelineColorBlendAttachments) ColorBlendOpToVK() vk.BlendOp

ShaderPipelineColorBlendAttachments.ColorWriteMaskToVK

func (a *ShaderPipelineColorBlendAttachments) ColorWriteMaskToVK() vk.ColorComponentFlagBits

ShaderPipelineColorBlendAttachments.DstAlphaBlendFactorToVK

func (a *ShaderPipelineColorBlendAttachments) DstAlphaBlendFactorToVK() vk.BlendFactor

ShaderPipelineColorBlendAttachments.DstColorBlendFactorToVK

func (a *ShaderPipelineColorBlendAttachments) DstColorBlendFactorToVK() vk.BlendFactor

ShaderPipelineColorBlendAttachments.ListAlphaBlendOp

func (a *ShaderPipelineColorBlendAttachments) ListAlphaBlendOp() []string

ShaderPipelineColorBlendAttachments.ListColorBlendOp

func (a *ShaderPipelineColorBlendAttachments) ListColorBlendOp() []string

ShaderPipelineColorBlendAttachments.ListDstAlphaBlendFactor

func (a *ShaderPipelineColorBlendAttachments) ListDstAlphaBlendFactor() []string

ShaderPipelineColorBlendAttachments.ListDstColorBlendFactor

func (a *ShaderPipelineColorBlendAttachments) ListDstColorBlendFactor() []string

ShaderPipelineColorBlendAttachments.ListSrcAlphaBlendFactor

func (a *ShaderPipelineColorBlendAttachments) ListSrcAlphaBlendFactor() []string

ShaderPipelineColorBlendAttachments.ListSrcColorBlendFactor

func (a *ShaderPipelineColorBlendAttachments) ListSrcColorBlendFactor() []string

ShaderPipelineColorBlendAttachments.SrcAlphaBlendFactorToVK

func (a *ShaderPipelineColorBlendAttachments) SrcAlphaBlendFactorToVK() vk.BlendFactor

ShaderPipelineColorBlendAttachments.SrcColorBlendFactorToVK

func (a *ShaderPipelineColorBlendAttachments) SrcColorBlendFactorToVK() vk.BlendFactor

ShaderPipelineColorBlendAttachmentsCompiled

struct

type ShaderPipelineColorBlendAttachmentsCompiled struct {
    BlendEnable         vk.Bool32
    SrcColorBlendFactor vk.BlendFactor
    DstColorBlendFactor vk.BlendFactor
    ColorBlendOp        vk.BlendOp
    SrcAlphaBlendFactor vk.BlendFactor
    DstAlphaBlendFactor vk.BlendFactor
    AlphaBlendOp        vk.BlendOp
    ColorWriteMask      vk.ColorComponentFlags
}

ShaderPipelineColorBlendCompiled

struct

type ShaderPipelineColorBlendCompiled struct {
    LogicOpEnable  vk.Bool32
    LogicOp        vk.LogicOp
    BlendConstants [4]float32
}

ShaderPipelineData

struct

type ShaderPipelineData struct {
    Name                  string
    InputAssembly         ShaderPipelineInputAssembly
    Rasterization         ShaderPipelinePipelineRasterization
    Multisample           ShaderPipelinePipelineMultisample
    ColorBlend            ShaderPipelineColorBlend
    ColorBlendAttachments []ShaderPipelineColorBlendAttachments
    DepthStencil          ShaderPipelineDepthStencil
    Tessellation          ShaderPipelineTessellation
    GraphicsPipeline      ShaderPipelineGraphicsPipeline
}

ShaderPipelineData.AlphaToCoverageEnableToVK

func (s *ShaderPipelineData) AlphaToCoverageEnableToVK() vk.Bool32

ShaderPipelineData.AlphaToOneEnableToVK

func (s *ShaderPipelineData) AlphaToOneEnableToVK() vk.Bool32

ShaderPipelineData.BackStencilOpStateToVK

func (s *ShaderPipelineData) BackStencilOpStateToVK() vk.StencilOpState

ShaderPipelineData.BlendConstants

func (s *ShaderPipelineData) BlendConstants() [4]float32

ShaderPipelineData.Compile

func (d *ShaderPipelineData) Compile(renderer Renderer) ShaderPipelineDataCompiled

ShaderPipelineData.DepthBiasEnableToVK

func (s *ShaderPipelineData) DepthBiasEnableToVK() vk.Bool32

ShaderPipelineData.DepthBoundsTestEnableToVK

func (s *ShaderPipelineData) DepthBoundsTestEnableToVK() vk.Bool32

ShaderPipelineData.DepthClampEnableToVK

func (s *ShaderPipelineData) DepthClampEnableToVK() vk.Bool32

ShaderPipelineData.DepthTestEnableToVK

func (s *ShaderPipelineData) DepthTestEnableToVK() vk.Bool32

ShaderPipelineData.DepthWriteEnableToVK

func (s *ShaderPipelineData) DepthWriteEnableToVK() vk.Bool32

ShaderPipelineData.FrontStencilOpStateToVK

func (s *ShaderPipelineData) FrontStencilOpStateToVK() vk.StencilOpState

TODO: This and the BackStencilOpStateToVK are duplicates because of a bad structure setup, please fix later

ShaderPipelineData.ListBackCompareOp

func (s ShaderPipelineData) ListBackCompareOp() []string

ShaderPipelineData.ListBackDepthFailOp

func (s ShaderPipelineData) ListBackDepthFailOp() []string

ShaderPipelineData.ListBackFailOp

func (s ShaderPipelineData) ListBackFailOp() []string

ShaderPipelineData.ListBackPassOp

func (s ShaderPipelineData) ListBackPassOp() []string

ShaderPipelineData.ListBlendFactor

func (s ShaderPipelineData) ListBlendFactor() []string

ShaderPipelineData.ListBlendOp

func (s ShaderPipelineData) ListBlendOp() []string

ShaderPipelineData.ListCullMode

func (s ShaderPipelineData) ListCullMode() []string

ShaderPipelineData.ListDepthCompareOp

func (s ShaderPipelineData) ListDepthCompareOp() []string

ShaderPipelineData.ListFrontCompareOp

func (s ShaderPipelineData) ListFrontCompareOp() []string

ShaderPipelineData.ListFrontDepthFailOp

func (s ShaderPipelineData) ListFrontDepthFailOp() []string

ShaderPipelineData.ListFrontFace

func (s ShaderPipelineData) ListFrontFace() []string

ShaderPipelineData.ListFrontFailOp

func (s ShaderPipelineData) ListFrontFailOp() []string

ShaderPipelineData.ListFrontPassOp

func (s ShaderPipelineData) ListFrontPassOp() []string

ShaderPipelineData.ListLogicOp

func (s ShaderPipelineData) ListLogicOp() []string

ShaderPipelineData.ListPatchControlPoints

func (s ShaderPipelineData) ListPatchControlPoints() []string

ShaderPipelineData.ListPolygonMode

func (s ShaderPipelineData) ListPolygonMode() []string

ShaderPipelineData.ListRasterizationSamples

func (s ShaderPipelineData) ListRasterizationSamples() []string

ShaderPipelineData.ListTopology

func (s ShaderPipelineData) ListTopology() []string

ShaderPipelineData.LogicOpEnableToVK

func (s *ShaderPipelineData) LogicOpEnableToVK() vk.Bool32

ShaderPipelineData.PrimitiveRestartToVK

func (s *ShaderPipelineData) PrimitiveRestartToVK() vk.Bool32

ShaderPipelineData.RasterizerDiscardEnableToVK

func (s *ShaderPipelineData) RasterizerDiscardEnableToVK() vk.Bool32

ShaderPipelineData.SampleShadingEnableToVK

func (s *ShaderPipelineData) SampleShadingEnableToVK() vk.Bool32

ShaderPipelineData.StencilTestEnableToVK

func (s *ShaderPipelineData) StencilTestEnableToVK() vk.Bool32

ShaderPipelineDataCompiled

struct

type ShaderPipelineDataCompiled struct {
    Name                  string
    InputAssembly         ShaderPipelineInputAssemblyCompiled
    Rasterization         ShaderPipelinePipelineRasterizationCompiled
    Multisample           ShaderPipelinePipelineMultisampleCompiled
    ColorBlend            ShaderPipelineColorBlendCompiled
    ColorBlendAttachments []ShaderPipelineColorBlendAttachmentsCompiled
    DepthStencil          ShaderPipelineDepthStencilCompiled
    Tessellation          ShaderPipelineTessellationCompiled
    GraphicsPipeline      ShaderPipelineGraphicsPipelineCompiled
}

ShaderPipelineDataCompiled.ConstructPipeline

func (s *ShaderPipelineDataCompiled) ConstructPipeline(renderer Renderer, shader *Shader, renderPass *RenderPass, stages []vk.PipelineShaderStageCreateInfo) bool

ShaderPipelineDepthStencil

struct

type ShaderPipelineDepthStencil struct {
    DepthTestEnable       bool
    DepthWriteEnable      bool
    DepthCompareOp        string `options:"StringVkCompareOp"`
    DepthBoundsTestEnable bool
    StencilTestEnable     bool
    FrontFailOp           string `options:"StringVkStencilOp" tip:"FailOp"`
    FrontPassOp           string `options:"StringVkStencilOp" tip:"PassOp"`
    FrontDepthFailOp      string `options:"StringVkStencilOp" tip:"DepthFailOp"`
    FrontCompareOp        string `options:"StringVkCompareOp" tip:"CompareOp"`
    FrontCompareMask      uint32 `tip:"CompareMask"`
    FrontWriteMask        uint32 `tip:"WriteMask"`
    FrontReference        uint32 `tip:"Reference"`
    BackFailOp            string `options:"StringVkStencilOp" tip:"FailOp"`
    BackPassOp            string `options:"StringVkStencilOp" tip:"PassOp"`
    BackDepthFailOp       string `options:"StringVkStencilOp" tip:"DepthFailOp"`
    BackCompareOp         string `options:"StringVkCompareOp" tip:"CompareOp"`
    BackCompareMask       uint32 `tip:"CompareMask"`
    BackWriteMask         uint32 `tip:"WriteMask"`
    BackReference         uint32 `tip:"Reference"`
    MinDepthBounds        float32
    MaxDepthBounds        float32
}

ShaderPipelineDepthStencilCompiled

struct

type ShaderPipelineDepthStencilCompiled struct {
    DepthTestEnable       vk.Bool32
    DepthWriteEnable      vk.Bool32
    DepthCompareOp        vk.CompareOp
    DepthBoundsTestEnable vk.Bool32
    StencilTestEnable     vk.Bool32
    Front                 vk.StencilOpState
    Back                  vk.StencilOpState
    MinDepthBounds        float32
    MaxDepthBounds        float32
}

ShaderPipelineGraphicsPipeline

struct

type ShaderPipelineGraphicsPipeline struct {
    Subpass             uint32
    PipelineCreateFlags []string `options:"StringVkPipelineCreateFlagBits"`
}

ShaderPipelineGraphicsPipeline.PipelineCreateFlagsToVK

func (s *ShaderPipelineGraphicsPipeline) PipelineCreateFlagsToVK() vk.PipelineCreateFlags

ShaderPipelineGraphicsPipelineCompiled

struct

type ShaderPipelineGraphicsPipelineCompiled struct {
    Subpass             uint32
    PipelineCreateFlags vk.PipelineCreateFlags
}

ShaderPipelineInputAssembly

struct

type ShaderPipelineInputAssembly struct {
    Topology         string `options:"StringVkPrimitiveTopology"`
    PrimitiveRestart bool
}

ShaderPipelineInputAssembly.TopologyToVK

func (s *ShaderPipelineInputAssembly) TopologyToVK() vk.PrimitiveTopology

ShaderPipelineInputAssemblyCompiled

struct

type ShaderPipelineInputAssemblyCompiled struct {
    Topology         vk.PrimitiveTopology
    PrimitiveRestart vk.Bool32
}

ShaderPipelinePipelineMultisample

struct

type ShaderPipelinePipelineMultisample struct {
    RasterizationSamples  string `options:"StringVkSampleCountFlagBits"`
    SampleShadingEnable   bool
    MinSampleShading      float32
    AlphaToCoverageEnable bool
    AlphaToOneEnable      bool
}

ShaderPipelinePipelineMultisample.RasterizationSamplesToVK

func (s *ShaderPipelinePipelineMultisample) RasterizationSamplesToVK(vr *Vulkan) vk.SampleCountFlagBits

ShaderPipelinePipelineMultisampleCompiled

struct

type ShaderPipelinePipelineMultisampleCompiled struct {
    RasterizationSamples  vk.SampleCountFlagBits
    SampleShadingEnable   vk.Bool32
    MinSampleShading      float32
    AlphaToCoverageEnable vk.Bool32
    AlphaToOneEnable      vk.Bool32
}

ShaderPipelinePipelineRasterization

struct

type ShaderPipelinePipelineRasterization struct {
    DepthClampEnable        bool
    RasterizerDiscardEnable bool
    PolygonMode             string `options:"StringVkPolygonMode"`
    CullMode                string `options:"StringVkCullModeFlagBits"`
    FrontFace               string `options:"StringVkFrontFace"`
    DepthBiasEnable         bool
    DepthBiasConstantFactor float32
    DepthBiasClamp          float32
    DepthBiasSlopeFactor    float32
    LineWidth               float32
}

ShaderPipelinePipelineRasterization.CullModeToVK

func (s *ShaderPipelinePipelineRasterization) CullModeToVK() vk.CullModeFlagBits

ShaderPipelinePipelineRasterization.FrontFaceToVK

func (s *ShaderPipelinePipelineRasterization) FrontFaceToVK() vk.FrontFace

ShaderPipelinePipelineRasterization.PolygonModeToVK

func (s *ShaderPipelinePipelineRasterization) PolygonModeToVK() vk.PolygonMode

ShaderPipelinePipelineRasterizationCompiled

struct

type ShaderPipelinePipelineRasterizationCompiled struct {
    DepthClampEnable        vk.Bool32
    DiscardEnable           vk.Bool32
    PolygonMode             vk.PolygonMode
    CullMode                vk.CullModeFlags
    FrontFace               vk.FrontFace
    DepthBiasEnable         vk.Bool32
    DepthBiasConstantFactor float32
    DepthBiasClamp          float32
    DepthBiasSlopeFactor    float32
    LineWidth               float32
}

ShaderPipelineTessellation

struct

type ShaderPipelineTessellation struct {
    PatchControlPoints string `options:"StringVkPatchControlPoints"`
}

ShaderPipelineTessellation.PatchControlPointsToVK

func (s *ShaderPipelineTessellation) PatchControlPointsToVK() uint32

ShaderPipelineTessellationCompiled

struct

type ShaderPipelineTessellationCompiled struct {
    PatchControlPoints uint32
}

SkinnedShaderData

struct

type SkinnedShaderData struct {
    // Has unexported fields.
}

TextShaderData

struct

type TextShaderData struct {
    ShaderDataBase
    UVs     matrix.Vec4
    FgColor matrix.Color
    BgColor matrix.Color
    Scissor matrix.Vec4
    PxRange matrix.Vec2
}

TextShaderData.Size

func (s TextShaderData) Size() int

Texture

struct

type Texture struct {
    Key               string
    TexturePixelCache []byte
    RenderId          TextureId
    Channels          int
    Filter            int
    MipLevels         int
    Width             int
    Height            int
    CacheInvalid      bool
    // Has unexported fields.
}

NewTexture

func NewTexture(renderer Renderer, assetDb *assets.Database, textureKey string, filter TextureFilter) (*Texture, error)

NewTextureFromMemory

func NewTextureFromMemory(key string, data []byte, width, height int, filter TextureFilter) (*Texture, error)

Texture.DelayedCreate

func (t *Texture) DelayedCreate(renderer Renderer)

Texture.Destroy

func (t *Texture) Destroy(renderer Renderer)

Texture.ReadPixel

func (t *Texture) ReadPixel(renderer Renderer, x, y int) matrix.Color

Texture.Size

func (t Texture) Size() matrix.Vec2

Texture.WritePixels

func (t *Texture) WritePixels(renderer Renderer, x, y, width, height int, pixels []byte)

TextureCache

struct

type TextureCache struct {
    // Has unexported fields.
}

NewTextureCache

func NewTextureCache(renderer Renderer, assetDatabase *assets.Database) TextureCache

TextureCache.CreatePending

func (t *TextureCache) CreatePending()

TextureCache.Destroy

func (t *TextureCache) Destroy()

TextureCache.Texture

func (t *TextureCache) Texture(textureKey string, filter TextureFilter) (*Texture, error)

TextureColorFormat

int

type TextureColorFormat int

const ( TextureColorFormatRgbaUnorm TextureColorFormat = iota TextureColorFormatRgbUnorm TextureColorFormatRgbaSrgb TextureColorFormatRgbSrgb TextureColorFormatLuminance )

TextureData

struct

type TextureData struct {
    Mem            []byte
    InternalFormat TextureInputType
    Format         TextureColorFormat
    Type           TextureMemType
    Width          int
    Height         int
    InputType      TextureFileFormat
}

ReadRawTextureData

func ReadRawTextureData(mem []byte, inputType TextureFileFormat) TextureData

TexturePixelsFromAsset

func TexturePixelsFromAsset(assetDb *assets.Database, textureKey string) (TextureData, error)

TextureFileFormat

int

type TextureFileFormat = int

const ( TextureFileFormatAstc TextureFileFormat = iota TextureFileFormatPng TextureFileFormatRaw )

TextureFilter

int

type TextureFilter = int

const ( TextureFilterLinear TextureFilter = iota TextureFilterNearest TextureFilterMax )

TextureId

struct

type TextureId struct {
    Image      vk.Image
    Memory     vk.DeviceMemory
    View       vk.ImageView
    Sampler    vk.Sampler
    Format     vk.Format
    MipLevels  uint32
    Layout     vk.ImageLayout
    Access     vk.AccessFlags
    Samples    vk.SampleCountFlagBits
    Width      int
    Height     int
    LayerCount int
}

TextureId.IsValid

func (t TextureId) IsValid() bool

TextureInputType

int

type TextureInputType int

const ( TextureInputTypeCompressedRgbaAstc4x4 TextureInputType = iota TextureInputTypeCompressedRgbaAstc5x4 TextureInputTypeCompressedRgbaAstc5x5 TextureInputTypeCompressedRgbaAstc6x5 TextureInputTypeCompressedRgbaAstc6x6 TextureInputTypeCompressedRgbaAstc8x5 TextureInputTypeCompressedRgbaAstc8x6 TextureInputTypeCompressedRgbaAstc8x8 TextureInputTypeCompressedRgbaAstc10x5 TextureInputTypeCompressedRgbaAstc10x6 TextureInputTypeCompressedRgbaAstc10x8 TextureInputTypeCompressedRgbaAstc10x10 TextureInputTypeCompressedRgbaAstc12x10 TextureInputTypeCompressedRgbaAstc12x12 TextureInputTypeRgba8 TextureInputTypeRgb8 TextureInputTypeLuminance )

TextureMemType

int

type TextureMemType = int

const ( TextureMemTypeUnsignedByte TextureMemType = iota )

Vertex

struct

type Vertex struct {
    Position     matrix.Vec3
    Normal       matrix.Vec3
    Tangent      matrix.Vec4
    UV0          matrix.Vec2
    Color        matrix.Color
    JointIds     matrix.Vec4i
    JointWeights matrix.Vec4
    MorphTarget  matrix.Vec3
}

Vulkan

struct

type Vulkan struct {
    // Has unexported fields.
}

NewVKRenderer

func NewVKRenderer(window RenderingContainer, applicationName string, assets *assets.Database) (*Vulkan, error)

Vulkan.AddPreRun

func (vr *Vulkan) AddPreRun(preRun func())

Vulkan.BlitTargets

func (vr *Vulkan) BlitTargets(passes []*RenderPass)

Vulkan.CopyBuffer

func (vr *Vulkan) CopyBuffer(srcBuffer vk.Buffer, dstBuffer vk.Buffer, size vk.DeviceSize)

Vulkan.CreateBuffer

func (vr *Vulkan) CreateBuffer(size vk.DeviceSize, usage vk.BufferUsageFlags, properties vk.MemoryPropertyFlags, buffer *vk.Buffer, bufferMemory *vk.DeviceMemory) bool

Vulkan.CreateFrameBuffer

func (vr *Vulkan) CreateFrameBuffer(renderPass *RenderPass, attachments []vk.ImageView, width, height uint32) (vk.Framebuffer, bool)

Vulkan.CreateImage

func (vr *Vulkan) CreateImage(width, height, mipLevels uint32, numSamples vk.SampleCountFlagBits, format vk.Format, tiling vk.ImageTiling, usage vk.ImageUsageFlags, properties vk.MemoryPropertyFlags, textureId *TextureId, layerCount int) bool

Vulkan.CreateMesh

func (vr *Vulkan) CreateMesh(mesh *Mesh, verts []Vertex, indices []uint32)

Vulkan.CreateShader

func (vr *Vulkan) CreateShader(shader *Shader, assetDB *assets.Database) error

Vulkan.CreateTexture

func (vr *Vulkan) CreateTexture(texture *Texture, data *TextureData)

Vulkan.Destroy

func (vr *Vulkan) Destroy()

Vulkan.DestroyGroup

func (vr *Vulkan) DestroyGroup(group *DrawInstanceGroup)

Vulkan.DestroyMesh

func (vr *Vulkan) DestroyMesh(mesh *Mesh)

Vulkan.DestroyShader

func (vr *Vulkan) DestroyShader(shader *Shader)

Vulkan.DestroyTexture

func (vr *Vulkan) DestroyTexture(texture *Texture)

Vulkan.Draw

func (vr *Vulkan) Draw(renderPass *RenderPass, drawings []ShaderDraw) bool

Vulkan.Initialize

func (vr *Vulkan) Initialize(caches RenderCaches, width, height int32) error

Vulkan.MeshIsReady

func (vr *Vulkan) MeshIsReady(mesh Mesh) bool

Vulkan.ReadyFrame

func (vr *Vulkan) ReadyFrame(camera cameras.Camera, uiCamera cameras.Camera, runtime float32) bool

Vulkan.Resize

func (vr *Vulkan) Resize(width, height int)

Vulkan.SwapFrame

func (vr *Vulkan) SwapFrame(width, height int32) bool

Vulkan.TextureFromId

func (vr *Vulkan) TextureFromId(texture *Texture, other TextureId)

Vulkan.TextureReadPixel

func (vr *Vulkan) TextureReadPixel(texture *Texture, x, y int) matrix.Color

Vulkan.TextureWritePixels

func (vr *Vulkan) TextureWritePixels(texture *Texture, x, y, width, height int, pixels []uint8)

Vulkan.WaitForRender

func (vr *Vulkan) WaitForRender()