summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2015-07-15 16:33:47 -0700
committerJason Ekstrand <[email protected]>2015-07-15 16:56:29 -0700
commit6037b5d6100aeea9f0970fccd4ec38c3f60ffcc9 (patch)
tree06a4af3199f826a2145c488fbe6bf61ccf17127c /src
parent7ccc8dd24ae254e10994b89e78f55d2003e0a12e (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/vulkan/anv_cmd_buffer.c8
-rw-r--r--src/vulkan/anv_cmd_emit.c10
-rw-r--r--src/vulkan/private.h3
3 files changed, 16 insertions, 5 deletions
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);