Murl Engine Lua Addon API  Version 1.0 beta
Murl.Resource.IShader

The IShader resource object interface.

A shader resource contains GPU shader program code in a number of possible formats, both source and binary forms are defined. The resource object can also contain meta information for the shader (such as information about attributes, texture semantics etc.), for shaders that cannot be queried for this information at run-time (e.g. DirectX 10+ HLSL binary blobs).


Table members

Methods


GetNumberOfSubShaders()

Get the number of individual shader chunks.

Integer GetNumberOfSubShaders()

Returns
Integer The number of chunks.

GetSubShader(shaderIndex)

Get the sub-shader at a given index.

Murl.Resource.IShader GetSubShader(Integer shaderIndex)

Parameters
shaderIndexThe index of the shader, from 0 to GetNumberOfShaders()-1.
Returns
Murl.Resource.IShader The sub-shader, or null if index is out of range.

GetSubShaderIndex(type, language)

Get the index of a sub-shader via a given type and language. If the resource does not contain a shader matching the given type and language, -1 is returned.

Integer GetSubShaderIndex(Murl.IEnums.ShaderType type, Murl.IEnums.ShaderLanguage language)

Parameters
typeThe shader type to query.
languageThe shader language to query.
Returns
Integer The number of chunks.

GetType()

Get the shader type.

Murl.IEnums.ShaderType GetType()

Returns
Murl.IEnums.ShaderType The shader type.

GetOutputLanguage()

Get the actual output shader language.

Murl.IEnums.ShaderLanguage GetOutputLanguage()

Returns
Murl.IEnums.ShaderLanguage The output shader language.

GetInputLanguage()

Get the input shader language this shader was translated from.

Murl.IEnums.ShaderLanguage GetInputLanguage()

Returns
Murl.IEnums.ShaderLanguage The input shader language, or IEnums::SHADER_LANGUAGE_UNDEFINED if the shader is compiled from its own source, i.e. not translated.

GetRawData()

Get the raw shader code data. This method returns the actual shader data that are passed to the video API. In case of OpenGL(ES), this represents a (possibly optimized) piece of GLSL source code. For DirectX, the data are present in binary form.

Murl.ConstData GetRawData()

Returns
Murl.ConstData A reference to a ConstData object holding the shader data.

GetUnoptimizedSource()

Get the unoptimized shader source code, if present. This method returns a string containing the whole source code of the shader including prefix, definitions and actual code, before it is optimized and compiled. An empty string is a valid return value, which indicates that the original source code is not available.

String GetUnoptimizedSource()

Returns
String A string holding the source code, or an empty one if not available.

GetUnoptimizedLog()

Get the compiler log output of the unoptimized shader source code, if present.

String GetUnoptimizedLog()

Returns
String A string holding the log, or an empty one if not available.

GetUnoptimizedDefinitions()

Get the variable definitions of the unoptimized shader source code, if present. This method returns only the variable definition section of the unoptimized code. Use GetUnoptimizedSource() to get the full source.

String GetUnoptimizedDefinitions()

Returns
String A string holding the variables, or an empty one if not available.

GetUnoptimizedPrefix()

Get the prefix(es) of the unoptimized shader source code, if present. This method returns only the prefix of the unoptimized code. Use GetUnoptimizedSource() to get the full source.

Murl.Array.String GetUnoptimizedPrefix()

Returns
Murl.Array.String A string array holding the prefixes, or an empty one if not available.

GetUnoptimizedCode()

Get the code section(s) of the unoptimized shader source code, if present. This method returns only the actual code section of the unoptimized code. Use GetUnoptimizedSource() to get the full source.

Murl.Array.String GetUnoptimizedCode()

Returns
Murl.Array.String A string array holding the code, or an empty one if not available.

GetOptimizedSource()

Get the optimized shader source code, if present. This method returns a string containing the optimized source code of the including prefix, definitions and actual code. An empty string is a valid return value, which indicates that the original source is not available.

String GetOptimizedSource()

Returns
String A string holding the source code, or an empty one if not available.

GetOptimizedLog()

Get the compiler log output of the optimized shader source code, if present.

String GetOptimizedLog()

Returns
String A string holding the log, or an empty one if not available.

GetOptimizedDefinitions()

Get the variable definitions of the optimized shader source code, if present. This method returns only the variable definition section of the optimized code. Use GetOptimizedSource() to get the full source.

