]> O.S.I.I.S - jp/vkhelpers.git/commitdiff
layers params for vkh_app_create
authorJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 31 Aug 2019 22:22:08 +0000 (00:22 +0200)
committerJean-Philippe Bruyère <jp_bruyere@hotmail.com>
Sat, 31 Aug 2019 22:22:08 +0000 (00:22 +0200)
CMakeLists.txt
include/vkh.h
src/vkh_app.c

index 93add6c8578e69a236a90acf7e870b344bc1c1fe..a0db23be833384ae483c91570589c198e0676cdb 100644 (file)
@@ -26,7 +26,11 @@ if (NOT VULKAN_SDK)
        set(VULKAN_SDK "$ENV{VULKAN_SDK}" CACHE STRING "LunarG Vulkan SDK path")
        if (VULKAN_SDK)
                        set(ENV{VULKAN_SDK} ${VULKAN_SDK})
-                       SET(ENV{VK_LAYER_PATH} "${VULKAN_SDK}/etc/explicit_layer.d")
+                       SET(vulkanSdkLayerPath "${VULKAN_SDK}/etc/vulkan/explicit_layer.d")
+                       IF (NOT EXISTS "${vulkanSdkLayerPath}")
+                               SET(vulkanSdkLayerPath "${VULKAN_SDK}/etc/explicit_layer.d")
+                       endif ()
+                       SET(ENV{VK_LAYER_PATH} "${vulkanSdkLayerPath}")
                        link_directories("${VULKAN_SDK}/lib")
        endif ()
 endif ()
index 9c665423cb24889ff469d2f349749a0300e02d00..44773f37b4553f6d63791d9165b534b853428aea 100644 (file)
@@ -64,7 +64,7 @@ typedef struct _vkh_presenter_t* VkhPresenter;
 /*************
  * VkhApp    *
  *************/
-VkhApp              vkh_app_create      (const char* app_name, uint32_t ext_count, const char* extentions[]);
+VkhApp              vkh_app_create      (const char* app_name, uint32_t enabledLayersCount, const char *enabledLayers[], uint32_t ext_count, const char* extentions[]);
 void                vkh_app_destroy     (VkhApp app);
 VkInstance          vkh_app_get_inst    (VkhApp app);
 VkPhysicalDevice    vkh_app_select_phy  (VkhApp app, VkPhysicalDeviceType preferedPhyType);
index 50388cef2f1b8b7fd9fb95be8104d63beab575eb..bb378f129a41ccc84199b72437f419755b8b4992 100644 (file)
@@ -25,7 +25,7 @@
 #define ENGINE_NAME     "vkhelpers"
 #define ENGINE_VERSION  1
 
-VkhApp vkh_app_create (const char* app_name, uint32_t ext_count, const char* extentions[]) {
+VkhApp vkh_app_create (const char* app_name, uint32_t enabledLayersCount, const char* enabledLayers[], uint32_t ext_count, const char* extentions[]) {
     VkhApp app = (VkhApp)malloc(sizeof(vkh_app_t));
 
     VkApplicationInfo infos = { .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
@@ -34,13 +34,6 @@ VkhApp vkh_app_create (const char* app_name, uint32_t ext_count, const char* ext
                                 .pEngineName = ENGINE_NAME,
                                 .engineVersion = ENGINE_VERSION,
                                 .apiVersion = VK_API_VERSION_1_0};
-#if VKH_USE_VALIDATION
-    const uint32_t enabledLayersCount = 1;
-    const char* enabledLayers[] = {"VK_LAYER_KHRONOS_validation"};
-#else
-    const uint32_t enabledLayersCount = 0;
-    const char* enabledLayers[] = {NULL};
-#endif
 
     VkInstanceCreateInfo inst_info = { .sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
                                        .pApplicationInfo = &infos,
@@ -69,14 +62,14 @@ VkhPhyInfo* vkh_app_get_phyinfos (VkhApp app, uint32_t* count, VkSurfaceKHR surf
     VK_CHECK_RESULT(vkEnumeratePhysicalDevices (app->inst, count, phyDevices));
     VkhPhyInfo* infos = (VkhPhyInfo*)malloc((*count) * sizeof(VkhPhyInfo));
 
-    for (int i=0; i<(*count); i++)
+    for (uint32_t i=0; i<(*count); i++)
         infos[i] = vkh_phyinfo_create (phyDevices[i], surface);
 
     return infos;
 }
 
 void vkh_app_free_phyinfos (uint32_t count, VkhPhyInfo* infos) {
-    for (int i=0; i<count; i++)
+    for (uint32_t i=0; i<count; i++)
         vkh_phyinfo_destroy (infos[i]);
     free (infos);
 }