Changeset 26072
- Timestamp:
- Dec 15, 2021, 7:43:41 AM (3 years ago)
- Location:
- ps/trunk
- Files:
-
- 4 added
- 2 deleted
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
ps/trunk/build/premake/premake5.lua
r26040 r26072 773 773 "graphics/scripting", 774 774 "renderer", 775 776 775 777 "renderer/scripting", 776 778 "third_party/mikktspace", -
ps/trunk/source/lib/ogl.cpp
r25982 r26072 34 34 #include "lib/external_libraries/libsdl.h" 35 35 #include "lib/debug.h" 36 #include "lib/sysdep/gfx.h"37 36 #include "lib/res/h_mgr.h" 38 37 -
ps/trunk/source/lib/ogl.h
r19503 r26072 1 /* Copyright (C) 20 17Wildfire Games.1 /* Copyright (C) 20 Wildfire Games. 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining … … 33 33 /** 34 34 * initialization: import extension function pointers and do feature detect. 35 * call before using any other function , and after each video mode change.35 * call before using any other function. 36 36 * fails if OpenGL not ready for use. 37 37 **/ -
ps/trunk/source/lib/sysdep/os/osx/osx.cpp
r23754 r26072 1 /* Copyright (C) 202 0Wildfire Games.1 /* Copyright (C) 202 Wildfire Games. 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining … … 25 25 #include "lib/lib.h" 26 26 #include "lib/sysdep/sysdep.h" 27 #include "lib/sysdep/gfx.h"28 27 #include "lib/utf8.h" 29 28 #include "osx_bundle.h" -
ps/trunk/source/lib/sysdep/os/win/wgfx.cpp
r23754 r26072 1 /* Copyright (C) 202 0Wildfire Games.1 /* Copyright (C) 202 Wildfire Games. 2 2 * 3 3 * Permission is hereby granted, free of charge, to any person obtaining … … 28 28 #include "lib/sysdep/os/win/wgfx.h" 29 29 30 #include "lib/sysdep/gfx.h"31 30 #include "lib/sysdep/os/win/wdll_ver.h" 32 31 #include "lib/sysdep/os/win/wutil.h" -
ps/trunk/source/ps/GameSetup/GameSetup.cpp
r26065 r26072 932 932 g_GUI = new CGUIManager(); 933 933 934 // (must come after SetVideoMode, since it calls ogl_Init)935 934 CStr8 renderPath = "default"; 936 935 CFG_GET_VAL("renderpath", renderPath); 937 if ((ogl_HaveExtensions(0, "GL_ARB_vertex_program", "GL_ARB_fragment_program", nullptr) // ARB 938 && ogl_HaveExtensions(0, "GL_ARB_vertex_shader", "GL_ARB_fragment_shader", nullptr)) // GLSL 939 || !ogl_HaveExtension("GL_ARB_vertex_buffer_object") // VBO 940 || ogl_HaveExtensions(0, "GL_ARB_multitexture", "GL_EXT_draw_range_elements", nullptr) 941 || (!ogl_HaveExtension("GL_EXT_framebuffer_object") && !ogl_HaveExtension("GL_ARB_framebuffer_object")) 942 || RenderPathEnum::FromString(renderPath) == FIXED) 936 if (RenderPathEnum::FromString(renderPath) == FIXED) 943 937 { 944 938 // It doesn't make sense to continue working here, because we're not -
ps/trunk/source/ps/GameSetup/HWDetect.cpp
r26040 r26072 26 26 #include "lib/posix/posix_utsname.h" 27 27 #include "lib/sysdep/cpu.h" 28 #include "lib/sysdep/gfx.h"29 28 #include "lib/sysdep/numa.h" 30 29 #include "lib/sysdep/os_cpu.h" … … 44 43 #include "ps/UserReport.h" 45 44 #include "ps/VideoMode.h" 45 46 46 #include "scriptinterface/FunctionWrapper.h" 47 47 #include "scriptinterface/JSON.h" … … 161 161 Script::SetProperty(rq, settings, "build_clang", (int)CLANG_VERSION); 162 162 163 Script::SetProperty(rq, settings, "gfx_card", g fx::CardName());164 Script::SetProperty(rq, settings, "gfx_drv_ver", g fx::DriverInfo());163 Script::SetProperty(rq, settings, "gfx_card", gName()); 164 Script::SetProperty(rq, settings, "gfx_drv_ver", g()); 165 165 #if CONFIG2_AUDIO 166 166 if (g_SoundManager) -
ps/trunk/source/ps/GameSetup/HWDetect.h
r8663 r26072 1 /* Copyright (C) 20 10Wildfire Games.1 /* Copyright (C) 20 Wildfire Games. 2 2 * This file is part of 0 A.D. 3 3 * … … 22 22 * Runs hardware-detection script to adjust default config settings 23 23 * and/or emit warnings depending on the user's system configuration. 24 * This must only be called after ogl_Init.24 * This must only be called after . 25 25 */ 26 26 void RunHardwareDetection(); -
ps/trunk/source/ps/Util.cpp
r25936 r26072 29 29 #include "lib/sysdep/arch/x86_x64/topology.h" 30 30 #endif 31 #include "lib/sysdep/gfx.h"32 31 #include "lib/sysdep/cpu.h" 33 32 #include "lib/sysdep/os_cpu.h" … … 45 44 #include "ps/Pyrogenesis.h" 46 45 #include "ps/VideoMode.h" 46 47 47 #include "renderer/Renderer.h" 48 48 … … 53 53 #include <iomanip> 54 54 #include <sstream> 55 56 static std::string SplitExts(const char *exts)57 {58 std::string str = exts;59 std::string ret = "";60 size_t idx = str.find_first_of(" ");61 while(idx != std::string::npos)62 {63 if(idx >= str.length() - 1)64 {65 ret += str;66 break;67 }68 69 ret += str.substr(0, idx);70 ret += "\n";71 str = str.substr(idx + 1);72 idx = str.find_first_of(" ");73 }74 75 return ret;76 }77 78 55 79 56 void WriteSystemInfo() … … 127 104 128 105 // graphics 129 const std::wstring cardName = gfx::CardName(); 130 const std::wstring driverInfo = gfx::DriverInfo(); 131 fprintf(f, "Graphics Card : %ls\n", cardName.c_str()); 132 fprintf(f, "OpenGL Drivers : %s; %ls\n", glGetString(GL_VERSION), driverInfo.c_str()); 106 fprintf(f, "Video Card : %s\n", g_VideoMode.GetBackendDevice()->GetName().c_str()); 107 fprintf(f, "Video Driver : %s\n", g_VideoMode.GetBackendDevice()->GetDriverInformation().c_str()); 133 108 fprintf(f, "Video Mode : %dx%d:%d\n", g_VideoMode.GetXRes(), g_VideoMode.GetYRes(), g_VideoMode.GetBPP()); 134 109 … … 148 123 149 124 // OpenGL extensions (write them last, since it's a lot of text) 150 const char* exts = ogl_ExtensionString(); 151 if (!exts) exts = "{unknown}"; 152 fprintf(f, "\nOpenGL Extensions: \n%s\n", SplitExts(exts).c_str()); 125 fprintf(f, "\nBackend Extensions:\n"); 126 if (g_VideoMode.GetBackendDevice()->GetExtensions().empty()) 127 fprintf(f, "{unknown}\n"); 128 else 129 for (const std::string& extension : g_VideoMode.GetBackendDevice()->GetExtensions()) 130 fprintf(f, "%s\n", extension.c_str()); 153 131 154 132 // System Management BIOS (even more text than OpenGL extensions) -
ps/trunk/source/ps/VideoMode.cpp
r26069 r26072 25 25 #include "lib/external_libraries/libsdl.h" 26 26 #include "lib/ogl.h" 27 #include "lib/sysdep/gfx.h"28 27 #include "lib/tex/tex.h" 29 28 #include "ps/CConsole.h" … … 35 34 #include "ps/GameSetup/Config.h" 36 35 #include "ps/Pyrogenesis.h" 36 37 37 #include "renderer/Renderer.h" 38 38 … … 287 287 } 288 288 289 m_Context = SDL_GL_CreateContext(m_Window); 290 if (!m_Context) 291 { 292 LOGERROR("SetVideoMode failed in SDL_GL_CreateContext: %dx%d:%d %d (\"%s\")", 293 w, h, bpp, fullscreen ? 1 : 0, SDL_GetError()); 289 #if OS_WIN 290 // We need to set the window for an error dialog. 291 wutil_SetAppWindow(m_Window); 292 #endif 293 294 if (!CreateBackendDevice(true)) 295 { 296 LOGERROR("SetVideoMode failed in backend device creation: %dx%d:%d %d", 297 w, h, bpp, fullscreen ? 1 : 0); 294 298 return false; 295 299 } … … 330 334 else 331 335 SDL_SetWindowGrab(m_Window, SDL_FALSE); 332 333 #if OS_WIN334 // We need to set the window for an error dialog.335 wutil_SetAppWindow(m_Window);336 #endif337 336 338 337 m_IsFullscreen = fullscreen; … … 469 468 // End work around. 470 469 471 ogl_Init(); // required after each mode change472 // (TODO: does that mean we need to call this when toggling fullscreen later?)473 474 470 m_IsInitialised = true; 475 471 … … 506 502 m_IsFullscreen = false; 507 503 m_IsInitialised = false; 508 if (m_Context) 509 { 510 SDL_GL_DeleteContext(m_Context); 511 m_Context = nullptr; 512 } 504 m_BackendDevice.reset(); 513 505 if (m_Window) 514 506 { … … 516 508 m_Window = nullptr; 517 509 } 510 511 512 513 514 515 518 516 } 519 517 -
ps/trunk/source/ps/VideoMode.h
r26069 r26072 25 25 typedef struct SDL_Window SDL_Window; 26 26 typedef void* SDL_GLContext; 27 28 29 30 31 32 33 34 35 36 37 27 38 28 39 class CVideoMode … … 53 64 */ 54 65 void Shutdown(); 66 67 68 69 70 71 55 72 56 73 /** … … 113 130 Backend GetBackend() const { return m_Backend; } 114 131 132 133 115 134 private: 116 135 void ReadConfig(); … … 126 145 127 146 SDL_Window* m_Window = nullptr; 128 SDL_GLContext m_Context = nullptr;129 147 130 148 // Initial desktop settings. … … 168 186 169 187 Backend m_Backend = Backend::GL; 188 170 189 }; 171 190 -
ps/trunk/source/renderer/Renderer.cpp
r26069 r26072 1389 1389 bool checkGLErrorAfterSwap = false; 1390 1390 CFG_GET_VAL("gl.checkerrorafterswap", checkGLErrorAfterSwap); 1391 1391 1392 if (!checkGLErrorAfterSwap) 1392 1393 return; 1394 1393 1395 PROFILE3("error check"); 1394 1396 // We have to check GL errors after SwapBuffer to avoid possible -
ps/trunk/source/tools/atlas/GameInterface/Handlers/GraphicsSetupHandlers.cpp
r26024 r26072 112 112 UNUSED2(msg); 113 113 114 ogl_Init();114 ); 115 115 116 116 InitGraphics(g_AtlasGameLoop->args, g_InitFlags, {});
Note:
See TracChangeset
for help on using the changeset viewer.