Commit 0efdb544 authored by Laszlo Agocs's avatar Laszlo Agocs
Browse files

Minor corrections in comments

parent 9c79d004
...@@ -433,7 +433,10 @@ void Window::render() ...@@ -433,7 +433,10 @@ void Window::render()
m_newlyExposed = false; m_newlyExposed = false;
} }
// Start a new frame. This is where we block when too far ahead of GPU/present. // Start a new frame. This is where we block when too far ahead of
// 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);
if (r == QRhi::FrameOpSwapChainOutOfDate) { if (r == QRhi::FrameOpSwapChainOutOfDate) {
resizeSwapChain(); resizeSwapChain();
...@@ -476,11 +479,11 @@ void Window::render() ...@@ -476,11 +479,11 @@ void Window::render()
QRhiCommandBuffer *cb = m_sc->currentFrameCommandBuffer(); QRhiCommandBuffer *cb = m_sc->currentFrameCommandBuffer();
const QSize outputSizeInPixels = m_sc->effectivePixelSize(); const QSize outputSizeInPixels = m_sc->effectivePixelSize();
// Apply buffer/texture updates, clear, queue the renderpass begin (where applicable). // Apply buffer updates, clear, start the renderpass (where applicable).
m_r->beginPass(m_sc->currentFrameRenderTarget(), cb, { 0.4f, 0.7f, 0.0f, 1.0f }, { 1.0f, 0 }, u); m_r->beginPass(m_sc->currentFrameRenderTarget(), cb, { 0.4f, 0.7f, 0.0f, 1.0f }, { 1.0f, 0 }, u);
m_r->setGraphicsPipeline(cb, m_ps); m_r->setGraphicsPipeline(cb, m_ps);
m_r->setViewport(cb, QRhiViewport(0, 0, outputSizeInPixels.width(), outputSizeInPixels.height())); m_r->setViewport(cb, { 0, 0, float(outputSizeInPixels.width()), float(outputSizeInPixels.height()) });
m_r->setVertexInput(cb, 0, { { m_vbuf, 0 } }); m_r->setVertexInput(cb, 0, { { m_vbuf, 0 } });
m_r->draw(cb, 3); m_r->draw(cb, 3);
......
...@@ -319,7 +319,7 @@ void QRhiD3D11::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) ...@@ -319,7 +319,7 @@ void QRhiD3D11::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport)
QD3D11CommandBuffer::Command cmd; QD3D11CommandBuffer::Command cmd;
cmd.cmd = QD3D11CommandBuffer::Command::Viewport; cmd.cmd = QD3D11CommandBuffer::Command::Viewport;
cmd.args.viewport.x = viewport.r.x(); cmd.args.viewport.x = viewport.r.x();
// d3d expects top-left, QRhiScissor is bottom-left // d3d expects top-left, QRhiViewport is bottom-left
cmd.args.viewport.y = cbD->currentTarget->sizeInPixels().height() - (viewport.r.y() + viewport.r.w() - 1); cmd.args.viewport.y = cbD->currentTarget->sizeInPixels().height() - (viewport.r.y() + viewport.r.w() - 1);
cmd.args.viewport.y = viewport.r.y(); cmd.args.viewport.y = viewport.r.y();
cmd.args.viewport.w = viewport.r.z(); cmd.args.viewport.w = viewport.r.z();
......
...@@ -46,9 +46,9 @@ ...@@ -46,9 +46,9 @@
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
/* /*
Metal backend. MRC. Double buffers and throttles to vsync. "Dynamic" Metal backend. Double buffers and throttles to vsync. "Dynamic" buffers are
buffers are Shared (host visible) and duplicated (due to 2 frames in Shared (host visible) and duplicated (due to 2 frames in flight), while
flight), while "static" buffers are ### "static" buffers are Managed on macOS and Shared on iOS/tvOS.
*/ */
#if __has_feature(objc_arc) #if __has_feature(objc_arc)
...@@ -621,7 +621,9 @@ bool QMetalBuffer::build() ...@@ -621,7 +621,9 @@ bool QMetalBuffer::build()
const int roundedSize = m_usage.testFlag(QRhiBuffer::UniformBuffer) ? aligned(m_size, 256) : m_size; const int roundedSize = m_usage.testFlag(QRhiBuffer::UniformBuffer) ? aligned(m_size, 256) : m_size;
MTLResourceOptions opts = MTLResourceStorageModeShared; // ### for now everything host visible and double buffered // ### for now everything host visible and double buffered
// should instead use Managed on macOS for immutable/static
MTLResourceOptions opts = MTLResourceStorageModeShared;
QRHI_RES_RHI(QRhiMetal); QRHI_RES_RHI(QRhiMetal);
for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) { for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) {
......
...@@ -2912,7 +2912,7 @@ bool QVkTextureRenderTarget::build() ...@@ -2912,7 +2912,7 @@ bool QVkTextureRenderTarget::build()
QRhiRenderTarget::Type QVkTextureRenderTarget::type() const QRhiRenderTarget::Type QVkTextureRenderTarget::type() const
{ {
return RtTexture; // this is a QVkTextureRenderTarget, owns fb and rp return RtTexture;
} }
QSize QVkTextureRenderTarget::sizeInPixels() const QSize QVkTextureRenderTarget::sizeInPixels() const
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment