[Mesa-dev] [PATCH 2/2] radv: do not use a bitfield when dirtying the vertex buffers
Gustaw Smolarczyk
wielkiegie at gmail.com
Wed Sep 6 17:13:24 UTC 2017
2017-09-06 15:53 GMT+02:00 Samuel Pitoiset <samuel.pitoiset at gmail.com>:
> Useless to track which one has been updated because we
> re-upload all the vertex buffers in one shot.
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> ---
> src/amd/vulkan/radv_cmd_buffer.c | 5 +++--
> src/amd/vulkan/radv_private.h | 2 +-
> 2 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/src/amd/vulkan/radv_cmd_buffer.c b/src/amd/vulkan/radv_cmd_buffer.c
> index ed2984eb5a..cc9a758d36 100644
> --- a/src/amd/vulkan/radv_cmd_buffer.c
> +++ b/src/amd/vulkan/radv_cmd_buffer.c
> @@ -1629,7 +1629,7 @@ radv_cmd_buffer_update_vertex_descriptors(struct radv_cmd_buffer *cmd_buffer)
> radv_emit_userdata_address(cmd_buffer, cmd_buffer->state.pipeline, MESA_SHADER_VERTEX,
> AC_UD_VS_VERTEX_BUFFERS, va);
> }
> - cmd_buffer->state.vb_dirty = 0;
> + cmd_buffer->state.vb_dirty = false;
> }
>
> static void
> @@ -2049,8 +2049,9 @@ void radv_CmdBindVertexBuffers(
> for (uint32_t i = 0; i < bindingCount; i++) {
> vb[firstBinding + i].buffer = radv_buffer_from_handle(pBuffers[i]);
> vb[firstBinding + i].offset = pOffsets[i];
> - cmd_buffer->state.vb_dirty |= 1 << (firstBinding + i);
> }
> +
> + cmd_buffer->state.vb_dirty = true;
> }
>
> void radv_CmdBindIndexBuffer(
> diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
> index 65ec712707..7c5dac3240 100644
> --- a/src/amd/vulkan/radv_private.h
> +++ b/src/amd/vulkan/radv_private.h
> @@ -757,7 +757,7 @@ struct radv_attachment_state {
> };
>
> struct radv_cmd_state {
> - uint32_t vb_dirty;
> + bool vb_dirty;
Maybe move it below the dirty field in order to save 8 bytes? You
might also move the predicating field in order to save another 8.
That might be a candidate for a different commit though...
Gustaw
More information about the mesa-dev
mailing list