gshaderc

package module
v0.0.0-...-dea3c2d Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

README

GoDoc Go Report Card

Introduction

Gshaderc is a golang wrapper to for https://github.com/google/shaderc. It's a pretty straight forward mapping of the C API

The goal in providing this wrapper primarily is for allowing golang Vulkan applications to compile shaders as need.

Getting started

Examples

Here is the simplest example:

source := "#version 450\nvoid main() {}"
// This will assume you're targeting Vulkan, with an entry point of 'main' and infers the shader type based upon filename
data, err := CompileShader(source, "main.vert", "")

Here is a more complex example:

options := gs.NewCompilerOptions()
defer options.Release()
compiler := gs.NewCompiler()
defer compiler.Release()
data, err := ioutil.ReadFile(*input)

if err != nil {
	panic(err)
}

options.SetOptimizationLevel(gs.Performance)

result := compiler.CompileIntoSPV(string(data), shaderType, filename, entryPoint, options)
defer result.Release()

if result.Error() == nil {
	err := ioutil.WriteFile("output", result.Bytes(), 0644)
	if err != nil {
		panic(err)
	}
} else {
	panic(result.Error())
}

Tools

There cmd/gsc.go is a tool to either manually or automatically compile shaders based off of changes. The default output name is to append .spv to compile files, and it will look for the extensions .vert, .frag, .comp, .tesc, .geom and .tese and automatically compile these files into shaders for the given target when they change.

celer@bear:~/go/src/github.com/celer/vkg/examples/sdf$ gsc -watch shaders/
2020/01/08 18:35:23 watching directory shaders/ for changes
shaders/sdf.comp:336: error: '' :  syntax error, unexpected INT, expecting COMMA or SEMICOLON
2020/01/08 18:35:26 error compiling shader 'shaders/sdf.comp': compilation error
shaders/sdf.comp:336: error: '' :  syntax error, unexpected INT, expecting COMMA or SEMICOLON
2020/01/08 18:35:26 error compiling shader 'shaders/sdf.comp': compilation error
shaders/sdf.comp:336: error: '' :  syntax error, unexpected INT, expecting COMMA or SEMICOLON
2020/01/08 18:35:26 error compiling shader 'shaders/sdf.comp': compilation error
shaders/sdf.comp:341: error: '' :  syntax error, unexpected SEMICOLON, expecting LEFT_PAREN
2020/01/08 18:35:27 error compiling shader 'shaders/sdf.comp': compilation error
2020/01/08 18:35:27 compiled shaders/sdf.comp -> shaders/sdf.comp.spv

See cmd/gsc.go for a basic example

Foot notes

[1] Tested against commit 0b9a2992c73d41debe4924d9f39260f773b5840a

Documentation

Overview

Package gshaderc provides an API wrapper around https://github.com/google/shaderc the primary goal being to allow opengl and vulkan based go applications to have the ability to compile shaders into SPIRV (https://en.wikipedia.org/wiki/Standard_Portable_Intermediate_Representation)

