summaryrefslogtreecommitdiffstats
path: root/tools/gfx/nvapi/nvapi-util.cpp
blob: 63bcc65fce76a178907e584884880eb3017bec31 (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
#include "nvapi-util.h"

#include "nvapi-include.h"

namespace gfx {

static SlangResult g_initStatus = SLANG_E_UNINITIALIZED;

/* static */SlangResult NVAPIUtil::initialize()
{
#ifdef GFX_NVAPI
    if (g_initStatus == SLANG_E_UNINITIALIZED)
    {
        NvAPI_Status ret = NVAPI_OK;
        ret = NvAPI_Initialize();
        g_initStatus = (ret == NVAPI_OK) ? SLANG_OK : SLANG_E_NOT_AVAILABLE;
    }
#else
    g_initStatus = SLANG_E_NOT_AVAILABLE;
#endif

    return g_initStatus;
}

/* static */bool NVAPIUtil::isAvailable()
{
    return SLANG_SUCCEEDED(g_initStatus);
}

} // gfx