예제 #1
0
static void SetupVulkanEnvVariables()
{
#ifdef CODEXL_GRAPHICS
    gtASCIIString layerNameA = "CXLGraphicsServerVulkan" GDT_PROJECT_SUFFIX;
#else
    gtASCIIString layerNameA = "VulkanServer" GDT_PROJECT_SUFFIX;
#endif

    gtString layerName;
    layerName.fromASCIIString(layerNameA.asCharArray());

    gtASCIIString serverPath;
    GetModuleDirectory(serverPath);

    osEnvironmentVariable layerPath;
    layerPath._name = L"VK_LAYER_PATH";
    layerPath._value.fromASCIIString(serverPath.asCharArray());
    layerPath._value.append(L"Plugins");

    osEnvironmentVariable instanceLayerName;
    instanceLayerName._name =  L"VK_INSTANCE_LAYERS";
    instanceLayerName._value = layerName;

    osEnvironmentVariable deviceLayerName;
    deviceLayerName._name = L"VK_DEVICE_LAYERS";
    deviceLayerName._value = layerName;

    osSetCurrentProcessEnvVariable(layerPath);
    osSetCurrentProcessEnvVariable(instanceLayerName);
    osSetCurrentProcessEnvVariable(deviceLayerName);
}
예제 #2
0
//--------------------------------------------------------------------------
/// Setup Vulkan-specific environment variables.
/// This code needs to be called during tool initialization.
//--------------------------------------------------------------------------
void SetupVulkanEnvVariables()
{
#if ENABLE_VULKAN

    // Windows
#ifdef _WIN32

#ifdef _DEBUG
#ifdef X64
    gtString layerName = L"CXLGraphicsServerVulkan-x64-d";
#else
    gtString layerName = L"CXLGraphicsServerVulkan-d";
#endif
#else
#ifdef X64
    gtString layerName = L"CXLGraphicsServerVulkan-x64";
#else
    gtString layerName = L"CXLGraphicsServerVulkan";
#endif
#endif

    gtASCIIString serverPath;
    GetModuleDirectory(serverPath);

    // Set VK_LAYER_PATH equal to where our layer lives
    osEnvironmentVariable layerPath;
    layerPath._name = L"VK_LAYER_PATH";
    layerPath._value.fromASCIIString(serverPath.asCharArray());
    layerPath._value.append(L"Plugins");

    // Set VK_INSTANCE_LAYERS equal to our layer above
    osEnvironmentVariable instanceLayerName;
    instanceLayerName._name =  L"VK_INSTANCE_LAYERS";
    instanceLayerName._value = layerName;

    // Set VK_DEVICE_LAYERS equal to our layer above
    osEnvironmentVariable deviceLayerName;
    deviceLayerName._name = L"VK_DEVICE_LAYERS";
    deviceLayerName._value = layerName;

    // Setting these environment variables should register our server as a layer
    osSetCurrentProcessEnvVariable(layerPath);
    osSetCurrentProcessEnvVariable(instanceLayerName);
    osSetCurrentProcessEnvVariable(deviceLayerName);

    // Linux
#else

#endif

#endif
}