From 0efdb54476da67337cba78348dc70723661d17e0 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 7 Nov 2018 21:03:59 +0100 Subject: [PATCH] Minor corrections in comments --- .../hellominimalcrossgfxtriangle.cpp | 9 ++++++--- src/rhi/qrhid3d11.cpp | 2 +- src/rhi/qrhimetal.mm | 10 ++++++---- src/rhi/qrhivulkan.cpp | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/examples/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp b/examples/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp index e490093..bb24027 100644 --- a/examples/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp +++ b/examples/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp @@ -433,7 +433,10 @@ void Window::render() 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); if (r == QRhi::FrameOpSwapChainOutOfDate) { resizeSwapChain(); @@ -476,11 +479,11 @@ void Window::render() QRhiCommandBuffer *cb = m_sc->currentFrameCommandBuffer(); 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->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->draw(cb, 3); diff --git a/src/rhi/qrhid3d11.cpp b/src/rhi/qrhid3d11.cpp index 9f8c1cc..6ab2e3b 100644 --- a/src/rhi/qrhid3d11.cpp +++ b/src/rhi/qrhid3d11.cpp @@ -319,7 +319,7 @@ void QRhiD3D11::setViewport(QRhiCommandBuffer *cb, const QRhiViewport &viewport) QD3D11CommandBuffer::Command cmd; cmd.cmd = QD3D11CommandBuffer::Command::Viewport; 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 = viewport.r.y(); cmd.args.viewport.w = viewport.r.z(); diff --git a/src/rhi/qrhimetal.mm b/src/rhi/qrhimetal.mm index 9dc7588..0f280db 100644 --- a/src/rhi/qrhimetal.mm +++ b/src/rhi/qrhimetal.mm @@ -46,9 +46,9 @@ QT_BEGIN_NAMESPACE /* - Metal backend. MRC. Double buffers and throttles to vsync. "Dynamic" - buffers are Shared (host visible) and duplicated (due to 2 frames in - flight), while "static" buffers are ### + Metal backend. Double buffers and throttles to vsync. "Dynamic" buffers are + Shared (host visible) and duplicated (due to 2 frames in flight), while + "static" buffers are Managed on macOS and Shared on iOS/tvOS. */ #if __has_feature(objc_arc) @@ -621,7 +621,9 @@ bool QMetalBuffer::build() 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); for (int i = 0; i < QMTL_FRAMES_IN_FLIGHT; ++i) { diff --git a/src/rhi/qrhivulkan.cpp b/src/rhi/qrhivulkan.cpp index 74bab36..3b92d76 100644 --- a/src/rhi/qrhivulkan.cpp +++ b/src/rhi/qrhivulkan.cpp @@ -2912,7 +2912,7 @@ bool QVkTextureRenderTarget::build() QRhiRenderTarget::Type QVkTextureRenderTarget::type() const { - return RtTexture; // this is a QVkTextureRenderTarget, owns fb and rp + return RtTexture; } QSize QVkTextureRenderTarget::sizeInPixels() const -- GitLab