mirror of
https://github.com/KhronosGroup/Vulkan-Hpp
synced 2024-11-09 14:10:07 +00:00
Change samples from resetting command buffers to resetting command pool (#1638)
This commit is contained in:
parent
e2f5348e28
commit
a6b2199409
@ -50,8 +50,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -54,8 +54,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -46,8 +46,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
@ -140,7 +139,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
device.flushMappedMemoryRanges( mappedMemoryRange );
|
device.flushMappedMemoryRanges( mappedMemoryRange );
|
||||||
deviceMemory.unmapMemory();
|
deviceMemory.unmapMemory();
|
||||||
|
|
||||||
commandBuffer.reset( {} );
|
// reset the command buffer by resetting the complete command pool
|
||||||
|
commandPool.reset();
|
||||||
|
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||||
|
|
||||||
// Intend to blit from this image, set the layout accordingly
|
// Intend to blit from this image, set the layout accordingly
|
||||||
@ -151,9 +152,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
// Do a 32x32 blit to all of the dst image - should get big squares
|
// Do a 32x32 blit to all of the dst image - should get big squares
|
||||||
vk::ImageSubresourceLayers imageSubresourceLayers( vk::ImageAspectFlagBits::eColor, 0, 0, 1 );
|
vk::ImageSubresourceLayers imageSubresourceLayers( vk::ImageAspectFlagBits::eColor, 0, 0, 1 );
|
||||||
vk::ImageBlit imageBlit( imageSubresourceLayers,
|
vk::ImageBlit imageBlit( imageSubresourceLayers,
|
||||||
{ { vk::Offset3D( 0, 0, 0 ), vk::Offset3D( 32, 32, 1 ) } },
|
{ { vk::Offset3D( 0, 0, 0 ), vk::Offset3D( 32, 32, 1 ) } },
|
||||||
imageSubresourceLayers,
|
imageSubresourceLayers,
|
||||||
{ { vk::Offset3D( 0, 0, 0 ), vk::Offset3D( surfaceData.extent.width, surfaceData.extent.height, 1 ) } } );
|
{ { vk::Offset3D( 0, 0, 0 ), vk::Offset3D( surfaceData.extent.width, surfaceData.extent.height, 1 ) } } );
|
||||||
commandBuffer.blitImage(
|
commandBuffer.blitImage(
|
||||||
*blitSourceImage, vk::ImageLayout::eTransferSrcOptimal, blitDestinationImage, vk::ImageLayout::eTransferDstOptimal, imageBlit, vk::Filter::eLinear );
|
*blitSourceImage, vk::ImageLayout::eTransferSrcOptimal, blitDestinationImage, vk::ImageLayout::eTransferDstOptimal, imageBlit, vk::Filter::eLinear );
|
||||||
|
|
||||||
|
@ -44,8 +44,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -48,8 +48,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -36,7 +36,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( physicalDevice.getQueueFamilyProperties() );
|
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( physicalDevice.getQueueFamilyProperties() );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsQueueFamilyIndex, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsQueueFamilyIndex, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsQueueFamilyIndex } );
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsQueueFamilyIndex } );
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsQueueFamilyIndex, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsQueueFamilyIndex, 0 );
|
||||||
@ -71,7 +71,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
// Now create an event and wait for it on the GPU
|
// Now create an event and wait for it on the GPU
|
||||||
vk::raii::Event event( device, vk::EventCreateInfo() );
|
vk::raii::Event event( device, vk::EventCreateInfo() );
|
||||||
|
|
||||||
commandBuffer.reset( vk::CommandBufferResetFlags() );
|
// reset the command buffer by resetting the complete command pool of this frame
|
||||||
|
commandPool.reset();
|
||||||
|
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||||
commandBuffer.waitEvents( { *event }, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
|
commandBuffer.waitEvents( { *event }, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
|
||||||
commandBuffer.end();
|
commandBuffer.end();
|
||||||
@ -98,10 +100,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
} while ( result == vk::Result::eTimeout );
|
} while ( result == vk::Result::eTimeout );
|
||||||
assert( result == vk::Result::eSuccess );
|
assert( result == vk::Result::eSuccess );
|
||||||
|
|
||||||
commandBuffer.reset( {} );
|
|
||||||
device.resetFences( { *fence } );
|
device.resetFences( { *fence } );
|
||||||
event.reset();
|
event.reset();
|
||||||
|
|
||||||
|
// reset the command buffer by resetting the complete command pool
|
||||||
|
commandPool.reset();
|
||||||
|
|
||||||
// Now set the event from the GPU and wait on the CPU
|
// Now set the event from the GPU and wait on the CPU
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||||
commandBuffer.setEvent( *event, vk::PipelineStageFlagBits::eBottomOfPipe );
|
commandBuffer.setEvent( *event, vk::PipelineStageFlagBits::eBottomOfPipe );
|
||||||
|
@ -56,8 +56,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -53,8 +53,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -89,8 +89,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -113,8 +113,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -51,8 +51,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -85,8 +85,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -52,8 +52,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -94,8 +94,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -77,8 +77,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, deviceExtensions );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, deviceExtensions );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -169,7 +169,7 @@ AccelerationStructureData createAccelerationStructureData( vk::raii::PhysicalDev
|
|||||||
struct PerFrameData
|
struct PerFrameData
|
||||||
{
|
{
|
||||||
PerFrameData( vk::raii::Device const & device, uint32_t queueFamilyIndex )
|
PerFrameData( vk::raii::Device const & device, uint32_t queueFamilyIndex )
|
||||||
: commandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, queueFamilyIndex } )
|
: commandPool( device, { {}, queueFamilyIndex } )
|
||||||
, commandBuffer( vk::raii::su::makeCommandBuffer( device, commandPool ) )
|
, commandBuffer( vk::raii::su::makeCommandBuffer( device, commandPool ) )
|
||||||
, fence( device, vk::FenceCreateInfo( vk::FenceCreateFlagBits::eSignaled ) )
|
, fence( device, vk::FenceCreateInfo( vk::FenceCreateFlagBits::eSignaled ) )
|
||||||
, presentCompleteSemaphore( device, vk::SemaphoreCreateInfo() )
|
, presentCompleteSemaphore( device, vk::SemaphoreCreateInfo() )
|
||||||
@ -1109,8 +1109,6 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
double startTime = glfwGetTime();
|
double startTime = glfwGetTime();
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
||||||
vk::raii::CommandBuffer const & commandBuffer = perFrameData[frameIndex].commandBuffer;
|
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
glfwGetWindowSize( window, &w, &h );
|
glfwGetWindowSize( window, &w, &h );
|
||||||
if ( ( w != static_cast<int>( windowExtent.width ) ) || ( h != static_cast<int>( windowExtent.height ) ) )
|
if ( ( w != static_cast<int>( windowExtent.width ) ) || ( h != static_cast<int>( windowExtent.height ) ) )
|
||||||
@ -1129,7 +1127,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
depthBufferData = vk::raii::su::DepthBufferData( physicalDevice, device, vk::raii::su::pickDepthFormat( physicalDevice ), windowExtent );
|
depthBufferData = vk::raii::su::DepthBufferData( physicalDevice, device, vk::raii::su::pickDepthFormat( physicalDevice ), windowExtent );
|
||||||
|
|
||||||
vk::raii::su::oneTimeSubmit(
|
vk::raii::su::oneTimeSubmit(
|
||||||
commandBuffer,
|
device,
|
||||||
|
perFrameData[frameIndex].commandPool,
|
||||||
graphicsQueue,
|
graphicsQueue,
|
||||||
[&]( vk::raii::CommandBuffer const & commandBuffer )
|
[&]( vk::raii::CommandBuffer const & commandBuffer )
|
||||||
{
|
{
|
||||||
@ -1160,6 +1159,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
;
|
;
|
||||||
device.resetFences( { *perFrameData[frameIndex].fence } );
|
device.resetFences( { *perFrameData[frameIndex].fence } );
|
||||||
|
|
||||||
|
// reset the command buffer by resetting the complete command pool of this frame
|
||||||
|
perFrameData[frameIndex].commandPool.reset();
|
||||||
|
|
||||||
|
vk::raii::CommandBuffer const & commandBuffer = perFrameData[frameIndex].commandBuffer;
|
||||||
|
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
||||||
|
|
||||||
if ( appInfo.useRasterRender )
|
if ( appInfo.useRasterRender )
|
||||||
|
@ -54,8 +54,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -82,8 +82,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -44,8 +44,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -86,8 +86,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
vk::raii::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::raii::Device device = vk::raii::su::makeDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::raii::CommandPool commandPool =
|
vk::raii::CommandPool commandPool = vk::raii::CommandPool( device, { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::raii::CommandPool( device, { vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first } );
|
|
||||||
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
vk::raii::CommandBuffer commandBuffer = vk::raii::su::makeCommandBuffer( device, commandPool );
|
||||||
|
|
||||||
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
vk::raii::Queue graphicsQueue( device, graphicsAndPresentQueueFamilyIndex.first, 0 );
|
||||||
|
@ -83,8 +83,9 @@ namespace vk
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
void oneTimeSubmit( vk::raii::CommandBuffer const & commandBuffer, vk::raii::Queue const & queue, Func const & func )
|
void oneTimeSubmit( vk::raii::Device const & device, vk::raii::CommandPool const & commandPool, vk::raii::Queue const & queue, Func const & func )
|
||||||
{
|
{
|
||||||
|
vk::raii::CommandBuffer commandBuffer = std::move( vk::raii::CommandBuffers( device, { *commandPool, vk::CommandBufferLevel::ePrimary, 1 } ).front() );
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
||||||
func( commandBuffer );
|
func( commandBuffer );
|
||||||
commandBuffer.end();
|
commandBuffer.end();
|
||||||
@ -93,13 +94,6 @@ namespace vk
|
|||||||
queue.waitIdle();
|
queue.waitIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Func>
|
|
||||||
void oneTimeSubmit( vk::raii::Device const & device, vk::raii::CommandPool const & commandPool, vk::raii::Queue const & queue, Func const & func )
|
|
||||||
{
|
|
||||||
vk::raii::CommandBuffers commandBuffers( device, { *commandPool, vk::CommandBufferLevel::ePrimary, 1 } );
|
|
||||||
oneTimeSubmit( commandBuffers.front(), queue, func );
|
|
||||||
}
|
|
||||||
|
|
||||||
void setImageLayout(
|
void setImageLayout(
|
||||||
vk::raii::CommandBuffer const & commandBuffer, vk::Image image, vk::Format format, vk::ImageLayout oldImageLayout, vk::ImageLayout newImageLayout )
|
vk::raii::CommandBuffer const & commandBuffer, vk::Image image, vk::Format format, vk::ImageLayout oldImageLayout, vk::ImageLayout newImageLayout )
|
||||||
{
|
{
|
||||||
|
@ -39,7 +39,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
@ -131,7 +131,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
device.flushMappedMemoryRanges( vk::MappedMemoryRange( deviceMemory, 0, memoryRequirements.size ) );
|
device.flushMappedMemoryRanges( vk::MappedMemoryRange( deviceMemory, 0, memoryRequirements.size ) );
|
||||||
device.unmapMemory( deviceMemory );
|
device.unmapMemory( deviceMemory );
|
||||||
|
|
||||||
commandBuffer.reset( {} );
|
// reset the command buffer by resetting the complete command pool
|
||||||
|
device.resetCommandPool( commandPool );
|
||||||
|
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||||
|
|
||||||
// Intend to blit from this image, set the layout accordingly
|
// Intend to blit from this image, set the layout accordingly
|
||||||
|
@ -43,7 +43,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( physicalDevice.getQueueFamilyProperties() );
|
uint32_t graphicsQueueFamilyIndex = vk::su::findGraphicsQueueFamilyIndex( physicalDevice.getQueueFamilyProperties() );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsQueueFamilyIndex );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsQueueFamilyIndex );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsQueueFamilyIndex );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsQueueFamilyIndex } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
@ -72,7 +72,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
// Now create an event and wait for it on the GPU
|
// Now create an event and wait for it on the GPU
|
||||||
vk::Event event = device.createEvent( vk::EventCreateInfo( vk::EventCreateFlags() ) );
|
vk::Event event = device.createEvent( vk::EventCreateInfo( vk::EventCreateFlags() ) );
|
||||||
|
|
||||||
commandBuffer.reset( vk::CommandBufferResetFlags() );
|
// reset the command buffer by resetting the complete command pool
|
||||||
|
device.resetCommandPool( commandPool );
|
||||||
|
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||||
commandBuffer.waitEvents( event, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
|
commandBuffer.waitEvents( event, vk::PipelineStageFlagBits::eHost, vk::PipelineStageFlagBits::eBottomOfPipe, nullptr, nullptr, nullptr );
|
||||||
commandBuffer.end();
|
commandBuffer.end();
|
||||||
@ -99,10 +101,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
} while ( result == vk::Result::eTimeout );
|
} while ( result == vk::Result::eTimeout );
|
||||||
assert( result == vk::Result::eSuccess );
|
assert( result == vk::Result::eSuccess );
|
||||||
|
|
||||||
commandBuffer.reset( {} );
|
|
||||||
device.resetFences( fence );
|
device.resetFences( fence );
|
||||||
device.resetEvent( event );
|
device.resetEvent( event );
|
||||||
|
|
||||||
|
// reset the command buffer by resetting the complete command pool
|
||||||
|
device.resetCommandPool( commandPool );
|
||||||
|
|
||||||
// Now set the event from the GPU and wait on the CPU
|
// Now set the event from the GPU and wait on the CPU
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
commandBuffer.begin( vk::CommandBufferBeginInfo() );
|
||||||
commandBuffer.setEvent( event, vk::PipelineStageFlagBits::eBottomOfPipe );
|
commandBuffer.setEvent( event, vk::PipelineStageFlagBits::eBottomOfPipe );
|
||||||
|
@ -52,7 +52,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -84,7 +84,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, deviceExtensions );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, deviceExtensions );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -745,8 +745,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::array<PerFrameData, IMGUI_VK_QUEUED_FRAMES> perFrameData;
|
std::array<PerFrameData, IMGUI_VK_QUEUED_FRAMES> perFrameData;
|
||||||
for ( int i = 0; i < IMGUI_VK_QUEUED_FRAMES; i++ )
|
for ( int i = 0; i < IMGUI_VK_QUEUED_FRAMES; i++ )
|
||||||
{
|
{
|
||||||
perFrameData[i].commandPool =
|
perFrameData[i].commandPool = device.createCommandPool( vk::CommandPoolCreateInfo( {}, graphicsAndPresentQueueFamilyIndex.first ) );
|
||||||
device.createCommandPool( vk::CommandPoolCreateInfo( vk::CommandPoolCreateFlagBits::eResetCommandBuffer, graphicsAndPresentQueueFamilyIndex.first ) );
|
|
||||||
perFrameData[i].commandBuffer =
|
perFrameData[i].commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( perFrameData[i].commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( perFrameData[i].commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
perFrameData[i].fence = device.createFence( vk::FenceCreateInfo( vk::FenceCreateFlagBits::eSignaled ) );
|
perFrameData[i].fence = device.createFence( vk::FenceCreateInfo( vk::FenceCreateFlagBits::eSignaled ) );
|
||||||
@ -1102,8 +1101,6 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
double startTime = glfwGetTime();
|
double startTime = glfwGetTime();
|
||||||
glfwPollEvents();
|
glfwPollEvents();
|
||||||
|
|
||||||
vk::CommandBuffer const & commandBuffer = perFrameData[frameIndex].commandBuffer;
|
|
||||||
|
|
||||||
int w, h;
|
int w, h;
|
||||||
glfwGetWindowSize( window, &w, &h );
|
glfwGetWindowSize( window, &w, &h );
|
||||||
if ( ( w != static_cast<int>( windowExtent.width ) ) || ( h != static_cast<int>( windowExtent.height ) ) )
|
if ( ( w != static_cast<int>( windowExtent.width ) ) || ( h != static_cast<int>( windowExtent.height ) ) )
|
||||||
@ -1122,7 +1119,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
depthBufferData = vk::su::DepthBufferData( physicalDevice, device, vk::su::pickDepthFormat( physicalDevice ), windowExtent );
|
depthBufferData = vk::su::DepthBufferData( physicalDevice, device, vk::su::pickDepthFormat( physicalDevice ), windowExtent );
|
||||||
|
|
||||||
vk::su::oneTimeSubmit(
|
vk::su::oneTimeSubmit(
|
||||||
commandBuffer,
|
device,
|
||||||
|
perFrameData[frameIndex].commandPool,
|
||||||
graphicsQueue,
|
graphicsQueue,
|
||||||
[&]( vk::CommandBuffer const & commandBuffer )
|
[&]( vk::CommandBuffer const & commandBuffer )
|
||||||
{
|
{
|
||||||
@ -1152,6 +1150,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
;
|
;
|
||||||
device.resetFences( perFrameData[frameIndex].fence );
|
device.resetFences( perFrameData[frameIndex].fence );
|
||||||
|
|
||||||
|
// reset the command buffer by resetting the complete command pool of this frame
|
||||||
|
device.resetCommandPool( perFrameData[frameIndex].commandPool );
|
||||||
|
|
||||||
|
vk::CommandBuffer const & commandBuffer = perFrameData[frameIndex].commandBuffer;
|
||||||
|
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
||||||
|
|
||||||
if ( appInfo.useRasterRender )
|
if ( appInfo.useRasterRender )
|
||||||
|
@ -53,7 +53,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -85,7 +85,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
std::pair<uint32_t, uint32_t> graphicsAndPresentQueueFamilyIndex = vk::su::findGraphicsAndPresentQueueFamilyIndex( physicalDevice, surfaceData.surface );
|
||||||
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
vk::Device device = vk::su::createDevice( physicalDevice, graphicsAndPresentQueueFamilyIndex.first, vk::su::getDeviceExtensions() );
|
||||||
|
|
||||||
vk::CommandPool commandPool = vk::su::createCommandPool( device, graphicsAndPresentQueueFamilyIndex.first );
|
vk::CommandPool commandPool = device.createCommandPool( { {}, graphicsAndPresentQueueFamilyIndex.first } );
|
||||||
vk::CommandBuffer commandBuffer =
|
vk::CommandBuffer commandBuffer =
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
|
|
||||||
|
@ -59,12 +59,6 @@ namespace vk
|
|||||||
return ( propertyIterator != extensionProperties.end() );
|
return ( propertyIterator != extensionProperties.end() );
|
||||||
}
|
}
|
||||||
|
|
||||||
vk::CommandPool createCommandPool( vk::Device const & device, uint32_t queueFamilyIndex )
|
|
||||||
{
|
|
||||||
vk::CommandPoolCreateInfo commandPoolCreateInfo( vk::CommandPoolCreateFlagBits::eResetCommandBuffer, queueFamilyIndex );
|
|
||||||
return device.createCommandPool( commandPoolCreateInfo );
|
|
||||||
}
|
|
||||||
|
|
||||||
vk::DescriptorPool createDescriptorPool( vk::Device const & device, std::vector<vk::DescriptorPoolSize> const & poolSizes )
|
vk::DescriptorPool createDescriptorPool( vk::Device const & device, std::vector<vk::DescriptorPoolSize> const & poolSizes )
|
||||||
{
|
{
|
||||||
assert( !poolSizes.empty() );
|
assert( !poolSizes.empty() );
|
||||||
|
@ -31,8 +31,10 @@ namespace vk
|
|||||||
const uint64_t FenceTimeout = 100000000;
|
const uint64_t FenceTimeout = 100000000;
|
||||||
|
|
||||||
template <typename Func>
|
template <typename Func>
|
||||||
void oneTimeSubmit( vk::CommandBuffer const & commandBuffer, vk::Queue const & queue, Func const & func )
|
void oneTimeSubmit( vk::Device const & device, vk::CommandPool const & commandPool, vk::Queue const & queue, Func const & func )
|
||||||
{
|
{
|
||||||
|
vk::CommandBuffer commandBuffer =
|
||||||
|
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
||||||
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
commandBuffer.begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlagBits::eOneTimeSubmit ) );
|
||||||
func( commandBuffer );
|
func( commandBuffer );
|
||||||
commandBuffer.end();
|
commandBuffer.end();
|
||||||
@ -40,14 +42,6 @@ namespace vk
|
|||||||
queue.waitIdle();
|
queue.waitIdle();
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename Func>
|
|
||||||
void oneTimeSubmit( vk::Device const & device, vk::CommandPool const & commandPool, vk::Queue const & queue, Func const & func )
|
|
||||||
{
|
|
||||||
vk::CommandBuffer commandBuffer =
|
|
||||||
device.allocateCommandBuffers( vk::CommandBufferAllocateInfo( commandPool, vk::CommandBufferLevel::ePrimary, 1 ) ).front();
|
|
||||||
oneTimeSubmit( commandBuffer, queue, func );
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
void copyToDevice( vk::Device const & device, vk::DeviceMemory const & deviceMemory, T const * pData, size_t count, vk::DeviceSize stride = sizeof( T ) )
|
void copyToDevice( vk::Device const & device, vk::DeviceMemory const & deviceMemory, T const * pData, size_t count, vk::DeviceSize stride = sizeof( T ) )
|
||||||
{
|
{
|
||||||
@ -360,7 +354,6 @@ namespace vk
|
|||||||
vk::MemoryRequirements const & memoryRequirements,
|
vk::MemoryRequirements const & memoryRequirements,
|
||||||
vk::MemoryPropertyFlags memoryPropertyFlags );
|
vk::MemoryPropertyFlags memoryPropertyFlags );
|
||||||
bool contains( std::vector<vk::ExtensionProperties> const & extensionProperties, std::string const & extensionName );
|
bool contains( std::vector<vk::ExtensionProperties> const & extensionProperties, std::string const & extensionName );
|
||||||
vk::CommandPool createCommandPool( vk::Device const & device, uint32_t queueFamilyIndex );
|
|
||||||
vk::DescriptorPool createDescriptorPool( vk::Device const & device, std::vector<vk::DescriptorPoolSize> const & poolSizes );
|
vk::DescriptorPool createDescriptorPool( vk::Device const & device, std::vector<vk::DescriptorPoolSize> const & poolSizes );
|
||||||
vk::DescriptorSetLayout createDescriptorSetLayout( vk::Device const & device,
|
vk::DescriptorSetLayout createDescriptorSetLayout( vk::Device const & device,
|
||||||
std::vector<std::tuple<vk::DescriptorType, uint32_t, vk::ShaderStageFlags>> const & bindingData,
|
std::vector<std::tuple<vk::DescriptorType, uint32_t, vk::ShaderStageFlags>> const & bindingData,
|
||||||
|
@ -14221,7 +14221,7 @@ namespace VULKAN_HPP_NAMESPACE
|
|||||||
# elif defined( __APPLE__ )
|
# elif defined( __APPLE__ )
|
||||||
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
m_library = dlopen( "libvulkan.dylib", RTLD_NOW | RTLD_LOCAL );
|
||||||
# elif defined( _WIN32 )
|
# elif defined( _WIN32 )
|
||||||
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
m_library = ::LoadLibraryA( "vulkan-1.dll" );
|
||||||
# else
|
# else
|
||||||
# error unsupported platform
|
# error unsupported platform
|
||||||
# endif
|
# endif
|
||||||
|
Loading…
Reference in New Issue
Block a user