Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ add to that function.
[,c++]
----
for (const auto& device : devices) {
physicalDevice = std::make_unique<vk::raii::PhysicalDevice>(device);
physicalDevice = device;
break;
}
----
Expand Down Expand Up @@ -93,14 +93,15 @@ function would look like this:

[,c++]
----
bool isDeviceSuitable(VkPhysicalDevice device) {
auto deviceProperties = device.getProperties();
auto deviceFeatures = device.getFeatures();
if (deviceProperties.deviceType == vk::PhysicalDeviceType::eDiscreteGpu &&
deviceFeatures.geometryShader) {
physicalDevice = std::make_unique<vk::raii::PhysicalDevice>(device);
break;
}
bool isDeviceSuitable(vk::raii::PhysicalDevice physicalDevice) {
auto deviceProperties = physicalDevice.getProperties();
auto deviceFeatures = physicalDevice.getFeatures();

if (deviceProperties.deviceType == vk::PhysicalDeviceType::eDiscreteGpu && deviceFeatures.geometryShader) {
return true;
}

return false;
}
----

Expand All @@ -117,7 +118,7 @@ something like that as follows:
...

void pickPhysicalDevice() {
auto devices = vk::raii::PhysicalDevices( *instance );
auto devices = vk::raii::PhysicalDevices( instance );
if (devices.empty()) {
throw std::runtime_error( "failed to find GPUs with Vulkan support!" );
}
Expand Down Expand Up @@ -146,7 +147,7 @@ void pickPhysicalDevice() {

// Check if the best candidate is suitable at all
if (candidates.rbegin()->first > 0) {
physicalDevice = std::make_unique<vk::raii::PhysicalDevice>(candidates.rbegin()->second);
physicalDevice = candidates.rbegin()->second;
} else {
throw std::runtime_error("failed to find a suitable GPU!");
}
Expand Down Expand Up @@ -218,9 +219,9 @@ could look like this:

[,c++]
----
uint32_t findQueueFamilies(VkPhysicalDevice device) {
uint32_t findQueueFamilies(vk::raii::PhysicalDevice physicalDevice) {
// find the index of the first queue family that supports graphics
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice->getQueueFamilyProperties();
std::vector<vk::QueueFamilyProperties> queueFamilyProperties = physicalDevice.getQueueFamilyProperties();

// get the first index into queueFamilyProperties which supports graphics
auto graphicsQueueFamilyProperty =
Expand Down
Loading