yum-mirror/slang
Making it easier to work with shaders
git clone https://git.yummers.dev/yum-mirror/slang
0d16228ae
master
1// slang-artifact-associated.h 2#ifndef SLANG_ARTIFACT_ASSOCIATED_H 3#define SLANG_ARTIFACT_ASSOCIATED_H 4 5#include "slang-artifact.h" 6 7namespace Slang 8{ 9 10struct ArtifactDiagnostic 11{ 12typedef ArtifactDiagnostic ThisType ; 13 14enum class Severity :uint8_t 15 { 16Unknown , 17Info , 18Warning , 19Error , 20CountOf , 21 }; 22enum class Stage :uint8_t 23 { 24Compile , 25Link , 26 }; 27 28struct Location 29 { 30typedef Location ThisType ; 31bool operator == (const ThisType & rhs )const 32 { 33return line == rhs .line && column == rhs .column ; 34 } 35bool operator != (const ThisType & rhs )const {return !(* this == rhs ); } 36 37Int line = 0 ;///< One indexed line number. 0 if not defined 38Int column = 0 ;///< One indexed *character (not byte)* column number. 0 if not defined 39 }; 40 41bool operator == (const ThisType & rhs )const 42 { 43return severity == rhs .severity && stage == rhs .stage && text == rhs .text && 44code == rhs .code && location == rhs .location ; 45 } 46bool operator != (const ThisType & rhs )const {return !(* this == rhs ); } 47 48Severity severity = Severity ::Unknown ;///< The severity of error 49Stage stage = Stage ::Compile ;///< The stage the error came from 50TerminatedCharSlice text ;///< The text of the error 51TerminatedCharSlice code ;///< The compiler specific error code 52TerminatedCharSlice filePath ;///< The path the error originated from 53Location location ;///< The location of the diagnostic in the filePath 54}; 55 56/* Artifact diagnostics interface. 57 58IArtifactDiagnostics are added as associated types on an IArtifact typically. 59*/ 60class IArtifactDiagnostics :public IClonable 61{ 62public : 63SLANG_COM_INTERFACE ( 640x91f9b857 , 650xcd6b , 660x45ca , 67 {0x8e ,0x3 ,0x8f ,0xa3 ,0x3c ,0x5c ,0xf0 ,0x1a }); 68 69typedef ArtifactDiagnostic Diagnostic ; 70 71/// Get the diagnostic at the index 72SLANG_NO_THROW virtual const Diagnostic * SLANG_MCALL getAt (Index i )= 0 ; 73/// Get the amount of diangostics 74SLANG_NO_THROW virtual Count SLANG_MCALL getCount ()= 0 ; 75/// Add a diagnostic 76SLANG_NO_THROW virtual void SLANG_MCALL add (const Diagnostic & diagnostic )= 0 ; 77/// Remove the diagnostic at the index 78SLANG_NO_THROW virtual void SLANG_MCALL removeAt ( Index i) = 0 ; 79 80/// Get raw diagnostics information 81SLANG_NO_THROW virtual TerminatedCharSlice SLANG_MCALL getRaw () = 0 ; 82/// Set the raw diagnostic info 83SLANG_NO_THROW virtual void SLANG_MCALL setRaw( const CharSlice & slice) = 0 ; 84/// Append to the raw diagnostic 85SLANG_NO_THROW virtual void SLANG_MCALL appendRaw( const CharSlice & slice) = 0 ; 86 87/// Get the result for a compilation 88SLANG_NO_THROW virtual SlangResult SLANG_MCALL getResult () = 0 ; 89/// Set the result 90SLANG_NO_THROW virtual void SLANG_MCALL setResult ( SlangResult res) = 0 ; 91 92/// Reset all state 93SLANG_NO_THROW virtual void SLANG_MCALL reset () = 0 ; 94 95/// Count the number of diagnostics which have 'severity' or greater 96SLANG_NO_THROW virtual Count SLANG_MCALL 97getCountAtLeastSeverity( Diagnostic ::Severity severity ) = 0 ; 98 99/// Get the number of diagnostics by severity 100SLANG_NO_THROW virtual Count SLANG_MCALL getCountBySeverity( Diagnostic ::Severity severity ) = 0 ; 101 102/// True if there are any diagnostics of severity or worse 103SLANG_NO_THROW virtual bool SLANG_MCALL hasOfAtLeastSeverity( Diagnostic ::Severity severity ) = 0 ; 104 105/// Stores in outCounts, the amount of diagnostics for the stage of each severity 106SLANG_NO_THROW virtual Count SLANG_MCALL getCountByStage ( 107Diagnostic :: Stage stage, 108Count outCounts[ Int (Diagnostic::Severity::CountOf)]) = 0 ; 109 110/// Remove all diagnostics of the type 111SLANG_NO_THROW virtual void SLANG_MCALL removeBySeverity( Diagnostic ::Severity severity ) = 0 ; 112 113/// Add a note 114SLANG_NO_THROW virtual void SLANG_MCALL maybeAddNote( const CharSlice & in) = 0 ; 115 116/// If there are no error diagnostics, adds a generic error diagnostic 117SLANG_NO_THROW virtual void SLANG_MCALL requireErrorDiagnostic () = 0 ; 118 119/// Creates summary text and place in outBlob 120SLANG_NO_THROW virtual void SLANG_MCALL calcSummary (ISlangBlob ** outBlob) = 0 ; 121/// Creates a simplified summary text and places it in out blob 122SLANG_NO_THROW virtual void SLANG_MCALL calcSimplifiedSummary (ISlangBlob ** outBlob) = 0 ; 123}; 124 125struct ShaderBindingRange ; 126 127class IArtifactPostEmitMetadata : public slang::IMetadata 128{ 129public : 130SLANG_COM_INTERFACE ( 1310x5d03bce9 , 1320xafb1 , 1330x4fc8 , 134{ 0xa4 , 0x6f , 0x3c , 0xe0 , 0x7b , 0x6 , 0x1b , 0x1b }); 135 136/// Get the binding ranges 137SLANG_NO_THROW virtual Slice < ShaderBindingRange > SLANG_MCALL getUsedBindingRanges () = 0 ; 138 139/// Get the list of functions that were exported in the linked IR 140SLANG_NO_THROW virtual Slice < String > SLANG_MCALL getExportedFunctionMangledNames () = 0 ; 141 142/// Get the debug build identifier for a base and debug spirv pair 143SLANG_NO_THROW virtual const char * SLANG_MCALL getDebugBuildIdentifier () = 0 ; 144}; 145 146} // namespace Slang 147 148#endif