MCPcopy Create free account
hub / github.com/Ipotrick/Daxa / create_task_image

Method create_task_image

src/utils/impl_task_graph.cpp:999–1051  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

997 }
998
999 auto TaskGraph::create_task_image(TaskImageInfo info) -> TaskImageView
1000 {
1001 auto & impl = *reinterpret_cast<ImplTaskGraph *>(this->object);
1002 DAXA_DBG_ASSERT_TRUE_M(!impl.compiled, "completed task graphs can not record new tasks");
1003 DAXA_DBG_ASSERT_TRUE_M(!impl.name_to_resource_table.contains(info.name), "task image names must be unique");
1004
1005 ImplTaskResource image = {};
1006 image.name = impl.task_memory.allocate_copy_string(info.name);
1007 image.kind = TaskResourceKind::IMAGE;
1008 image.external = {};
1009 image.id = {}; // Set in transient resource creation.
1010 image.info = {};
1011 image.lifetime_type = info.lifetime_type;
1012 image.info.image.dimensions = info.dimensions;
1013 image.info.image.format = info.format;
1014 image.info.image.size = info.size;
1015 image.info.image.mip_level_count = info.mip_level_count;
1016 image.info.image.array_layer_count = info.array_layer_count;
1017 image.info.image.sample_count = info.sample_count;
1018 impl.resources.push_back(image);
1019 u32 const index = static_cast<u32>(impl.resources.size()) - 1u;
1020
1021 impl.name_to_resource_table[image.name] = std::pair{&impl.resources.back(), index};
1022
1023 if (info.lifetime_type == TaskResourceLifetimeType::PERSISTENT_DOUBLE_BUFFER)
1024 {
1025 auto image_back_buffer = image;
1026 image_back_buffer.name = impl.task_memory.allocate_copy_string(std::format("{}::back_buffer", info.name).c_str());
1027
1028 impl.resources.push_back(image_back_buffer);
1029 u32 const back_buffer_resource_index = static_cast<u32>(impl.resources.size()) - 1u;
1030
1031 impl.name_to_resource_table[image_back_buffer.name] = std::pair{&impl.resources.back(), back_buffer_resource_index};
1032
1033 impl.resources[index].double_buffer_pair_resource = { &impl.resources.back(), back_buffer_resource_index };
1034 impl.resources[index].double_buffer_index = 0u;
1035 impl.resources[back_buffer_resource_index].double_buffer_pair_resource = { (&impl.resources.back()) - 1u, index };
1036 impl.resources[back_buffer_resource_index].double_buffer_index = 1u;
1037 }
1038
1039 auto task_image_view = TaskImageView{
1040 .task_graph_index = impl.unique_index,
1041 .index = index,
1042 .slice = {
1043 .base_mip_level = 0,
1044 .level_count = info.mip_level_count,
1045 .base_array_layer = 0,
1046 .layer_count = info.array_layer_count,
1047 },
1048 };
1049
1050 return task_image_view;
1051 }
1052
1053 auto validate_resource_view_is_owned_by_graph(ImplTaskGraph & impl, auto transient)
1054 {

Callers 7

bindless_handlesFunction · 0.80
transient_write_aliasingFunction · 0.80
permutation_aliasingFunction · 0.80
transient_resourcesFunction · 0.80
write_read_imageFunction · 0.80
write_read_image_layerFunction · 0.80
optional_attachmentsFunction · 0.80

Calls 6

containsMethod · 0.80
allocate_copy_stringMethod · 0.80
c_strMethod · 0.80
push_backMethod · 0.45
sizeMethod · 0.45
backMethod · 0.45

Tested by

no test coverage detected