String GetOptimizedDefinitions()

Returns
String A string holding the variables, or an empty one if not available.

GetOptimizedPrefix()

Get the prefix(es) of the optimized shader source code, if present. This method returns only the prefix of the optimized code. Use GetOptimizedSource() to get the full source.

Murl.Array.String GetOptimizedPrefix()

Returns
Murl.Array.String A string array holding the prefixes, or an empty one if not available.

GetOptimizedCode()

Get the code section(s) of the optimized shader source code, if present. This method returns only the actual code section of the optimized code. Use GetOptimizedSource() to get the full source.

Murl.Array.String GetOptimizedCode()

Returns
Murl.Array.String A string array holding the code, or an empty one if not available.

GetNumberOfConstants()

Get the number of constants used by the shader.

Integer GetNumberOfConstants()

Returns
Integer The number of constants.

GetConstantIndex(name)

Get the index of a constant with a given name.

Integer GetConstantIndex(String name)

Parameters
nameThe name to query.
Returns
Integer The zero-bases index, or -1 if not found.

GetConstantType(constantIndex)

Get the data type of a given constant.

Murl.IEnums.ConstantType GetConstantType(Integer constantIndex)

Parameters
constantIndexThe constant index, from 0 to GetNumberOfConstants()-1.
Returns
Murl.IEnums.ConstantType The data type, or IEnums::CONSTANT_TYPE_UNDEFINED if the index is out of range.

GetConstantPrecision(constantIndex)

Get the precision of a given constant.

Murl.IEnums.ShaderVariablePrecision GetConstantPrecision(Integer constantIndex)

Parameters
constantIndexThe constant index, from 0 to GetNumberOfConstants()-1.
Returns
Murl.IEnums.ShaderVariablePrecision The precision, or IEnums::SHADER_VARIABLE_PRECISION_DEFAULT if the index is out of range.

GetConstantDefaultValue(constantIndex)

Get the default value of a given constant as a string.

String GetConstantDefaultValue(Integer constantIndex)

Parameters
constantIndexThe constant index, from 0 to GetNumberOfConstants()-1.
Returns
String The default value, or an empty string if the index is out of range.

GetConstantName(constantIndex)

Get the name of a given constant.

String GetConstantName(Integer constantIndex)

Parameters
constantIndexThe constant index, from 0 to GetNumberOfConstants()-1.
Returns
String The constant name, or an empty string if the index is out of range.

GetNumberOfConstantBuffers()

Get the number of constant buffers used by the shader.

Integer GetNumberOfConstantBuffers()

Returns
Integer The number of constant buffers.

GetConstantBufferIndex(name)

Get the index of a constant buffer with a given name.

Integer GetConstantBufferIndex(String name)

Parameters
nameThe name to query.
Returns
Integer The zero-bases index, or -1 if not found.

GetConstantBufferLocation(constantBufferIndex)

Get the location or register number of a given constant buffer.

Integer GetConstantBufferLocation(Integer constantBufferIndex)

Parameters
constantBufferIndexThe buffer index, from 0 to GetNumberOfConstantBuffers()-1.
Returns
Integer The location, or -1 if the index is out of range.

GetConstantBufferItem(constantBufferIndex)

Get the predefined item of a given constant buffer.

Murl.IEnums.ConstantBufferItem GetConstantBufferItem(Integer constantBufferIndex)

Parameters
constantBufferIndexThe buffer index, from 0 to GetNumberOfConstantBuffers()-1.
Returns
Murl.IEnums.ConstantBufferItem The item, or IEnums::CONSTANT_BUFFER_ITEM_CUSTOM if the index is out of range.

GetConstantBufferName(constantBufferIndex)

Get the primary variable name of a given constant buffer.

String GetConstantBufferName(Integer constantBufferIndex)

Parameters
constantBufferIndexThe buffer index, from 0 to GetNumberOfConstantBuffers()-1.
Returns
String The variable name, or an empty string if the index is out of range.

GetNumberOfConstantBufferAlternativeNames(constantBufferIndex)

Get the number of alternative variable names of a given constant buffer.

Integer GetNumberOfConstantBufferAlternativeNames(Integer constantBufferIndex)

