summaryrefslogtreecommitdiffstats
path: root/src/gui/rhi/qrhivulkan.cpp
diff options
context:
space:
mode:
authorBen Fletcher <ben.fletcher@me.com>2022-10-16 10:40:29 -0700
committerBen Fletcher <ben.fletcher@me.com>2022-10-18 22:17:15 +0000
commitfda5061abd5cef06d8ac649d927792fdc8d1d01f (patch)
treec82186f98f0f1dd8d352d51fa71ebff9dafa3454 /src/gui/rhi/qrhivulkan.cpp
parentf50f6a456aca6f0782eab2bf475d4f9c86a21f4c (diff)
RHI: Align setViewport behavior on Metal/Vulkan with OpenGL/D3D
Fixes to prevent crash on Metal/Vulkan when setViewport is called with no current graphics pipeline is set. This normalizes behavior across Metal/Vulkan/OpenGL/D3D. Change-Id: I8057e01005cfe89ea02a8415f06eaee0f27865fc Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'src/gui/rhi/qrhivulkan.cpp')
-rw-r--r--src/gui/rhi/qrhivulkan.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/gui/rhi/qrhivulkan.cpp b/src/gui/rhi/qrhivulkan.cpp
index a04b9e8e0a..05a67e82de 100644
--- a/src/gui/rhi/qrhivulkan.cpp
+++ b/src/gui/rhi/qrhivulkan.cpp
@@ -4946,7 +4946,9 @@ void QRhiVulkan::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport
cmd.cmd = QVkCommandBuffer::Command::SetViewport;
}
- if (!QRHI_RES(QVkGraphicsPipeline, cbD->currentGraphicsPipeline)->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor)) {
+ if (cbD->currentGraphicsPipeline
+ && !QRHI_RES(QVkGraphicsPipeline, cbD->currentGraphicsPipeline)
+ ->m_flags.testFlag(QRhiGraphicsPipeline::UsesScissor)) {
QVkCommandBuffer::Command &cmd(cbD->commands.get());
VkRect2D *s = &cmd.args.setScissor.scissor;
s->offset.x = int32_t(x);