diff --git a/examples/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp b/examples/rhi/hellominimalcrossgfxtriangle/hellominimalcrossgfxtriangle.cpp index e490093dda9481b34ca48615a748dd122c56c721..bb240279dc4540943407e1db2bb73a0cd0a01de7 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 9f8c1ccf6c1d7cfd43185735f6ce1c21c27ec9f4..6ab2e3b471672787c8faf362a8e3683fd10f7332 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 9dc7588ba6934238303c4fcefcd34755f2ad62ad..0f280dbab212e9a0541e3827b64583cd4905b762 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 74bab3697d62355e3a6f339d121453c47171dd43..3b92d76ba6598f6a16bb5115fa8fa34276b27143 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