Метод | Описание | |
---|---|---|
ConvertShader ( |
Converts a source shader into a C#-runnable class
|
|
RemovePreprocessorDirectives ( string _Source ) : string |
Removes all recognizable preprocessor directives like //#ifdef, //#define, //#ifndef, //#endif, etc.
|
|
ReplaceStaticConsts ( string _Source ) : string |
Replaces "static consts" by simple "static"
|
Метод | Описание | |
---|---|---|
CommentLinesWith ( string _Source, string _Pattern ) : string |
Comments any line containing the specified pattern
|
|
ConvertConstantBuffers ( string _Source ) : string |
Converts all constant buffers syntax (cbuffer) into a struct with a cbuffer attribute Builds a dictionary of constant names so we can replace their simple use by a composition cbufferName.ConstantName instead
|
|
ConvertFloatToDouble ( string _Source ) : string |
Converts the float type to double type
|
|
ConvertOutFunctions ( string _Source ) : string |
Converts all functions with an "inout" syntax as "ref" and fix callers of such functions to issue either a "ref" or an "out" prefix
|
|
ConvertRegisters ( string _Source ) : string |
Converts all registers syntax (: register(xx)) into an attribute inserted above the line with register
|
|
ConvertSemantics ( string _Source ) : string |
Converts all semantics syntax (: NAME) into an attribute inserted above the line with semantic
|
|
ConvertVectorConstructors ( string _Source ) : string |
Converts vector constructors (float2, float3, float4, uint2, uint3, uint4, etc.) by a function that calls actual C# constructors
|
|
EnsureAlphanumeric ( string _Name ) : bool |
Ensures the provided name is alphanumeric
|
|
ErrorIfLinesWith ( string _Source, string _Pattern ) : void |
Throws an exception if there is a line with the //#if syntax, which is not supported in C# (except very annoying //#define at the very beginning of the file)!
|
|
FindBOL ( string _Source, int _StartIndex ) : int |
/// Inserts a snippet of text at a specific index in the source /// Finds the index of the beginning of the current line
|
|
FindEOL ( string _Source, int _StartIndex ) : int |
Finds teh index of the end of the current line
|
|
IndexOfBetween ( string _Source, string _Pattern, int _StartIndex, int _EndIndex ) : int |
Same as IndexOf except it returns -1 if the match is outside of the specified [Start,End] range
|
|
IsCommentedLine ( string _Source, int _Index ) : bool |
Checks if the current position is part of a comment (warning: only // coments are supported!)
|
|
MakeStructFieldsPublic ( string _Source ) : string |
Makes all the fields in structs public
|
|
ResolveIncludes ( |
Resolves all include files an merge them into the shader source
|
public static ConvertShader ( |
||
_ShaderPath | The path of the shader to convert (for includes resolution) | |
_ShaderSource | string | The shader code |
_ClassName | string | |
_EntryPointVS | string | The name of the Vertex Shader entry point function |
_EntryPointPS | string | The name of the Vertex Shader entry point function |
Результат | string |
public static RemovePreprocessorDirectives ( string _Source ) : string | ||
_Source | string | |
Результат | string |
public static ReplaceStaticConsts ( string _Source ) : string | ||
_Source | string | |
Результат | string |