@@ -320,7 +320,7 @@ namespace Slang
320
320
321
321
//
322
322
323
- Profile Profile::LookUp (char const * name)
323
+ Profile Profile::lookUp (char const * name)
324
324
{
325
325
#define PROFILE (TAG, NAME, STAGE, VERSION ) if (strcmp(name, #NAME) == 0 ) return Profile::TAG;
326
326
#define PROFILE_ALIAS (TAG, DEF, NAME ) if (strcmp(name, #NAME) == 0 ) return Profile::TAG;
@@ -408,27 +408,57 @@ namespace Slang
408
408
return session->getOrLoadDownstreamCompiler (passThrough, nullptr ) ? SLANG_OK: SLANG_E_NOT_FOUND;
409
409
}
410
410
411
- PassThroughMode getDownstreamCompilerRequiredForTarget (CodeGenTarget target )
411
+ SourceLanguage getDefaultSourceLanguageForDownstreamCompiler (PassThroughMode compiler )
412
412
{
413
- switch (target )
413
+ switch (compiler )
414
414
{
415
- case CodeGenTarget ::None:
415
+ case PassThroughMode ::None:
416
416
{
417
- return PassThroughMode::None ;
417
+ return SourceLanguage::Unknown ;
418
418
}
419
- case CodeGenTarget::GLSL:
419
+ case PassThroughMode::Fxc:
420
+ case PassThroughMode::Dxc:
421
+ {
422
+ return SourceLanguage::HLSL;
423
+ }
424
+ case PassThroughMode::Glslang:
420
425
{
421
- // Can always output GLSL
422
- return PassThroughMode::None;
426
+ return SourceLanguage::GLSL;
423
427
}
428
+ case PassThroughMode::Clang:
429
+ case PassThroughMode::VisualStudio:
430
+ case PassThroughMode::Gcc:
431
+ case PassThroughMode::GenericCCpp:
432
+ {
433
+ // These could ingest C, but we only have this function to work out a
434
+ // 'default' language to ingest.
435
+ return SourceLanguage::CPP;
436
+ }
437
+ case PassThroughMode::NVRTC:
438
+ {
439
+ return SourceLanguage::CUDA;
440
+ }
441
+ default : break ;
442
+ }
443
+ SLANG_ASSERT (!" Unknown compiler" );
444
+ return SourceLanguage::Unknown;
445
+ }
446
+
447
+ PassThroughMode getDownstreamCompilerRequiredForTarget (CodeGenTarget target)
448
+ {
449
+ switch (target)
450
+ {
451
+ // Don't *require* a downstream compiler for source output
452
+ case CodeGenTarget::GLSL:
424
453
case CodeGenTarget::HLSL:
454
+ case CodeGenTarget::CUDASource:
455
+ case CodeGenTarget::CPPSource:
456
+ case CodeGenTarget::CSource:
425
457
{
426
- // Can always output HLSL
427
458
return PassThroughMode::None;
428
459
}
429
- case CodeGenTarget::CUDASource :
460
+ case CodeGenTarget::None :
430
461
{
431
- // Can always output CUDA
432
462
return PassThroughMode::None;
433
463
}
434
464
case CodeGenTarget::SPIRVAssembly:
@@ -451,12 +481,6 @@ namespace Slang
451
481
{
452
482
return PassThroughMode::Glslang;
453
483
}
454
- case CodeGenTarget::CPPSource:
455
- case CodeGenTarget::CSource:
456
- {
457
- // Don't need an external compiler to output C and C++ code
458
- return PassThroughMode::None;
459
- }
460
484
case CodeGenTarget::HostCallable:
461
485
case CodeGenTarget::SharedLibrary:
462
486
case CodeGenTarget::Executable:
@@ -607,7 +631,7 @@ namespace Slang
607
631
}
608
632
609
633
char const * stagePrefix = nullptr ;
610
- switch ( profile.GetStage () )
634
+ switch ( profile.getStage () )
611
635
{
612
636
// Note: All of the raytracing-related stages require
613
637
// compiling for a `lib_*` profile, even when only a
@@ -642,7 +666,7 @@ namespace Slang
642
666
}
643
667
644
668
char const * versionSuffix = nullptr ;
645
- switch (profile.GetVersion ())
669
+ switch (profile.getVersion ())
646
670
{
647
671
#define CASE (TAG, SUFFIX ) case ProfileVersion::TAG: versionSuffix = #SUFFIX; break
648
672
CASE (DX_4_0, _4_0);
0 commit comments