diff --git a/base/vulkanexamplebase.cpp b/base/vulkanexamplebase.cpp index 5ab27685..be758470 100644 --- a/base/vulkanexamplebase.cpp +++ b/base/vulkanexamplebase.cpp @@ -129,51 +129,6 @@ void VulkanExampleBase::destroyCommandBuffers() vkFreeCommandBuffers(device, cmdPool, static_cast(drawCmdBuffers.size()), drawCmdBuffers.data()); } -VkCommandBuffer VulkanExampleBase::createCommandBuffer(VkCommandBufferLevel level, bool begin) -{ - VkCommandBuffer cmdBuffer; - - VkCommandBufferAllocateInfo cmdBufAllocateInfo = - vks::initializers::commandBufferAllocateInfo( - cmdPool, - level, - 1); - - VK_CHECK_RESULT(vkAllocateCommandBuffers(device, &cmdBufAllocateInfo, &cmdBuffer)); - - // If requested, also start the new command buffer - if (begin) - { - VkCommandBufferBeginInfo cmdBufInfo = vks::initializers::commandBufferBeginInfo(); - VK_CHECK_RESULT(vkBeginCommandBuffer(cmdBuffer, &cmdBufInfo)); - } - - return cmdBuffer; -} - -void VulkanExampleBase::flushCommandBuffer(VkCommandBuffer commandBuffer, VkQueue queue, bool free) -{ - if (commandBuffer == VK_NULL_HANDLE) - { - return; - } - - VK_CHECK_RESULT(vkEndCommandBuffer(commandBuffer)); - - VkSubmitInfo submitInfo = {}; - submitInfo.sType = VK_STRUCTURE_TYPE_SUBMIT_INFO; - submitInfo.commandBufferCount = 1; - submitInfo.pCommandBuffers = &commandBuffer; - - VK_CHECK_RESULT(vkQueueSubmit(queue, 1, &submitInfo, VK_NULL_HANDLE)); - VK_CHECK_RESULT(vkQueueWaitIdle(queue)); - - if (free) - { - vkFreeCommandBuffers(device, cmdPool, 1, &commandBuffer); - } -} - void VulkanExampleBase::createPipelineCache() { VkPipelineCacheCreateInfo pipelineCacheCreateInfo = {}; diff --git a/base/vulkanexamplebase.h b/base/vulkanexamplebase.h index c3c498b9..e01ce6f3 100644 --- a/base/vulkanexamplebase.h +++ b/base/vulkanexamplebase.h @@ -334,11 +334,6 @@ public: /** @brief (Virtual) Called after the physical device features have been read, can be used to set features to enable on the device */ virtual void getEnabledFeatures(); - /** @brief Creates and returns a new command buffer */ - VkCommandBuffer createCommandBuffer(VkCommandBufferLevel level, bool begin); - /** @brief End the command buffer, submit it to the queue and free (if requested) */ - void flushCommandBuffer(VkCommandBuffer commandBuffer, VkQueue queue, bool free); - /** @brief Prepares all Vulkan resources and functions required to run the sample */ virtual void prepare(); diff --git a/examples/computecloth/computecloth.cpp b/examples/computecloth/computecloth.cpp index 0eea27e9..c73cf479 100644 --- a/examples/computecloth/computecloth.cpp +++ b/examples/computecloth/computecloth.cpp @@ -410,7 +410,7 @@ public: storageBufferSize); // Copy from staging buffer - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = {}; copyRegion.size = storageBufferSize; vkCmdCopyBuffer(copyCmd, stagingBuffer.buffer, compute.storageBuffers.input.buffer, 1, ©Region); @@ -419,7 +419,7 @@ public: // so that when the compute command buffer executes for the first time // it doesn't complain about a lack of a corresponding "release" to its "acquire" addGraphicsToComputeBarriers(copyCmd); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); stagingBuffer.destroy(); @@ -450,11 +450,11 @@ public: indexBufferSize); // Copy from staging buffer - copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); copyRegion = {}; copyRegion.size = indexBufferSize; vkCmdCopyBuffer(copyCmd, stagingBuffer.buffer, graphics.indices.buffer, 1, ©Region); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); stagingBuffer.destroy(); } diff --git a/examples/computenbody/computenbody.cpp b/examples/computenbody/computenbody.cpp index 99d2d656..7e184c30 100644 --- a/examples/computenbody/computenbody.cpp +++ b/examples/computenbody/computenbody.cpp @@ -409,7 +409,7 @@ public: storageBufferSize); // Copy from staging buffer to storage buffer - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = {}; copyRegion.size = storageBufferSize; vkCmdCopyBuffer(copyCmd, stagingBuffer.buffer, compute.storageBuffer.buffer, 1, ©Region); @@ -438,7 +438,7 @@ public: 1, &buffer_barrier, 0, nullptr); } - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); stagingBuffer.destroy(); diff --git a/examples/computeparticles/computeparticles.cpp b/examples/computeparticles/computeparticles.cpp index a063d77a..c11b4c38 100644 --- a/examples/computeparticles/computeparticles.cpp +++ b/examples/computeparticles/computeparticles.cpp @@ -327,7 +327,7 @@ public: storageBufferSize); // Copy from staging buffer to storage buffer - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = {}; copyRegion.size = storageBufferSize; vkCmdCopyBuffer(copyCmd, stagingBuffer.buffer, compute.storageBuffer.buffer, 1, ©Region); @@ -356,7 +356,7 @@ public: 1, &buffer_barrier, 0, nullptr); } - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); stagingBuffer.destroy(); diff --git a/examples/computeraytracing/computeraytracing.cpp b/examples/computeraytracing/computeraytracing.cpp index 4712b72f..cceaa587 100644 --- a/examples/computeraytracing/computeraytracing.cpp +++ b/examples/computeraytracing/computeraytracing.cpp @@ -162,7 +162,7 @@ public: VK_CHECK_RESULT(vkAllocateMemory(device, &memAllocInfo, nullptr, &tex->deviceMemory)); VK_CHECK_RESULT(vkBindImageMemory(device, tex->image, tex->deviceMemory, 0)); - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); tex->imageLayout = VK_IMAGE_LAYOUT_GENERAL; vks::tools::setImageLayout( @@ -172,7 +172,7 @@ public: VK_IMAGE_LAYOUT_UNDEFINED, tex->imageLayout); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); // Create sampler VkSamplerCreateInfo sampler = vks::initializers::samplerCreateInfo(); @@ -337,11 +337,11 @@ public: storageBufferSize); // Copy to staging buffer - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = {}; copyRegion.size = storageBufferSize; vkCmdCopyBuffer(copyCmd, stagingBuffer.buffer, compute.storageBuffers.spheres.buffer, 1, ©Region); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); stagingBuffer.destroy(); @@ -372,10 +372,10 @@ public: storageBufferSize); // Copy to staging buffer - copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); copyRegion.size = storageBufferSize; vkCmdCopyBuffer(copyCmd, stagingBuffer.buffer, compute.storageBuffers.planes.buffer, 1, ©Region); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); stagingBuffer.destroy(); } diff --git a/examples/computeshader/computeshader.cpp b/examples/computeshader/computeshader.cpp index f2f84f32..f9cabbe6 100644 --- a/examples/computeshader/computeshader.cpp +++ b/examples/computeshader/computeshader.cpp @@ -152,7 +152,7 @@ public: VK_CHECK_RESULT(vkAllocateMemory(device, &memAllocInfo, nullptr, &tex->deviceMemory)); VK_CHECK_RESULT(vkBindImageMemory(device, tex->image, tex->deviceMemory, 0)); - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); tex->imageLayout = VK_IMAGE_LAYOUT_GENERAL; vks::tools::setImageLayout( @@ -161,7 +161,7 @@ public: VK_IMAGE_LAYOUT_UNDEFINED, tex->imageLayout); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); // Create sampler VkSamplerCreateInfo sampler = vks::initializers::samplerCreateInfo(); diff --git a/examples/deferred/deferred.cpp b/examples/deferred/deferred.cpp index fee8c412..f004067c 100644 --- a/examples/deferred/deferred.cpp +++ b/examples/deferred/deferred.cpp @@ -438,7 +438,7 @@ public: { if (offScreenCmdBuffer == VK_NULL_HANDLE) { - offScreenCmdBuffer = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); + offScreenCmdBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); } // Create a semaphore used to synchronize offscreen rendering and usage diff --git a/examples/deferredmultisampling/deferredmultisampling.cpp b/examples/deferredmultisampling/deferredmultisampling.cpp index 994a64b3..17efd146 100644 --- a/examples/deferredmultisampling/deferredmultisampling.cpp +++ b/examples/deferredmultisampling/deferredmultisampling.cpp @@ -450,7 +450,7 @@ public: void buildDeferredCommandBuffer() { if (offScreenCmdBuffer == VK_NULL_HANDLE) { - offScreenCmdBuffer = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); + offScreenCmdBuffer = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); } // Create a semaphore used to synchronize offscreen rendering and usage diff --git a/examples/deferredshadows/deferredshadows.cpp b/examples/deferredshadows/deferredshadows.cpp index 1ad80c59..ca330bac 100644 --- a/examples/deferredshadows/deferredshadows.cpp +++ b/examples/deferredshadows/deferredshadows.cpp @@ -354,7 +354,7 @@ public: { if (commandBuffers.deferred == VK_NULL_HANDLE) { - commandBuffers.deferred = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); + commandBuffers.deferred = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); } // Create a semaphore used to synchronize offscreen rendering and usage diff --git a/examples/gltfscene/gltfscene.cpp b/examples/gltfscene/gltfscene.cpp index f567bbeb..74405946 100644 --- a/examples/gltfscene/gltfscene.cpp +++ b/examples/gltfscene/gltfscene.cpp @@ -569,7 +569,7 @@ public: &glTFModel.indices.memory)); // Copy data from staging buffers (host) do device local buffer (gpu) - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = {}; copyRegion.size = vertexBufferSize; @@ -588,7 +588,7 @@ public: 1, ©Region); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); // Free staging resources vkDestroyBuffer(device, vertexStaging.buffer, nullptr); diff --git a/examples/instancing/instancing.cpp b/examples/instancing/instancing.cpp index 4e86d64f..31b24e5a 100644 --- a/examples/instancing/instancing.cpp +++ b/examples/instancing/instancing.cpp @@ -504,7 +504,7 @@ public: &instanceBuffer.memory)); // Copy to staging buffer - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = { }; copyRegion.size = instanceBuffer.size; @@ -515,7 +515,7 @@ public: 1, ©Region); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); instanceBuffer.descriptor.range = instanceBuffer.size; instanceBuffer.descriptor.buffer = instanceBuffer.buffer; diff --git a/examples/pbribl/pbribl.cpp b/examples/pbribl/pbribl.cpp index cf936adf..ac0cad83 100644 --- a/examples/pbribl/pbribl.cpp +++ b/examples/pbribl/pbribl.cpp @@ -778,14 +778,14 @@ public: fbufCreateInfo.layers = 1; VK_CHECK_RESULT(vkCreateFramebuffer(device, &fbufCreateInfo, nullptr, &offscreen.framebuffer)); - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); vks::tools::setImageLayout( layoutCmd, offscreen.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); } // Descriptors @@ -1173,14 +1173,14 @@ public: fbufCreateInfo.layers = 1; VK_CHECK_RESULT(vkCreateFramebuffer(device, &fbufCreateInfo, nullptr, &offscreen.framebuffer)); - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); vks::tools::setImageLayout( layoutCmd, offscreen.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); } // Descriptors diff --git a/examples/pbrtexture/main.cpp b/examples/pbrtexture/main.cpp index d9f60b06..bb6b238c 100644 --- a/examples/pbrtexture/main.cpp +++ b/examples/pbrtexture/main.cpp @@ -719,14 +719,14 @@ public: fbufCreateInfo.layers = 1; VK_CHECK_RESULT(vkCreateFramebuffer(device, &fbufCreateInfo, nullptr, &offscreen.framebuffer)); - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); vks::tools::setImageLayout( layoutCmd, offscreen.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); } // Descriptors @@ -1114,14 +1114,14 @@ public: fbufCreateInfo.layers = 1; VK_CHECK_RESULT(vkCreateFramebuffer(device, &fbufCreateInfo, nullptr, &offscreen.framebuffer)); - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); vks::tools::setImageLayout( layoutCmd, offscreen.image, VK_IMAGE_ASPECT_COLOR_BIT, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_COLOR_ATTACHMENT_OPTIMAL); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); } // Descriptors diff --git a/examples/scenerendering/scenerendering.cpp b/examples/scenerendering/scenerendering.cpp index b3a46e1f..4902f9df 100644 --- a/examples/scenerendering/scenerendering.cpp +++ b/examples/scenerendering/scenerendering.cpp @@ -822,7 +822,7 @@ public: void loadScene() { - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, false); scene = new Scene(vulkanDevice, queue); #if defined(__ANDROID__) diff --git a/examples/shadowmappingomni/shadowmappingomni.cpp b/examples/shadowmappingomni/shadowmappingomni.cpp index 5418f67a..fc694de3 100644 --- a/examples/shadowmappingomni/shadowmappingomni.cpp +++ b/examples/shadowmappingomni/shadowmappingomni.cpp @@ -195,7 +195,7 @@ public: VkMemoryAllocateInfo memAllocInfo = vks::initializers::memoryAllocateInfo(); VkMemoryRequirements memReqs; - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); // Create cube map image VK_CHECK_RESULT(vkCreateImage(device, &imageCreateInfo, nullptr, &shadowCubeMap.image)); @@ -220,7 +220,7 @@ public: VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL, subresourceRange); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); // Create sampler VkSamplerCreateInfo sampler = vks::initializers::samplerCreateInfo(); @@ -298,7 +298,7 @@ public: VK_CHECK_RESULT(vkAllocateMemory(device, &memAlloc, nullptr, &offscreenPass.color.mem)); VK_CHECK_RESULT(vkBindImageMemory(device, offscreenPass.color.image, offscreenPass.color.mem, 0)); - VkCommandBuffer layoutCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer layoutCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); vks::tools::setImageLayout( layoutCmd, @@ -339,7 +339,7 @@ public: VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_DEPTH_STENCIL_ATTACHMENT_OPTIMAL); - VulkanExampleBase::flushCommandBuffer(layoutCmd, queue, true); + vulkanDevice->flushCommandBuffer(layoutCmd, queue, true); depthStencilView.image = offscreenPass.depth.image; VK_CHECK_RESULT(vkCreateImageView(device, &depthStencilView, nullptr, &offscreenPass.depth.view)); diff --git a/examples/skeletalanimation/skeletalanimation.cpp b/examples/skeletalanimation/skeletalanimation.cpp index c49ecb5f..58afe7fb 100644 --- a/examples/skeletalanimation/skeletalanimation.cpp +++ b/examples/skeletalanimation/skeletalanimation.cpp @@ -636,7 +636,7 @@ public: indexBufferSize)); // Copy from staging buffers - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = {}; @@ -656,7 +656,7 @@ public: 1, ©Region); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); vkDestroyBuffer(device, vertexStaging.buffer, nullptr); vkFreeMemory(device, vertexStaging.memory, nullptr); diff --git a/examples/terraintessellation/terraintessellation.cpp b/examples/terraintessellation/terraintessellation.cpp index 0966d45e..cc72b704 100644 --- a/examples/terraintessellation/terraintessellation.cpp +++ b/examples/terraintessellation/terraintessellation.cpp @@ -552,7 +552,7 @@ public: &models.terrain.indices.memory)); // Copy from staging buffers - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkBufferCopy copyRegion = {}; @@ -572,7 +572,7 @@ public: 1, ©Region); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); models.terrain.device = device; diff --git a/examples/texture/texture.cpp b/examples/texture/texture.cpp index 5cc5b943..3b2aa6df 100644 --- a/examples/texture/texture.cpp +++ b/examples/texture/texture.cpp @@ -255,7 +255,7 @@ public: VK_CHECK_RESULT(vkAllocateMemory(device, &memAllocInfo, nullptr, &texture.deviceMemory)); VK_CHECK_RESULT(vkBindImageMemory(device, texture.image, texture.deviceMemory, 0)); - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); // Image memory barriers for the texture image @@ -321,7 +321,7 @@ public: // Store current layout for later reuse texture.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); // Clean up staging resources vkFreeMemory(device, stagingMemory, nullptr); @@ -368,7 +368,7 @@ public: texture.imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL; // Setup image memory barrier transfer image to shader read layout - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); // The sub resource range describes the regions of the image we will be transition VkImageSubresourceRange subresourceRange = {}; @@ -398,7 +398,7 @@ public: 0, nullptr, 1, &imageMemoryBarrier); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); } ktxTexture_Destroy(ktxTexture); diff --git a/examples/texture3d/texture3d.cpp b/examples/texture3d/texture3d.cpp index 63803243..2363f73a 100644 --- a/examples/texture3d/texture3d.cpp +++ b/examples/texture3d/texture3d.cpp @@ -381,7 +381,7 @@ public: memcpy(mapped, data, texMemSize); vkUnmapMemory(device, stagingMemory); - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); // The sub resource range describes the regions of the image we will be transitioned VkImageSubresourceRange subresourceRange = {}; @@ -428,7 +428,7 @@ public: texture.imageLayout, subresourceRange); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); // Clean up staging resources delete[] data; diff --git a/examples/texturearray/texturearray.cpp b/examples/texturearray/texturearray.cpp index 4ea1cc17..c672d2d8 100644 --- a/examples/texturearray/texturearray.cpp +++ b/examples/texturearray/texturearray.cpp @@ -216,7 +216,7 @@ public: VK_CHECK_RESULT(vkAllocateMemory(device, &memAllocInfo, nullptr, &textureArray.deviceMemory)); VK_CHECK_RESULT(vkBindImageMemory(device, textureArray.image, textureArray.deviceMemory, 0)); - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); // Image barrier for optimal image (target) // Set initial layout for all array layers (faces) of the optimal (target) tiled texture @@ -252,7 +252,7 @@ public: textureArray.imageLayout, subresourceRange); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); // Create sampler VkSamplerCreateInfo sampler = vks::initializers::samplerCreateInfo(); diff --git a/examples/texturecubemap/texturecubemap.cpp b/examples/texturecubemap/texturecubemap.cpp index d56857e1..5532b5f1 100644 --- a/examples/texturecubemap/texturecubemap.cpp +++ b/examples/texturecubemap/texturecubemap.cpp @@ -215,7 +215,7 @@ public: VK_CHECK_RESULT(vkAllocateMemory(device, &memAllocInfo, nullptr, &cubeMap.deviceMemory)); VK_CHECK_RESULT(vkBindImageMemory(device, cubeMap.image, cubeMap.deviceMemory, 0)); - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); // Setup buffer copy regions for each face including all of its miplevels std::vector bufferCopyRegions; @@ -276,7 +276,7 @@ public: cubeMap.imageLayout, subresourceRange); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); // Create sampler VkSamplerCreateInfo sampler = vks::initializers::samplerCreateInfo(); diff --git a/examples/texturemipmapgen/texturemipmapgen.cpp b/examples/texturemipmapgen/texturemipmapgen.cpp index 04c98e33..e0e12140 100644 --- a/examples/texturemipmapgen/texturemipmapgen.cpp +++ b/examples/texturemipmapgen/texturemipmapgen.cpp @@ -204,7 +204,7 @@ public: VK_CHECK_RESULT(vkAllocateMemory(device, &memAllocInfo, nullptr, &texture.deviceMemory)); VK_CHECK_RESULT(vkBindImageMemory(device, texture.image, texture.deviceMemory, 0)); - VkCommandBuffer copyCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer copyCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); VkImageSubresourceRange subresourceRange = {}; subresourceRange.aspectMask = VK_IMAGE_ASPECT_COLOR_BIT; @@ -247,7 +247,7 @@ public: VK_PIPELINE_STAGE_TRANSFER_BIT, subresourceRange); - VulkanExampleBase::flushCommandBuffer(copyCmd, queue, true); + vulkanDevice->flushCommandBuffer(copyCmd, queue, true); // Clean up staging resources vkFreeMemory(device, stagingMemory, nullptr); @@ -258,7 +258,7 @@ public: // --------------------------------------------------------------- // We copy down the whole mip chain doing a blit from mip-1 to mip // An alternative way would be to always blit from the first mip level and sample that one down - VkCommandBuffer blitCmd = VulkanExampleBase::createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); + VkCommandBuffer blitCmd = vulkanDevice->createCommandBuffer(VK_COMMAND_BUFFER_LEVEL_PRIMARY, true); // Copy down mips from n-1 to n for (int32_t i = 1; i < texture.mipLevels; i++) @@ -336,7 +336,7 @@ public: VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, subresourceRange); - VulkanExampleBase::flushCommandBuffer(blitCmd, queue, true); + vulkanDevice->flushCommandBuffer(blitCmd, queue, true); // --------------------------------------------------------------- // Create samplers