Resolve a validation layer warnings on destruction order of Image/Buffer and bound DeviceMemory. (#1636)
This commit is contained in:
committed by
GitHub
parent
0e3e8967be
commit
87936f9bc8
@@ -89,10 +89,10 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
vk::ImageView depthView = device.createImageView( vk::ImageViewCreateInfo(
|
||||
vk::ImageViewCreateFlags(), depthImage, vk::ImageViewType::e2D, depthFormat, {}, { vk::ImageAspectFlagBits::eDepth, 0, 1, 0, 1 } ) );
|
||||
|
||||
// destroy depthView, depthMemory, and depthImage
|
||||
// destroy depthView, depthImage, and depthMemory
|
||||
device.destroyImageView( depthView );
|
||||
device.destroyImage( depthImage ); // the Image should to be destroyed before the bound DeviceMemory is freed
|
||||
device.freeMemory( depthMemory );
|
||||
device.destroyImage( depthImage );
|
||||
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
|
||||
@@ -78,8 +78,8 @@ int main( int /*argc*/, char ** /*argv*/ )
|
||||
device.bindBufferMemory( uniformDataBuffer, uniformDataMemory, 0 );
|
||||
|
||||
// free device memory and destroy buffer
|
||||
device.destroyBuffer( uniformDataBuffer ); // the Buffer should be destroyed before the bound DeviceMemory is freed
|
||||
device.freeMemory( uniformDataMemory );
|
||||
device.destroyBuffer( uniformDataBuffer );
|
||||
|
||||
/* VULKAN_HPP_KEY_END */
|
||||
|
||||
|
||||
@@ -107,8 +107,8 @@ namespace vk
|
||||
|
||||
void clear( vk::Device const & device )
|
||||
{
|
||||
device.destroyBuffer( buffer ); // to prevent some validation layer warning, the Buffer needs to be destroyed before the bound DeviceMemory
|
||||
device.freeMemory( deviceMemory );
|
||||
device.destroyBuffer( buffer );
|
||||
}
|
||||
|
||||
template <typename DataType>
|
||||
@@ -187,8 +187,8 @@ namespace vk
|
||||
void clear( vk::Device const & device )
|
||||
{
|
||||
device.destroyImageView( imageView );
|
||||
device.destroyImage( image ); // the Image should to be destroyed before the bound DeviceMemory is freed
|
||||
device.freeMemory( deviceMemory );
|
||||
device.destroyImage( image );
|
||||
}
|
||||
|
||||
vk::Format format;
|
||||
|
||||
Reference in New Issue
Block a user