File tree Expand file tree Collapse file tree
texture_mipmap_generation Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- /* Copyright (c) 2019-2025 , Sascha Willems
1+ /* Copyright (c) 2019-2026 , Sascha Willems
22 *
33 * SPDX-License-Identifier: Apache-2.0
44 *
@@ -408,10 +408,13 @@ void TextureLoading::load_texture()
408408// Free all Vulkan resources used by a texture object
409409void TextureLoading::destroy_texture (Texture texture)
410410{
411- vkDestroyImageView (get_device ().get_handle (), texture.view , nullptr );
412- vkDestroyImage (get_device ().get_handle (), texture.image , nullptr );
413- vkDestroySampler (get_device ().get_handle (), texture.sampler , nullptr );
414- vkFreeMemory (get_device ().get_handle (), texture.device_memory , nullptr );
411+ if (has_device ())
412+ {
413+ vkDestroyImageView (get_device ().get_handle (), texture.view , nullptr );
414+ vkDestroyImage (get_device ().get_handle (), texture.image , nullptr );
415+ vkDestroySampler (get_device ().get_handle (), texture.sampler , nullptr );
416+ vkFreeMemory (get_device ().get_handle (), texture.device_memory , nullptr );
417+ }
415418}
416419
417420void TextureLoading::build_command_buffers ()
Original file line number Diff line number Diff line change 1- /* Copyright (c) 2019-2025 , Sascha Willems
1+ /* Copyright (c) 2019-2026 , Sascha Willems
22 *
33 * SPDX-License-Identifier: Apache-2.0
44 *
@@ -285,9 +285,12 @@ void TextureMipMapGeneration::load_texture_generate_mipmaps(std::string file_nam
285285// Free all Vulkan resources used by a texture object
286286void TextureMipMapGeneration::destroy_texture (Texture texture)
287287{
288- vkDestroyImageView (get_device ().get_handle (), texture.view , nullptr );
289- vkDestroyImage (get_device ().get_handle (), texture.image , nullptr );
290- vkFreeMemory (get_device ().get_handle (), texture.device_memory , nullptr );
288+ if (has_device ())
289+ {
290+ vkDestroyImageView (get_device ().get_handle (), texture.view , nullptr );
291+ vkDestroyImage (get_device ().get_handle (), texture.image , nullptr );
292+ vkFreeMemory (get_device ().get_handle (), texture.device_memory , nullptr );
293+ }
291294}
292295
293296void TextureMipMapGeneration::load_assets ()
Original file line number Diff line number Diff line change @@ -40,7 +40,10 @@ HPPPipelineCache::~HPPPipelineCache()
4040 get_device ().get_handle ().destroyPipelineCache (pipeline_cache);
4141 }
4242
43- vkb::fs::write_temp (get_device ().get_resource_cache ().serialize (), " hpp_cache.data" );
43+ if (has_device ())
44+ {
45+ vkb::fs::write_temp (get_device ().get_resource_cache ().serialize (), " hpp_cache.data" );
46+ }
4447}
4548
4649bool HPPPipelineCache::prepare (const vkb::ApplicationOptions &options)
Original file line number Diff line number Diff line change @@ -70,7 +70,10 @@ PipelineCache::~PipelineCache()
7070 vkDestroyPipelineCache (get_device ().get_handle (), pipeline_cache, nullptr );
7171 }
7272
73- vkb::fs::write_temp (get_device ().get_resource_cache ().serialize (), " cache.data" );
73+ if (has_device ())
74+ {
75+ vkb::fs::write_temp (get_device ().get_resource_cache ().serialize (), " cache.data" );
76+ }
7477}
7578
7679bool PipelineCache::prepare (const vkb::ApplicationOptions &options)
You can’t perform that action at this time.
0 commit comments