39 lines
1.3 KiB
C++
39 lines
1.3 KiB
C++
#include "physicaldevice.h"
|
|
|
|
Engine::PhysicalDevice::PhysicalDevice(
|
|
VkPhysicalDevice raw,
|
|
const QueueFamilyIndices& indices,
|
|
const SwapChainSupportDetails& swapChainSupport):
|
|
indices(indices),
|
|
swapChainSupport(swapChainSupport),
|
|
vk(raw)
|
|
{}
|
|
|
|
bool Engine::PhysicalDevice::checkDeviceExtensionSupport(VkPhysicalDevice device, std::set<std::string> requiredExtensions) {
|
|
uint32_t extensionCount;
|
|
vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, nullptr);
|
|
|
|
std::vector<VkExtensionProperties> availableExtensions(extensionCount);
|
|
vkEnumerateDeviceExtensionProperties(device, nullptr, &extensionCount, availableExtensions.data());
|
|
|
|
for (const auto& extension : availableExtensions)
|
|
requiredExtensions.erase(extension.extensionName);
|
|
|
|
if (!requiredExtensions.empty()) {
|
|
// std::cout << "Available Extensions: " << std::endl;
|
|
// for (const auto& ext : availableExtensions)
|
|
// std::cout << ext.extensionName << std::endl;
|
|
|
|
|
|
std::cout << "Missing Extensions: " << std::endl;
|
|
for (const auto& ext : requiredExtensions)
|
|
std::cout << ext << std::endl;
|
|
}
|
|
|
|
return requiredExtensions.empty();
|
|
}
|
|
|
|
void Engine::PhysicalDevice::recreateSwapChainSupportDetails(const Surface* surface) {
|
|
swapChainSupport = surface->querySwapChainSupport(vk);
|
|
}
|