mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Fix warnings and errors on clang-3.9
This commit is contained in:
parent
b58aa05aeb
commit
57555edfb2
@ -99,7 +99,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
|
|
||||||
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
|
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
|
||||||
|
@ -108,7 +108,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
{} );
|
{} );
|
||||||
|
|
||||||
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
||||||
@ -135,7 +135,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
|
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -115,7 +115,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
textureData );
|
textureData );
|
||||||
|
|
||||||
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
||||||
@ -142,7 +142,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
// commandBuffer->begin() has already been called above!
|
// commandBuffer->begin() has already been called above!
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -152,7 +152,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBufferDynamic, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBufferDynamic, uniformBufferData.buffer, {} } },
|
||||||
{} );
|
{} );
|
||||||
|
|
||||||
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
||||||
@ -177,7 +177,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
|
commandBuffer->begin( vk::CommandBufferBeginInfo( vk::CommandBufferUsageFlags() ) );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -159,7 +159,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -244,7 +244,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
uint32_t currentBuffer = result.value;
|
uint32_t currentBuffer = result.value;
|
||||||
|
|
||||||
vk::ClearValue clearValue;
|
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(),
|
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer].get(),
|
framebuffers[currentBuffer].get(),
|
||||||
vk::Rect2D( vk::Offset2D( 0, 0 ), surfaceData.extent ),
|
vk::Rect2D( vk::Offset2D( 0, 0 ), surfaceData.extent ),
|
||||||
|
@ -164,7 +164,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::DescriptorSetLayoutCreateInfo( vk::DescriptorSetLayoutCreateFlags(), 1, &sampler2DBinding ) );
|
vk::DescriptorSetLayoutCreateInfo( vk::DescriptorSetLayoutCreateFlags(), 1, &sampler2DBinding ) );
|
||||||
|
|
||||||
// Create pipeline layout with multiple descriptor sets
|
// 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::UniquePipelineLayout pipelineLayout = device->createPipelineLayoutUnique(
|
||||||
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), 2, descriptorSetLayouts.data() ) );
|
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), 2, descriptorSetLayouts.data() ) );
|
||||||
|
|
||||||
@ -183,12 +183,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::DescriptorImageInfo textureImageInfo( textureData.textureSampler.get(),
|
vk::DescriptorImageInfo textureImageInfo( textureData.textureSampler.get(),
|
||||||
textureData.imageData->imageView.get(),
|
textureData.imageData->imageView.get(),
|
||||||
vk::ImageLayout::eShaderReadOnlyOptimal );
|
vk::ImageLayout::eShaderReadOnlyOptimal );
|
||||||
std::array<vk::WriteDescriptorSet, 2> writeDescriptorSets = {
|
std::array<vk::WriteDescriptorSet, 2> writeDescriptorSets = { {
|
||||||
vk::WriteDescriptorSet(
|
vk::WriteDescriptorSet(
|
||||||
descriptorSets[0].get(), 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &uniformBufferInfo ),
|
descriptorSets[0].get(), 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &uniformBufferInfo ),
|
||||||
vk::WriteDescriptorSet(
|
vk::WriteDescriptorSet(
|
||||||
descriptorSets[1].get(), 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &textureImageInfo )
|
descriptorSets[1].get(), 0, 0, 1, vk::DescriptorType::eCombinedImageSampler, &textureImageInfo )
|
||||||
};
|
} };
|
||||||
device->updateDescriptorSets( writeDescriptorSets, nullptr );
|
device->updateDescriptorSets( writeDescriptorSets, nullptr );
|
||||||
|
|
||||||
/* VULKAN_KEY_END */
|
/* VULKAN_KEY_END */
|
||||||
@ -214,7 +214,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -108,7 +108,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
{} );
|
{} );
|
||||||
|
|
||||||
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
||||||
@ -158,7 +158,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
commandBuffer->resetQueryPool( queryPool.get(), 0, 2 );
|
commandBuffer->resetQueryPool( queryPool.get(), 0, 2 );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
|
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -146,7 +146,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
textureData );
|
textureData );
|
||||||
|
|
||||||
/* VULKAN_KEY_START */
|
/* VULKAN_KEY_START */
|
||||||
@ -315,7 +315,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
|
|
||||||
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
|
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
|
||||||
|
@ -113,7 +113,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
textureData );
|
textureData );
|
||||||
|
|
||||||
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
||||||
@ -260,7 +260,7 @@ void main()
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
|
|
||||||
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
|
commandBuffer->beginRenderPass( vk::RenderPassBeginInfo( renderPass.get(),
|
||||||
|
@ -164,7 +164,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::WriteDescriptorSet( *descriptorSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfo ), {} );
|
vk::WriteDescriptorSet( *descriptorSet, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfo ), {} );
|
||||||
|
|
||||||
// Create our push constant data, which matches shader expectations
|
// 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
|
// Ensure we have enough room for push constant data
|
||||||
assert( ( sizeof( pushConstants ) <= physicalDevice.getProperties().limits.maxPushConstantsSize ) &&
|
assert( ( sizeof( pushConstants ) <= physicalDevice.getProperties().limits.maxPushConstantsSize ) &&
|
||||||
@ -195,7 +195,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
|
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
|
@ -164,7 +164,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -265,6 +265,8 @@ namespace vk
|
|||||||
orbit( glm::vec2( delta[0], -delta[1] ), true );
|
orbit( glm::vec2( delta[0], -delta[1] ), true );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
update();
|
update();
|
||||||
|
@ -904,8 +904,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} },
|
||||||
{ vk::DescriptorType::eStorageBuffer, materialBufferData.buffer, vk::UniqueBufferView() } },
|
{ vk::DescriptorType::eStorageBuffer, materialBufferData.buffer, {} } },
|
||||||
textures );
|
textures );
|
||||||
|
|
||||||
// RayTracing specific stuff
|
// RayTracing specific stuff
|
||||||
@ -1030,10 +1030,10 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
rayTracingDescriptorSets[i],
|
rayTracingDescriptorSets[i],
|
||||||
{ { bindings[2].descriptorType, uniformBufferData.buffer, vk::UniqueBufferView() },
|
{ { bindings[2].descriptorType, uniformBufferData.buffer, {} },
|
||||||
{ bindings[3].descriptorType, vertexBufferData.buffer, vk::UniqueBufferView() },
|
{ bindings[3].descriptorType, vertexBufferData.buffer, {} },
|
||||||
{ bindings[4].descriptorType, indexBufferData.buffer, vk::UniqueBufferView() },
|
{ bindings[4].descriptorType, indexBufferData.buffer, {} },
|
||||||
{ bindings[5].descriptorType, materialBufferData.buffer, vk::UniqueBufferView() } },
|
{ bindings[5].descriptorType, materialBufferData.buffer, {} } },
|
||||||
textures,
|
textures,
|
||||||
2 );
|
2 );
|
||||||
}
|
}
|
||||||
@ -1131,7 +1131,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
shaderBindingTableBufferData.upload( device, shaderHandleStorage );
|
shaderBindingTableBufferData.upload( device, shaderHandleStorage );
|
||||||
|
|
||||||
std::array<vk::ClearValue, 2> clearValues;
|
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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
|
|
||||||
// Main loop
|
// Main loop
|
||||||
|
@ -137,12 +137,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSets[0],
|
descriptorSets[0],
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
greenTextureData );
|
greenTextureData );
|
||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSets[1],
|
descriptorSets[1],
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
checkeredTextureData );
|
checkeredTextureData );
|
||||||
|
|
||||||
/* VULKAN_KEY_START */
|
/* VULKAN_KEY_START */
|
||||||
@ -192,7 +192,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
}
|
}
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
|
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
|
@ -154,10 +154,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
// binding 0 = uniform buffer (MVP)
|
// binding 0 = uniform buffer (MVP)
|
||||||
// binding 1 = texture2D
|
// binding 1 = texture2D
|
||||||
// binding 2 = sampler
|
// 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( 0, vk::DescriptorType::eUniformBuffer, 1, vk::ShaderStageFlagBits::eVertex ),
|
||||||
vk::DescriptorSetLayoutBinding( 1, vk::DescriptorType::eSampledImage, 1, vk::ShaderStageFlagBits::eFragment ),
|
vk::DescriptorSetLayoutBinding( 1, vk::DescriptorType::eSampledImage, 1, vk::ShaderStageFlagBits::eFragment ),
|
||||||
vk::DescriptorSetLayoutBinding( 2, vk::DescriptorType::eSampler, 1, vk::ShaderStageFlagBits::eFragment )
|
vk::DescriptorSetLayoutBinding( 2, vk::DescriptorType::eSampler, 1, vk::ShaderStageFlagBits::eFragment )
|
||||||
|
}
|
||||||
};
|
};
|
||||||
vk::UniqueDescriptorSetLayout descriptorSetLayout = device->createDescriptorSetLayoutUnique(
|
vk::UniqueDescriptorSetLayout descriptorSetLayout = device->createDescriptorSetLayoutUnique(
|
||||||
vk::DescriptorSetLayoutCreateInfo( vk::DescriptorSetLayoutCreateFlags(),
|
vk::DescriptorSetLayoutCreateInfo( vk::DescriptorSetLayoutCreateFlags(),
|
||||||
@ -169,9 +170,9 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), 1, &( *descriptorSetLayout ) ) );
|
vk::PipelineLayoutCreateInfo( vk::PipelineLayoutCreateFlags(), 1, &( *descriptorSetLayout ) ) );
|
||||||
|
|
||||||
// Create a single pool to contain data for the descriptor set
|
// 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::eSampledImage, 1 ),
|
||||||
vk::DescriptorPoolSize( vk::DescriptorType::eSampler, 1 ) };
|
vk::DescriptorPoolSize( vk::DescriptorType::eSampler, 1 ) } };
|
||||||
vk::UniqueDescriptorPool descriptorPool = device->createDescriptorPoolUnique(
|
vk::UniqueDescriptorPool descriptorPool = device->createDescriptorPoolUnique(
|
||||||
vk::DescriptorPoolCreateInfo( vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet,
|
vk::DescriptorPoolCreateInfo( vk::DescriptorPoolCreateFlagBits::eFreeDescriptorSet,
|
||||||
1,
|
1,
|
||||||
@ -188,11 +189,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
textureData.imageData->imageView.get(),
|
textureData.imageData->imageView.get(),
|
||||||
vk::ImageLayout::eShaderReadOnlyOptimal );
|
vk::ImageLayout::eShaderReadOnlyOptimal );
|
||||||
vk::DescriptorImageInfo samplerInfo( sampler.get(), {}, {} );
|
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, 0, 0, 1, vk::DescriptorType::eUniformBuffer, nullptr, &bufferInfo ),
|
||||||
vk::WriteDescriptorSet( *descriptorSet, 1, 0, 1, vk::DescriptorType::eSampledImage, &imageInfo ),
|
vk::WriteDescriptorSet( *descriptorSet, 1, 0, 1, vk::DescriptorType::eSampledImage, &imageInfo ),
|
||||||
vk::WriteDescriptorSet( *descriptorSet, 2, 0, 1, vk::DescriptorType::eSampler, &samplerInfo )
|
vk::WriteDescriptorSet( *descriptorSet, 2, 0, 1, vk::DescriptorType::eSampler, &samplerInfo )
|
||||||
};
|
} };
|
||||||
device->updateDescriptorSets( descriptorWrites, nullptr );
|
device->updateDescriptorSets( descriptorWrites, nullptr );
|
||||||
|
|
||||||
/* VULKAN_KEY_END */
|
/* VULKAN_KEY_END */
|
||||||
@ -219,7 +220,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
|
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
|
@ -114,7 +114,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::su::updateDescriptorSets(
|
vk::su::updateDescriptorSets(
|
||||||
device,
|
device,
|
||||||
descriptorSet,
|
descriptorSet,
|
||||||
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, vk::UniqueBufferView() } },
|
{ { vk::DescriptorType::eUniformBuffer, uniformBufferData.buffer, {} } },
|
||||||
textureData );
|
textureData );
|
||||||
|
|
||||||
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
vk::UniquePipelineCache pipelineCache = device->createPipelineCacheUnique( vk::PipelineCacheCreateInfo() );
|
||||||
@ -138,7 +138,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
assert( currentBuffer.value < framebuffers.size() );
|
assert( currentBuffer.value < framebuffers.size() );
|
||||||
|
|
||||||
vk::ClearValue clearValues[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 );
|
clearValues[1].depthStencil = vk::ClearDepthStencilValue( 1.0f, 0 );
|
||||||
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
|
@ -170,7 +170,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
commandBuffer->begin( vk::CommandBufferBeginInfo() );
|
commandBuffer->begin( vk::CommandBufferBeginInfo() );
|
||||||
|
|
||||||
vk::ClearValue clearValue;
|
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(),
|
vk::RenderPassBeginInfo renderPassBeginInfo( renderPass.get(),
|
||||||
framebuffers[currentBuffer.value].get(),
|
framebuffers[currentBuffer.value].get(),
|
||||||
vk::Rect2D( vk::Offset2D( 0, 0 ), surfaceData.extent ),
|
vk::Rect2D( vk::Offset2D( 0, 0 ), surfaceData.extent ),
|
||||||
|
@ -15,8 +15,12 @@
|
|||||||
|
|
||||||
#include <vulkan/vulkan.hpp>
|
#include <vulkan/vulkan.hpp>
|
||||||
#define GLM_FORCE_RADIANS
|
#define GLM_FORCE_RADIANS
|
||||||
|
|
||||||
|
#if defined(_MSC_VER)
|
||||||
#pragma warning( disable : 4201 ) // disable warning C4201: nonstandard extension used: nameless struct/union; needed
|
#pragma warning( disable : 4201 ) // disable warning C4201: nonstandard extension used: nameless struct/union; needed
|
||||||
// to get glm/detail/type_vec?.hpp without warnings
|
// to get glm/detail/type_vec?.hpp without warnings
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <glm/gtc/matrix_transform.hpp>
|
#include <glm/gtc/matrix_transform.hpp>
|
||||||
|
|
||||||
namespace vk
|
namespace vk
|
||||||
|
@ -230,8 +230,8 @@ namespace vk
|
|||||||
class CheckerboardImageGenerator
|
class CheckerboardImageGenerator
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CheckerboardImageGenerator( std::array<uint8_t, 3> const & rgb0 = { 0, 0, 0 },
|
CheckerboardImageGenerator( std::array<uint8_t, 3> const & rgb0 = { { 0, 0, 0 } },
|
||||||
std::array<uint8_t, 3> const & rgb1 = { 255, 255, 255 } );
|
std::array<uint8_t, 3> const & rgb1 = { { 255, 255, 255 } } );
|
||||||
|
|
||||||
void operator()( void * data, vk::Extent2D & extent ) const;
|
void operator()( void * data, vk::Extent2D & extent ) const;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user