Parameters
constantBufferIndexThe buffer index, from 0 to GetNumberOfConstantBuffers()-1.
Returns
Integer The number of alternative names, or 0 if the index is out of range.

GetConstantBufferAlternativeName(constantBufferIndex, alternativeNameIndex)

Get an alternative variable name of a given constant buffer.

String GetConstantBufferAlternativeName(Integer constantBufferIndex, Integer alternativeNameIndex)

Parameters
constantBufferIndexThe buffer index, from 0 to GetNumberOfConstantBuffers()-1.
alternativeNameIndexThe name index, from 0 to GetNumberOfConstantBufferAlternativeNames()-1.
Returns
String The alternative variable name, or an empty string if an index is out of range.

GetNumberOfConstantBufferUniforms(constantBufferIndex)

Get the number of uniform variables present in a given constant buffer.

Integer GetNumberOfConstantBufferUniforms(Integer constantBufferIndex)

Parameters
constantBufferIndexThe buffer index, from 0 to GetNumberOfConstantBuffers()-1.
Returns
Integer The number of uniforms present in the constant buffer at the given index.

GetConstantBufferUniformIndex(constantBufferIndex, uniformIndex)

Get the global index of a uniform in a given constant buffer at a given index.

Integer GetConstantBufferUniformIndex(Integer constantBufferIndex, Integer uniformIndex)

Parameters
constantBufferIndexThe constant buffer index, from 0 to GetNumberOfConstantBuffers()-1.
uniformIndexThe local uniform index, from 0 to GetNumberOfConstantBufferUniforms(constantBufferIndex)-1.
Returns
Integer The zero-based global uniform index to be used in any of the GetUniform*() calls, or -1 if not found.

GetNumberOfUniforms()

Get the number of uniform variables used by the shader.

Integer GetNumberOfUniforms()

Returns
Integer The number of uniform variables.

GetUniformIndex(name)

Get the index of a uniform with a given name.

Integer GetUniformIndex(String name)

Parameters
nameThe name to query.
Returns
Integer The zero-bases index, or -1 if not found.

GetUniformLocation(uniformIndex)

Get the location, register number or constant buffer offset of a given uniform.

