| 2367 | } |
| 2368 | |
| 2369 | TaskGraphDebugUi::TaskGraphDebugUi(TaskGraphDebugUiInfo const & info) |
| 2370 | { |
| 2371 | this->object = new ImplTaskGraphDebugUi{}; |
| 2372 | auto & ui_context = *r_cast<ImplTaskGraphDebugUi *>(this->object); |
| 2373 | ui_context.imgui_renderer = info.imgui_renderer; |
| 2374 | ui_context.device = info.device; |
| 2375 | ui_context.buffer_layout_cache_folder = info.buffer_layout_cache_folder; |
| 2376 | |
| 2377 | if(ui_context.buffer_layout_cache_folder.has_value()) |
| 2378 | { |
| 2379 | if(!std::filesystem::exists(ui_context.buffer_layout_cache_folder.value())) |
| 2380 | { |
| 2381 | std::filesystem::create_directories(ui_context.buffer_layout_cache_folder.value()); |
| 2382 | } |
| 2383 | } |
| 2384 | |
| 2385 | DAXA_DBG_ASSERT_TRUE_M(ui_context.resource_viewer_sampler.is_empty(), "IMPOSSIBLE CASE! The UI cannot already ahve a sampler created"); |
| 2386 | { |
| 2387 | ui_context.resource_viewer_sampler = ui_context.device.create_sampler({ |
| 2388 | .magnification_filter = Filter::NEAREST, |
| 2389 | .minification_filter = Filter::NEAREST, |
| 2390 | }); |
| 2391 | } |
| 2392 | |
| 2393 | #if TASK_GRAPH_RESOURCE_VIEWER_ONLINE_COMPILE_SHADERS |
| 2394 | |
| 2395 | /// ==================================================== |
| 2396 | /// ======= DEV LIVE RESOURCE VIEWER COMPILATION ======= |
| 2397 | /// ==================================================== |
| 2398 | |
| 2399 | DAXA_DBG_ASSERT_TRUE_M(!ui_context.pipeline_manager.is_valid(), "IMPOSSIBLE CASE! The UI cannot already have a pipeline manager"); |
| 2400 | if (!ui_context.pipeline_manager.is_valid()) |
| 2401 | { |
| 2402 | ui_context.pipeline_manager = daxa::PipelineManager(daxa::PipelineManagerInfo2{ |
| 2403 | .device = info.device, |
| 2404 | .root_paths = { |
| 2405 | DAXA_SHADER_INCLUDE_DIR, |
| 2406 | }, |
| 2407 | .write_out_spirv = std::nullopt, |
| 2408 | .default_language = daxa::ShaderLanguage::SLANG, |
| 2409 | .default_enable_debug_info = false, |
| 2410 | .name = "tg_attach_viewer_pipeline_manager", |
| 2411 | }); |
| 2412 | |
| 2413 | auto compilation_result = ui_context.pipeline_manager.add_compute_pipeline2({ |
| 2414 | .source = daxa::ShaderFile{"../src/utils/impl_resource_viewer.slang"}, |
| 2415 | .entry_point = "main", |
| 2416 | .push_constant_size = sizeof(TaskGraphDebugUiPush), |
| 2417 | .name = "impl_resource_viewer.slang", |
| 2418 | }); |
| 2419 | if (compilation_result.value()->is_valid()) |
| 2420 | { |
| 2421 | std::cout << "[TaskGraphDebugUi] SUCCESSFULLY compiled image resource viewer pipeline" << std::endl; |
| 2422 | } |
| 2423 | else |
| 2424 | { |
| 2425 | std::cout << std::format("[TaskGraphDebugUi] FAILED to compile image resource viewer pipeline with message \n {}", compilation_result.message()) << std::endl; |
| 2426 | } |
nothing calls this directly
no test coverage detected