diff options
author | Marc Mutz <marc.mutz@kdab.com> | 2017-05-22 10:23:16 +0200 |
---|---|---|
committer | Marc Mutz <marc.mutz@kdab.com> | 2017-05-22 08:50:05 +0000 |
commit | d3f1076d0a3b8b0f44250399ea325020bbe9a0fd (patch) | |
tree | 362585a9e1428ddb39eb839f2c01832551fc1c7d /src/gui/vulkan/qvulkanwindow.cpp | |
parent | 6ec3a972971a6a83b74f5ccbb24c7bb088a863d3 (diff) |
QVulkanWindow: use QVector, not QSet, for small int set
Apart from being more efficient to construct and test, for the
expected very small number of entries, the example code itself shows
that a sorted vector is much more useful than an unordered set.
Change-Id: Ic5e38df0176ac4be08eac6a89c2e1cabab2a9020
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/vulkan/qvulkanwindow.cpp')
-rw-r--r-- | src/gui/vulkan/qvulkanwindow.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index 82c157147c..a9f5bb41df 100644 --- a/src/gui/vulkan/qvulkanwindow.cpp +++ b/src/gui/vulkan/qvulkanwindow.cpp @@ -512,6 +512,7 @@ static struct { VkSampleCountFlagBits mask; int count; } qvk_sampleCounts[] = { + // keep this sorted by 'count' { VK_SAMPLE_COUNT_1_BIT, 1 }, { VK_SAMPLE_COUNT_2_BIT, 2 }, { VK_SAMPLE_COUNT_4_BIT, 4 }, @@ -523,7 +524,7 @@ static struct { /*! Returns the set of supported sample counts when using the physical device - selected by setPhysicalDeviceIndex(). + selected by setPhysicalDeviceIndex(), as a sorted vector. By default QVulkanWindow uses a sample count of 1. By calling setSampleCount() with a different value (2, 4, 8, ...) from the set returned by this @@ -533,10 +534,10 @@ static struct { \sa setSampleCount() */ -QSet<int> QVulkanWindow::supportedSampleCounts() +QVector<int> QVulkanWindow::supportedSampleCounts() { Q_D(const QVulkanWindow); - QSet<int> result; + QVector<int> result; availablePhysicalDevices(); @@ -555,7 +556,7 @@ QSet<int> QVulkanWindow::supportedSampleCounts() && (depth & qvk_sampleCounts[i].mask) && (stencil & qvk_sampleCounts[i].mask)) { - result.insert(qvk_sampleCounts[i].count); + result.append(qvk_sampleCounts[i].count); } } |