From: Jason Ekstrand Date: Wed, 15 Jul 2015 23:33:47 +0000 (-0700) Subject: vk/cmd_buffer: Add a helper for allocating dynamic state X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6037b5d6100aeea9f0970fccd4ec38c3f60ffcc9;p=mesa.git vk/cmd_buffer: Add a helper for allocating dynamic state This matches what we do for surface state and makes the dynamic state pool more opaque to things that need to get dynamic state. --- diff --git a/src/vulkan/anv_cmd_buffer.c b/src/vulkan/anv_cmd_buffer.c index 86d8f08971e..e6e60e14189 100644 --- a/src/vulkan/anv_cmd_buffer.c +++ b/src/vulkan/anv_cmd_buffer.c @@ -318,6 +318,14 @@ anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer, return state; } +struct anv_state +anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer, + uint32_t size, uint32_t alignment) +{ + return anv_state_stream_alloc(&cmd_buffer->dynamic_state_stream, + size, alignment); +} + VkResult anv_cmd_buffer_new_surface_state_bo(struct anv_cmd_buffer *cmd_buffer) { diff --git a/src/vulkan/anv_cmd_emit.c b/src/vulkan/anv_cmd_emit.c index b4cb0c048d0..4c9f29ffaab 100644 --- a/src/vulkan/anv_cmd_emit.c +++ b/src/vulkan/anv_cmd_emit.c @@ -409,7 +409,7 @@ cmd_buffer_emit_samplers(struct anv_cmd_buffer *cmd_buffer, return VK_SUCCESS; uint32_t size = sampler_count * 16; - *state = anv_state_stream_alloc(&cmd_buffer->dynamic_state_stream, size, 32); + *state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, size, 32); if (state->map == NULL) return VK_ERROR_OUT_OF_DEVICE_MEMORY; @@ -522,8 +522,8 @@ anv_cmd_buffer_emit_dynamic(struct anv_cmd_buffer *cmd_buffer, { struct anv_state state; - state = anv_state_stream_alloc(&cmd_buffer->dynamic_state_stream, - dwords * 4, alignment); + state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, + dwords * 4, alignment); memcpy(state.map, a, dwords * 4); VG(VALGRIND_CHECK_MEM_IS_DEFINED(state.map, dwords * 4)); @@ -539,8 +539,8 @@ anv_cmd_buffer_merge_dynamic(struct anv_cmd_buffer *cmd_buffer, struct anv_state state; uint32_t *p; - state = anv_state_stream_alloc(&cmd_buffer->dynamic_state_stream, - dwords * 4, alignment); + state = anv_cmd_buffer_alloc_dynamic_state(cmd_buffer, + dwords * 4, alignment); p = state.map; for (uint32_t i = 0; i < dwords; i++) p[i] = a[i] | b[i]; diff --git a/src/vulkan/private.h b/src/vulkan/private.h index cd80c896f35..cfc46ee8f60 100644 --- a/src/vulkan/private.h +++ b/src/vulkan/private.h @@ -717,6 +717,9 @@ struct anv_cmd_buffer { struct anv_state anv_cmd_buffer_alloc_surface_state(struct anv_cmd_buffer *cmd_buffer, uint32_t size, uint32_t alignment); +struct anv_state +anv_cmd_buffer_alloc_dynamic_state(struct anv_cmd_buffer *cmd_buffer, + uint32_t size, uint32_t alignment); VkResult anv_cmd_buffer_new_surface_state_bo(struct anv_cmd_buffer *cmd_buffer);