aboutsummaryrefslogtreecommitdiff
path: root/demos/cube.cpp
diff options
context:
space:
mode:
authorJeremy Hayes <jeremy@lunarg.com>2016-11-16 13:42:08 -0700
committerJeremy Hayes <jeremy-lunarg@users.noreply.github.com>2016-11-18 14:11:43 -0700
commit233130a0a3757ed7a6725b5c53142e960c87d8b8 (patch)
tree066854499f8155e7b3e92201602996da2ceaa1b5 /demos/cube.cpp
parent24f120aaede7b3e17c562ffcbc81d6d3ceef7a80 (diff)
downloadusermoji-233130a0a3757ed7a6725b5c53142e960c87d8b8.tar.xz
demos: move cmd bfr creation out of layout util
Change-Id: I01c4f59497f4ac22f2a96bda535c7965d34156d8
Diffstat (limited to 'demos/cube.cpp')
-rw-r--r--demos/cube.cpp25
1 files changed, 10 insertions, 15 deletions
diff --git a/demos/cube.cpp b/demos/cube.cpp
index e91b0c3f..f092a0c5 100644
--- a/demos/cube.cpp
+++ b/demos/cube.cpp
@@ -1179,6 +1179,15 @@ struct Demo {
.setLevel(vk::CommandBufferLevel::ePrimary)
.setCommandBufferCount(1);
+ result = device.allocateCommandBuffers(&cmd, &this->cmd);
+ VERIFY(result == vk::Result::eSuccess);
+
+ auto const cmd_buf_info =
+ vk::CommandBufferBeginInfo().setPInheritanceInfo(nullptr);
+
+ result = this->cmd.begin(&cmd_buf_info);
+ VERIFY(result == vk::Result::eSuccess);
+
prepare_buffers();
prepare_depth();
prepare_textures();
@@ -2107,21 +2116,7 @@ struct Demo {
vk::AccessFlags srcAccessMask,
vk::PipelineStageFlags src_stages,
vk::PipelineStageFlags dest_stages) {
- if (!cmd) {
- auto const cmd = vk::CommandBufferAllocateInfo()
- .setCommandPool(cmd_pool)
- .setLevel(vk::CommandBufferLevel::ePrimary)
- .setCommandBufferCount(1);
-
- auto result = device.allocateCommandBuffers(&cmd, &this->cmd);
- VERIFY(result == vk::Result::eSuccess);
-
- auto const cmd_buf_info =
- vk::CommandBufferBeginInfo().setPInheritanceInfo(nullptr);
-
- result = this->cmd.begin(&cmd_buf_info);
- VERIFY(result == vk::Result::eSuccess);
- }
+ assert(cmd);
auto DstAccessMask = [](vk::ImageLayout const &layout) {
vk::AccessFlags flags;