summaryrefslogtreecommitdiffstats
path: root/tools/gfx/nvapi/nvapi-util.cpp
blob: efb053c071121c224fb03ebe4c9b77be5d68e27e (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
#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);
}

} // namespace gfx