Skip to content

Commit

Permalink
Removing a fixed structure VkPhysicalDeviceFeatures, getting this str…
Browse files Browse the repository at this point in the history
…ucture using vkGetPhysicalDeviceFeatures
  • Loading branch information
tx00100xt committed Jun 5, 2022
1 parent 8205ea5 commit 40bfc9a
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 12 deletions.
8 changes: 5 additions & 3 deletions SamTFE/Sources/Engine/Graphics/Gfx_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ void SvkMain::Reset_Vulkan()
gl_VkPhysDevice = VK_NULL_HANDLE;
gl_VkPhMemoryProperties = {};
gl_VkPhProperties = {};
gl_VkPhFeatures = {};
gl_VkPhFeatures[0] = {};
gl_VkPhFeatures[1] = {};
gl_VkPhSurfCapabilities = {};

gl_VkQueueFamGraphics = 0;
Expand Down Expand Up @@ -798,8 +799,9 @@ BOOL SvkMain::CreateDevice()
VkDeviceCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
createInfo.queueCreateInfoCount = (uint32_t)queueInfos.Count();
createInfo.pQueueCreateInfos = &queueInfos[0];
createInfo.pEnabledFeatures = &features;
createInfo.pQueueCreateInfos = &queueInfos[0];
//createInfo.pEnabledFeatures = &features;
createInfo.pEnabledFeatures = &gl_VkPhFeatures[gl_vkNumDev];
createInfo.enabledExtensionCount = (uint32_t)gl_VkPhysDeviceExtensions.Count();
createInfo.ppEnabledExtensionNames = &gl_VkPhysDeviceExtensions[0];
#if SVK_ENABLE_VALIDATION
Expand Down
3 changes: 2 additions & 1 deletion SamTFE/Sources/Engine/Graphics/Vulkan/SvkMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class SvkMain
VkPhysicalDevice gl_VkPhysDevice;
VkPhysicalDeviceMemoryProperties gl_VkPhMemoryProperties;
VkPhysicalDeviceProperties gl_VkPhProperties;
VkPhysicalDeviceFeatures gl_VkPhFeatures;
VkPhysicalDeviceFeatures gl_VkPhFeatures[2];
INDEX gl_vkNumDev;
VkSurfaceCapabilitiesKHR gl_VkPhSurfCapabilities;
CStaticArray<VkSurfaceFormatKHR> gl_VkPhSurfFormats;
CStaticArray<VkPresentModeKHR> gl_VkPhSurfPresentModes;
Expand Down
11 changes: 9 additions & 2 deletions SamTFE/Sources/Engine/Graphics/Vulkan/SvkUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ BOOL SvkMain::PickPhysicalDevice()
VK_CHECKERROR(r)
ASSERT(physDeviceCount > 0);

// vulkan devices count
if (physDeviceCount > 2) {
physDeviceCount = 2;
}

CPrintF("Vulkan: Physical Devices Count: %d\n", physDeviceCount);

for (uint32_t i = 0; i < physDeviceCount; i++)
Expand All @@ -361,7 +366,7 @@ BOOL SvkMain::PickPhysicalDevice()
uint32_t formatsCount = 0, presentModesCount = 0;

gl_VkPhysDevice = physDevice;
vkGetPhysicalDeviceFeatures(physDevice, &gl_VkPhFeatures);
vkGetPhysicalDeviceFeatures(physDevice, &gl_VkPhFeatures[i]);
vkGetPhysicalDeviceMemoryProperties(physDevice, &gl_VkPhMemoryProperties);
vkGetPhysicalDeviceProperties(physDevice, &gl_VkPhProperties);
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physDevice, gl_VkSurface, &gl_VkPhSurfCapabilities);
Expand Down Expand Up @@ -461,7 +466,9 @@ BOOL SvkMain::PickPhysicalDevice()
gl_VkMaxSampleCount = VK_SAMPLE_COUNT_1_BIT;
CPrintF("Vulkan: VK_SAMPLE_COUNT_2_BIT\n");
}


