Skip to content

Commit

Permalink
Add missing checks in ~ImageView and ~RenderPass; adjust loading in m…
Browse files Browse the repository at this point in the history
…ulti_draw_indirect (#1031)
  • Loading branch information
asuessenbach committed Apr 18, 2024
1 parent 57680a6 commit 6d4a95a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
5 changes: 4 additions & 1 deletion framework/core/image_view.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,10 @@ ImageView::ImageView(ImageView &&other) :

ImageView::~ImageView()
{
vkDestroyImageView(get_device().get_handle(), get_handle(), nullptr);
if (has_device())
{
vkDestroyImageView(get_device().get_handle(), get_handle(), nullptr);
}
}

const Image &ImageView::get_image() const
Expand Down
5 changes: 4 additions & 1 deletion framework/core/render_pass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,10 @@ RenderPass::RenderPass(RenderPass &&other) :
RenderPass::~RenderPass()
{
// Destroy render pass
vkDestroyRenderPass(get_device().get_handle(), get_handle(), nullptr);
if (has_device())
{
vkDestroyRenderPass(get_device().get_handle(), get_handle(), nullptr);
}
}

const uint32_t RenderPass::get_color_output_count(uint32_t subpass_index) const
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,13 +310,11 @@ bool MultiDrawIndirect::prepare(const vkb::ApplicationOptions &options)

void MultiDrawIndirect::load_scene()
{
assert(has_device());
vkb::GLTFLoader loader{get_device()};
const std::string scene_path = "scenes/vokselia/";
auto scene = loader.read_scene_from_file(scene_path + "vokselia.gltf");
ApiVulkanSample::load_scene(scene_path + "vokselia.gltf");

assert(has_scene());
for (auto &&mesh : scene->get_components<vkb::sg::Mesh>())
for (auto &&mesh : get_scene().get_components<vkb::sg::Mesh>())
{
const size_t texture_index = textures.size();
const auto &short_name = mesh->get_name();
Expand Down

0 comments on commit 6d4a95a

Please sign in to comment.