Documentation ¶
Overview ¶
Package shadertools wraps around external C code for manipulating shaders.
Index ¶
- Constants
- func AssembleSpirvText(chars string) []uint32
- func CompileGlsl(source string, o CompileOptions) ([]uint32, error)
- func DisassembleSpirvBinary(words []uint32) string
- func ExtractDebugSource(shader []uint32) (string, string, bool, error)
- func ParseAllDescriptorSets(shader []uint32) (map[string]DescriptorSets, error)
- type ClientType
- type CompileOptions
- type DescriptorBinding
- type DescriptorSet
- type DescriptorSets
- type ShaderType
- type StaticAnalysisCounters
Constants ¶
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) )
const ( OpenGL = ClientType(C.OPENGL) OpenGLES = ClientType(C.OPENGLES) Vulkan = ClientType(C.VULKAN) )
Variables ¶
This section is empty.
Functions ¶
func AssembleSpirvText ¶
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 ¶
DisassembleSpirvBinary disassembles the given SPIR-V binary words by calling SPIRV-Tools and returns the disassembly. Returns an empty string if diassembling fails.
func ExtractDebugSource ¶
ExtractDebugSource returns the decompiled shader and it's source language as a string. If the decompiled shader was provided via OpSource, the function returns false. Otherwise, if SPIRV-Cross was needed to decompile the shader, it returns true.
func ParseAllDescriptorSets ¶
func ParseAllDescriptorSets(shader []uint32) (map[string]DescriptorSets, error)
ParseAllDescriptorSets determines what descriptor sets are implied by the shader, for all entry points of the shader.
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 DescriptorSet ¶
type DescriptorSet []DescriptorBinding
type DescriptorSets ¶
type DescriptorSets map[uint32]DescriptorSet
type ShaderType ¶
type ShaderType int
ShaderType is the enumerator of shader types.
func (ShaderType) String ¶
func (t ShaderType) String() string