Fix warnings and errors on clang-3.9

This commit is contained in:
Markus Tavenrath 2020-05-18 14:02:37 +02:00
parent b58aa05aeb
commit 57555edfb2
20 changed files with 51 additions and 44 deletions

View File

@ -99,7 +99,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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 );
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );

View File

@ -108,7 +108,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
{} );
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
@ -135,7 +135,7 @@ int main( int /*argc*/, char ** /*argv*/ )
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -115,7 +115,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
textureData );
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
@ -142,7 +142,7 @@ int main( int /*argc*/, char ** /*argv*/ )
// commandBuffer->begin() has already been called above!
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -152,7 +152,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBufferDynamic, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBufferDynamic, uniformBufferData.buffer, {} } },
{} );
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
@ -177,7 +177,7 @@ int main( int /*argc*/, char ** /*argv*/ )
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -159,7 +159,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -244,7 +244,7 @@ int main( int /*argc*/, char ** /*argv*/ )
uint32_t currentBuffer = result.value;
vk::ClearValue clearValue;
clearValue.color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
clearValue.color = vk::ClearColorValue( std::array<float, 4>( { { 0.2f, 0.2f, 0.2f, 0.2f } } ) );
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
framebuffers[currentBuffer].get(),
vk::Rect2D( vk::Offset2D( 0, 0 ), surfaceData.extent ),

View File

@ -164,7 +164,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::DescriptorSetLayoutCreateInfo( vk::DescriptorSetLayoutCreateFlags(), 1, &sampler2DBinding ) );
// Create pipeline layout with multiple descriptor sets
std::array<vk::DescriptorSetLayout, 2> descriptorSetLayouts = { uniformLayout.get(), samplerLayout.get() };
std::array<vk::DescriptorSetLayout, 2> descriptorSetLayouts = { { uniformLayout.get(), samplerLayout.get() } };
vk::UniquePipelineLayout pipelineLayout = device->createPipelineLayoutUnique(
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), 2, descriptorSetLayouts.data() ) );
@ -183,12 +183,12 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::DescriptorImageInfo textureImageInfo( textureData.textureSampler.get(),
textureData.imageData->imageView.get(),
vk::ImageLayout::eShaderReadOnlyOptimal );
std::array<vk::WriteDescriptorSet, 2> writeDescriptorSets = {
std::array<vk::WriteDescriptorSet, 2> writeDescriptorSets = { {
vk::WriteDescriptorSet(
descriptorSets[0].get(), 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &uniformBufferInfo ),
vk::WriteDescriptorSet(
descriptorSets[1].get(), 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &textureImageInfo )
};
} };
device->updateDescriptorSets( writeDescriptorSets, nullptr );
/* VULKAN_KEY_END */
@ -214,7 +214,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -108,7 +108,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
{} );
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
@ -158,7 +158,7 @@ int main( int /*argc*/, char ** /*argv*/ )
commandBuffer->resetQueryPool( queryPool.get(), 0, 2 );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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 );
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
framebuffers[currentBuffer.value].get(),

View File

@ -146,7 +146,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
textureData );
/* VULKAN_KEY_START */
@ -315,7 +315,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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 );
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),

View File

@ -113,7 +113,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
textureData );
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
@ -260,7 +260,7 @@ void main()
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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 );
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),

View File

@ -164,7 +164,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::WriteDescriptorSet( *descriptorSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfo ), {} );
// Create our push constant data, which matches shader expectations
std::array<unsigned, 2> pushConstants = { (unsigned)2, (unsigned)0x3F800000 };
std::array<unsigned, 2> pushConstants = { { (unsigned)2, (unsigned)0x3F800000 } };
// Ensure we have enough room for push constant data
assert( ( sizeof( pushConstants ) <= physicalDevice.getProperties().limits.maxPushConstantsSize ) &&
@ -195,7 +195,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -164,7 +164,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -265,6 +265,8 @@ namespace vk
orbit( glm::vec2( delta[0], -delta[1] ), true );
}
break;
default:
break;
}
update();

View File

@ -904,8 +904,8 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() },
{ vk::DescriptorType::eStorageBuffer, materialBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} },
{ vk::DescriptorType::eStorageBuffer, materialBufferData.buffer, {} } },
textures );
// RayTracing specific stuff
@ -1030,10 +1030,10 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
rayTracingDescriptorSets[i],
{ { bindings[2].descriptorType, uniformBufferData.buffer, vk::UniqueBufferView() },
{ bindings[3].descriptorType, vertexBufferData.buffer, vk::UniqueBufferView() },
{ bindings[4].descriptorType, indexBufferData.buffer, vk::UniqueBufferView() },
{ bindings[5].descriptorType, materialBufferData.buffer, vk::UniqueBufferView() } },
{ { bindings[2].descriptorType, uniformBufferData.buffer, {} },
{ bindings[3].descriptorType, vertexBufferData.buffer, {} },
{ bindings[4].descriptorType, indexBufferData.buffer, {} },
{ bindings[5].descriptorType, materialBufferData.buffer, {} } },
textures,
2 );
}
@ -1131,7 +1131,7 @@ int main( int /*argc*/, char ** /*argv*/ )
shaderBindingTableBufferData.upload( device, shaderHandleStorage );
std::array<vk::ClearValue, 2> clearValues;
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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 );
// Main loop

