DirectX12ShaderInfo

Description

sealed class Tinman.AddOns.DirectX12.Effects.DirectX12ShaderInfo

Full source code is included in the Tinman 3D SDK download.

Represents the shader metadata that the HLSL compiler writes into the Assembler Output / *.asm files.

The source code produced via ICodeOutput is minimal but parseable Assembler Output / *.asm file that contains the required shader metadata, see Reduce.

Public / Constructors

Direct​X12​Shader​Info


public constructor DirectX12ShaderInfo → (1)

assemblerOutput in : string

[not-null]
Source code of the Assembler Output / *.asm file, generated by the HLSL compiler.

Creates a new instance of DirectXShaderInfo.

This is the grammar for parsing the leading comment block of Assembler Output / *.asm files:

asm                      := (skip-line | skip-section | buffer-definitions
                            | structure-definition | resource-bindings
                            | line-break)* ;

buffer-definitions       := 'Buffer Definitions:' line-break (line-break*
                            buffer-definition)* ;
resource-bindings        := 'Resource Bindings:' line-break+
                            resource-bindings-header resource-binding* ;
skip-line                := ('shader hash' | 'Pipeline Runtime Information:')
                            ~line-break* line-break+ ;
skip-section             := ('Tessellation Output Primitive'
                            | 'Patch Constant signature' | 'Tessellation Domain'
                            | 'Output signature:' | 'Input signature:'
                            | 'Geometry Shader' | 'Domain Shader' | 'ViewId state:'
                            | 'Vertex Shader' | 'Pixel Shader' | 'Hull Shader'
                            | 'Compute Shader'
                            | 'Note: shader requires additional functionality:')
                            ~line-break* line-break+ ignore-line* ;
structure-definition     := 'Resource' 'bind' 'info' 'for' identifier '{' ]$[+
                            '$Element' ';' '; Offset:' '0' 'Size:' number '}' ;

buffer-definition        := 'cbuffer' identifier '{' 'struct' (identifier .. '.')
                            '{' buffer-element* '}' identifier ';' '; Offset:' '0'
                            'Size:' number '}' ;
ignore-line              := ~line-break+ line-break ;
resource-binding         := identifier ('[' number ']')? identifier identifier word
                            identifier ('s' | 't' | 'u' | 'cb') number number ' '*
                            line-break ;
resource-bindings-header := 'Name' 'Type' 'Format' 'Dim' 'ID' 'HLSL Bind' 'Count'
                            line-break '-'+[7] line-break ;

buffer-element           := matrix-order? data-type identifier ('[' number ']')? ';'
                            '; Offset:' number line-break ;
word                     := (letter | '/' | digit)+ ;

data-type                := data-type-name (data-type-count 'x' data-type-count
                            | data-type-count)? ;
identifier               := letter (letter | digit)* ;
line-break               := '\r'? '\n' ;
matrix-order             := 'row_major' | 'column_major' ;
number                   := digit+ ;

data-type-count          := '1' | '2' | '3' | '4' ;
data-type-name           := 'float' | 'int' | 'uint' | 'bool' ;
digit                    := '0'..'9' ;
letter                   := 'a'..'z' | 'A'..'Z' | '_' ;
ValidatingException

The assemblerOutput in is malformed and cannot be parsed.

Public / Methods

Reduce


[Pure]
public static method Reduce → (1)

assemblerOutput in : string

[not-null]
Source code of the Assembler Output / *.asm file, generated by the HLSL compiler.

returns → string

The reduced source code.

Reduces the given assemblerOutput in by retaining required metadata only.

ValidatingException

The assemblerOutput in is malformed and cannot be parsed.