Dreikblack Posted February 17 Share Posted February 17 Release also have lower fps but difference is not that noticeable. "Benchmark" test with stable build: Beta branch: Example code: #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> panel; shared_ptr<Icon> icon1; shared_ptr<Icon> icon2; bool isFirst = true; void initGui() { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); panel = CreatePanel(10, 50, 64, 64, ui->root, PANEL_DEFAULT); icon1 = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Icons/help.svg"); icon2 = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Icons/new.svg"); } int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); menuWold->RecordStats(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { if (!ui) initGui(); isFirst = !isFirst; if (isFirst) { panel->SetIcon(icon1); } else { panel->SetIcon(icon2); } } window->SetText("FPS: " + String(menuWold->renderstats.framerate)); menuWold->Update(); menuWold->Render(framebuffer, false); } return 0; } 1 Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 17 Share Posted February 17 It is defiantly slow. But I think it might be the fact it's an .svg file and that it has to be rasterised into a usable texture in the rendering thread so it can be drawn. I know this was the same for setting a font for the first time too. Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted February 17 Author Share Posted February 17 FPS is lower in beta in compare with stable branch even before i init GUI and load icons Quote Link to comment Share on other sites More sharing options...
SpiderPig Posted February 17 Share Posted February 17 Josh will know more, I'm sure he will figure it out. Quote Link to comment Share on other sites More sharing options...
klepto2 Posted February 17 Share Posted February 17 Just to show a more extreme sample which i came up with (might be interesting for you as well @SpiderPig) It is a combination of multiple factors and shows multiple problems at once. Instantiating still has a memleak, not that high than then previously but still visible in this scenario Debug leads to rendertimes > 4000 ms while release is much lower but still too high in my opinion (even if you comment out the extra rendertargets and cameras) Having too many instances at the same position leads to an exception in the physicsthread Having too many instances leads to vulkan buffer size and index validation errors. #include "UltraEngine.h" #include "ComponentSystem.h" //#include "Steamworks/Steamworks.h" using namespace UltraEngine; SIZE_T PrintMemoryInfo() { auto myHandle = GetCurrentProcess(); //to fill in the process' memory usage details PROCESS_MEMORY_COUNTERS pmc; //return the usage (bytes), if I may if (GetProcessMemoryInfo(myHandle, &pmc, sizeof(pmc))) return(pmc.WorkingSetSize); else return 0; } int main(int argc, const char* argv[]) { #ifdef STEAM_API_H if (not Steamworks::Initialize()) { RuntimeError("Steamworks failed to initialize."); return 1; } #endif RegisterComponents(); auto cl = ParseCommandLine(argc, argv); //Load FreeImage plugin (optional) auto fiplugin = LoadPlugin("Plugins/FITextureLoader"); //Get the displays auto displays = GetDisplays(); //Create a window auto window = CreateWindow("Ultra Engine", 0, 0, 1280 * displays[0]->scale, 720 * displays[0]->scale, displays[0], WINDOW_CENTER | WINDOW_TITLEBAR); if (!AttachConsole(ATTACH_PARENT_PROCESS)) { if (AllocConsole()) { freopen("conin$", "r", stdin); freopen("conout$", "w", stdout); freopen("conout$", "w", stderr); } } else { auto consoleHandleOut = GetStdHandle(STD_OUTPUT_HANDLE); auto consoleHandleIn = GetStdHandle(STD_INPUT_HANDLE); auto consoleHandleErr = GetStdHandle(STD_ERROR_HANDLE); if (consoleHandleOut != INVALID_HANDLE_VALUE) { freopen("conout$", "w", stdout); setvbuf(stdout, NULL, _IONBF, 0); } if (consoleHandleIn != INVALID_HANDLE_VALUE) { freopen("conin$", "r", stdin); setvbuf(stdin, NULL, _IONBF, 0); } if (consoleHandleErr != INVALID_HANDLE_VALUE) { freopen("conout$", "w", stderr); setvbuf(stderr, NULL, _IONBF, 0); } } //Create a framebuffer auto framebuffer = CreateFramebuffer(window); //Create a world auto world = CreateWorld(); auto camera = CreateCamera(world); camera->SetClearColor(0.125); camera->SetFov(70); camera->Move(0, 2, -8); camera->AddComponent<CameraControls>(); //Create light auto light = CreateDirectionalLight(world); light->SetRotation(45, 35, 0); light->SetColor(2); auto render_target = CreateTextureBuffer(framebuffer->size.x, framebuffer->size.y); auto render_target_2 = CreateTextureBuffer(framebuffer->size.x, framebuffer->size.y); auto test_camera = CreateCamera(world); test_camera->SetRenderTarget(render_target); auto test_camera_2 = CreateCamera(world); test_camera_2->SetRenderTarget(render_target_2); camera->SetSweptCulling(true); world->RecordStats(true); int waterLevel = 20; shared_ptr<Entity> main_instance = CreateTerrain(world, 1024, 1024); auto sphere = CreateSphere(nullptr, 2.0, 32); vector<shared_ptr<Entity>> test_instances; bool set_position = true; //Set to false and it leads to a exception in the Physicsthread int step_size = 32; //Lower that and it will lead to invalid buffersize indices / size in vulkan //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { test_camera->SetMatrix(camera->GetMatrix()); test_camera->SetRange(camera->GetRange()); test_camera_2->SetRotation(camera->GetRotation() * Vec3(-1.0, 1.0, -1.0)); test_camera_2->SetPosition(camera->position.x, -camera->position.y + 2 * (waterLevel + 5.0), camera->position.z); test_camera_2->SetRange(camera->GetRange()); test_instances.clear(); for (int x = -512; x <= 512; x += step_size) for (int z = -512; z <= 512; z += step_size) { auto i = sphere->Instantiate(world); if(set_position) i->SetPosition(x, 1.0, z); i->SetColor(Vec4(1.0, 0.0, 0.0, 1.0)); test_instances.push_back(i); } world->Update(); world->Render(framebuffer); #ifdef STEAM_API_H Steamworks::Update(); #endif window->SetText("rt: " +String(world->renderstats.rendertime) + " MEM: " + String(PrintMemoryInfo() / 1024) + " kb"); } #ifdef STEAM_API_H Steamworks::Shutdown(); #endif return 0; } this is the interesting part for the multiple errors: bool set_position = true; //Set to false and it leads to a exception in the Physicsthread int step_size = 32; //Lower that and it will lead to invalid buffersize indices / size in vulkan I hope you can resolve this as it breaks the in majority very fast renderer. 1 1 Quote Windows 10 Pro 64-Bit-Version NVIDIA Geforce 1080 TI Link to comment Share on other sites More sharing options...
SpiderPig Posted February 17 Share Posted February 17 That is interesting. After about a minute the spheres vanish for 10 or so seconds too. Near to two minutes they vanish again and the shadows do to. Well on my end anyway. Visual Studio shows RAM all over the place, it stabilizes for a bit but then climbs again. Quote Link to comment Share on other sites More sharing options...
Josh Posted February 17 Share Posted February 17 16 hours ago, klepto2 said: Having too many instances at the same position leads to an exception in the physicsthread This is not surprising at all. Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Josh Posted February 21 Share Posted February 21 The graphics update I am working on is already significantly faster than either of these versions. Let's pick this up again after it is out, and see where we are at then. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Dreikblack Posted March 8 Author Share Posted March 8 With latest update it's better than it was before last update but still worse than prev stable build Quote Link to comment Share on other sites More sharing options...
Dreikblack Posted March 11 Author Share Posted March 11 In new build debug mode have too low fps again. Seems to be related to GUI. 4000 if i do nothing and i hit a button to create widget it's dropping to 600. In my game it's 30-40 fps. In release same as in prev build 1 Quote Link to comment Share on other sites More sharing options...
Josh Posted March 14 Share Posted March 14 That does seem to be a big reduction in performance just based on a single panel being visible. I'm going from 4000 to 400 FPS when the space key is hit, in debug mode. I don't see the same change in release mode. #include "UltraEngine.h" using namespace UltraEngine; shared_ptr<Window> window; shared_ptr<Framebuffer> framebuffer; shared_ptr<World> menuWold; shared_ptr<Interface> ui; shared_ptr<Camera> uiCamera; shared_ptr<Widget> panel; shared_ptr<Icon> icon1; shared_ptr<Icon> icon2; bool isFirst = true; int main(int argc, const char* argv[]) { //Get the displays auto displays = GetDisplays(); //Create a window window = CreateWindow("Ultra Engine", 0, 0, 1280, 720, displays[0], WINDOW_DEFAULT); //Create a world menuWold = CreateWorld(); menuWold->RecordStats(); //Create a framebuffer framebuffer = CreateFramebuffer(window); //Create light auto light = CreateBoxLight(menuWold); light->SetRange(-10, 10); light->SetRotation(15, 15, 0); light->SetColor(2); //Create camera auto camera = CreateCamera(menuWold); camera->SetClearColor(0.125); camera->SetPosition(0, 0, -3); camera->SetFov(70); uiCamera = CreateCamera(menuWold, PROJECTION_ORTHOGRAPHIC); uiCamera->SetPosition((float)framebuffer->GetSize().x * 0.5f, (float)framebuffer->GetSize().y * 0.5f, 0); uiCamera->SetRenderLayers(2); uiCamera->SetClearMode(CLEAR_DEPTH); uiCamera->SetLighting(false); //Main loop while (window->Closed() == false and window->KeyDown(KEY_ESCAPE) == false) { if (window->KeyHit(KEY_SPACE)) { if (not ui) { auto default_font = LoadFont("Fonts\\arial.ttf"); ui = CreateInterface(menuWold, default_font, framebuffer->GetSize()); ui->SetRenderLayers(2); ui->root->SetColor(0.0f, 0.0f, 0.0f, 0.0f); panel = CreatePanel(10, 50, 64, 64, ui->root, PANEL_DEFAULT); icon1 = LoadIcon("https://raw.githubusercontent.com/UltraEngine/Documentation/master/Assets/Icons/help.svg"); panel->SetIcon(icon1); } } window->SetText("FPS: " + String(menuWold->renderstats.framerate)); menuWold->Update(); menuWold->Render(framebuffer, false); } return 0; } Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Solution Josh Posted March 14 Solution Share Posted March 14 Okay, this was being caused by all the Assert statements I had in the source. Constructing a WString from a const char apparently is pretty slow in debug builds. Once I removed that the change in framerate was more like 4000 -> 3000 in the debug build. 1 Quote My job is to make tools you love, with the features you want, and performance you can't live without. Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.