summaryrefslogtreecommitdiffstats
path: root/source/core/slang-cpp-compiler.h
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2019-08-12 16:28:18 -0400
committerGitHub <noreply@github.com>2019-08-12 16:28:18 -0400
commitea200663ffe33d7b4c739c0d84e9c21a3ae2ffa6 (patch)
tree73fae6929c3114be15e84875e4e798ef5a3e563c /source/core/slang-cpp-compiler.h
parent6fc2c37d9a4c408331db1b33deb3b46e74d2a7d2 (diff)
Ability to set Paths on Pass Through/Back End Compilers (#1010)
* Expanded prelude for some other resource types. Disable C++ output for ParameterGroup. * WIP: Layout for CPU. * Fixes to CPU layout. * WIP: The uniform is output, but the variable definition is not. * WIP: Entry point parameters to global scope in C++. Handling of resource types (in so far as outputting) * Some discussion of ABI and different input types. * WIP: More C++ support around resource types. * WIP: Split up variables into different structures on emit. * WIP: Emitting C++ with wrapping up of 'Context' * WIP: C++ code has access to semantic values. Wrap in struct so can use method calls to pass shared state. Disable legalizeResourceTypes and legalizeExistentialTypeLayout * Fix structured buffer layout for CPU. * Remove testing/handling of global uniforms on CPU path. Typo fix. Changed CPU tests to use new CPU calling convention. * Check globals are working. Initalize context to zero globals. * Order the global parameters for C++ ouput by their layout. Note - that layout isn't quite working correctly because the StructuredBuffer<int> the int seems to be consuming uniform space. * Work around for reflection not having all data needed for layout ordering for C++ code. * Output constant buffers as pointers. * Entry point parameters accessed through pointer to struct. * WIP: Layout for CPU is reasonable for test case. * Only output 'f' after float literal if type marks as a float. * Cast construction works on C++. * Made IntrinsicOp::ConvertConstruct to make intent clearer. * C++ handling construction from scalar. Handle access of a scalar with .x. Check default initialization. * Comment about need for split of kIROp_construct. Release build works. * Added support from constructVectorFromScalar to C/C++ target. * Handling of in/out in C/C++. * First pass documentation CPU support. * Improvements to C++/C slang code generation documentation. * Small doc change to include need for mechansim to specify cpp compiler path. * WIP: Being able to set path for backends. * Better handling of swizzling - allow swizzling a scalar into a vector. * Fix missing/broken headers for path setting on session. * Fix for compiling using clang on Windows. * Remove Clang test code. * * Removed spSessionGetGlobalSession - no longer needed because SlangSession is slang::IGlobalSession alias. * Gave Session a ref count on spCreateSession, and have it checked on spDestroySession, so behaves correctly as ISlangUnknown Note that spDestroySession does a release (and checks the ref count on debug builds). It's behaviour could be the same as just release, but this seems closer to the original intention.
Diffstat (limited to 'source/core/slang-cpp-compiler.h')
-rw-r--r--source/core/slang-cpp-compiler.h20
1 files changed, 18 insertions, 2 deletions
diff --git a/source/core/slang-cpp-compiler.h b/source/core/slang-cpp-compiler.h
index 185e960f3..d87ed63dc 100644
--- a/source/core/slang-cpp-compiler.h
+++ b/source/core/slang-cpp-compiler.h
@@ -6,6 +6,8 @@
#include "slang-process-util.h"
+#include "slang-platform.h"
+
namespace Slang
{
@@ -93,6 +95,7 @@ public:
enum Enum : Flags
{
EnableExceptionHandling = 0x01,
+ Verbose = 0x02,
};
};
@@ -104,6 +107,8 @@ public:
Flags flags = Flag::EnableExceptionHandling;
+ PlatformKind platform = PlatformKind::Unknown;
+
String modulePath; ///< The path/name of the output module. Should not have the extension, as that will be added for each of the target types
List<Define> defines;
@@ -171,7 +176,7 @@ public:
struct Output
{
/// Reset to an initial empty state
- void reset() { messages.clear(); result = SLANG_OK; }
+ void reset() { messages.clear(); rawMessages = String(); result = SLANG_OK; }
/// Get the number of messages by type
Index getCountByType(OutputMessage::Type type) const;
@@ -189,6 +194,8 @@ public:
/// Remove all messages of the type
void removeByType(OutputMessage::Type type);
+ String rawMessages;
+
SlangResult result;
List<OutputMessage> messages;
};
@@ -287,6 +294,7 @@ struct CPPCompilerBaseUtil
typedef CPPCompiler::TargetType TargetType;
typedef CPPCompiler::DebugInfoType DebugInfoType;
typedef CPPCompiler::SourceType SourceType;
+ typedef CPPCompiler::CompilerType CompilerType;
typedef CPPCompiler::OutputMessage OutputMessage;
typedef CPPCompiler::FloatingPointMode FloatingPointMode;
@@ -303,6 +311,14 @@ struct CPPCompilerUtil: public CPPCompilerBaseUtil
Newest,
};
+ struct InitializeSetDesc
+ {
+ const String& getPath(CompilerType type) const { return paths[int(type)]; }
+ void setPath(CompilerType type, const String& path) { paths[int(type)] = path; }
+
+ String paths[int(CPPCompiler::CompilerType::CountOf)];
+ };
+
/// Find a compiler
static CPPCompiler* findCompiler(const CPPCompilerSet* set, MatchType matchType, const CPPCompiler::Desc& desc);
static CPPCompiler* findCompiler(const List<CPPCompiler*>& compilers, MatchType matchType, const CPPCompiler::Desc& desc);
@@ -315,7 +331,7 @@ struct CPPCompilerUtil: public CPPCompilerBaseUtil
static const CPPCompiler::Desc& getCompiledWithDesc();
/// Given a set, registers compilers found through standard means and determines a reasonable default compiler if possible
- static SlangResult initializeSet(CPPCompilerSet* set);
+ static SlangResult initializeSet(const InitializeSetDesc& desc, CPPCompilerSet* set);
};
}