shadertools

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 11, 2020 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package shadertools wraps around external C code for manipulating shaders.

Index

Constants

View Source
const (
	TypeVertex         = ShaderType(C.VERTEX)
	TypeTessControl    = ShaderType(C.TESS_CONTROL)
	TypeTessEvaluation = ShaderType(C.TESS_EVALUATION)
	TypeGeometry       = ShaderType(C.GEOMETRY)
	TypeFragment       = ShaderType(C.FRAGMENT)
	TypeCompute        = ShaderType(C.COMPUTE)
)
View Source
const (
	OpenGL   = ClientType(C.OPENGL)
	OpenGLES = ClientType(C.OPENGLES)
	Vulkan   = ClientType(C.VULKAN)
)

Variables

This section is empty.

Functions

func AssembleSpirvText

func AssembleSpirvText(chars string) []uint32

AssembleSpirvText assembles the given SPIR-V text chars by calling SPIRV-Tools and returns the slice for the encoded binary. Returns nil if assembling fails.

func CompileGlsl

func CompileGlsl(source string, o CompileOptions) ([]uint32, error)

CompileGlsl compiles GLSL source code to SPIR-V binary words.

func DisassembleSpirvBinary

func DisassembleSpirvBinary(words []uint32) string

DisassembleSpirvBinary disassembles the given SPIR-V binary words by calling SPIRV-Tools and returns the disassembly. Returns an empty string if diassembling fails.

func ParseAllDescriptorSets

func ParseAllDescriptorSets(shader []uint32) (map[string]DescriptorSets, error)

ParseDescriptorSets determines what descriptor sets are implied by the shader

Types

type ClientType

type ClientType int

ClientType is the enumerator of client types.

type CompileOptions

type CompileOptions struct {
	// The type of shader.
	ShaderType ShaderType
	// Either OpenGL, OpenGLES or Vulkan
	ClientType ClientType
	// Shader source preamble.
	Preamble string
}

CompileOptions controls how CompileGlsl compile its passed-in GLSL source code.

type DescriptorBinding

type DescriptorBinding struct {
	Set             uint32
	Binding         uint32
	SpirvId         uint32
	DescriptorType  uint32
	DescriptorCount uint32
	ShaderStage     uint32
}

type DescriptorSet

type DescriptorSet []DescriptorBinding

type DescriptorSets

type DescriptorSets map[uint32]DescriptorSet

func ParseDescriptorSets

func ParseDescriptorSets(shader []uint32, entryPoint string) (DescriptorSets, error)

ParseDescriptorSets determines what descriptor sets are implied by the shader

type ShaderType

type ShaderType int

ShaderType is the enumerator of shader types.

func (ShaderType) String

func (t ShaderType) String() string

Jump to

Keyboard shortcuts

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