class TShader

Defined at line 465 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

Make one TShader per shader that you will link into a program. Then

- provide the shader through setStrings() or setStringsWithLengths()

- optionally call setEnv*(), see below for more detail

- optionally use setPreamble() to set a special shader string that will be

processed before all others but won't affect the validity of #version

- optionally call addProcesses() for each setting/transform,

see comment for class TProcesses

- call parse(): source language and target environment must be selected

either by correct setting of EShMessages sent to parse(), or by

explicitly calling setEnv*()

- query the info logs

N.B.: Does not yet support having the same TShader instance being linked into

multiple programs.

N.B.: Destruct a linked program *before* destructing the shaders linked into it.

Protected Members

TPoolAllocator * pool
 stage
TCompiler * compiler
TIntermediate * intermediate
TInfoSink * infoSink
const char *const * strings
const int * lengths
const char *const * stringNames
int numStrings
const char * preamble
basic_string sourceEntryPointName
int overrideVersion
TEnvironment environment
bool compileOnly

Public Methods

void TShader (EShLanguage )
void addProcesses (const std::vector<std::string> & )
void addUniformLocationOverride (const char * name, int loc)
void addBlockStorageOverride (const char * nameStr, glslang::TBlockStorageClass backing)
void addSourceText (const char * text, size_t len)
const char * getInfoLog ()
const char * getInfoDebugLog ()
void setPreamble (const char * s)

Defined at line 474 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void setEnvInput (EShSource lang, EShLanguage envStage, EShClient client, int version)

For setting up the environment (cleared to nothingness in the constructor).

These must be called so that parsing is done for the right source language and

target environment, either indirectly through TranslateEnvironment() based on

EShMessages et. al., or directly by the user.

setEnvInput: The input source language and stage. If generating code for a

specific client, the input client semantics to use and the

version of that client's input semantics to use, otherwise

use EShClientNone and version of 0, e.g. for validation mode.

Note 'version' does not describe the target environment,

just the version of the source dialect to compile under.

For example, to choose the Vulkan dialect of GLSL defined by

version 100 of the KHR_vulkan_glsl extension: lang = EShSourceGlsl,

dialect = EShClientVulkan, and version = 100.

See the definitions of TEnvironment, EShSource, EShLanguage,

and EShClient for choices and more detail.

setEnvClient: The client that will be hosting the execution, and its version.

Note 'version' is not the version of the languages involved, but

the version of the client environment.

Use EShClientNone and version of 0 if there is no client, e.g.

for validation mode.

See EShTargetClientVersion for choices.

setEnvTarget: The language to translate to when generating code, and that

language's version.

Use EShTargetNone and version of 0 if there is no client, e.g.

for validation mode.

Defined at line 550 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void setEnvClient (EShClient client, EShTargetClientVersion version)

Defined at line 557 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void setEnvTarget (EShTargetLanguage lang, EShTargetLanguageVersion version)

Defined at line 562 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void getStrings (const char *const *& s, int & n)

Defined at line 568 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void setEnvTargetHlslFunctionality1 ()

Defined at line 571 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

bool getEnvTargetHlslFunctionality1 ()

Defined at line 572 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void setEnvInputVulkanRulesRelaxed ()

Defined at line 577 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

bool getEnvInputVulkanRulesRelaxed ()

Defined at line 578 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void setCompileOnly ()

Defined at line 580 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

bool getCompileOnly ()

Defined at line 581 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

bool parse (const TBuiltInResource * res, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, bool forwardCompatible, EShMessages messages)

Defined at line 671 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

bool parse (const TBuiltInResource * builtInResources, int defaultVersion, bool forwardCompatible, EShMessages messages)

Equivalent to parse() without a default profile and without forcing defaults.

Defined at line 679 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

bool parse (const TBuiltInResource * builtInResources, int defaultVersion, bool forwardCompatible, EShMessages messages, Includer & includer)

Defined at line 684 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

EShLanguage getStage ()

Defined at line 700 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

TIntermediate * getIntermediate ()

Defined at line 701 of file ../../third_party/glslang/src/glslang/Public/ShaderLang.h

void ~TShader ()
void setStrings (const char *const * s, int n)
void setStringsWithLengths (const char *const * s, const int * l, int n)
void setStringsWithLengthsAndNames (const char *const * s, const int * l, const char *const * names, int n)
void setEntryPoint (const char * entryPoint)
void setSourceEntryPoint (const char * sourceEntryPointName)
void setUniqueId (unsigned long long id)
void setOverrideVersion (int version)
void setDebugInfo (bool debugInfo)
void setShiftBinding (TResourceType res, unsigned int base)

IO resolver binding data: see comments in ShaderLang.cpp

void setShiftSamplerBinding (unsigned int base)
void setShiftTextureBinding (unsigned int base)
void setShiftImageBinding (unsigned int base)
void setShiftUboBinding (unsigned int base)
void setShiftUavBinding (unsigned int base)
void setShiftCbufferBinding (unsigned int base)
void setShiftSsboBinding (unsigned int base)
void setShiftBindingForSet (TResourceType res, unsigned int base, unsigned int set)
void setResourceSetBinding (const std::vector<std::string> & base)
void setAutoMapBindings (bool map)
void setAutoMapLocations (bool map)
void setUniformLocationBase (int base)
void setInvertY (bool invert)
void setDxPositionW (bool dxPosW)
void setEnhancedMsgs ()
void setHlslIoMapping (bool hlslIoMap)
void setFlattenUniformArrays (bool flatten)
void setNoStorageFormat (bool useUnknownFormat)
void setNanMinMaxClamp (bool nanMinMaxClamp)
void setTextureSamplerTransformMode (EShTextureSamplerTransformMode mode)
void setGlobalUniformBlockName (const char * name)
void setAtomicCounterBlockName (const char * name)
void setGlobalUniformSet (unsigned int set)
void setGlobalUniformBinding (unsigned int binding)
void setAtomicCounterBlockSet (unsigned int set)
void setAtomicCounterBlockBinding (unsigned int binding)
void setSourceFile (const char * file)
bool parse (const TBuiltInResource * , int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, bool forwardCompatible, EShMessages , Includer & )
bool preprocess (const TBuiltInResource * builtInResources, int defaultVersion, EProfile defaultProfile, bool forceDefaultVersionAndProfile, bool forwardCompatible, EShMessages message, std::string * outputString, Includer & includer)

NOTE: Doing just preprocessing to obtain a correct preprocessed shader string

is not an officially supported or fully working path.

Records

Friends

class TProgram