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

Method runtime

source/runtime.cpp:178–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178reshade::runtime::runtime(api::swapchain *swapchain, api::command_queue *graphics_queue, const std::filesystem::path &config_path, bool is_vr) :
179 _swapchain(swapchain),
180 _device(swapchain->get_device()),
181 _graphics_queue(graphics_queue),
182 _is_vr(is_vr),
183 _start_time(std::chrono::high_resolution_clock::now()),
184 _last_present_time(_start_time),
185 _last_frame_duration(std::chrono::milliseconds(1)),
186 _effect_search_paths({ L".\\" }),
187 _texture_search_paths({ L".\\" }),
188 _config_path(config_path),
189 _screenshot_path(L".\\"),
190 _screenshot_name("%AppName% %Date% %Time%_%TimeMS%"), // Include milliseconds by default because users may request more than one screenshot per second
191 _screenshot_post_save_command_arguments("\"%TargetPath%\""),
192 _screenshot_post_save_command_working_directory(L".\\")
193{
194 assert(swapchain != nullptr && graphics_queue != nullptr);
195
196 _device->get_property(api::device_properties::vendor_id, &_vendor_id);
197 _device->get_property(api::device_properties::device_id, &_device_id);
198
199 _device->get_property(api::device_properties::api_version, &_renderer_id);
200 switch (_device->get_api())
201 {
202 case api::device_api::d3d9:
203 case api::device_api::d3d10:
204 case api::device_api::d3d11:
205 case api::device_api::d3d12:
206 break;
207 case api::device_api::opengl:
208 _renderer_id |= 0x10000;
209 break;
210 case api::device_api::vulkan:
211 _renderer_id |= 0x20000;
212 break;
213 }
214
215 char device_description[256] = "";
216 _device->get_property(api::device_properties::description, device_description);
217
218 if (uint32_t driver_version = 0;
219 _device->get_property(api::device_properties::driver_version, &driver_version))
220 log::message(log::level::info, "Running on %s Driver %u.%u.", device_description, driver_version / 100, driver_version % 100);
221 else
222 log::message(log::level::info, "Running on %s.", device_description);
223
224 check_for_update();
225
226 // Default shortcut PrtScrn
227 _screenshot_key_data[0] = 0x2C;
228
229#if RESHADE_GUI
230 _timestamp_frequency = graphics_queue->get_timestamp_frequency();
231
232 init_gui();
233#endif
234
235 // Ensure config path is absolute, in case an add-on created an effect runtime with a relative path

Callers

nothing calls this directly

Calls 6

messageFunction · 0.85
resolve_pathFunction · 0.85
get_deviceMethod · 0.45
get_propertyMethod · 0.45
get_apiMethod · 0.45

Tested by

no test coverage detected