| 718 | } |
| 719 | |
| 720 | void Application::InitCommon() |
| 721 | { |
| 722 | TracyGpuContext; |
| 723 | ZoneScopedC(0x81A861); |
| 724 | // This timestamp is needed to initialize random number generator |
| 725 | profileStartTime_ = TimeStamp::now(); |
| 726 | |
| 727 | #if defined(WITH_TRACY) |
| 728 | TracyAppInfo(NCINE_APP, sizeof(NCINE_APP) - 1); |
| 729 | LOGW("Tracy integration is enabled"); |
| 730 | #endif |
| 731 | |
| 732 | // Initialization of the static random generator seeds |
| 733 | Random().Init(TimeStamp::now().ticks(), profileStartTime_.ticks()); |
| 734 | |
| 735 | frameTimer_ = std::make_unique<FrameTimer>(appCfg_.frameTimerLogInterval, 0.2f); |
| 736 | #if defined(DEATH_TARGET_WINDOWS) |
| 737 | _waitableTimer = ::CreateWaitableTimerW(NULL, TRUE, NULL); |
| 738 | #endif |
| 739 | |
| 740 | #if defined(WITH_AUDIO) |
| 741 | if (appCfg_.withAudio) { |
| 742 | theServiceLocator().RegisterAudioDevice(std::make_unique<ALAudioDevice>()); |
| 743 | } |
| 744 | #endif |
| 745 | #if defined(WITH_THREADS) |
| 746 | if (appCfg_.withThreads) { |
| 747 | theServiceLocator().RegisterThreadPool(std::make_unique<ThreadPool>()); |
| 748 | } |
| 749 | #endif |
| 750 | |
| 751 | if (appCfg_.withGraphics) { |
| 752 | theServiceLocator().RegisterGfxCapabilities(std::make_unique<GfxCapabilities>()); |
| 753 | const auto& gfxCapabilities = theServiceLocator().GetGfxCapabilities(); |
| 754 | GLDebug::Init(gfxCapabilities); |
| 755 | |
| 756 | #if !defined(WITH_ANGLE) && !defined(DEATH_TARGET_EMSCRIPTEN) && !defined(DEATH_TARGET_WINDOWS_RT) |
| 757 | if (appCfg_.fixedBatchSize > 0) { |
| 758 | LOGI("Using fixed batch size: {}", appCfg_.fixedBatchSize); |
| 759 | } else { |
| 760 | const auto& info = gfxCapabilities.GetGLInfoStrings(); |
| 761 | const StringView vendor = info.vendor; |
| 762 | const StringView renderer = info.renderer; |
| 763 | // Some GPUs don't work with dynamic batch size, so it refuses to render VBOs (shows a black screen), disable it for them |
| 764 | if ((vendor == "Imagination Technologies"_s && (renderer == "PowerVR Rogue GE8300"_s || renderer == "PowerVR Rogue GE8320"_s || renderer == "PowerVR Rogue GE9215"_s)) || |
| 765 | (vendor == "ARM"_s && renderer == "Mali-T830"_s)) { |
| 766 | const StringView vendorPrefix = vendor.findOr(' ', vendor.end()); |
| 767 | if DEATH_UNLIKELY(renderer.hasPrefix(vendor.prefix(vendorPrefix.begin()))) { |
| 768 | LOGW("Detected {}: Using fixed batch size", renderer); |
| 769 | } else { |
| 770 | LOGW("Detected {} {}: Using fixed batch size", vendor, renderer); |
| 771 | } |
| 772 | appCfg_.fixedBatchSize = 10; |
| 773 | } |
| 774 | } |
| 775 | #endif |
| 776 | |
| 777 | #if defined(WITH_RENDERDOC) |
nothing calls this directly
no test coverage detected