summaryrefslogtreecommitdiff
path: root/source/slang/slang-emit.cpp
diff options
context:
space:
mode:
authorTim Foley <tfoleyNV@users.noreply.github.com>2020-06-18 13:40:08 -0700
committerGitHub <noreply@github.com>2020-06-18 13:40:08 -0700
commit82ba914db9c3823ad7a0834d46b7fccedfe0acee (patch)
treea2361c042e6a03ff957bd4a921f73efbb89dc1b7 /source/slang/slang-emit.cpp
parent8c6e02bd094bbc0c9afb141265be9675f99ddb61 (diff)
parent5952e3b3d7f505a7e6d71ecd0793911224f5bac3 (diff)
Merge branch 'master' into dyndispatch
Diffstat (limited to 'source/slang/slang-emit.cpp')
-rw-r--r--source/slang/slang-emit.cpp45
1 files changed, 13 insertions, 32 deletions
diff --git a/source/slang/slang-emit.cpp b/source/slang/slang-emit.cpp
index 260a862ae..f2552f95d 100644
--- a/source/slang/slang-emit.cpp
+++ b/source/slang/slang-emit.cpp
@@ -308,7 +308,7 @@ Result linkAndOptimizeIR(
// We don't need the legalize pass for C/C++ based types
if(options.shouldLegalizeExistentialAndResourceTypes )
-// if (!(sourceStyle == SourceStyle::CPP || sourceStyle == SourceStyle::C))
+// if (!(sourceLanguage == SourceLanguage::CPP || sourceStyle == SourceLanguage::C))
{
// The Slang language allows interfaces to be used like
// ordinary types (including placing them in constant
@@ -495,7 +495,7 @@ Result linkAndOptimizeIR(
auto profile = targetRequest->targetProfile;
if( profile.getFamily() == ProfileFamily::DX )
{
- if(profile.GetVersion() <= ProfileVersion::DX_5_0)
+ if(profile.getVersion() <= ProfileVersion::DX_5_0)
{
// Fxc and earlier dxc versions do not support
// a templates `.Load<T>` operation on byte-address
@@ -646,27 +646,25 @@ SlangResult emitEntryPointSourceFromIR(
RefPtr<CLikeSourceEmitter> sourceEmitter;
- typedef CLikeSourceEmitter::SourceStyle SourceStyle;
-
- SourceStyle sourceStyle = CLikeSourceEmitter::getSourceStyle(target);
- switch (sourceStyle)
+ SourceLanguage sourceLanguage = CLikeSourceEmitter::getSourceLanguage(target);
+ switch (sourceLanguage)
{
- case SourceStyle::CPP:
+ case SourceLanguage::CPP:
{
sourceEmitter = new CPPSourceEmitter(desc);
break;
}
- case SourceStyle::GLSL:
+ case SourceLanguage::GLSL:
{
sourceEmitter = new GLSLSourceEmitter(desc);
break;
}
- case SourceStyle::HLSL:
+ case SourceLanguage::HLSL:
{
sourceEmitter = new HLSLSourceEmitter(desc);
break;
}
- case SourceStyle::CUDA:
+ case SourceLanguage::CUDA:
{
sourceEmitter = new CUDASourceEmitter(desc);
break;
@@ -687,14 +685,14 @@ SlangResult emitEntryPointSourceFromIR(
linkingAndOptimizationOptions.sourceEmitter = sourceEmitter;
- switch( sourceStyle )
+ switch( sourceLanguage )
{
default:
break;
- case SourceStyle::CPP:
- case SourceStyle::C:
- case SourceStyle::CUDA:
+ case SourceLanguage::CPP:
+ case SourceLanguage::C:
+ case SourceLanguage::CUDA:
linkingAndOptimizationOptions.shouldLegalizeExistentialAndResourceTypes = false;
break;
}
@@ -728,25 +726,8 @@ SlangResult emitEntryPointSourceFromIR(
// it is time to stitch together the final output.
{
- Session* session = compileRequest->getSession();
-
- // Get the downstream compiler needed for final target
- PassThroughMode passThru = getDownstreamCompilerRequiredForTarget(targetRequest->target);
-
- // If generic CPP work out what compiler will actually be used
- if (passThru == PassThroughMode::GenericCCpp)
- {
- const SourceLanguage sourceLanguage = (sourceStyle == SourceStyle::C) ? SourceLanguage::C : SourceLanguage::CPP;
- // Get the compiler used for the language
- DownstreamCompiler* compiler = session->getDefaultDownstreamCompiler(sourceLanguage);
- if (compiler)
- {
- passThru = PassThroughMode(compiler->getDesc().type);
- }
- }
-
// If there is a prelude emit it
- const auto& prelude = compileRequest->getSession()->getDownstreamCompilerPrelude(passThru);
+ const auto& prelude = compileRequest->getSession()->getPreludeForLanguage(sourceLanguage);
if (prelude.getLength() > 0)
{
sourceWriter.emit(prelude.getUnownedSlice());