Skip to content
Snippets Groups Projects
Commit d98ff2cc authored by M Henning's avatar M Henning Committed by Marge Bot
Browse files

nvk: Don't clobber vb0 after repeated blits

If a program does two blits in a row, we internally do a sequence of
operations that involves binding vb0.

Previously, the vb0 state after each operation would look something like:

| operation                    | cmd->state.gfx.vb0 | hardware  | save->vb0 |
| ---------------------------- | ------------------ | --------- | --------- |
|                              | user               | user      |           |
| nvk_meta_begin()             | user               | user      | user      |
| BindVertexBuffers(internal0) | internal0          | internal0 | user      |
| nvk_meta_end()               | internal0          | user      |           |
| nvk_meta_begin()             | internal0          | user      | internal0 |
| BindVertexBuffers(internal1) | internal1          | internal1 | internal0 |
| nvk_meta_end()               | internal1          | internal0 |           |

That is, CmdBindVertexBuffers() would update cmd->state.gfx.vb0, but
nvk_meta_end() would not. This meant that the last operation would bind a
driver-internal buffer instead of the original value that the user set.

This change fixes the issue by tracking cmd->state.gfx.vb0 in
nvk_cmd_bind_vertex_buffer(), which both CmdBindVertexBuffers() and
nvk_meta_end() call into.

After this commit, the state looks like:

| operation                    | cmd->state.gfx.vb0 | hardware  | save->vb0 |
| ---------------------------- | ------------------ | --------- | --------- |
|                              | user               | user      |           |
| nvk_meta_begin()             | user               | user      | user      |
| BindVertexBuffers(internal0) | internal0          | internal0 | user      |
| nvk_meta_end()               | user               | user      |           |
| nvk_meta_begin()             | user               | user      | user      |
| BindVertexBuffers(internal1) | internal1          | internal1 | user      |
| nvk_meta_end()               | user               | user      |           |

To test this commit, build gtk4 commit 87b66de1, run:

    GSK_RENDERER=vulkan gtk4-demo --run=image_scaling

then select trilinear filtering in the dropdown and check for rendering
artifacts.

Fixes: e1c66501 ("nvk: Use vk_meta for CmdClearAttachments")
Part-of: <mesa/mesa!27559>
parent 53ff6638
No related branches found
No related tags found
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment