aboutsummaryrefslogtreecommitdiffstats
path: root/src/intel/vulkan/anv_cmd_buffer.c
diff options
context:
space:
mode:
authorIago Toral Quiroga <[email protected]>2017-03-03 11:31:14 +0100
committerIago Toral Quiroga <[email protected]>2017-03-16 11:40:05 +0100
commitc04dbd6b3e8b13fbf89338c79bccf4c06e6ff5aa (patch)
treebe7430aeabf88528411ffb892639e04142e1ac07 /src/intel/vulkan/anv_cmd_buffer.c
parent94a4f0c255b5f12a42928fd9ee49f07e14c1f860 (diff)
anv/cmd_buffer: handle out of memory during vkCmdPushConstants
Fixes: dEQP-VK.api.out_of_host_memory.cmd_push_constants Reviewed-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_cmd_buffer.c')
-rw-r--r--src/intel/vulkan/anv_cmd_buffer.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/intel/vulkan/anv_cmd_buffer.c b/src/intel/vulkan/anv_cmd_buffer.c
index b3fd02fef53..909bee2add4 100644
--- a/src/intel/vulkan/anv_cmd_buffer.c
+++ b/src/intel/vulkan/anv_cmd_buffer.c
@@ -160,13 +160,17 @@ anv_cmd_buffer_ensure_push_constants_size(struct anv_cmd_buffer *cmd_buffer,
if (*ptr == NULL) {
*ptr = vk_alloc(&cmd_buffer->pool->alloc, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (*ptr == NULL)
+ if (*ptr == NULL) {
+ anv_batch_set_error(&cmd_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ }
} else if ((*ptr)->size < size) {
*ptr = vk_realloc(&cmd_buffer->pool->alloc, *ptr, size, 8,
VK_SYSTEM_ALLOCATION_SCOPE_OBJECT);
- if (*ptr == NULL)
+ if (*ptr == NULL) {
+ anv_batch_set_error(&cmd_buffer->batch, VK_ERROR_OUT_OF_HOST_MEMORY);
return vk_error(VK_ERROR_OUT_OF_HOST_MEMORY);
+ }
}
(*ptr)->size = size;
@@ -718,7 +722,11 @@ void anv_CmdPushConstants(
ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer);
anv_foreach_stage(stage, stageFlags) {
- anv_cmd_buffer_ensure_push_constant_field(cmd_buffer, stage, client_data);
+ VkResult result =
+ anv_cmd_buffer_ensure_push_constant_field(cmd_buffer,
+ stage, client_data);
+ if (result != VK_SUCCESS)
+ return;
memcpy(cmd_buffer->state.push_constants[stage]->client_data + offset,
pValues, size);