diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-08-27 12:49:38 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2019-08-29 10:23:15 +0200 |
commit | 2602209f545ea3873f0dc880c258669a508d283a (patch) | |
tree | c6bd770239f740af72161bac3c487edd122dd193 /tests/manual | |
parent | 0077e0f88cd3dfa59779ef121e4010f309f2ff7a (diff) |
rhi: vulkan: Introduce secondary command buffer usage
As an option. Must opt in via setting ExternalContentsInPass in
the flags for beginFrame(). It is somewhat unfortunate to require
declaring this up front, but forcing using secondary command buffers
always, even though beginExternal() may not be used in many applications,
would be an overkill.
Change-Id: I8d52bcab40c96f89f140c4c7877b6c459925e3c7
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r-- | tests/manual/rhi/shared/examplefw.h | 3 | ||||
-rw-r--r-- | tests/manual/rhi/triquadcube/triquadcube.cpp | 5 |
2 files changed, 7 insertions, 1 deletions
diff --git a/tests/manual/rhi/shared/examplefw.h b/tests/manual/rhi/shared/examplefw.h index 450aa172c2..1a29ef5f7e 100644 --- a/tests/manual/rhi/shared/examplefw.h +++ b/tests/manual/rhi/shared/examplefw.h @@ -124,6 +124,7 @@ QString graphicsApiName() QRhi::Flags rhiFlags = QRhi::EnableDebugMarkers; int sampleCount = 1; QRhiSwapChain::Flags scFlags = 0; +QRhi::BeginFrameFlags beginFrameFlags = 0; QRhi::EndFrameFlags endFrameFlags = 0; class Window : public QWindow @@ -375,7 +376,7 @@ void Window::render() // GPU/present, and that's what throttles the thread to the refresh rate. // (except for OpenGL where it happens either in endFrame or somewhere else // depending on the GL implementation) - QRhi::FrameOpResult r = m_r->beginFrame(m_sc); + QRhi::FrameOpResult r = m_r->beginFrame(m_sc, beginFrameFlags); if (r == QRhi::FrameOpSwapChainOutOfDate) { resizeSwapChain(); if (!m_hasSwapChain) diff --git a/tests/manual/rhi/triquadcube/triquadcube.cpp b/tests/manual/rhi/triquadcube/triquadcube.cpp index 4165e96127..76dbe558ab 100644 --- a/tests/manual/rhi/triquadcube/triquadcube.cpp +++ b/tests/manual/rhi/triquadcube/triquadcube.cpp @@ -71,6 +71,7 @@ //#define READBACK_SWAPCHAIN //#define NO_VSYNC //#define USE_MIN_SWAPCHAIN_BUFFERS +//#define DECLARE_EXT_CONTENTS struct { TriangleRenderer triRenderer; @@ -118,6 +119,10 @@ void preInit() scFlags |= QRhiSwapChain::MinimalBufferCount; #endif +#ifdef DECLARE_EXT_CONTENTS + beginFrameFlags |= QRhi::ExternalContentsInPass; +#endif + // For OpenGL some of these are incorporated into the QSurfaceFormat by // examplefw.h after returning from here as that is out of the RHI's control. } |