diff options
| author | Tim Foley <tim.foley.is@gmail.com> | 2017-07-10 19:45:21 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-07-10 19:45:21 -0700 |
| commit | a923aff63a7b0d8847a50459361111347e3c527e (patch) | |
| tree | e53bfd90d2b9e4b04d22f58548999a33b7944d46 /source/slang/compiler.h | |
| parent | 5577e2d5e8bb374a00d9ecdd8e2c667ace546036 (diff) | |
| parent | 22c7a4de0c3810fcfc1099843e42b315c366a7c5 (diff) | |
Merge pull request #67 from kyaoNV/spirv
SPIR-V Support
Diffstat (limited to 'source/slang/compiler.h')
| -rw-r--r-- | source/slang/compiler.h | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/source/slang/compiler.h b/source/slang/compiler.h index cb7eb6265..2b440ad85 100644 --- a/source/slang/compiler.h +++ b/source/slang/compiler.h @@ -48,13 +48,30 @@ namespace Slang ReflectionJSON = SLANG_REFLECTION_JSON, }; + enum class ResultFormat + { + None, + Text, + Binary + }; + class CompileRequest; class TranslationUnitRequest; - // Result of compiling an entry point - struct EntryPointResult + // Result of compiling an entry point. + // Should only ever be string OR binary. + class CompileResult { - String outputSource; + public: + CompileResult() = default; + CompileResult(String const& str) : format(ResultFormat::Text), outputString(str) {} + CompileResult(List<uint8_t> const& buffer) : format(ResultFormat::Binary), outputBinary(buffer) {} + + void append(CompileResult const& result); + + ResultFormat format = ResultFormat::None; + String outputString; + List<uint8_t> outputBinary; }; // Describes an entry point that we've been requested to compile @@ -80,7 +97,7 @@ namespace Slang // The resulting output for the enry point // // TODO: low-level code generation should be a distinct step - EntryPointResult result; + CompileResult result; // The translation unit that this entry point came from TranslationUnitRequest* getTranslationUnit(); @@ -105,12 +122,6 @@ namespace Slang String content; }; - // Result of compiling a translation unit - struct TranslationUnitResult - { - String outputSource; - }; - // A single translation unit requested to be compiled. // class TranslationUnitRequest : public RefObject @@ -144,7 +155,7 @@ namespace Slang // The resulting output for the translation unit // // TODO: low-level code generation should be a distinct step - TranslationUnitResult result; + CompileResult result; }; // A directory to be searched when looking for files (e.g., `#include`) |
