Introduce structure constructors using ArrayProxyNoTemporaries

This commit is contained in:
asuessenbach
2020-07-08 10:58:37 +02:00
parent d9a88324d8
commit d86303c0e4
57 changed files with 2229 additions and 604 deletions

View File

@@ -82,7 +82,7 @@ int main( int /*argc*/, char ** /*argv*/ )
{ { vk::DescriptorType::eUniformBuffer, 1, vk::ShaderStageFlagBits::eVertex },
{ vk::DescriptorType::eCombinedImageSampler, 1, vk::ShaderStageFlagBits::eFragment } } );
vk::UniquePipelineLayout pipelineLayout = device->createPipelineLayoutUnique(
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), 1, &descriptorSetLayout.get() ) );
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), *descriptorSetLayout ) );
vk::UniqueRenderPass renderPass = vk::su::createRenderPass(
device,
@@ -109,14 +109,11 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::UniqueDescriptorPool descriptorPool = vk::su::createDescriptorPool(
device, { { vk::DescriptorType::eUniformBuffer, 1 }, { vk::DescriptorType::eCombinedImageSampler, 1 } } );
vk::UniqueDescriptorSet descriptorSet = std::move(
device->allocateDescriptorSetsUnique( vk::DescriptorSetAllocateInfo( *descriptorPool, 1, &*descriptorSetLayout ) )
device->allocateDescriptorSetsUnique( vk::DescriptorSetAllocateInfo( *descriptorPool, *descriptorSetLayout ) )
.front() );
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
textureData );
device, descriptorSet, { { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } }, textureData );
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
vk::UniquePipeline graphicsPipeline =
@@ -141,13 +138,12 @@ int main( int /*argc*/, char ** /*argv*/ )
// commandBuffer->begin() has already been called above!
vk::ClearValue clearValues[2];
std::array<vk::ClearValue, 2> clearValues;
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { { 0.2f, 0.2f, 0.2f, 0.2f } } ) );
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
framebuffers[currentBuffer.value].get(),
vk::Rect2D( vk::Offset2D( 0, 0 ), surfaceData.extent ),
2,
clearValues );
commandBuffer->beginRenderPass( renderPassBeginInfo, vk::SubpassContents::eInline );
commandBuffer->bindPipeline( vk::PipelineBindPoint::eGraphics, graphicsPipeline.get() );
@@ -171,14 +167,13 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::UniqueFence drawFence = device->createFenceUnique( vk::FenceCreateInfo() );
vk::PipelineStageFlags waitDestinationStageMask( vk::PipelineStageFlagBits::eColorAttachmentOutput );
vk::SubmitInfo submitInfo( 1, &imageAcquiredSemaphore.get(), &waitDestinationStageMask, 1, &commandBuffer.get() );
vk::SubmitInfo submitInfo( *imageAcquiredSemaphore, waitDestinationStageMask, *commandBuffer );
graphicsQueue.submit( submitInfo, drawFence.get() );
while ( vk::Result::eTimeout == device->waitForFences( drawFence.get(), VK_TRUE, vk::su::FenceTimeout ) )
;
presentQueue.presentKHR(
vk::PresentInfoKHR( 0, nullptr, 1, &swapChainData.swapChain.get(), &currentBuffer.value ) );
presentQueue.presentKHR( vk::PresentInfoKHR( {}, *swapChainData.swapChain, currentBuffer.value ) );
std::this_thread::sleep_for( std::chrono::milliseconds( 1000 ) );
/* VULKAN_KEY_END */
@@ -190,9 +185,9 @@ int main( int /*argc*/, char ** /*argv*/ )
std::cout << "vk::SystemError: " << err.what() << std::endl;
exit( -1 );
}
catch ( std::runtime_error & err )
catch ( std::exception & err )
{
std::cout << "std::runtime_error: " << err.what() << std::endl;
std::cout << "std::exception: " << err.what() << std::endl;
exit( -1 );
}
catch ( ... )