MCPcopy Create free account
hub / github.com/crosire/reshade / on_reset

Method on_reset

source/runtime.cpp:522–585  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

520 return false;
521}
522void reshade::runtime::on_reset()
523{
524 if (_is_initialized)
525 // Update initialization state immediately, so that any effect loading still in progress can abort early
526 _is_initialized = false;
527 else
528 return; // Nothing to do if the runtime was already destroyed or not successfully initialized in the first place
529
530 // Already performs a wait for idle, so no need to do it again before destroying resources below
531 destroy_effects();
532
533 _device->destroy_resource(_empty_tex);
534 _empty_tex = {};
535 _device->destroy_resource_view(_empty_srv);
536 _empty_srv = {};
537
538 for (const effect_permutation &permutation : _effect_permutations)
539 {
540 _device->destroy_resource(permutation.color_tex);
541 _device->destroy_resource_view(permutation.color_srv[0]);
542 _device->destroy_resource_view(permutation.color_srv[1]);
543
544 _device->destroy_resource(permutation.stencil_tex);
545 _device->destroy_resource_view(permutation.stencil_dsv);
546 }
547 _effect_permutations.clear();
548
549 _device->destroy_pipeline(_copy_pipeline);
550 _copy_pipeline = {};
551 _device->destroy_pipeline_layout(_copy_pipeline_layout);
552 _copy_pipeline_layout = {};
553 _device->destroy_sampler(_copy_sampler_state);
554 _copy_sampler_state = {};
555
556 _device->destroy_resource(_back_buffer_resolved);
557 _back_buffer_resolved = {};
558 _device->destroy_resource_view(_back_buffer_resolved_srv);
559 _back_buffer_resolved_srv = {};
560
561 for (const api::resource_view view : _back_buffer_targets)
562 _device->destroy_resource_view(view);
563 _back_buffer_targets.clear();
564
565 destroy_state_block(_device, _app_state);
566 _app_state = {};
567
568 _width = _height = 0;
569 _back_buffer_format = api::format::unknown;
570 _back_buffer_samples = 1;
571 _back_buffer_color_space = api::color_space::unknown;
572
573#if RESHADE_GUI
574 if (_is_vr)
575 deinit_gui_vr();
576
577 destroy_imgui_resources();
578#endif
579

Callers 2

reset_effect_runtimeMethod · 0.45

Calls 7

messageFunction · 0.85
destroy_resourceMethod · 0.45
destroy_resource_viewMethod · 0.45
clearMethod · 0.45
destroy_pipelineMethod · 0.45
destroy_samplerMethod · 0.45

Tested by

no test coverage detected