MCPcopy Create free account
hub / github.com/Ipotrick/Daxa / ~ImplTaskGraph

Method ~ImplTaskGraph

src/utils/impl_task_graph.cpp:4030–4105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4028 }
4029
4030 ImplTaskGraph::~ImplTaskGraph()
4031 {
4032 // Destroy image views
4033 for (u32 t = 0u; t < this->tasks.size(); ++t)
4034 {
4035 ImplTask & task = this->tasks[t];
4036 for (u32 attach_i = 0; attach_i < task.attachments.size(); ++attach_i)
4037 {
4038 // Null Attachments have to be skipped
4039 if (task.attachment_access_groups[attach_i].first == nullptr)
4040 {
4041 continue;
4042 }
4043
4044 std::span<ImageViewId> views = task.attachment_image_views[attach_i];
4045 for (u32 view_i = 0u; view_i < views.size(); ++view_i)
4046 {
4047 // Tail of image views can be empty when the task image view slice is smaller than the shader array size.
4048 // Skip tail views.
4049 if (views[view_i].is_empty())
4050 {
4051 break;
4052 }
4053 if (this->info.device.is_id_valid(views[view_i]))
4054 {
4055 ImageId parent_image = this->info.device.image_view_info(views[view_i]).value().image;
4056 ImageViewId default_view = parent_image.default_view();
4057 bool is_default_view = default_view == views[view_i];
4058 if (!is_default_view)
4059 {
4060 this->info.device.destroy_image_view(views[view_i]);
4061 }
4062 }
4063 }
4064 }
4065 }
4066
4067 // Destroy transient resources
4068 // Decrement external resource reference counters
4069 for (u32 i = 0; i < this->resources.size(); ++i)
4070 {
4071 ImplTaskResource & resource = this->resources[i];
4072 if (resource.external != nullptr)
4073 {
4074 // ExternalTaskBuffer is idential to Tlas and Blas internals.
4075 if (resource.kind != TaskResourceKind::IMAGE)
4076 {
4077 static_cast<ImplExternalResource *>(resource.external)->dec_refcnt(ImplExternalResource::zero_ref_callback, nullptr);
4078 }
4079 else
4080 {
4081 static_cast<ImplExternalResource *>(resource.external)->dec_refcnt(ImplExternalResource::zero_ref_callback, nullptr);
4082 }
4083 continue;
4084 }
4085 switch (resource.kind)
4086 {
4087 case TaskResourceKind::BUFFER:

Callers

nothing calls this directly

Calls 5

is_emptyMethod · 0.80
is_id_validMethod · 0.80
sizeMethod · 0.45
valueMethod · 0.45
dec_refcntMethod · 0.45

Tested by

no test coverage detected