From 2189e0f2fc2aadf84ed53a7ae6210e2bbe04b45e Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Sun, 11 Oct 2020 22:02:43 +0200 Subject: rhi: Make the new direct buffer update available for non-uniform buffers The original restriction to UniformBuffer was due to the GL backend where there is no GL buffer object for QRhiBuffers with usage UniformBuffer. However, we can still implement this for cases when there is a true GL buffer object underneath. With other backends it should all work as-is already. This becomes useful when one has buffers with usage Vertex that need full updates every frame. (f.ex. instance data) Unfortunately this involves renaming the function. But while at it, add an autotest case as well. Change-Id: Iff59e4509a8bae06654cc92fe8428bd79eb012fb Reviewed-by: Andy Nichols --- src/gui/rhi/qrhid3d11.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/gui/rhi/qrhid3d11.cpp') diff --git a/src/gui/rhi/qrhid3d11.cpp b/src/gui/rhi/qrhid3d11.cpp index 9fccff7b5c..48e626106c 100644 --- a/src/gui/rhi/qrhid3d11.cpp +++ b/src/gui/rhi/qrhid3d11.cpp @@ -2708,15 +2708,15 @@ QRhiBuffer::NativeBuffer QD3D11Buffer::nativeBuffer() return { { &buffer }, 1 }; } -char *QD3D11Buffer::beginFullDynamicUniformBufferUpdateForCurrentFrame() +char *QD3D11Buffer::beginFullDynamicBufferUpdateForCurrentFrame() { // Shortcut the entire buffer update mechanism and allow the client to do // the host writes directly to the buffer. This will lead to unexpected // results when combined with QRhiResourceUpdateBatch-based updates for the // buffer, since dynBuf is left untouched and out of sync, but provides a - // fast path for uniform buffers that have all their content changed in + // fast path for dynamic buffers that have all their content changed in // every frame. - Q_ASSERT(m_type == Dynamic && m_usage.testFlag(UniformBuffer)); + Q_ASSERT(m_type == Dynamic); D3D11_MAPPED_SUBRESOURCE mp; QRHI_RES_RHI(QRhiD3D11); HRESULT hr = rhiD->context->Map(buffer, 0, D3D11_MAP_WRITE_DISCARD, 0, &mp); @@ -2727,7 +2727,7 @@ char *QD3D11Buffer::beginFullDynamicUniformBufferUpdateForCurrentFrame() return static_cast(mp.pData); } -void QD3D11Buffer::endFullDynamicUniformBufferUpdateForCurrentFrame() +void QD3D11Buffer::endFullDynamicBufferUpdateForCurrentFrame() { QRHI_RES_RHI(QRhiD3D11); rhiD->context->Unmap(buffer, 0); -- cgit v1.2.3