![]() |
Qt 6.x
The Qt SDK
|
#include <qrhigles2_p.h>
Public Member Functions | |
QGles2SwapChain (QRhiImplementation *rhi) | |
~QGles2SwapChain () | |
void | destroy () override |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
QRhiCommandBuffer * | currentFrameCommandBuffer () override |
QRhiRenderTarget * | currentFrameRenderTarget () override |
QRhiRenderTarget * | currentFrameRenderTarget (StereoTargetBuffer targetBuffer) override |
QSize | surfacePixelSize () override |
bool | isFormatSupported (Format f) override |
QRhiRenderPassDescriptor * | newCompatibleRenderPassDescriptor () override |
bool | createOrResize () override |
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size of the targeted surface. | |
void | initSwapChainRenderTarget (QGles2SwapChainRenderTarget *rt) |
![]() | |
QRhiResource::Type | resourceType () const override |
QWindow * | window () const |
void | setWindow (QWindow *window) |
Sets the window. | |
QRhiSwapChainProxyData | proxyData () const |
void | setProxyData (const QRhiSwapChainProxyData &d) |
Sets the proxy data d. | |
Flags | flags () const |
void | setFlags (Flags f) |
Sets the flags f. | |
Format | format () const |
void | setFormat (Format f) |
Sets the format f. | |
QRhiRenderBuffer * | depthStencil () const |
void | setDepthStencil (QRhiRenderBuffer *ds) |
Sets the renderbuffer ds for use as a depth-stencil buffer. | |
int | sampleCount () const |
void | setSampleCount (int samples) |
Sets the sample count. | |
QRhiRenderPassDescriptor * | renderPassDescriptor () const |
void | setRenderPassDescriptor (QRhiRenderPassDescriptor *desc) |
Associates with the QRhiRenderPassDescriptor desc. | |
QSize | currentPixelSize () const |
virtual QRhiCommandBuffer * | currentFrameCommandBuffer ()=0 |
virtual QRhiRenderTarget * | currentFrameRenderTarget ()=0 |
virtual QRhiRenderTarget * | currentFrameRenderTarget (StereoTargetBuffer targetBuffer) |
virtual QSize | surfacePixelSize ()=0 |
virtual bool | isFormatSupported (Format f)=0 |
virtual QRhiRenderPassDescriptor * | newCompatibleRenderPassDescriptor ()=0 |
virtual bool | createOrResize ()=0 |
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size of the targeted surface. | |
virtual QRhiSwapChainHdrInfo | hdrInfo () |
\variable QRhiSwapChainHdrInfo::isHardCodedDefaults | |
![]() | |
virtual | ~QRhiResource () |
Destructor. | |
virtual Type | resourceType () const =0 |
virtual void | destroy ()=0 |
Releases (or requests deferred releasing of) the underlying native graphics resources. | |
void | deleteLater () |
When called without a frame being recorded, this function is equivalent to deleting the object. | |
QByteArray | name () const |
void | setName (const QByteArray &name) |
Sets a name for the object. | |
quint64 | globalResourceId () const |
QRhi * | rhi () const |
Public Attributes | |
QSurface * | surface = nullptr |
QSize | pixelSize |
QGles2SwapChainRenderTarget | rt |
QGles2SwapChainRenderTarget | rtLeft |
QGles2SwapChainRenderTarget | rtRight |
QGles2CommandBuffer | cb |
int | frameCount = 0 |
Definition at line 703 of file qrhigles2_p.h.
QGles2SwapChain::QGles2SwapChain | ( | QRhiImplementation * | rhi | ) |
Definition at line 6112 of file qrhigles2.cpp.
QGles2SwapChain::~QGles2SwapChain | ( | ) |
Definition at line 6121 of file qrhigles2.cpp.
References destroy().
|
overridevirtual |
Creates the swapchain if not already done and resizes the swapchain buffers to match the current size of the targeted surface.
Call this whenever the size of the target surface is different than before.
true
when successful, false
when a graphics operation failed. Regardless of the return value, calling destroy() is always safe. Implements QRhiSwapChain.
Definition at line 6184 of file qrhigles2.cpp.
References QRhiRenderBuffer::create(), QGles2SwapChainRenderTarget::d, destroy(), QRhiRenderBuffer::flags(), QWindow::format(), frameCount, initSwapChainRenderTarget(), QRhiSwapChain::LeftBuffer, QRhiSwapChain::m_currentPixelSize, QRhiSwapChain::m_depthStencil, QRhiSwapChain::m_window, QRhiRenderBuffer::pixelSize(), pixelSize, QRHI_RES_RHI, QRhiSwapChain::RightBuffer, rt, rtLeft, rtRight, QRhiRenderBuffer::setPixelSize(), QSurfaceFormat::stereo(), QGles2RenderTargetData::stereoTarget, surface, surfacePixelSize(), and QRhiRenderBuffer::UsedWithSwapChainOnly.
|
overridevirtual |
Implements QRhiSwapChain.
Definition at line 6133 of file qrhigles2.cpp.
References cb.
|
overridevirtual |
Implements QRhiSwapChain.
Definition at line 6138 of file qrhigles2.cpp.
References rt.
|
overridevirtual |
When stereoscopic rendering is not supported, the return value will be the default target. For the time being the only backend and 3D API where traditional stereoscopic rendering is supported is OpenGL (excluding OpenGL ES), in combination with \l QSurfaceFormat::StereoBuffers, assuming it is supported by the graphics and display driver stack at run time. All other backends are going to return the default render target from this overload.
Reimplemented from QRhiSwapChain.
Definition at line 6143 of file qrhigles2.cpp.
References QGles2SwapChainRenderTarget::d, QGles2RenderTargetData::isValid(), QRhiSwapChain::LeftBuffer, QRhiSwapChain::RightBuffer, rt, rtLeft, and rtRight.
|
overridevirtual |
Releases (or requests deferred releasing of) the underlying native graphics resources.
Safe to call multiple times, subsequent invocations will be a no-op then.
Once destroy() is called, the QRhiResource instance can be reused, by calling create()
again. That will then result in creating new native graphics resources underneath.
The QRhiResource destructor also performs the same task, so calling this function is not necessary before deleting a QRhiResource.
Implements QRhiResource.
Definition at line 6126 of file qrhigles2.cpp.
References QRHI_RES_RHI.
Referenced by ~QGles2SwapChain(), and createOrResize().
void QGles2SwapChain::initSwapChainRenderTarget | ( | QGles2SwapChainRenderTarget * | rt | ) |
Definition at line 6172 of file qrhigles2.cpp.
References QGles2RenderTargetData::colorAttCount, QGles2SwapChainRenderTarget::d, QGles2RenderTargetData::dpr, QGles2RenderTargetData::dsAttCount, QRhiSwapChain::m_depthStencil, QRhiSwapChain::m_flags, QRhiSwapChain::m_renderPassDesc, QRhiSwapChain::m_sampleCount, QRhiSwapChain::m_window, QGles2RenderTargetData::pixelSize, pixelSize, qBound(), QRHI_RES, QGles2RenderTargetData::rp, rt, QGles2RenderTargetData::sampleCount, QRhiRenderTarget::setRenderPassDescriptor(), QRhiSwapChain::sRGB, and QGles2RenderTargetData::srgbUpdateAndBlend.
Referenced by createOrResize().
|
overridevirtual |
The main use of this function is to call it before the first createOrResize() after the window is already set. This allow the QRhi backends to perform platform or windowing system specific queries to determine if the window (and the screen it is on) is capable of true HDR output with the specified format.
When the format is reported as supported, call setFormat() to set the requested format and call createOrResize(). Be aware of the consequences however: successfully requesting a HDR format will involve having to deal with a different color space, possibly doing white level correction for non-HDR-aware content, adjusting tonemapping methods, adjusting offscreen render target settings, etc.
Implements QRhiSwapChain.
Definition at line 6159 of file qrhigles2.cpp.
References QRhiSwapChain::SDR.
|
overridevirtual |
The returned value is used in two ways: it can be passed to setRenderPassDescriptor() and QRhiGraphicsPipeline::setRenderPassDescriptor(). A render pass descriptor describes the attachments (color, depth/stencil) and the load/store behavior that can be affected by flags(). A QRhiGraphicsPipeline can only be used in combination with a swapchain that has a \l{QRhiRenderPassDescriptor::isCompatible()}{compatible} QRhiRenderPassDescriptor set.
Implements QRhiSwapChain.
Definition at line 6164 of file qrhigles2.cpp.
References QRhiResource::m_rhi, and QRHI_RES_RHI.
|
overridevirtual |
{QWindow::size() * QWindow::devicePixelRatio()}. With some graphics APIs and windowing system interfaces (for example, Vulkan) there is a theoretical possibility for a surface to assume a size different from the associated window. To support these cases, {rendering logic must always base size-derived calculations (such as, viewports) on the size reported from QRhiSwapChain, and never on the size queried from QWindow}.Implements QRhiSwapChain.
Definition at line 6153 of file qrhigles2.cpp.
References QRhiSwapChain::m_window, Q_ASSERT, and QWindow::size().
Referenced by createOrResize().
QGles2CommandBuffer QGles2SwapChain::cb |
Definition at line 726 of file qrhigles2_p.h.
Referenced by QRhiGles2::beginFrame(), currentFrameCommandBuffer(), QRhiGles2::endFrame(), and QRhiGles2::finish().
int QGles2SwapChain::frameCount = 0 |
Definition at line 727 of file qrhigles2_p.h.
Referenced by createOrResize(), and QRhiGles2::endFrame().
QSize QGles2SwapChain::pixelSize |
Definition at line 722 of file qrhigles2_p.h.
Referenced by createOrResize(), QRhiGles2::executeCommandBuffer(), and initSwapChainRenderTarget().
QGles2SwapChainRenderTarget QGles2SwapChain::rt |
Definition at line 723 of file qrhigles2_p.h.
Referenced by createOrResize(), currentFrameRenderTarget(), currentFrameRenderTarget(), and initSwapChainRenderTarget().
QGles2SwapChainRenderTarget QGles2SwapChain::rtLeft |
Definition at line 724 of file qrhigles2_p.h.
Referenced by createOrResize(), and currentFrameRenderTarget().
QGles2SwapChainRenderTarget QGles2SwapChain::rtRight |
Definition at line 725 of file qrhigles2_p.h.
Referenced by createOrResize(), and currentFrameRenderTarget().
Definition at line 721 of file qrhigles2_p.h.
Referenced by QRhiGles2::beginExternal(), QRhiGles2::beginFrame(), createOrResize(), QRhiGles2::endFrame(), QRhiGles2::finish(), and QRhiGles2::makeThreadLocalNativeContextCurrent().