From fcf83dbf9effab3bd98bad2b83b2468b7eb05cfd Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 9 Jun 2017 11:34:21 -0700 Subject: Initial import of code. --- source/slang/compiled-program.h | 96 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 source/slang/compiled-program.h (limited to 'source/slang/compiled-program.h') diff --git a/source/slang/compiled-program.h b/source/slang/compiled-program.h new file mode 100644 index 000000000..7a86dfe90 --- /dev/null +++ b/source/slang/compiled-program.h @@ -0,0 +1,96 @@ +#ifndef BAKER_SL_COMPILED_PROGRAM_H +#define BAKER_SL_COMPILED_PROGRAM_H + +#include "../core/basic.h" +#include "diagnostics.h" +#include "syntax.h" +#include "type-layout.h" + +namespace Slang +{ + namespace Compiler + { +#if 0 + class ShaderMetaData + { + public: + CoreLib::String ShaderName; + CoreLib::EnumerableDictionary> ParameterSets; // bindingName->DescSet + }; + + class StageSource + { + public: + String MainCode; + List BinaryCode; + }; + + class CompiledShaderSource + { + public: + EnumerableDictionary Stages; + ShaderMetaData MetaData; + }; +#endif + + void IndentString(StringBuilder & sb, String src); + + struct EntryPointResult + { + String outputSource; + }; + + struct TranslationUnitResult + { + String outputSource; + List entryPoints; + }; + + class CompileResult + { + public: + DiagnosticSink* mSink = nullptr; + +#if 0 + String ScheduleFile; + RefPtr Program; + EnumerableDictionary CompiledSource; // shader -> stage -> code +#endif + + // Per-translation-unit results + List translationUnits; + +#if 0 + void PrintDiagnostics() + { + for (int i = 0; i < sink.diagnostics.Count(); i++) + { + fprintf(stderr, "%S(%d): %s %d: %S\n", + sink.diagnostics[i].Position.FileName.ToWString(), + sink.diagnostics[i].Position.Line, + getSeverityName(sink.diagnostics[i].severity), + sink.diagnostics[i].ErrorID, + sink.diagnostics[i].Message.ToWString()); + } + } +#endif + + CompileResult() + {} + ~CompileResult() + { + } + DiagnosticSink * GetErrorWriter() + { + return mSink; + } + int GetErrorCount() + { + return mSink->GetErrorCount(); + } + }; + + } +} + +#endif \ No newline at end of file -- cgit v1.2.3