gl_vkNumDev = i;
CPrintF("Vulkan: Physical Device Number: %d\n", i);
return TRUE;
}
}
Expand Down
8 changes: 5 additions & 3 deletions SamTSE/Sources/Engine/Graphics/Gfx_Vulkan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -439,7 +439,8 @@ void SvkMain::Reset_Vulkan()
gl_VkPhysDevice = VK_NULL_HANDLE;
gl_VkPhMemoryProperties = {};
gl_VkPhProperties = {};
gl_VkPhFeatures = {};
gl_VkPhFeatures[0] = {};
gl_VkPhFeatures[1] = {};
gl_VkPhSurfCapabilities = {};

gl_VkQueueFamGraphics = 0;
Expand Down Expand Up @@ -798,8 +799,9 @@ BOOL SvkMain::CreateDevice()
VkDeviceCreateInfo createInfo = {};
createInfo.sType = VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO;
createInfo.queueCreateInfoCount = (uint32_t)queueInfos.Count();
createInfo.pQueueCreateInfos = &queueInfos[0];
createInfo.pEnabledFeatures = &features;
createInfo.pQueueCreateInfos = &queueInfos[0];
//createInfo.pEnabledFeatures = &features;
createInfo.pEnabledFeatures = &gl_VkPhFeatures[gl_vkNumDev];
createInfo.enabledExtensionCount = (uint32_t)gl_VkPhysDeviceExtensions.Count();
createInfo.ppEnabledExtensionNames = &gl_VkPhysDeviceExtensions[0];
#if SVK_ENABLE_VALIDATION
Expand Down
3 changes: 2 additions & 1 deletion SamTSE/Sources/Engine/Graphics/Vulkan/SvkMain.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ class SvkMain
VkPhysicalDevice gl_VkPhysDevice;
VkPhysicalDeviceMemoryProperties gl_VkPhMemoryProperties;
VkPhysicalDeviceProperties gl_VkPhProperties;
VkPhysicalDeviceFeatures gl_VkPhFeatures;
VkPhysicalDeviceFeatures gl_VkPhFeatures[2];
INDEX gl_vkNumDev;
VkSurfaceCapabilitiesKHR gl_VkPhSurfCapabilities;
CStaticArray<VkSurfaceFormatKHR> gl_VkPhSurfFormats;
CStaticArray<VkPresentModeKHR> gl_VkPhSurfPresentModes;
Expand Down
11 changes: 9 additions & 2 deletions SamTSE/Sources/Engine/Graphics/Vulkan/SvkUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,6 +347,11 @@ BOOL SvkMain::PickPhysicalDevice()
VK_CHECKERROR(r)
ASSERT(physDeviceCount > 0);

// vulkan devices count
if (physDeviceCount > 2) {
physDeviceCount = 2;
}

CPrintF("Vulkan: Physical Devices Count: %d\n", physDeviceCount);

for (uint32_t i = 0; i < physDeviceCount; i++)
Expand All @@ -361,7 +366,7 @@ BOOL SvkMain::PickPhysicalDevice()
uint32_t formatsCount = 0, presentModesCount = 0;

gl_VkPhysDevice = physDevice;
vkGetPhysicalDeviceFeatures(physDevice, &gl_VkPhFeatures);
vkGetPhysicalDeviceFeatures(physDevice, &gl_VkPhFeatures[i]);
vkGetPhysicalDeviceMemoryProperties(physDevice, &gl_VkPhMemoryProperties);
vkGetPhysicalDeviceProperties(physDevice, &gl_VkPhProperties);
vkGetPhysicalDeviceSurfaceCapabilitiesKHR(physDevice, gl_VkSurface, &gl_VkPhSurfCapabilities);
Expand Down Expand Up @@ -461,7 +466,9 @@ BOOL SvkMain::PickPhysicalDevice()
gl_VkMaxSampleCount = VK_SAMPLE_COUNT_1_BIT;
CPrintF("Vulkan: VK_SAMPLE_COUNT_2_BIT\n");
}


gl_vkNumDev = i;
CPrintF("Vulkan: Physical Device Number: %d\n", i);
return TRUE;
}
}
Expand Down

0 comments on commit 40bfc9a

Please sign in to comment.