aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Northrop <cody@lunarg.com>2015-07-09 18:08:32 -0600
committerCourtney Goeltzenleuchter <courtney@LunarG.com>2015-07-17 10:05:20 -0600
commit91e221b35fef7524095fd04e17c15105fbdaa29e (patch)
treeda4ecd4318472df32048900dc34c9b4d5ace2ba0
parente91de3b255afc4a84b5bd7a6815278646beee60d (diff)
downloadusermoji-91e221b35fef7524095fd04e17c15105fbdaa29e.tar.xz
demos: Update for command pools
-rw-r--r--demos/cube.c18
-rw-r--r--demos/tri.c18
2 files changed, 29 insertions, 7 deletions
diff --git a/demos/cube.c b/demos/cube.c
index caaae796..f6c1aca1 100644
--- a/demos/cube.c
+++ b/demos/cube.c
@@ -316,6 +316,7 @@ struct demo {
PFN_vkGetSwapChainInfoWSI fpGetSwapChainInfoWSI;
PFN_vkQueuePresentWSI fpQueuePresentWSI;
VkSwapChainWSI swap_chain;
+ VkCmdPool cmd_pool;
struct {
VkImage image;
VkDeviceMemory mem;
@@ -430,7 +431,7 @@ static void demo_set_image_layout(
const VkCmdBufferCreateInfo cmd = {
.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,
.pNext = NULL,
- .queueNodeIndex = demo->graphics_queue_node_index,
+ .cmdPool = demo->cmd_pool,
.level = VK_CMD_BUFFER_LEVEL_PRIMARY,
.flags = 0,
};
@@ -1652,14 +1653,24 @@ static void demo_prepare_framebuffers(struct demo *demo)
static void demo_prepare(struct demo *demo)
{
+ VkResult U_ASSERT_ONLY err;
+
+ const VkCmdPoolCreateInfo cmd_pool_info = {
+ .sType = VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,
+ .pNext = NULL,
+ .queueFamilyIndex = demo->graphics_queue_node_index,
+ .flags = 0,
+ };
+ err = vkCreateCommandPool(demo->device, &cmd_pool_info, &demo->cmd_pool);
+ assert(!err);
+
const VkCmdBufferCreateInfo cmd = {
.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,
.pNext = NULL,
- .queueNodeIndex = demo->graphics_queue_node_index,
+ .cmdPool = demo->cmd_pool,
.level = VK_CMD_BUFFER_LEVEL_PRIMARY,
.flags = 0,
};
- VkResult U_ASSERT_ONLY err;
demo_prepare_buffers(demo);
demo_prepare_depth(demo);
@@ -1740,6 +1751,7 @@ static void demo_cleanup(struct demo *demo)
vkDestroyCommandBuffer(demo->device, demo->buffers[i].cmd);
}
+ vkDestroyCommandPool(demo->device, demo->cmd_pool);
vkDestroyDevice(demo->device);
if (demo->validate) {
demo->dbgDestroyMsgCallback(demo->inst, demo->msg_callback);
diff --git a/demos/tri.c b/demos/tri.c
index 3d63275f..e7aa08d3 100644
--- a/demos/tri.c
+++ b/demos/tri.c
@@ -164,6 +164,7 @@ struct demo {
PFN_vkQueuePresentWSI fpQueuePresentWSI;
VkSwapChainWSI swap_chain;
+ VkCmdPool cmd_pool;
struct {
VkImage image;
VkDeviceMemory mem;
@@ -271,7 +272,7 @@ static void demo_set_image_layout(
const VkCmdBufferCreateInfo cmd = {
.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,
.pNext = NULL,
- .queueNodeIndex = demo->graphics_queue_node_index,
+ .cmdPool = demo->cmd_pool,
.level = VK_CMD_BUFFER_LEVEL_PRIMARY,
.flags = 0,
};
@@ -1284,15 +1285,24 @@ static void demo_prepare_framebuffers(struct demo *demo)
static void demo_prepare(struct demo *demo)
{
+ VkResult U_ASSERT_ONLY err;
+
+ const VkCmdPoolCreateInfo cmd_pool_info = {
+ .sType = VK_STRUCTURE_TYPE_CMD_POOL_CREATE_INFO,
+ .pNext = NULL,
+ .queueFamilyIndex = demo->graphics_queue_node_index,
+ .flags = 0,
+ };
+ err = vkCreateCommandPool(demo->device, &cmd_pool_info, &demo->cmd_pool);
+ assert(!err);
+
const VkCmdBufferCreateInfo cmd = {
.sType = VK_STRUCTURE_TYPE_CMD_BUFFER_CREATE_INFO,
.pNext = NULL,
- .queueNodeIndex = demo->graphics_queue_node_index,
+ .cmdPool = demo->cmd_pool,
.level = VK_CMD_BUFFER_LEVEL_PRIMARY,
.flags = 0,
};
- VkResult U_ASSERT_ONLY err;
-
err = vkCreateCommandBuffer(demo->device, &cmd, &demo->draw_cmd);
assert(!err);