summaryrefslogtreecommitdiffstats
path: root/source/slang/slang-profile.cpp
blob: 9b7112b1fb198a0babc0a1e558650c98345a8d74 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// slang-profile.cpp
#include "slang-profile.h"

namespace Slang {

ProfileFamily getProfileFamily(ProfileVersion version)
{
    switch( version )
    {
    default: return ProfileFamily::Unknown;

#define PROFILE_VERSION(TAG, FAMILY) case ProfileVersion::TAG: return ProfileFamily::FAMILY;
#include "slang-profile-defs.h"
    }
}

bool isRaytracingStage(Stage inStage)
{
    switch (inStage)
    {
    case Stage::RayGeneration:
    case Stage::Miss:
    case Stage::Intersection:
    case Stage::ClosestHit:
    case Stage::Callable:
    case Stage::AnyHit:
        return true;
    default:
        return false;
    }
}

const char* getStageName(Stage stage)
{
    switch(stage)
    {
#define PROFILE_STAGE(ID, NAME, ENUM) \
    case Stage::ID: return #NAME;

#include "slang-profile-defs.h"

    default:
        return nullptr;
    }

}

void printDiagnosticArg(StringBuilder& sb, Stage val)
{
    sb << getStageName(val);
}

void printDiagnosticArg(StringBuilder& sb, ProfileVersion val)
{
    sb << Profile(val).getName();
}


}