summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/slang/slang-compiler.cpp')
-rw-r--r--source/slang/slang-compiler.cpp30
1 files changed, 21 insertions, 9 deletions
diff --git a/source/slang/slang-compiler.cpp b/source/slang/slang-compiler.cpp
index 705b4ed59..92759ed0f 100644
--- a/source/slang/slang-compiler.cpp
+++ b/source/slang/slang-compiler.cpp
@@ -396,23 +396,23 @@ namespace Slang
}
}
- Stage findStageByName(String const& name)
+ static const struct
{
- static const struct
- {
- char const* name;
- Stage stage;
- } kStages[] =
- {
- #define PROFILE_STAGE(ID, NAME, ENUM) \
+ char const* name;
+ Stage stage;
+ } kStages[] =
+ {
+ #define PROFILE_STAGE(ID, NAME, ENUM) \
{ #NAME, Stage::ID },
#define PROFILE_STAGE_ALIAS(ID, NAME, VAL) \
{ #NAME, Stage::ID },
#include "slang-profile-defs.h"
- };
+ };
+ Stage findStageByName(String const& name)
+ {
for(auto entry : kStages)
{
if(name == entry.name)
@@ -424,6 +424,18 @@ namespace Slang
return Stage::Unknown;
}
+ UnownedStringSlice getStageText(Stage stage)
+ {
+ for (auto entry : kStages)
+ {
+ if (stage == entry.stage)
+ {
+ return UnownedStringSlice(entry.name);
+ }
+ }
+ return UnownedStringSlice();
+ }
+
static UnownedStringSlice _getPassThroughAsText(PassThroughMode mode)
{
switch (mode)