qt: Fix compiling with Vulkan support unavailable
This commit is contained in:
@@ -280,6 +280,11 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
ui->actionOpenGL_3_0_Core->setVisible(false);
|
ui->actionOpenGL_3_0_Core->setVisible(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if !QT_CONFIG(vulkan)
|
||||||
|
if (vid_api == 4) vid_api = 0;
|
||||||
|
ui->actionVulkan->setVisible(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
QActionGroup* actGroup = nullptr;
|
QActionGroup* actGroup = nullptr;
|
||||||
|
|
||||||
actGroup = new QActionGroup(this);
|
actGroup = new QActionGroup(this);
|
||||||
|
@@ -245,6 +245,7 @@ void
|
|||||||
RendererStack::createRenderer(Renderer renderer)
|
RendererStack::createRenderer(Renderer renderer)
|
||||||
{
|
{
|
||||||
switch (renderer) {
|
switch (renderer) {
|
||||||
|
default:
|
||||||
case Renderer::Software:
|
case Renderer::Software:
|
||||||
{
|
{
|
||||||
auto sw = new SoftwareRenderer(this);
|
auto sw = new SoftwareRenderer(this);
|
||||||
@@ -296,6 +297,7 @@ RendererStack::createRenderer(Renderer renderer)
|
|||||||
current.reset(this->createWindowContainer(hw, this));
|
current.reset(this->createWindowContainer(hw, this));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#if QT_CONFIG(vulkan)
|
||||||
case Renderer::Vulkan:
|
case Renderer::Vulkan:
|
||||||
{
|
{
|
||||||
this->createWinId();
|
this->createWinId();
|
||||||
@@ -331,6 +333,7 @@ RendererStack::createRenderer(Renderer renderer)
|
|||||||
current.reset(this->createWindowContainer(hw, this));
|
current.reset(this->createWindowContainer(hw, this));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
current->setFocusPolicy(Qt::NoFocus);
|
current->setFocusPolicy(Qt::NoFocus);
|
||||||
|
@@ -34,6 +34,7 @@
|
|||||||
#include <QCoreApplication>
|
#include <QCoreApplication>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
#include "qt_vulkanrenderer.hpp"
|
#include "qt_vulkanrenderer.hpp"
|
||||||
|
#if QT_CONFIG(vulkan)
|
||||||
#include <QVulkanFunctions>
|
#include <QVulkanFunctions>
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
@@ -1003,3 +1004,4 @@ void VulkanRenderer2::startNextFrame()
|
|||||||
m_window->frameReady();
|
m_window->frameReady();
|
||||||
m_window->requestUpdate(); // render continuously, throttled by the presentation rate
|
m_window->requestUpdate(); // render continuously, throttled by the presentation rate
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include <QVulkanWindow>
|
#include <QVulkanWindow>
|
||||||
#include <QImage>
|
#include <QImage>
|
||||||
|
|
||||||
|
#if QT_CONFIG(vulkan)
|
||||||
#include "qt_vulkanwindowrenderer.hpp"
|
#include "qt_vulkanwindowrenderer.hpp"
|
||||||
|
|
||||||
class VulkanRenderer2 : public QVulkanWindowRenderer
|
class VulkanRenderer2 : public QVulkanWindowRenderer
|
||||||
@@ -91,3 +92,4 @@ private:
|
|||||||
QMatrix4x4 m_proj;
|
QMatrix4x4 m_proj;
|
||||||
float m_rotation = 0.0f;
|
float m_rotation = 0.0f;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
@@ -5,6 +5,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QWindow>
|
#include <QWindow>
|
||||||
|
|
||||||
|
#if QT_CONFIG(vulkan)
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
|
||||||
@@ -847,3 +848,4 @@ std::vector<std::tuple<uint8_t *, std::atomic_flag *>> VulkanWindowRenderer::get
|
|||||||
{
|
{
|
||||||
return std::vector{std::make_tuple((uint8_t*)renderer->mappedPtr, &this->buf_usage[0])};
|
return std::vector{std::make_tuple((uint8_t*)renderer->mappedPtr, &this->buf_usage[0])};
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
#include <QVulkanWindow>
|
#include <QVulkanWindow>
|
||||||
|
|
||||||
|
#if QT_CONFIG(vulkan)
|
||||||
#include "qt_renderercommon.hpp"
|
#include "qt_renderercommon.hpp"
|
||||||
#include "qt_vulkanrenderer.hpp"
|
#include "qt_vulkanrenderer.hpp"
|
||||||
|
|
||||||
@@ -33,5 +34,6 @@ private:
|
|||||||
|
|
||||||
VulkanRenderer2* renderer;
|
VulkanRenderer2* renderer;
|
||||||
};
|
};
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif // VULKANWINDOWRENDERER_HPP
|
#endif // VULKANWINDOWRENDERER_HPP
|
||||||
|
Reference in New Issue
Block a user