mirror of
https://github.com/KhronosGroup/Vulkan-Hpp.git
synced 2024-10-14 16:32:17 +00:00
Removed explicit setting of the ComponentMapping for ImageViews in samples to RGBA, as the default of Identity does the same.
This commit is contained in:
parent
d8c9f4f0ee
commit
9b7adb35ee
@ -160,13 +160,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
|
|
||||||
std::vector<vk::raii::ImageView> imageViews;
|
std::vector<vk::raii::ImageView> imageViews;
|
||||||
imageViews.reserve( swapChainImages.size() );
|
imageViews.reserve( swapChainImages.size() );
|
||||||
vk::ComponentMapping componentMapping(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
{}, {}, vk::ImageViewType::e2D, format, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::ImageSubresourceRange subResourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
|
||||||
for ( auto image : swapChainImages )
|
for ( auto image : swapChainImages )
|
||||||
{
|
{
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
imageViewCreateInfo.image = static_cast<vk::Image>( image );
|
||||||
{}, static_cast<vk::Image>( image ), vk::ImageViewType::e2D, format, componentMapping, subResourceRange );
|
|
||||||
imageViews.push_back( { device, imageViewCreateInfo } );
|
imageViews.push_back( { device, imageViewCreateInfo } );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,11 +92,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::DeviceMemory depthMemory( device, memoryAllocateInfo );
|
vk::raii::DeviceMemory depthMemory( device, memoryAllocateInfo );
|
||||||
depthImage.bindMemory( *depthMemory, 0 );
|
depthImage.bindMemory( *depthMemory, 0 );
|
||||||
|
|
||||||
vk::ComponentMapping componentMapping(
|
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
|
||||||
vk::ImageSubresourceRange subResourceRange( vk::ImageAspectFlagBits::eDepth, 0, 1, 0, 1 );
|
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
{}, *depthImage, vk::ImageViewType::e2D, depthFormat, componentMapping, subResourceRange );
|
{}, *depthImage, vk::ImageViewType::e2D, depthFormat, {}, { vk::ImageAspectFlagBits::eDepth, 0, 1, 0, 1 } );
|
||||||
vk::raii::ImageView depthView( device, imageViewCreateInfo );
|
vk::raii::ImageView depthView( device, imageViewCreateInfo );
|
||||||
|
|
||||||
/* VULKAN_HPP_KEY_END */
|
/* VULKAN_HPP_KEY_END */
|
||||||
|
@ -193,11 +193,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::BorderColor::eFloatOpaqueWhite );
|
vk::BorderColor::eFloatOpaqueWhite );
|
||||||
vk::raii::Sampler sampler( device, samplerCreateInfo );
|
vk::raii::Sampler sampler( device, samplerCreateInfo );
|
||||||
|
|
||||||
vk::ComponentMapping componentMapping(
|
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
|
||||||
vk::ImageSubresourceRange imageSubresourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
{}, *image, vk::ImageViewType::e2D, format, componentMapping, imageSubresourceRange );
|
{}, *image, vk::ImageViewType::e2D, format, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::raii::ImageView imageView( device, imageViewCreateInfo );
|
vk::raii::ImageView imageView( device, imageViewCreateInfo );
|
||||||
|
|
||||||
/* VULKAN_KEY_END */
|
/* VULKAN_KEY_END */
|
||||||
|
@ -144,11 +144,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::ImageLayout::eUndefined,
|
vk::ImageLayout::eUndefined,
|
||||||
vk::ImageLayout::eTransferDstOptimal );
|
vk::ImageLayout::eTransferDstOptimal );
|
||||||
|
|
||||||
vk::ClearColorValue clearColorValue( std::array<float, 4>( { { 1.0f, 1.0f, 0.0f, 0.0f } } ) );
|
|
||||||
vk::ImageSubresourceRange imageSubresourceRange(
|
|
||||||
vk::ImageAspectFlagBits::eColor, 0, VK_REMAINING_MIP_LEVELS, 0, VK_REMAINING_ARRAY_LAYERS );
|
|
||||||
commandBuffer.clearColorImage(
|
commandBuffer.clearColorImage(
|
||||||
*inputImage, vk::ImageLayout::eTransferDstOptimal, clearColorValue, imageSubresourceRange );
|
*inputImage,
|
||||||
|
vk::ImageLayout::eTransferDstOptimal,
|
||||||
|
{ std::array<float, 4>( { { 1.0f, 1.0f, 0.0f, 0.0f } } ) },
|
||||||
|
{ { vk::ImageAspectFlagBits::eColor, 0, VK_REMAINING_MIP_LEVELS, 0, VK_REMAINING_ARRAY_LAYERS } } );
|
||||||
|
|
||||||
// Set the image layout to SHADER_READONLY_OPTIMAL for use by the shaders
|
// Set the image layout to SHADER_READONLY_OPTIMAL for use by the shaders
|
||||||
vk::raii::su::setImageLayout( commandBuffer,
|
vk::raii::su::setImageLayout( commandBuffer,
|
||||||
@ -157,11 +157,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::ImageLayout::eTransferDstOptimal,
|
vk::ImageLayout::eTransferDstOptimal,
|
||||||
vk::ImageLayout::eShaderReadOnlyOptimal );
|
vk::ImageLayout::eShaderReadOnlyOptimal );
|
||||||
|
|
||||||
vk::ComponentMapping componentMapping(
|
vk::ImageViewCreateInfo imageViewCreateInfo( {},
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
*inputImage,
|
||||||
imageSubresourceRange = vk::ImageSubresourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
vk::ImageViewType::e2D,
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
swapChainData.colorFormat,
|
||||||
{}, *inputImage, vk::ImageViewType::e2D, swapChainData.colorFormat, componentMapping, imageSubresourceRange );
|
{},
|
||||||
|
{ vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::raii::ImageView inputAttachmentView( device, imageViewCreateInfo );
|
vk::raii::ImageView inputAttachmentView( device, imageViewCreateInfo );
|
||||||
|
|
||||||
vk::DescriptorSetLayoutBinding layoutBinding(
|
vk::DescriptorSetLayoutBinding layoutBinding(
|
||||||
@ -219,7 +220,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::raii::DescriptorPool descriptorPool( device, descriptorPoolCreateInfo );
|
vk::raii::DescriptorPool descriptorPool( device, descriptorPoolCreateInfo );
|
||||||
|
|
||||||
vk::DescriptorSetAllocateInfo descriptorSetAllocateInfo( *descriptorPool, *descriptorSetLayout );
|
vk::DescriptorSetAllocateInfo descriptorSetAllocateInfo( *descriptorPool, *descriptorSetLayout );
|
||||||
vk::raii::DescriptorSet descriptorSet = std::move( vk::raii::DescriptorSets( device, descriptorSetAllocateInfo ).front() );
|
vk::raii::DescriptorSet descriptorSet =
|
||||||
|
std::move( vk::raii::DescriptorSets( device, descriptorSetAllocateInfo ).front() );
|
||||||
|
|
||||||
vk::DescriptorImageInfo inputImageInfo( nullptr, *inputAttachmentView, vk::ImageLayout::eShaderReadOnlyOptimal );
|
vk::DescriptorImageInfo inputImageInfo( nullptr, *inputAttachmentView, vk::ImageLayout::eShaderReadOnlyOptimal );
|
||||||
vk::WriteDescriptorSet writeDescriptorSet(
|
vk::WriteDescriptorSet writeDescriptorSet(
|
||||||
@ -227,8 +229,7 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
device.updateDescriptorSets( writeDescriptorSet, nullptr );
|
device.updateDescriptorSets( writeDescriptorSet, nullptr );
|
||||||
|
|
||||||
vk::raii::PipelineCache pipelineCache( device, vk::PipelineCacheCreateInfo() );
|
vk::raii::PipelineCache pipelineCache( device, vk::PipelineCacheCreateInfo() );
|
||||||
vk::raii::Pipeline graphicsPipeline =
|
vk::raii::Pipeline graphicsPipeline = vk::raii::su::makeGraphicsPipeline( device,
|
||||||
vk::raii::su::makeGraphicsPipeline( device,
|
|
||||||
pipelineCache,
|
pipelineCache,
|
||||||
vertexShaderModule,
|
vertexShaderModule,
|
||||||
nullptr,
|
nullptr,
|
||||||
|
@ -313,13 +313,7 @@ namespace vk
|
|||||||
image.bindMemory( *deviceMemory, 0 );
|
image.bindMemory( *deviceMemory, 0 );
|
||||||
imageView = vk::raii::ImageView(
|
imageView = vk::raii::ImageView(
|
||||||
device,
|
device,
|
||||||
vk::ImageViewCreateInfo(
|
vk::ImageViewCreateInfo( {}, *image, vk::ImageViewType::e2D, format, {}, { aspectMask, 0, 1, 0, 1 } ) );
|
||||||
{},
|
|
||||||
*image,
|
|
||||||
vk::ImageViewType::e2D,
|
|
||||||
format,
|
|
||||||
{ ComponentSwizzle::eR, ComponentSwizzle::eG, ComponentSwizzle::eB, ComponentSwizzle::eA },
|
|
||||||
{ aspectMask, 0, 1, 0, 1 } ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageData( std::nullptr_t ) {}
|
ImageData( std::nullptr_t ) {}
|
||||||
@ -440,17 +434,11 @@ namespace vk
|
|||||||
images = swapChain.getImages();
|
images = swapChain.getImages();
|
||||||
|
|
||||||
imageViews.reserve( images.size() );
|
imageViews.reserve( images.size() );
|
||||||
vk::ComponentMapping componentMapping(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
{}, {}, vk::ImageViewType::e2D, colorFormat, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::ImageSubresourceRange subResourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
|
||||||
for ( auto image : images )
|
for ( auto image : images )
|
||||||
{
|
{
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo( {},
|
imageViewCreateInfo.image = static_cast<vk::Image>( image );
|
||||||
static_cast<vk::Image>( image ),
|
|
||||||
vk::ImageViewType::e2D,
|
|
||||||
colorFormat,
|
|
||||||
componentMapping,
|
|
||||||
subResourceRange );
|
|
||||||
imageViews.emplace_back( device, imageViewCreateInfo );
|
imageViews.emplace_back( device, imageViewCreateInfo );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,13 +166,11 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
|
|
||||||
std::vector<vk::ImageView> imageViews;
|
std::vector<vk::ImageView> imageViews;
|
||||||
imageViews.reserve( swapChainImages.size() );
|
imageViews.reserve( swapChainImages.size() );
|
||||||
vk::ComponentMapping componentMapping(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
{}, {}, vk::ImageViewType::e2D, format, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::ImageSubresourceRange subResourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
|
||||||
for ( auto image : swapChainImages )
|
for ( auto image : swapChainImages )
|
||||||
{
|
{
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
imageViewCreateInfo.image = image;
|
||||||
vk::ImageViewCreateFlags(), image, vk::ImageViewType::e2D, format, componentMapping, subResourceRange );
|
|
||||||
imageViews.push_back( device.createImageView( imageViewCreateInfo ) );
|
imageViews.push_back( device.createImageView( imageViewCreateInfo ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,15 +92,13 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
|
|
||||||
device.bindImageMemory( depthImage, depthMemory, 0 );
|
device.bindImageMemory( depthImage, depthMemory, 0 );
|
||||||
|
|
||||||
vk::ComponentMapping componentMapping(
|
vk::ImageView depthView =
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
device.createImageView( vk::ImageViewCreateInfo( vk::ImageViewCreateFlags(),
|
||||||
vk::ImageSubresourceRange subResourceRange( vk::ImageAspectFlagBits::eDepth, 0, 1, 0, 1 );
|
|
||||||
vk::ImageView depthView = device.createImageView( vk::ImageViewCreateInfo( vk::ImageViewCreateFlags(),
|
|
||||||
depthImage,
|
depthImage,
|
||||||
vk::ImageViewType::e2D,
|
vk::ImageViewType::e2D,
|
||||||
depthFormat,
|
depthFormat,
|
||||||
componentMapping,
|
{},
|
||||||
subResourceRange ) );
|
{ vk::ImageAspectFlagBits::eDepth, 0, 1, 0, 1 } ) );
|
||||||
|
|
||||||
// destroy depthView, depthMemory, and depthImage
|
// destroy depthView, depthMemory, and depthImage
|
||||||
device.destroyImageView( depthView );
|
device.destroyImageView( depthView );
|
||||||
|
@ -194,11 +194,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::BorderColor::eFloatOpaqueWhite );
|
vk::BorderColor::eFloatOpaqueWhite );
|
||||||
vk::Sampler sampler = device.createSampler( samplerCreateInfo );
|
vk::Sampler sampler = device.createSampler( samplerCreateInfo );
|
||||||
|
|
||||||
vk::ComponentMapping componentMapping(
|
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
|
||||||
vk::ImageSubresourceRange imageSubresourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
{}, image, vk::ImageViewType::e2D, format, componentMapping, imageSubresourceRange );
|
{}, image, vk::ImageViewType::e2D, format, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::ImageView imageView = device.createImageView( imageViewCreateInfo );
|
vk::ImageView imageView = device.createImageView( imageViewCreateInfo );
|
||||||
|
|
||||||
/* VULKAN_KEY_END */
|
/* VULKAN_KEY_END */
|
||||||
|
@ -159,11 +159,12 @@ int main( int /*argc*/, char ** /*argv*/ )
|
|||||||
vk::ImageLayout::eTransferDstOptimal,
|
vk::ImageLayout::eTransferDstOptimal,
|
||||||
vk::ImageLayout::eShaderReadOnlyOptimal );
|
vk::ImageLayout::eShaderReadOnlyOptimal );
|
||||||
|
|
||||||
vk::ComponentMapping componentMapping(
|
vk::ImageViewCreateInfo imageViewCreateInfo( {},
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
inputImage,
|
||||||
vk::ImageSubresourceRange imageSubresourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
vk::ImageViewType::e2D,
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
swapChainData.colorFormat,
|
||||||
{}, inputImage, vk::ImageViewType::e2D, swapChainData.colorFormat, componentMapping, imageSubresourceRange );
|
{},
|
||||||
|
{ vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::ImageView inputAttachmentView = device.createImageView( imageViewCreateInfo );
|
vk::ImageView inputAttachmentView = device.createImageView( imageViewCreateInfo );
|
||||||
|
|
||||||
vk::DescriptorSetLayoutBinding layoutBinding(
|
vk::DescriptorSetLayoutBinding layoutBinding(
|
||||||
|
@ -879,11 +879,8 @@ namespace vk
|
|||||||
|
|
||||||
device.bindImageMemory( image, deviceMemory, 0 );
|
device.bindImageMemory( image, deviceMemory, 0 );
|
||||||
|
|
||||||
vk::ComponentMapping componentMapping(
|
|
||||||
ComponentSwizzle::eR, ComponentSwizzle::eG, ComponentSwizzle::eB, ComponentSwizzle::eA );
|
|
||||||
vk::ImageSubresourceRange imageSubresourceRange( aspectMask, 0, 1, 0, 1 );
|
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
{}, image, vk::ImageViewType::e2D, format, componentMapping, imageSubresourceRange );
|
{}, image, vk::ImageViewType::e2D, format, {}, { aspectMask, 0, 1, 0, 1 } );
|
||||||
imageView = device.createImageView( imageViewCreateInfo );
|
imageView = device.createImageView( imageViewCreateInfo );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -969,13 +966,11 @@ namespace vk
|
|||||||
images = device.getSwapchainImagesKHR( swapChain );
|
images = device.getSwapchainImagesKHR( swapChain );
|
||||||
|
|
||||||
imageViews.reserve( images.size() );
|
imageViews.reserve( images.size() );
|
||||||
vk::ComponentMapping componentMapping(
|
vk::ImageViewCreateInfo imageViewCreateInfo(
|
||||||
vk::ComponentSwizzle::eR, vk::ComponentSwizzle::eG, vk::ComponentSwizzle::eB, vk::ComponentSwizzle::eA );
|
{}, {}, vk::ImageViewType::e2D, colorFormat, {}, { vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 } );
|
||||||
vk::ImageSubresourceRange subResourceRange( vk::ImageAspectFlagBits::eColor, 0, 1, 0, 1 );
|
|
||||||
for ( auto image : images )
|
for ( auto image : images )
|
||||||
{
|
{
|
||||||
vk::ImageViewCreateInfo imageViewCreateInfo(
|
imageViewCreateInfo.image = image;
|
||||||
vk::ImageViewCreateFlags(), image, vk::ImageViewType::e2D, colorFormat, componentMapping, subResourceRange );
|
|
||||||
imageViews.push_back( device.createImageView( imageViewCreateInfo ) );
|
imageViews.push_back( device.createImageView( imageViewCreateInfo ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user