Search Results for

    Show / Hide Table of Contents

    Class ShaderAnalyzer

    Analyzer for a shader code.

    Inheritance
    object
    ShaderAnalyzer
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Evergine.Framework.Graphics.Effects.Analyzer
    Assembly: Evergine.Framework.dll
    Syntax
    public class ShaderAnalyzer

    Constructors

    ShaderAnalyzer()

    Initializes a new instance of the ShaderAnalyzer class.

    Declaration
    public ShaderAnalyzer()

    Fields

    BeginPassKeyword

    The begin pass keyword.

    Declaration
    protected const string BeginPassKeyword = "Begin_Pass(:(\\w+))?"
    Field Value
    Type Description
    string

    BeginResourceLayoutKeyword

    The begin resource layout keyword.

    Declaration
    protected const string BeginResourceLayoutKeyword = "Begin_ResourceLayout"
    Field Value
    Type Description
    string

    DefaultValueKeyword

    The default value keyword.

    Declaration
    protected const string DefaultValueKeyword = "Default"
    Field Value
    Type Description
    string

    DirectivesKeyword

    The directives keyword.

    Declaration
    protected const string DirectivesKeyword = "Directives"
    Field Value
    Type Description
    string

    EndPassKeyword

    The end pass keyword.

    Declaration
    protected const string EndPassKeyword = "End_Pass"
    Field Value
    Type Description
    string

    EndResourceLayoutKeyword

    The end resource layout keyword.

    Declaration
    protected const string EndResourceLayoutKeyword = "End_ResourceLayout"
    Field Value
    Type Description
    string

    codeLines

    The code lines.

    Declaration
    protected LineInfo[] codeLines
    Field Value
    Type Description
    LineInfo[]

    passSections

    The pass sections.

    Declaration
    protected List<PassSection> passSections
    Field Value
    Type Description
    List<PassSection>

    resourceLayoutSection

    The resource layout section.

    Declaration
    protected ResourceLayoutSection resourceLayoutSection
    Field Value
    Type Description
    ResourceLayoutSection

    Properties

    CodeLines

    Gets the array of line information from source.

    Declaration
    public LineInfo[] CodeLines { get; }
    Property Value
    Type Description
    LineInfo[]

    DirectivesGroups

    Gets the Directives groups.

    Declaration
    public List<DirectivesGroup> DirectivesGroups { get; }
    Property Value
    Type Description
    List<DirectivesGroup>

    PassesNames

    Gets the passes names list.

    Declaration
    public string[] PassesNames { get; }
    Property Value
    Type Description
    string[]

    ResourceLayoutInfo

    Gets the resource layout info cloned.

    Declaration
    public GraphicsResourceInfo[] ResourceLayoutInfo { get; }
    Property Value
    Type Description
    GraphicsResourceInfo[]

    StructsInfo

    Gets the Structs defined.

    Declaration
    public List<StructInfo> StructsInfo { get; }
    Property Value
    Type Description
    List<StructInfo>

    Methods

    ArrayCopy(LineInfo[], int, out LineInfo[], int)

    Copy the array.

    Declaration
    protected void ArrayCopy(LineInfo[] source, int codeIndex, out LineInfo[] destination, int length)
    Parameters
    Type Name Description
    LineInfo[] source

    The source.

    int codeIndex

    Index of the code.

    LineInfo[] destination

    The destination.

    int length

    The length.

    CombinationBetweenTwoGroup(DirectivesCombination[], DirectivesCombination[])

    Combinations for the two groups of directives.

    Declaration
    protected DirectivesCombination[] CombinationBetweenTwoGroup(DirectivesCombination[] combinations1, DirectivesCombination[] combinations2)
    Parameters
    Type Name Description
    DirectivesCombination[] combinations1

    First group of directives.

    DirectivesCombination[] combinations2

    Second group of directives.

    Returns
    Type Description
    DirectivesCombination[]

    The combinations for the two groups of directives.

    ConcatCode(List<CodeBlock>, string[])

    Concatenates the given code blocks using the specified directives.

    Declaration
    protected List<LineInfo> ConcatCode(List<CodeBlock> codeBlocks, string[] directives)
    Parameters
    Type Name Description
    List<CodeBlock> codeBlocks

    The code blocks.

    string[] directives

    The directives.

    Returns
    Type Description
    List<LineInfo>

    The lines of concatenated code.

    DivideInSections(LineInfo[])

    Divides the given lines in sections.

    Declaration
    protected void DivideInSections(LineInfo[] lines)
    Parameters
    Type Name Description
    LineInfo[] lines

    The lines.

    Error(int, string)

    Sets the result as error in the specified line with the given message.

    Declaration
    protected void Error(int line, string msg)
    Parameters
    Type Name Description
    int line

    The line.

    string msg

    The message.

    Evaluate(string, string[])

    Evaluates the specified expression using the given directive.

    Declaration
    protected bool Evaluate(string expression, string[] directives)
    Parameters
    Type Name Description
    string expression

    The expression.

    string[] directives

    The directives.

    Returns
    Type Description
    bool

    The logical evaluation of the expression.

    FindPass(string)

    Return the Pass information.

    Declaration
    public PassSection FindPass(string passName)
    Parameters
    Type Name Description
    string passName

    Pass name.

    Returns
    Type Description
    PassSection

    Pass information.

    GenerateAllDirectivesCombination()

    Generate all combinations between directives.

    Declaration
    public List<string[]> GenerateAllDirectivesCombination()
    Returns
    Type Description
    List<string[]>

    directives array list.

    GenerateAllPassAndDirectivesCombination()

    Generate all directive combinations for all passes.

    Declaration
    public PassCombination[] GenerateAllPassAndDirectivesCombination()
    Returns
    Type Description
    PassCombination[]

    directive list.

    GetEffectType()

    Get Effect Type. (Graphics or Compute).

    Declaration
    public ShaderAnalyzer.EffectTypes GetEffectType()
    Returns
    Type Description
    ShaderAnalyzer.EffectTypes

    Type of Effect.

    GetHLSLInputLayout(PreprocessShader, string)

    Gets the HLSL input layout.

    Declaration
    protected InputLayouts GetHLSLInputLayout(PreprocessShader source, string vertexEntryPoint)
    Parameters
    Type Name Description
    PreprocessShader source

    The source.

    string vertexEntryPoint

    The vertex entry point.

    Returns
    Type Description
    InputLayouts

    The HLSL input layout.

    GetHLSLInputStructCode(string, string)

    Gets the HLSL input structure code.

    Declaration
    protected string GetHLSLInputStructCode(string source, string vertexEntryPoint)
    Parameters
    Type Name Description
    string source

    The source.

    string vertexEntryPoint

    The vertex entry point.

    Returns
    Type Description
    string

    The HLSL input structure code.

    GetHLSLResourceLayout(ResourceLayoutSection)

    Gets the HLSL resource layout from the given section and stores it in the ResourceLayoutInfo variable.

    Declaration
    protected void GetHLSLResourceLayout(ResourceLayoutSection section)
    Parameters
    Type Name Description
    ResourceLayoutSection section

    The section.

    GetInputLayout(string, PreprocessShader)

    Gets estimated inputLayout from shader source.

    Declaration
    public InputLayouts GetInputLayout(string passName, PreprocessShader cleanSource)
    Parameters
    Type Name Description
    string passName

    Pass name.

    PreprocessShader cleanSource

    Source with active pass and directives.

    Returns
    Type Description
    InputLayouts

    Input layouts.

    HLSLPreprocess(PassSection, string[])

    Preprocess th HLSL shader.

    Declaration
    protected PreprocessShader HLSLPreprocess(PassSection passSection, string[] activeDirectives)
    Parameters
    Type Name Description
    PassSection passSection

    The pass section.

    string[] activeDirectives

    The active directives.

    Returns
    Type Description
    PreprocessShader

    The preprocess result.

    HLSLToElementFormat(string)

    Transform HLSL to element format.

    Declaration
    protected ElementFormat HLSLToElementFormat(string format)
    Parameters
    Type Name Description
    string format

    The format.

    Returns
    Type Description
    ElementFormat

    The element format.

    HLSLToElementSemanticType(string)

    Transform HLSL to element semantic type.

    Declaration
    protected ElementSemanticType HLSLToElementSemanticType(string semantic)
    Parameters
    Type Name Description
    string semantic

    The semantic.

    Returns
    Type Description
    ElementSemanticType

    The element semantic type.

    LineToString(LineInfo[])

    Appends the given lines text.

    Declaration
    protected string LineToString(LineInfo[] lines)
    Parameters
    Type Name Description
    LineInfo[] lines

    The lines.

    Returns
    Type Description
    string

    The appended lines text.

    Preprocess(string, string[])

    Return shader code with active directives.

    Declaration
    public PreprocessShader Preprocess(string passName, string[] activeDirectives)
    Parameters
    Type Name Description
    string passName

    Pass name.

    string[] activeDirectives

    Active directives.

    Returns
    Type Description
    PreprocessShader

    Cleaned shader code.

    ReadEntryPoints(PassSection, string, int)

    Reads the section entry points.

    Declaration
    protected void ReadEntryPoints(PassSection section, string line, int lineNumber)
    Parameters
    Type Name Description
    PassSection section

    The section.

    string line

    The line.

    int lineNumber

    The line number.

    ReadMode(PassSection, string, int)

    Reads the compilation mode.

    Declaration
    protected void ReadMode(PassSection section, string line, int lineNumber)
    Parameters
    Type Name Description
    PassSection section

    The section.

    string line

    The line.

    int lineNumber

    The line number.

    ReadPassSection(PassSection)

    Reads the pass section.

    Declaration
    protected void ReadPassSection(PassSection section)
    Parameters
    Type Name Description
    PassSection section

    The section.

    ReadProfile(PassSection, string, int)

    Reads the section profile.

    Declaration
    protected void ReadProfile(PassSection section, string line, int lineNumber)
    Parameters
    Type Name Description
    PassSection section

    The section.

    string line

    The line.

    int lineNumber

    The line number.

    ReadRequiredWith(PassSection, string, int)

    Reads the section 'requiredwith'.

    Declaration
    protected void ReadRequiredWith(PassSection section, string line, int lineNumber)
    Parameters
    Type Name Description
    PassSection section

    The section.

    string line

    The line.

    int lineNumber

    The line number.

    ReadResourceLayoutSection(ResourceLayoutSection)

    Reads the resource layout section.

    Declaration
    protected void ReadResourceLayoutSection(ResourceLayoutSection section)
    Parameters
    Type Name Description
    ResourceLayoutSection section

    The section.

    ReadShaderSettings(PassSection, string, int, ref List<OverridedRenderLayerProperty>)

    Reads the shader settings.

    Declaration
    protected bool ReadShaderSettings(PassSection section, string line, int lineNumber, ref List<OverridedRenderLayerProperty> overridedProperties)
    Parameters
    Type Name Description
    PassSection section

    The section.

    string line

    The line.

    int lineNumber

    The line number.

    List<OverridedRenderLayerProperty> overridedProperties

    The overrided RenderLayer properties list.

    Returns
    Type Description
    bool

    True if the section has been processed, otherwise returns false.

    ReadSource(string)

    Analyzes shader source.

    Declaration
    public AnalyzerResult ReadSource(string source)
    Parameters
    Type Name Description
    string source

    Shader source.

    Returns
    Type Description
    AnalyzerResult

    Analyzer result.

    Warning(int, string)

    Sets the result as warning in the specified line with the given message.

    Declaration
    protected void Warning(int line, string msg)
    Parameters
    Type Name Description
    int line

    The line.

    string msg

    The message.

    Extension Methods

    ReflectionHelper.GetMemberAssembly(object)
    ReflectionHelper.GetTypeName(object)
    In This Article
    Back to top
    Generated by DocFX