diff options
author | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-01-05 15:48:32 +0100 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@qt.io> | 2021-01-13 09:37:37 +0100 |
commit | 1d7fc87b89167e678f2f66bd05423f493b51a7fd (patch) | |
tree | 22164ca8281981c52ecfdce797f475f06d853a1e /examples | |
parent | 5aa3cf7b9a9d2932c95f9fbcd89011c968f7426a (diff) |
rhi: gl: Reset tracked state upon a buffer update or readback
...encountered in the command list.
Move all, previously local, tracking variables into a struct. This
allows creating helper functions to reduce error-prone repetition in the
executeCommandBuffer() function body.
The only real change in the patch is in the handling of
Command::BufferSubData and Command::GetBufferSubData: here, instead of
calling glBindBuffer directly, use a helper function that also resets
the relevant state tracking variables. A subsequent
Command::BindVertexBuffer or BindIndexBuffer will therefore correctly
rebind the appropriate buffers.
This is particularly relevant with certain command stream patterns
exercised by some Qt Quick 3D scenes:
- A View3D renders a mesh,
- another View3D has some 2D Qt Quick content, as well as a model with
the same mesh.
When both View3Ds use the default Offscreen render mode, the resulting
command list consists of segments along the lines of:
1. prepare resources for first View3D
2. render content for first View3D - this binds the vertex and index
buffers for the mesh (state is tracked; all 1-4 steps are within
the same command list, processed by a single call to
executeCommandBuffer())
3. prepare the content for the "inline" 2D Qt Quick scene - this may
update vertex and index buffers, that may lead to adding
BufferSubData commands to the list (tracked state (last
vertex/index buffer) may need invalidation/updating - and that's
where our problem lies)
4. the second View3Ds 3D content is rendered: a model with the same
mesh as the last (Quick)3D draw call, so same vertex and index
buffers. If #3 did not invalidate and/or update the tracked state,
the glBindBuffer calls are (incorrectly) skipped.
Fixes: QTBUG-89780
Change-Id: Icc933252f3993b8727d192e7ba4aa0f842bab51e
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
(cherry picked from commit 5f8efb259774040303f37d00b6307afd22857af2)
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
Diffstat (limited to 'examples')
0 files changed, 0 insertions, 0 deletions