Integer GetUniformLocation(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
Integer The location, or -1 if the index is out of range.

GetUniformConstantBufferIndex(uniformIndex)

Get the index of the constant buffer the uniform belongs to.

Integer GetUniformConstantBufferIndex(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
Integer The constant buffer index, or -1 if the index is out of range or the uniform does not belong to a constant buffer.

GetUniformItem(uniformIndex)

Get the predefined item of a given uniform.

Murl.IEnums.UniformItem GetUniformItem(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
Murl.IEnums.UniformItem The item, or IEnums::UNIFORM_ITEM_CUSTOM if the index is out of range.

GetUniformType(uniformIndex)

Get the data type of a given uniform.

Murl.IEnums.UniformType GetUniformType(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
Murl.IEnums.UniformType The data type, or IEnums::UNIFORM_TYPE_UNDEFINED if the index is out of range.

GetUniformPrecision(uniformIndex)

Get the variable precision of a given uniform.

Murl.IEnums.ShaderVariablePrecision GetUniformPrecision(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
Murl.IEnums.ShaderVariablePrecision The precision, or IEnums::SHADER_VARIABLE_PRECISION_DEFAULT if the index is out of range.

GetUniformArraySize(uniformIndex)

Get the array size of a given uniform.

Integer GetUniformArraySize(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
Integer The array size, or 0 for a scalar uniform.

GetUniformDefaultValue(uniformIndex)

Get the default value of a given uniform as a string.

String GetUniformDefaultValue(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
String The default value, or an empty string if the index is out of range.

GetUniformName(uniformIndex)

Get the primary variable name of a given uniform.

String GetUniformName(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
String The variable name, or an empty string if the index is out of range.

GetNumberOfUniformAlternativeNames(uniformIndex)

Get the number of alternative variable names of a given uniform.

Integer GetNumberOfUniformAlternativeNames(Integer uniformIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
Returns
Integer The number of alternative names, or 0 if the index is out of range.

GetUniformAlternativeName(uniformIndex, alternativeNameIndex)

Get an alternative variable name of a given uniform.

String GetUniformAlternativeName(Integer uniformIndex, Integer alternativeNameIndex)

Parameters
uniformIndexThe uniform index, from 0 to GetNumberOfUniforms()-1.
alternativeNameIndexThe name index, from 0 to GetNumberOfUniformAlternativeNames()-1.
Returns
String The alternative variable name, or an empty string if an index is out of range.

GetNumberOfAttributes()

Get the number of attribute variables used by the shader.

Integer GetNumberOfAttributes()

Returns
Integer The number of attribute variables.

GetAttributeIndex(name)

Get the index of an attribute with a given name.

Integer GetAttributeIndex(String name)

Parameters
nameThe name to query.
Returns
Integer The zero-bases index, or -1 if not found.

GetAttributeLocation(attributeIndex)

Get the location or register number of a given attribute.

Integer GetAttributeLocation(Integer attributeIndex)

Parameters
attributeIndexThe attribute index, from 0 to GetNumberOfAttributes()-1.
Returns
Integer The location, or -1 if the index is out of range.

GetAttributeItem(attributeIndex)

Get the predefined item of a given attribute.

Murl.IEnums.AttributeItem GetAttributeItem(Integer attributeIndex)

Parameters
attributeIndexThe attribute index, from 0 to GetNumberOfAttributes()-1.
Returns
Murl.IEnums.AttributeItem The item, or IEnums::ATTRIBUTE_ITEM_CUSTOM if the index is out of range.

GetAttributeType(attributeIndex)

Get the data type of a given attribute.

Murl.IEnums.AttributeType GetAttributeType(Integer attributeIndex)

Parameters
attributeIndexThe attribute index, from 0 to GetNumberOfAttributes()-1.
Returns
Murl.IEnums.AttributeType The data type, or IEnums::ATTRIBUTE_TYPE_UNDEFINED if the index is out of range.

GetAttributePrecision(attributeIndex)

Get the variable precision of a given attribute.

Murl.IEnums.ShaderVariablePrecision GetAttributePrecision(Integer attributeIndex)

Parameters
attributeIndexThe attribute index, from 0 to GetNumberOfAttributes()-1.
Returns
Murl.IEnums.ShaderVariablePrecision The precision, or IEnums::SHADER_VARIABLE_PRECISION_DEFAULT if the index is out of range.

GetAttributeName(attributeIndex)

Get the primary variable name of a given attribute.

String GetAttributeName(Integer attributeIndex)

Parameters
attributeIndexThe attribute index, from 0 to GetNumberOfAttributes()-1.
Returns
String The variable name, or an empty string if the index is out of range.

GetNumberOfAttributeAlternativeNames(attributeIndex)

Get the number of alternative variable names of a given attribute.

Integer GetNumberOfAttributeAlternativeNames(Integer attributeIndex)

Parameters
attributeIndexThe attribute index, from 0 to GetNumberOfAttributes()-1.
Returns
Integer The number of alternative names, or 0 if the index is out of range.

GetAttributeAlternativeName(attributeIndex, alternativeNameIndex)

Get an alternative variable name of a given attribute.

String GetAttributeAlternativeName(Integer attributeIndex, Integer alternativeNameIndex)

Parameters
attributeIndexThe attribute index, from 0 to GetNumberOfAttributes()-1.
alternativeNameIndexThe name index, from 0 to GetNumberOfAttributeAlternativeNames()-1.
Returns
String The alternative variable name, or an empty string if an index is out of range.

GetNumberOfVaryings()

Get the number of varying variables used by the shader.

Integer GetNumberOfVaryings()

Returns
Integer The number of varying variables.

GetVaryingIndex(name)

Get the index of a varying with a given name.

Integer GetVaryingIndex(String name)

Parameters
nameThe name to query.
Returns
Integer The zero-bases index, or -1 if not found.

GetVaryingLocation(varyingIndex)

Get the location or register number of a given varying variable.

Integer GetVaryingLocation(Integer varyingIndex)

Parameters
varyingIndexThe varying variable index, from 0 to GetNumberOfVaryings()-1.
Returns
Integer The location, or -1 if the index is out of range.

GetVaryingType(varyingIndex)

Get the data type of a given varying variable.

Murl.IEnums.VaryingType GetVaryingType(Integer varyingIndex)

Parameters
varyingIndexThe varying variable index, from 0 to GetNumberOfVaryings()-1.
Returns
Murl.IEnums.VaryingType The data type, or IEnums::VARYING_TYPE_UNDEFINED if the index is out of range.

GetVaryingPrecision(varyingIndex)

Get the variable precision of a given varying variable.

Murl.IEnums.ShaderVariablePrecision GetVaryingPrecision(Integer varyingIndex)

Parameters
varyingIndexThe varying variable index, from 0 to GetNumberOfVaryings()-1.
Returns
Murl.IEnums.ShaderVariablePrecision The precision, or IEnums::SHADER_VARIABLE_PRECISION_DEFAULT if the index is out of range.

GetVaryingName(varyingIndex)

Get the name of a given varying variable.

String GetVaryingName(Integer varyingIndex)

Parameters
varyingIndexThe varying variable index, from 0 to GetNumberOfVaryings()-1.
Returns
String The variable name, or an empty string if the index is out of range.

GetNumberOfTextures()

Get the number of texture (sampler) variables used by the shader.

Integer GetNumberOfTextures()

Returns
Integer The number of sampler variables.

GetTextureIndex(name)

Get the index of a texture with a given name.

Integer GetTextureIndex(String name)

Parameters
nameThe name to query.
Returns
Integer The zero-bases index, or -1 if not found.

GetTextureLocation(textureIndex)

Get the location or register number of a given texture sampler.

Integer GetTextureLocation(Integer textureIndex)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
Returns
Integer The location, or -1 if the index is out of range.

GetTextureType(textureIndex)

Get the data type of a given texture sampler.

Murl.IEnums.TextureType GetTextureType(Integer textureIndex)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
Returns
Murl.IEnums.TextureType The type, or IEnums::TEXTURE_TYPE_DEFAULT if the index is out of range.

GetTextureFlags(textureIndex)

Get additional flags of a given texture sampler.

Integer GetTextureFlags(Integer textureIndex)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
Returns
Integer The flag bit mask, or IEnums::TEXTURE_FLAG_MASK_NONE if the index is out of range.

GetTexturePrecision(textureIndex)

Get the variable precision of a given texture sampler.

Murl.IEnums.ShaderVariablePrecision GetTexturePrecision(Integer textureIndex)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
Returns
Murl.IEnums.ShaderVariablePrecision The precision, or IEnums::SHADER_VARIABLE_PRECISION_DEFAULT if the index is out of range.

GetTextureSemantic(textureIndex, colorComponent)

Get the semantic of a given texture sampler for a given color channel.

Murl.IEnums.TextureSemantic GetTextureSemantic(Integer textureIndex, Murl.IEnums.ColorComponent colorComponent)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
colorComponentThe color component to query.
Returns
Murl.IEnums.TextureSemantic The semantic, or IEnums::TEXTURE_SEMANTIC_UNDEFINED if the index is out of range.

GetTextureSemanticIndex(textureIndex, colorComponent)

Get the semantic index of a given texture sampler for a given color channel.

Integer GetTextureSemanticIndex(Integer textureIndex, Murl.IEnums.ColorComponent colorComponent)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
colorComponentThe color component to query.
Returns
Integer The index, or 0 if the index is out of range.

GetTextureDefaultValue(textureIndex, colorComponent)

Get the default value of a given texture sampler for a given color channel.

Number GetTextureDefaultValue(Integer textureIndex, Murl.IEnums.ColorComponent colorComponent)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
colorComponentThe color component to query.
Returns
Number The default value, or 0.0 if the index is out of range.

GetTextureName(textureIndex)

Get the primary variable name of a given texture sampler.

String GetTextureName(Integer textureIndex)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
Returns
String The variable name, or an empty string if the index is out of range.

GetNumberOfTextureAlternativeNames(textureIndex)

Get the number of alternative variable names of a given texture sampler.

Integer GetNumberOfTextureAlternativeNames(Integer textureIndex)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
Returns
Integer The number of alternative names, or 0 if the index is out of range.

GetTextureAlternativeName(textureIndex, alternativeNameIndex)

Get an alternative variable name of a given texture sampler.

String GetTextureAlternativeName(Integer textureIndex, Integer alternativeNameIndex)

Parameters
textureIndexThe sampler index, from 0 to GetNumberOfTextures()-1.
alternativeNameIndexThe name index, from 0 to GetNumberOfTextureAlternativeNames()-1.
Returns
String The alternative variable name, or an empty string if an index is out of range.