View File

@ -137,12 +137,12 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSets[0],
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
greenTextureData );
vk::su::updateDescriptorSets(
device,
descriptorSets[1],
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
checkeredTextureData );
/* VULKAN_KEY_START */
@ -192,7 +192,7 @@ int main( int /*argc*/, char ** /*argv*/ )
}
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -154,10 +154,11 @@ int main( int /*argc*/, char ** /*argv*/ )
// binding 0 = uniform buffer (MVP)
// binding 1 = texture2D
// binding 2 = sampler
std::array<vk::DescriptorSetLayoutBinding, 3> resourceBindings = {
std::array<vk::DescriptorSetLayoutBinding, 3> resourceBindings = { {
vk::DescriptorSetLayoutBinding( 0, vk::DescriptorType::eUniformBuffer, 1, vk::ShaderStageFlagBits::eVertex ),
vk::DescriptorSetLayoutBinding( 1, vk::DescriptorType::eSampledImage, 1, vk::ShaderStageFlagBits::eFragment ),
vk::DescriptorSetLayoutBinding( 2, vk::DescriptorType::eSampler, 1, vk::ShaderStageFlagBits::eFragment )
}
};
vk::UniqueDescriptorSetLayout descriptorSetLayout = device->createDescriptorSetLayoutUnique(
vk::DescriptorSetLayoutCreateInfo( vk::DescriptorSetLayoutCreateFlags(),
@ -169,9 +170,9 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), 1, &( *descriptorSetLayout ) ) );
// Create a single pool to contain data for the descriptor set
std::array<vk::DescriptorPoolSize, 3> poolSizes = { vk::DescriptorPoolSize( vk::DescriptorType::eUniformBuffer, 1 ),
std::array<vk::DescriptorPoolSize, 3> poolSizes = { { vk::DescriptorPoolSize( vk::DescriptorType::eUniformBuffer, 1 ),
vk::DescriptorPoolSize( vk::DescriptorType::eSampledImage, 1 ),
vk::DescriptorPoolSize( vk::DescriptorType::eSampler, 1 ) };
vk::DescriptorPoolSize( vk::DescriptorType::eSampler, 1 ) } };
vk::UniqueDescriptorPool descriptorPool = device->createDescriptorPoolUnique(
vk::DescriptorPoolCreateInfo( vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet,
1,
@ -188,11 +189,11 @@ int main( int /*argc*/, char ** /*argv*/ )
textureData.imageData->imageView.get(),
vk::ImageLayout::eShaderReadOnlyOptimal );
vk::DescriptorImageInfo samplerInfo( sampler.get(), {}, {} );
std::array<vk::WriteDescriptorSet, 3> descriptorWrites = {
std::array<vk::WriteDescriptorSet, 3> descriptorWrites = { {
vk::WriteDescriptorSet( *descriptorSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfo ),
vk::WriteDescriptorSet( *descriptorSet, 1, 0, 1, vk::DescriptorType::eSampledImage, &imageInfo ),
vk::WriteDescriptorSet( *descriptorSet, 2, 0, 1, vk::DescriptorType::eSampler, &samplerInfo )
};
} };
device->updateDescriptorSets( descriptorWrites, nullptr );
/* VULKAN_KEY_END */
@ -219,7 +220,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -114,7 +114,7 @@ int main( int /*argc*/, char ** /*argv*/ )
vk::su::updateDescriptorSets(
device,
descriptorSet,
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
textureData );
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
@ -138,7 +138,7 @@ int main( int /*argc*/, char ** /*argv*/ )
assert( currentBuffer.value < framebuffers.size() );
vk::ClearValue clearValues[2];
clearValues[0].color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
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(),

View File

@ -170,7 +170,7 @@ int main( int /*argc*/, char ** /*argv*/ )
commandBuffer->begin( vk::CommandBufferBeginInfo() );
vk::ClearValue clearValue;
clearValue.color = vk::ClearColorValue( std::array<float, 4>( { 0.2f, 0.2f, 0.2f, 0.2f } ) );
clearValue.color = vk::ClearColorValue( std::array<float, 4>( { { 0.2f, 0.2f, 0.2f, 0.2f } } ) );
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
framebuffers[currentBuffer.value].get(),
vk::Rect2D( vk::Offset2D( 0, 0 ), surfaceData.extent ),

View File

@ -15,8 +15,12 @@
#include <vulkan/vulkan.hpp>
#define GLM_FORCE_RADIANS
#if defined(_MSC_VER)
#pragma warning( disable : 4201 ) // disable warning C4201: nonstandard extension used: nameless struct/union; needed
// to get glm/detail/type_vec?.hpp without warnings
#endif
#include <glm/gtc/matrix_transform.hpp>
namespace vk

View File

@ -230,8 +230,8 @@ namespace vk
class CheckerboardImageGenerator
{
public:
CheckerboardImageGenerator( std::array<uint8_t, 3> const & rgb0 = { 0, 0, 0 },
std::array<uint8_t, 3> const & rgb1 = { 255, 255, 255 } );
CheckerboardImageGenerator( std::array<uint8_t, 3> const & rgb0 = { { 0, 0, 0 } },
std::array<uint8_t, 3> const & rgb1 = { { 255, 255, 255 } } );
void operator()( void * data, vk::Extent2D & extent ) const;