With the release of Vulkan ( https://www.khronos.org/vulkan/ ) the ability to compile shaders is no longer directly provided with the Vulkan API as it was previously provided as part of the OpenGL APIs.

Index

Constants

View Source
const (
	// Forced shader kinds. These shader kinds force the compiler to compile the
	// source code as the specified kind of shader.
	VertexShader         ShaderType = ShaderType(C.shaderc_vertex_shader)
	FragmentShader                  = ShaderType(C.shaderc_fragment_shader)
	ComputeShader                   = ShaderType(C.shaderc_compute_shader)
	GeometryShader                  = ShaderType(C.shaderc_geometry_shader)
	TessControlShader               = ShaderType(C.shaderc_tess_control_shader)
	TessEvaluationShader            = ShaderType(C.shaderc_tess_evaluation_shader)
	// Deduce the shader kind from #pragma annotation in the source code. Compiler
	// will emit error if #pragma annotation is not found.
	InferFromSource = ShaderType(C.shaderc_glsl_infer_from_source)
	// Default shader kinds. Compiler will fall back to compile the source code as
	// the specified kind of shader when #pragma annotation is not found in the
	// source code.
	DefaultVertexShader         = ShaderType(C.shaderc_glsl_default_vertex_shader)
	DefaultFragmentShader       = ShaderType(C.shaderc_glsl_default_fragment_shader)
	DefaultComputeShader        = ShaderType(C.shaderc_glsl_default_compute_shader)
	DefaultGeometryShader       = ShaderType(C.shaderc_glsl_default_geometry_shader)
	DefaultTessControlShader    = ShaderType(C.shaderc_glsl_default_tess_control_shader)
	DefaultTessEcaluationShader = ShaderType(C.shaderc_glsl_default_tess_evaluation_shader)

	SPIRVAssembly = ShaderType(C.shaderc_spirv_assembly)
)
View Source
const (
	Vulkan Target = Target(C.shaderc_target_env_vulkan) // SPIR-V under Vulkan semantics
	OpenGL        = Target(C.shaderc_target_env_opengl) // SPIR-V under OpenGL semantics
	// NOTE: SPIR-V code generation is not supported for shaders under OpenGL
	// compatibility profile.
	OpenGLCompat = Target(C.shaderc_target_env_opengl_compat) // SPIR-V under OpenGL semantics,
	// including compatibility profile
	// functions
	WebGPU  = Target(C.shaderc_target_env_webgpu) // SPIR-V under WebGPU semantics
	Default = Vulkan
)
View Source
const (
	// Image and image buffer.
	UniformKindImage UniformKind = UniformKind(C.shaderc_uniform_kind_image)
	// Pure sampler.
	UniformKindSampler = UniformKind(C.shaderc_uniform_kind_sampler)
	// Sampled texture in GLSL, and Shader Resource View in HLSL.
	UniformKindTexture = UniformKind(C.shaderc_uniform_kind_texture)
	// Uniform Buffer Object (UBO) in GLSL.  Cbuffer in HLSL.
	UniformKindBuffer = UniformKind(C.shaderc_uniform_kind_buffer)
	// Shader Storage Buffer Object (SSBO) in GLSL.
	UniformKindStorageBuffer = UniformKind(C.shaderc_uniform_kind_storage_buffer)
	// Unordered Access View, in HLSL.  (Writable storage image or storage
	// buffer.)
	UniformKindUnorderedAccessView = UniformKind(C.shaderc_uniform_kind_unordered_access_view)
)
View Source
const (
	MaxLights                                 ResourceLimit = ResourceLimit(C.shaderc_limit_max_lights)
	MaxClipPlanes                                           = ResourceLimit(C.shaderc_limit_max_clip_planes)
	MaxTextureUnits                                         = ResourceLimit(C.shaderc_limit_max_texture_units)
	MaxTextureCoords                                        = ResourceLimit(C.shaderc_limit_max_texture_coords)
	MaxVertexAttribs                                        = ResourceLimit(C.shaderc_limit_max_vertex_attribs)
	MaxVertexUniformComponents                              = ResourceLimit(C.shaderc_limit_max_vertex_uniform_components)
	MaxVaryingFloats                                        = ResourceLimit(C.shaderc_limit_max_varying_floats)
	MaxVertexTextureImageUnits                              = ResourceLimit(C.shaderc_limit_max_vertex_texture_image_units)
	MaxCombinedTextureImageUnits                            = ResourceLimit(C.shaderc_limit_max_combined_texture_image_units)
	MaxTextureImageUnits                                    = ResourceLimit(C.shaderc_limit_max_texture_image_units)
	MaxFragmentUniformComponents                            = ResourceLimit(C.shaderc_limit_max_fragment_uniform_components)
	MaxDrawBuffers                                          = ResourceLimit(C.shaderc_limit_max_draw_buffers)
	MaxVertexUniformVectors                                 = ResourceLimit(C.shaderc_limit_max_vertex_uniform_vectors)
	MaxVaryingVectors                                       = ResourceLimit(C.shaderc_limit_max_varying_vectors)
	MaxFragmentUniformVectors                               = ResourceLimit(C.shaderc_limit_max_fragment_uniform_vectors)
	MaxVertexOutputVectors                                  = ResourceLimit(C.shaderc_limit_max_vertex_output_vectors)
	MaxFragmentInputVectors                                 = ResourceLimit(C.shaderc_limit_max_fragment_input_vectors)
	MinProgramTexelOffset                                   = ResourceLimit(C.shaderc_limit_min_program_texel_offset)
	MaxProgramTexelOffset                                   = ResourceLimit(C.shaderc_limit_max_program_texel_offset)
	MaxClipDistances                                        = ResourceLimit(C.shaderc_limit_max_clip_distances)
	MaxComputeWorkGroupCountX                               = ResourceLimit(C.shaderc_limit_max_compute_work_group_count_x)
	MaxComputeWorkGroupCountY                               = ResourceLimit(C.shaderc_limit_max_compute_work_group_count_y)
	MaxComputeWorkGroupCountZ                               = ResourceLimit(C.shaderc_limit_max_compute_work_group_count_z)
	MaxComputeWorkGroupSizeX                                = ResourceLimit(C.shaderc_limit_max_compute_work_group_size_x)
	MaxComputeWorkGroupSizeY                                = ResourceLimit(C.shaderc_limit_max_compute_work_group_size_y)
	MaxComputeWorkGroupSizeZ                                = ResourceLimit(C.shaderc_limit_max_compute_work_group_size_z)
	MaxComputeUniformComponents                             = ResourceLimit(C.shaderc_limit_max_compute_uniform_components)
	MaxComputeTextureImageUnits                             = ResourceLimit(C.shaderc_limit_max_compute_texture_image_units)
	MaxComputeImageUniforms                                 = ResourceLimit(C.shaderc_limit_max_compute_image_uniforms)
	MaxComputeAtomicCounters                                = ResourceLimit(C.shaderc_limit_max_compute_atomic_counters)
	MaxComputeAtomicCounterBuffers                          = ResourceLimit(C.shaderc_limit_max_compute_atomic_counter_buffers)
	MaxVaryingComponents                                    = ResourceLimit(C.shaderc_limit_max_varying_components)
	MaxVertexOutputComponents                               = ResourceLimit(C.shaderc_limit_max_vertex_output_components)
	MaxGeometryInputComponents                              = ResourceLimit(C.shaderc_limit_max_geometry_input_components)
	MaxGeometryOutputComponents                             = ResourceLimit(C.shaderc_limit_max_geometry_output_components)
	MaxFragmentInputComponents                              = ResourceLimit(C.shaderc_limit_max_fragment_input_components)
	MaxImageUnits                                           = ResourceLimit(C.shaderc_limit_max_image_units)
	MaxCombinedImageUnitsAndFragment_outputs                = ResourceLimit(C.shaderc_limit_max_combined_image_units_and_fragment_outputs)
	MaxCombinedShaderOutputResources                        = ResourceLimit(C.shaderc_limit_max_combined_shader_output_resources)
	MaxImageSamples                                         = ResourceLimit(C.shaderc_limit_max_image_samples)
	MaxVertexImageUniforms                                  = ResourceLimit(C.shaderc_limit_max_vertex_image_uniforms)
	MaxTessControlImageUniforms                             = ResourceLimit(C.shaderc_limit_max_tess_control_image_uniforms)
	MaxTessEvaluationImageUniforms                          = ResourceLimit(C.shaderc_limit_max_tess_evaluation_image_uniforms)
	MaxGeometryImageUniforms                                = ResourceLimit(C.shaderc_limit_max_geometry_image_uniforms)
	MaxFragmentImageUniforms                                = ResourceLimit(C.shaderc_limit_max_fragment_image_uniforms)
	MaxCombinedImageUniforms                                = ResourceLimit(C.shaderc_limit_max_combined_image_uniforms)
	MaxGeometryTextureImageUnits                            = ResourceLimit(C.shaderc_limit_max_geometry_texture_image_units)
	MaxGeometryOutputVertices                               = ResourceLimit(C.shaderc_limit_max_geometry_output_vertices)
	MaxGeometryTotalOutputComponents                        = ResourceLimit(C.shaderc_limit_max_geometry_total_output_components)
	MaxGeometryUniformComponents                            = ResourceLimit(C.shaderc_limit_max_geometry_uniform_components)
	MaxGeometryVaryingComponents                            = ResourceLimit(C.shaderc_limit_max_geometry_varying_components)
	MaxTessControlInputComponents                           = ResourceLimit(C.shaderc_limit_max_tess_control_input_components)
	MaxTessControlOutputComponents                          = ResourceLimit(C.shaderc_limit_max_tess_control_output_components)
	MaxTessControlTextureImageUnits                         = ResourceLimit(C.shaderc_limit_max_tess_control_texture_image_units)
	MaxTessControlUniformComponents                         = ResourceLimit(C.shaderc_limit_max_tess_control_uniform_components)
	MaxTessControlTotalOutputComponents                     = ResourceLimit(C.shaderc_limit_max_tess_control_total_output_components)
	MaxTessEvaluationInputComponents                        = ResourceLimit(C.shaderc_limit_max_tess_evaluation_input_components)
	MaxTessEvaluationOutputComponents                       = ResourceLimit(C.shaderc_limit_max_tess_evaluation_output_components)
	MaxTessEvaluationTextureImageUnits                      = ResourceLimit(C.shaderc_limit_max_tess_evaluation_texture_image_units)
	MaxTessEvaluationUniformComponents                      = ResourceLimit(C.shaderc_limit_max_tess_evaluation_uniform_components)
	MaxTessPatchComponents                                  = ResourceLimit(C.shaderc_limit_max_tess_patch_components)
	MaxPatchVertices                                        = ResourceLimit(C.shaderc_limit_max_patch_vertices)
	MaxTessGenLevel                                         = ResourceLimit(C.shaderc_limit_max_tess_gen_level)
	MaxViewports                                            = ResourceLimit(C.shaderc_limit_max_viewports)
	MaxVertexAtomicCounters                                 = ResourceLimit(C.shaderc_limit_max_vertex_atomic_counters)
	MaxTessControlAtomicCounters                            = ResourceLimit(C.shaderc_limit_max_tess_control_atomic_counters)
	MaxTessEvaluationAtomicCounters                         = ResourceLimit(C.shaderc_limit_max_tess_evaluation_atomic_counters)
	MaxGeometryAtomicCounters                               = ResourceLimit(C.shaderc_limit_max_geometry_atomic_counters)
	MaxFragmentAtomicCounters                               = ResourceLimit(C.shaderc_limit_max_fragment_atomic_counters)
	MaxCombinedAtomicCounters                               = ResourceLimit(C.shaderc_limit_max_combined_atomic_counters)
	MaxAtomicCounterBindings                                = ResourceLimit(C.shaderc_limit_max_atomic_counter_bindings)
	MaxVertexAtomicCounterBuffers                           = ResourceLimit(C.shaderc_limit_max_vertex_atomic_counter_buffers)
	MaxTessControlAtomicCounterBuffers                      = ResourceLimit(C.shaderc_limit_max_tess_control_atomic_counter_buffers)
	MaxTessEvaluationAtomicCounterBuffers                   = ResourceLimit(C.shaderc_limit_max_tess_evaluation_atomic_counter_buffers)
	MaxGeometryAtomicCounterBuffers                         = ResourceLimit(C.shaderc_limit_max_geometry_atomic_counter_buffers)
	MaxFragmentAtomicCounterBuffers                         = ResourceLimit(C.shaderc_limit_max_fragment_atomic_counter_buffers)
	MaxCombinedAtomicCounterBuffers                         = ResourceLimit(C.shaderc_limit_max_combined_atomic_counter_buffers)
	MaxAtomicCounterBufferSize                              = ResourceLimit(C.shaderc_limit_max_atomic_counter_buffer_size)
	MaxTransformFeedbackBuffers                             = ResourceLimit(C.shaderc_limit_max_transform_feedback_buffers)
	MaxTransformFeedbackInterleavedComponents               = ResourceLimit(C.shaderc_limit_max_transform_feedback_interleaved_components)
	MaxCullDistances                                        = ResourceLimit(C.shaderc_limit_max_cull_distances)
	MaxCombinedClipAndCullDistances                         = ResourceLimit(C.shaderc_limit_max_combined_clip_and_cull_distances)
	MaxSamples                                              = ResourceLimit(C.shaderc_limit_max_samples)
)

Some vim regex foo, incase this list ever needs to be regenerated

s/\(shaderc_\(.*\)\),/\2=ResourceLimit(C.\1)/g s/^\s\+limit_max_\([a-z]\+\)/Max\u\1/g s/^\s\+limit_max_\([a-z]\+\)_\([a-z]\+\)_\([a-z]\+\)_\([a-z]\+\)_\([a-z]\+\)/Max\u\1\u\2\u\3\u\4\u\5/g

View Source
const (
	TargetVulkan11     string = "vulkan_1_1"
	TargetVulkan10            = "vulkan_1_0"
	TargetOpenGL              = "opengl"
	TargetOpenGLCompat        = "opengl_compat"
	TargetWebGPU              = "webgpu"
)

Variables

View Source
var CompilationError = fmt.Errorf("compilation error")
View Source
var ConfigurationError = fmt.Errorf("configuration error")
View Source
var InternalError = fmt.Errorf("internal error")
View Source
var InvalidAssemblyError = fmt.Errorf("invalid assembly error")
View Source
var InvalidStageError = fmt.Errorf("invalid stage")
View Source
var NullResultObjectError = fmt.Errorf("null result object error")
View Source
var TransformationError = fmt.Errorf("transformation error")
View Source
var ValidationError = fmt.Errorf("validation error")

Functions

func CompileShader

func CompileShader(source, filename, target string) ([]byte, error)

CompileShader is a utility function for compiling a shader, it will determine the shader type based upon filename, and will default to vulkan_1_1 if no target type is specified. It assumes a default entry point of "main"

func GetShaderExtensionByType

func GetShaderExtensionByType(stype ShaderType) string

Types

type CompilationResult

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

CompilationResult the result of compiling stuff

func (*CompilationResult) Bytes

func (c *CompilationResult) Bytes() []byte

Bytes returns the resulting compiled item

func (*CompilationResult) Error

func (c *CompilationResult) Error() error

Error returns a generic error message

func (*CompilationResult) ErrorMessage

func (c *CompilationResult) ErrorMessage() string

ErrorMessage returns a specific error message

func (*CompilationResult) NumErrors

func (c *CompilationResult) NumErrors() int

NumErrors returns the number of errors

func (*CompilationResult) NumWarnings

func (c *CompilationResult) NumWarnings() int

NumWarnings returns the number of warnings

func (*CompilationResult) Release

func (c *CompilationResult) Release()

Release releases the compilation results

type Compiler

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

func NewCompiler

func NewCompiler() *Compiler

NewCompiler creates a new compiler

func (*Compiler) AssembleIntoSPV

func (c *Compiler) AssembleIntoSPV(source string, options *CompilerOptions) *CompilationResult

AssembleIntoSPV Takes an assembly string of the format defined in the SPIRV-Tools project (https://github.com/KhronosGroup/SPIRV-Tools/blob/master/syntax.md), assembles it into SPIR-V binary and a shaderc_compilation_result will be returned to hold the results. The assembling will pick options suitable for assembling specified in the additional_options parameter. May be safely called from multiple threads without explicit synchronization. If there was failure in allocating the compiler object, null will be returned.

func (*Compiler) CompileIntoPreProcessedText

func (c *Compiler) CompileIntoPreProcessedText(source string, shaderType ShaderType, inputFilename string, entryPoint string, options *CompilerOptions) *CompilationResult

CompileIntoPreProcessedText Like shaderc_compile_into_spv, but the result contains SPIR-V assembly text instead of a SPIR-V binary module. The SPIR-V assembly syntax is as defined by the SPIRV-Tools open source project.

func (*Compiler) CompileIntoSPV

func (c *Compiler) CompileIntoSPV(source string, shaderType ShaderType, inputFilename string, entryPoint string, options *CompilerOptions) *CompilationResult

CompileIntoSPV Takes a GLSL source string and the associated shader kind, input file name, compiles it according to the given additional_options. If the shader kind is not set to a specified kind, but shaderc_glslc_infer_from_source, the compiler will try to deduce the shader kind from the source string and a failure in deducing will generate an error. Currently only #pragma annotation is supported. If the shader kind is set to one of the default shader kinds, the compiler will fall back to the default shader kind in case it failed to deduce the shader kind from source string. The input_file_name is a null-termintated string. It is used as a tag to identify the source string in cases like emitting error messages. It doesn't have to be a 'file name'. The source string will be compiled into SPIR-V binary and a shaderc_compilation_result will be returned to hold the results. The entry_point_name null-terminated string defines the name of the entry point to associate with this GLSL source. If the additional_options parameter is not null, then the compilation is modified by any options present. May be safely called from multiple threads without explicit synchronization. If there was failure in allocating the compiler object, null will be returned.

func (*Compiler) Release

func (c *Compiler) Release()

Release the compiler instance

type CompilerOptions

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

CommpilerOptions allows specific compiler options to be set

func NewCompilerOptions

func NewCompilerOptions() *CompilerOptions

NewCompilerOptions creates a new compiler options object

func (*CompilerOptions) AddMacroDefinition

func (c *CompilerOptions) AddMacroDefinition(name, value string)

AddMacroDefinition Adds a predefined macro to the compilation options. This has the same effect as passing -Dname=value to the command-line compiler. If value is NULL, it has the same effect as passing -Dname to the command-line compiler. If a macro definition with the same name has previously been added, the value is replaced with the new value. The macro name and value are passed in with char pointers, which point to their data, and the lengths of their data.

func (*CompilerOptions) Clone

func (c *CompilerOptions) Clone() *CompilerOptions

Clone clones a copy of the compiler options

func (*CompilerOptions) Release

func (c *CompilerOptions) Release()

Releases the compiler options

func (*CompilerOptions) SetAutoBindUniforms

func (c *CompilerOptions) SetAutoBindUniforms(auto bool)

SetAutoBindUniforms Sets whether the compiler should automatically assign bindings to uniforms that aren't already explicitly bound in the shader source.

func (*CompilerOptions) SetBindingBase

func (c *CompilerOptions) SetBindingBase(kind UniformKind, base uint32)

SetBindingBase Sets the base binding number used for for a uniform resource type when automatically assigning bindings. For GLSL compilation, sets the lowest automatically assigned number. For HLSL compilation, the regsiter number assigned to the resource is added to this specified base.

func (*CompilerOptions) SetIncludeCallback

func (c *CompilerOptions) SetIncludeCallback(resolver IncludeResolver)

SetIncludeCallback sets a include resolver

func (*CompilerOptions) SetInvertY

func (c *CompilerOptions) SetInvertY(enabled bool)

SetInvertY Sets whether the compiler should invert position.Y output in vertex shader.

func (*CompilerOptions) SetLimit

func (c *CompilerOptions) SetLimit(limit ResourceLimit, value int)

SetLimit sets a resource limit

func (*CompilerOptions) SetNanClamp

func (c *CompilerOptions) SetNanClamp(enabled bool)

SetNanClamp Sets whether the compiler generates code for max and min builtins which, if given a NaN operand, will return the other operand. Similarly, the clamp builtin will favour the non-NaN operands, as if clamp were implemented as a composition of max and min.

func (*CompilerOptions) SetOptimizationLevel

func (c *CompilerOptions) SetOptimizationLevel(level OptimizationLevel)

SetOptimizationLevel Sets the compiler optimization level to the given level. Only the last one takes effect if multiple calls of this function exist.

func (*CompilerOptions) SetSPIRVVersion

func (c *CompilerOptions) SetSPIRVVersion(version SPIRVVersion)

SetSPIRVVersion Sets the target SPIR-V version. The generated module will use this version of SPIR-V. Each target environment determines what versions of SPIR-V it can consume. Defaults to the highest version of SPIR-V 1.0 which is required to be supported by the target environment. E.g. Default to SPIR-V 1.0 for Vulkan 1.0 and SPIR-V 1.3 for Vulkan 1.1.

func (*CompilerOptions) SetTargetByName

func (c *CompilerOptions) SetTargetByName(target string) error

func (*CompilerOptions) SetTargetEnv

func (c *CompilerOptions) SetTargetEnv(target Target, version EnvVersion)

SetTargetEnv Sets the target shader environment, affecting which warnings or errors will be issued. The version will be for distinguishing between different versions of the target environment. The version value should be either 0 or a value listed in shaderc_env_version. The 0 value maps to Vulkan 1.0 if |target| is Vulkan, and it maps to OpenGL 4.5 if |target| is OpenGL.

func (*CompilerOptions) SetWarningsAsErrors

func (c *CompilerOptions) SetWarningsAsErrors()

SetWarningsAsErrors Sets the compiler mode to treat all warnings as errors. Note the suppress-warnings mode overrides this option, i.e. if both warning-as-errors and suppress-warnings modes are set, warnings will not be emitted as error messages.

func (*CompilerOptions) SuppressWarnings

func (c *CompilerOptions) SuppressWarnings()

SuppressWarnings Sets the compiler mode to suppress warnings, overriding warnings-as-errors mode. When both suppress-warnings and warnings-as-errors modes are turned on, warning messages will be inhibited, and will not be emitted as error messages.

type EnvVersion

type EnvVersion int

type IncludeResolver

type IncludeResolver func(requestedSource string, itype IncludeType, requestingSource string, includeDepth int) (sourceName, content string, err error)

IncludeResolver An includer resolver type for mapping an #include request to an include result. The requested_source parameter specifies the name of the source being requested. The type parameter specifies the kind of inclusion request being made. The requesting_source parameter specifies the name of the source containing the #include request. Returns the name of the source file, the contents and optionally an error

func CreateDefaultIncludeResolver

func CreateDefaultIncludeResolver(dirs []string) IncludeResolver

CreateDefaultIncludeResolver returns a basic include resolover which looks for files in a list of specified directories

type IncludeType

type IncludeType int
const (
	// IncludeRelative E.g. #include "source"
	IncludeRelative IncludeType = IncludeType(C.shaderc_include_type_relative)
	// IncludeStandard E.g. #include <source>
	IncludeStandard = IncludeType(C.shaderc_include_type_standard)
)

type OptimizationLevel

type OptimizationLevel int

type ResourceLimit

type ResourceLimit int

type ShaderType

type ShaderType int

func GetShaderTypeByFilename

func GetShaderTypeByFilename(filename string) ShaderType

type Target

type Target int

type UniformKind

type UniformKind int

Uniform resource kinds. In Vulkan, uniform resources are bound to the pipeline via descriptors with numbered bindings and sets.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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