diff --git a/examples/vulkan/hellovulkancubes/renderer.cpp b/examples/vulkan/hellovulkancubes/renderer.cpp index 96ae6020a7f..3b837d85d45 100644 --- a/examples/vulkan/hellovulkancubes/renderer.cpp +++ b/examples/vulkan/hellovulkancubes/renderer.cpp @@ -97,7 +97,7 @@ Renderer::Renderer(VulkanWindow *w, int initialCount) void Renderer::preInitResources() { - QSet sampleCounts = m_window->supportedSampleCounts(); + const QVector sampleCounts = m_window->supportedSampleCounts(); if (DBG) qDebug() << "Supported sample counts:" << sampleCounts; if (sampleCounts.contains(4)) { diff --git a/examples/vulkan/hellovulkanwidget/hellovulkanwidget.cpp b/examples/vulkan/hellovulkanwidget/hellovulkanwidget.cpp index 78de338f1f9..81daa9bb96e 100644 --- a/examples/vulkan/hellovulkanwidget/hellovulkanwidget.cpp +++ b/examples/vulkan/hellovulkanwidget/hellovulkanwidget.cpp @@ -170,8 +170,7 @@ void VulkanRenderer::initResources() m_window->colorFormat(), m_window->depthStencilFormat()); info += QStringLiteral("Supported sample counts:"); - QList sampleCounts = m_window->supportedSampleCounts().toList(); - std::sort(sampleCounts.begin(), sampleCounts.end()); + const QVector sampleCounts = m_window->supportedSampleCounts(); for (int count : sampleCounts) info += QLatin1Char(' ') + QString::number(count); info += QLatin1Char('\n'); diff --git a/examples/vulkan/shared/trianglerenderer.cpp b/examples/vulkan/shared/trianglerenderer.cpp index a0800080a06..7327c5a7062 100644 --- a/examples/vulkan/shared/trianglerenderer.cpp +++ b/examples/vulkan/shared/trianglerenderer.cpp @@ -73,7 +73,7 @@ TriangleRenderer::TriangleRenderer(QVulkanWindow *w, bool msaa) : m_window(w) { if (msaa) { - QSet counts = w->supportedSampleCounts(); + const QVector counts = w->supportedSampleCounts(); qDebug() << "Supported sample counts:" << counts; for (int s = 16; s >= 4; s /= 2) { if (counts.contains(s)) { diff --git a/src/gui/vulkan/qvulkanwindow.cpp b/src/gui/vulkan/qvulkanwindow.cpp index 82c157147c1..a9f5bb41df4 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 QVulkanWindow::supportedSampleCounts() +QVector QVulkanWindow::supportedSampleCounts() { Q_D(const QVulkanWindow); - QSet result; + QVector result; availablePhysicalDevices(); @@ -555,7 +556,7 @@ QSet QVulkanWindow::supportedSampleCounts() && (depth & qvk_sampleCounts[i].mask) && (stencil & qvk_sampleCounts[i].mask)) { - result.insert(qvk_sampleCounts[i].count); + result.append(qvk_sampleCounts[i].count); } } diff --git a/src/gui/vulkan/qvulkanwindow.h b/src/gui/vulkan/qvulkanwindow.h index c32c40d459f..bbeba156039 100644 --- a/src/gui/vulkan/qvulkanwindow.h +++ b/src/gui/vulkan/qvulkanwindow.h @@ -96,7 +96,7 @@ public: void setPreferredColorFormats(const QVector &formats); - QSet supportedSampleCounts(); + QVector supportedSampleCounts(); void setSampleCount(int sampleCount); bool isValid() const;