summaryrefslogtreecommitdiff
path: root/engine/xe_device.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engine/xe_device.cpp')
-rwxr-xr-xengine/xe_device.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/engine/xe_device.cpp b/engine/xe_device.cpp
index d6d0713..f602e18 100755
--- a/engine/xe_device.cpp
+++ b/engine/xe_device.cpp
@@ -121,6 +121,7 @@ void Device::pickPhysicalDevice() {
for (const auto &device : devices) {
if (isDeviceSuitable(device)) {
physicalDevice = device;
+ msaaSamples = getMaxUsableSampleCount();
break;
}
}
@@ -133,6 +134,21 @@ void Device::pickPhysicalDevice() {
std::cout << "Physical device: " << properties.deviceName << std::endl;
}
+VkSampleCountFlagBits Device::getMaxUsableSampleCount() {
+ VkPhysicalDeviceProperties physicalDeviceProperties;
+ vkGetPhysicalDeviceProperties(physicalDevice, &physicalDeviceProperties);
+
+ VkSampleCountFlags counts = physicalDeviceProperties.limits.framebufferColorSampleCounts & physicalDeviceProperties.limits.framebufferDepthSampleCounts;
+ if (counts & VK_SAMPLE_COUNT_64_BIT) { return VK_SAMPLE_COUNT_64_BIT; }
+ if (counts & VK_SAMPLE_COUNT_32_BIT) { return VK_SAMPLE_COUNT_32_BIT; }
+ if (counts & VK_SAMPLE_COUNT_16_BIT) { return VK_SAMPLE_COUNT_16_BIT; }
+ if (counts & VK_SAMPLE_COUNT_8_BIT) { return VK_SAMPLE_COUNT_8_BIT; }
+ if (counts & VK_SAMPLE_COUNT_4_BIT) { return VK_SAMPLE_COUNT_4_BIT; }
+ if (counts & VK_SAMPLE_COUNT_2_BIT) { return VK_SAMPLE_COUNT_2_BIT; }
+
+ return VK_SAMPLE_COUNT_1_BIT;
+}
+
void Device::createLogicalDevice() {
QueueFamilyIndices indices = findQueueFamilies(physicalDevice);