renderer_opengl.cpp 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. // Copyright 2014 Citra Emulator Project
  2. // Licensed under GPLv2 or any later version
  3. // Refer to the license.txt file included.
  4. #include <algorithm>
  5. #include <cstddef>
  6. #include <cstdlib>
  7. #include <cstring>
  8. #include <memory>
  9. #include <glad/glad.h>
  10. #include "common/assert.h"
  11. #include "common/logging/log.h"
  12. #include "common/telemetry.h"
  13. #include "core/core.h"
  14. #include "core/core_timing.h"
  15. #include "core/frontend/emu_window.h"
  16. #include "core/memory.h"
  17. #include "core/perf_stats.h"
  18. #include "core/settings.h"
  19. #include "core/telemetry_session.h"
  20. #include "core/tracer/recorder.h"
  21. #include "video_core/morton.h"
  22. #include "video_core/renderer_opengl/gl_rasterizer.h"
  23. #include "video_core/renderer_opengl/renderer_opengl.h"
  24. namespace OpenGL {
  25. static const char vertex_shader[] = R"(
  26. #version 150 core
  27. in vec2 vert_position;
  28. in vec2 vert_tex_coord;
  29. out vec2 frag_tex_coord;
  30. // This is a truncated 3x3 matrix for 2D transformations:
  31. // The upper-left 2x2 submatrix performs scaling/rotation/mirroring.
  32. // The third column performs translation.
  33. // The third row could be used for projection, which we don't need in 2D. It hence is assumed to
  34. // implicitly be [0, 0, 1]
  35. uniform mat3x2 modelview_matrix;
  36. void main() {
  37. // Multiply input position by the rotscale part of the matrix and then manually translate by
  38. // the last column. This is equivalent to using a full 3x3 matrix and expanding the vector
  39. // to `vec3(vert_position.xy, 1.0)`
  40. gl_Position = vec4(mat2(modelview_matrix) * vert_position + modelview_matrix[2], 0.0, 1.0);
  41. frag_tex_coord = vert_tex_coord;
  42. }
  43. )";
  44. static const char fragment_shader[] = R"(
  45. #version 150 core
  46. in vec2 frag_tex_coord;
  47. out vec4 color;
  48. uniform sampler2D color_texture;
  49. void main() {
  50. // Swap RGBA -> ABGR so we don't have to do this on the CPU. This needs to change if we have to
  51. // support more framebuffer pixel formats.
  52. color = texture(color_texture, frag_tex_coord);
  53. }
  54. )";
  55. /**
  56. * Vertex structure that the drawn screen rectangles are composed of.
  57. */
  58. struct ScreenRectVertex {
  59. ScreenRectVertex(GLfloat x, GLfloat y, GLfloat u, GLfloat v) {
  60. position[0] = x;
  61. position[1] = y;
  62. tex_coord[0] = u;
  63. tex_coord[1] = v;
  64. }
  65. GLfloat position[2];
  66. GLfloat tex_coord[2];
  67. };
  68. /**
  69. * Defines a 1:1 pixel ortographic projection matrix with (0,0) on the top-left
  70. * corner and (width, height) on the lower-bottom.
  71. *
  72. * The projection part of the matrix is trivial, hence these operations are represented
  73. * by a 3x2 matrix.
  74. */
  75. static std::array<GLfloat, 3 * 2> MakeOrthographicMatrix(const float width, const float height) {
  76. std::array<GLfloat, 3 * 2> matrix; // Laid out in column-major order
  77. // clang-format off
  78. matrix[0] = 2.f / width; matrix[2] = 0.f; matrix[4] = -1.f;
  79. matrix[1] = 0.f; matrix[3] = -2.f / height; matrix[5] = 1.f;
  80. // Last matrix row is implicitly assumed to be [0, 0, 1].
  81. // clang-format on
  82. return matrix;
  83. }
  84. ScopeAcquireGLContext::ScopeAcquireGLContext(Core::Frontend::EmuWindow& emu_window_)
  85. : emu_window{emu_window_} {
  86. if (Settings::values.use_multi_core) {
  87. emu_window.MakeCurrent();
  88. }
  89. }
  90. ScopeAcquireGLContext::~ScopeAcquireGLContext() {
  91. if (Settings::values.use_multi_core) {
  92. emu_window.DoneCurrent();
  93. }
  94. }
  95. RendererOpenGL::RendererOpenGL(Core::Frontend::EmuWindow& window)
  96. : VideoCore::RendererBase{window} {}
  97. RendererOpenGL::~RendererOpenGL() = default;
  98. /// Swap buffers (render frame)
  99. void RendererOpenGL::SwapBuffers(
  100. std::optional<std::reference_wrapper<const Tegra::FramebufferConfig>> framebuffer) {
  101. ScopeAcquireGLContext acquire_context{render_window};
  102. Core::System::GetInstance().GetPerfStats().EndSystemFrame();
  103. // Maintain the rasterizer's state as a priority
  104. OpenGLState prev_state = OpenGLState::GetCurState();
  105. state.Apply();
  106. if (framebuffer) {
  107. // If framebuffer is provided, reload it from memory to a texture
  108. if (screen_info.texture.width != (GLsizei)framebuffer->get().width ||
  109. screen_info.texture.height != (GLsizei)framebuffer->get().height ||
  110. screen_info.texture.pixel_format != framebuffer->get().pixel_format) {
  111. // Reallocate texture if the framebuffer size has changed.
  112. // This is expected to not happen very often and hence should not be a
  113. // performance problem.
  114. ConfigureFramebufferTexture(screen_info.texture, *framebuffer);
  115. }
  116. // Load the framebuffer from memory, draw it to the screen, and swap buffers
  117. LoadFBToScreenInfo(*framebuffer);
  118. if (renderer_settings.screenshot_requested)
  119. CaptureScreenshot();
  120. DrawScreen(render_window.GetFramebufferLayout());
  121. render_window.SwapBuffers();
  122. }
  123. render_window.PollEvents();
  124. Core::System::GetInstance().FrameLimiter().DoFrameLimiting(CoreTiming::GetGlobalTimeUs());
  125. Core::System::GetInstance().GetPerfStats().BeginSystemFrame();
  126. // Restore the rasterizer state
  127. prev_state.Apply();
  128. }
  129. /**
  130. * Loads framebuffer from emulated memory into the active OpenGL texture.
  131. */
  132. void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) {
  133. const u32 bytes_per_pixel{Tegra::FramebufferConfig::BytesPerPixel(framebuffer.pixel_format)};
  134. const u64 size_in_bytes{framebuffer.stride * framebuffer.height * bytes_per_pixel};
  135. const VAddr framebuffer_addr{framebuffer.address + framebuffer.offset};
  136. // Framebuffer orientation handling
  137. framebuffer_transform_flags = framebuffer.transform_flags;
  138. framebuffer_crop_rect = framebuffer.crop_rect;
  139. // Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default
  140. // only allows rows to have a memory alignement of 4.
  141. ASSERT(framebuffer.stride % 4 == 0);
  142. if (!rasterizer->AccelerateDisplay(framebuffer, framebuffer_addr, framebuffer.stride)) {
  143. // Reset the screen info's display texture to its own permanent texture
  144. screen_info.display_texture = screen_info.texture.resource.handle;
  145. Memory::RasterizerFlushVirtualRegion(framebuffer_addr, size_in_bytes,
  146. Memory::FlushMode::Flush);
  147. VideoCore::MortonCopyPixels128(framebuffer.width, framebuffer.height, bytes_per_pixel, 4,
  148. Memory::GetPointer(framebuffer_addr),
  149. gl_framebuffer_data.data(), true);
  150. state.texture_units[0].texture = screen_info.texture.resource.handle;
  151. state.Apply();
  152. glActiveTexture(GL_TEXTURE0);
  153. glPixelStorei(GL_UNPACK_ROW_LENGTH, static_cast<GLint>(framebuffer.stride));
  154. // Update existing texture
  155. // TODO: Test what happens on hardware when you change the framebuffer dimensions so that
  156. // they differ from the LCD resolution.
  157. // TODO: Applications could theoretically crash yuzu here by specifying too large
  158. // framebuffer sizes. We should make sure that this cannot happen.
  159. glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, framebuffer.width, framebuffer.height,
  160. screen_info.texture.gl_format, screen_info.texture.gl_type,
  161. gl_framebuffer_data.data());
  162. glPixelStorei(GL_UNPACK_ROW_LENGTH, 0);
  163. state.texture_units[0].texture = 0;
  164. state.Apply();
  165. }
  166. }
  167. /**
  168. * Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can
  169. * be 1x1 but will stretch across whatever it's rendered on.
  170. */
  171. void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a,
  172. const TextureInfo& texture) {
  173. state.texture_units[0].texture = texture.resource.handle;
  174. state.Apply();
  175. glActiveTexture(GL_TEXTURE0);
  176. u8 framebuffer_data[4] = {color_a, color_b, color_g, color_r};
  177. // Update existing texture
  178. glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, framebuffer_data);
  179. state.texture_units[0].texture = 0;
  180. state.Apply();
  181. }
  182. /**
  183. * Initializes the OpenGL state and creates persistent objects.
  184. */
  185. void RendererOpenGL::InitOpenGLObjects() {
  186. glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue,
  187. 0.0f);
  188. // Link shaders and get variable locations
  189. shader.CreateFromSource(vertex_shader, nullptr, fragment_shader);
  190. state.draw.shader_program = shader.handle;
  191. state.Apply();
  192. uniform_modelview_matrix = glGetUniformLocation(shader.handle, "modelview_matrix");
  193. uniform_color_texture = glGetUniformLocation(shader.handle, "color_texture");
  194. attrib_position = glGetAttribLocation(shader.handle, "vert_position");
  195. attrib_tex_coord = glGetAttribLocation(shader.handle, "vert_tex_coord");
  196. // Generate VBO handle for drawing
  197. vertex_buffer.Create();
  198. // Generate VAO
  199. vertex_array.Create();
  200. state.draw.vertex_array = vertex_array.handle;
  201. state.draw.vertex_buffer = vertex_buffer.handle;
  202. state.Apply();
  203. // Attach vertex data to VAO
  204. glBufferData(GL_ARRAY_BUFFER, sizeof(ScreenRectVertex) * 4, nullptr, GL_STREAM_DRAW);
  205. glVertexAttribPointer(attrib_position, 2, GL_FLOAT, GL_FALSE, sizeof(ScreenRectVertex),
  206. (GLvoid*)offsetof(ScreenRectVertex, position));
  207. glVertexAttribPointer(attrib_tex_coord, 2, GL_FLOAT, GL_FALSE, sizeof(ScreenRectVertex),
  208. (GLvoid*)offsetof(ScreenRectVertex, tex_coord));
  209. glEnableVertexAttribArray(attrib_position);
  210. glEnableVertexAttribArray(attrib_tex_coord);
  211. // Allocate textures for the screen
  212. screen_info.texture.resource.Create();
  213. // Allocation of storage is deferred until the first frame, when we
  214. // know the framebuffer size.
  215. state.texture_units[0].texture = screen_info.texture.resource.handle;
  216. state.Apply();
  217. glActiveTexture(GL_TEXTURE0);
  218. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0);
  219. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
  220. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
  221. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
  222. glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
  223. screen_info.display_texture = screen_info.texture.resource.handle;
  224. state.texture_units[0].texture = 0;
  225. state.Apply();
  226. // Clear screen to black
  227. LoadColorToActiveGLTexture(0, 0, 0, 0, screen_info.texture);
  228. }
  229. void RendererOpenGL::CreateRasterizer() {
  230. if (rasterizer) {
  231. return;
  232. }
  233. // Initialize sRGB Usage
  234. OpenGLState::ClearsRGBUsed();
  235. rasterizer = std::make_unique<RasterizerOpenGL>(render_window, screen_info);
  236. }
  237. void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
  238. const Tegra::FramebufferConfig& framebuffer) {
  239. texture.width = framebuffer.width;
  240. texture.height = framebuffer.height;
  241. GLint internal_format;
  242. switch (framebuffer.pixel_format) {
  243. case Tegra::FramebufferConfig::PixelFormat::ABGR8:
  244. internal_format = GL_RGBA;
  245. texture.gl_format = GL_RGBA;
  246. texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
  247. gl_framebuffer_data.resize(texture.width * texture.height * 4);
  248. break;
  249. default:
  250. internal_format = GL_RGBA;
  251. texture.gl_format = GL_RGBA;
  252. texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
  253. gl_framebuffer_data.resize(texture.width * texture.height * 4);
  254. LOG_CRITICAL(Render_OpenGL, "Unknown framebuffer pixel format: {}",
  255. static_cast<u32>(framebuffer.pixel_format));
  256. UNREACHABLE();
  257. }
  258. state.texture_units[0].texture = texture.resource.handle;
  259. state.Apply();
  260. glActiveTexture(GL_TEXTURE0);
  261. glTexImage2D(GL_TEXTURE_2D, 0, internal_format, texture.width, texture.height, 0,
  262. texture.gl_format, texture.gl_type, nullptr);
  263. state.texture_units[0].texture = 0;
  264. state.Apply();
  265. }
  266. void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, float y, float w,
  267. float h) {
  268. const auto& texcoords = screen_info.display_texcoords;
  269. auto left = texcoords.left;
  270. auto right = texcoords.right;
  271. if (framebuffer_transform_flags != Tegra::FramebufferConfig::TransformFlags::Unset) {
  272. if (framebuffer_transform_flags == Tegra::FramebufferConfig::TransformFlags::FlipV) {
  273. // Flip the framebuffer vertically
  274. left = texcoords.right;
  275. right = texcoords.left;
  276. } else {
  277. // Other transformations are unsupported
  278. LOG_CRITICAL(Render_OpenGL, "Unsupported framebuffer_transform_flags={}",
  279. static_cast<u32>(framebuffer_transform_flags));
  280. UNIMPLEMENTED();
  281. }
  282. }
  283. ASSERT_MSG(framebuffer_crop_rect.top == 0, "Unimplemented");
  284. ASSERT_MSG(framebuffer_crop_rect.left == 0, "Unimplemented");
  285. // Scale the output by the crop width/height. This is commonly used with 1280x720 rendering
  286. // (e.g. handheld mode) on a 1920x1080 framebuffer.
  287. f32 scale_u = 1.f, scale_v = 1.f;
  288. if (framebuffer_crop_rect.GetWidth() > 0) {
  289. scale_u = static_cast<f32>(framebuffer_crop_rect.GetWidth()) / screen_info.texture.width;
  290. }
  291. if (framebuffer_crop_rect.GetHeight() > 0) {
  292. scale_v = static_cast<f32>(framebuffer_crop_rect.GetHeight()) / screen_info.texture.height;
  293. }
  294. std::array<ScreenRectVertex, 4> vertices = {{
  295. ScreenRectVertex(x, y, texcoords.top * scale_u, left * scale_v),
  296. ScreenRectVertex(x + w, y, texcoords.bottom * scale_u, left * scale_v),
  297. ScreenRectVertex(x, y + h, texcoords.top * scale_u, right * scale_v),
  298. ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v),
  299. }};
  300. state.texture_units[0].texture = screen_info.display_texture;
  301. state.texture_units[0].swizzle = {GL_RED, GL_GREEN, GL_BLUE, GL_ALPHA};
  302. // Workaround brigthness problems in SMO by enabling sRGB in the final output
  303. // if it has been used in the frame
  304. // Needed because of this bug in QT
  305. // QTBUG-50987
  306. state.framebuffer_srgb.enabled = OpenGLState::GetsRGBUsed();
  307. state.Apply();
  308. glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(vertices), vertices.data());
  309. glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
  310. // restore default state
  311. state.framebuffer_srgb.enabled = false;
  312. state.texture_units[0].texture = 0;
  313. state.Apply();
  314. // Clear sRGB state for the next frame
  315. OpenGLState::ClearsRGBUsed();
  316. }
  317. /**
  318. * Draws the emulated screens to the emulator window.
  319. */
  320. void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
  321. if (renderer_settings.set_background_color) {
  322. // Update background color before drawing
  323. glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue,
  324. 0.0f);
  325. }
  326. const auto& screen = layout.screen;
  327. glViewport(0, 0, layout.width, layout.height);
  328. glClear(GL_COLOR_BUFFER_BIT);
  329. // Set projection matrix
  330. std::array<GLfloat, 3 * 2> ortho_matrix =
  331. MakeOrthographicMatrix((float)layout.width, (float)layout.height);
  332. glUniformMatrix3x2fv(uniform_modelview_matrix, 1, GL_FALSE, ortho_matrix.data());
  333. // Bind texture in Texture Unit 0
  334. glActiveTexture(GL_TEXTURE0);
  335. glUniform1i(uniform_color_texture, 0);
  336. DrawScreenTriangles(screen_info, (float)screen.left, (float)screen.top,
  337. (float)screen.GetWidth(), (float)screen.GetHeight());
  338. m_current_frame++;
  339. }
  340. /// Updates the framerate
  341. void RendererOpenGL::UpdateFramerate() {}
  342. void RendererOpenGL::CaptureScreenshot() {
  343. // Draw the current frame to the screenshot framebuffer
  344. screenshot_framebuffer.Create();
  345. GLuint old_read_fb = state.draw.read_framebuffer;
  346. GLuint old_draw_fb = state.draw.draw_framebuffer;
  347. state.draw.read_framebuffer = state.draw.draw_framebuffer = screenshot_framebuffer.handle;
  348. state.Apply();
  349. Layout::FramebufferLayout layout{renderer_settings.screenshot_framebuffer_layout};
  350. GLuint renderbuffer;
  351. glGenRenderbuffers(1, &renderbuffer);
  352. glBindRenderbuffer(GL_RENDERBUFFER, renderbuffer);
  353. glRenderbufferStorage(GL_RENDERBUFFER, GL_RGB8, layout.width, layout.height);
  354. glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, renderbuffer);
  355. DrawScreen(layout);
  356. glReadPixels(0, 0, layout.width, layout.height, GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
  357. renderer_settings.screenshot_bits);
  358. screenshot_framebuffer.Release();
  359. state.draw.read_framebuffer = old_read_fb;
  360. state.draw.draw_framebuffer = old_draw_fb;
  361. state.Apply();
  362. glDeleteRenderbuffers(1, &renderbuffer);
  363. renderer_settings.screenshot_complete_callback();
  364. renderer_settings.screenshot_requested = false;
  365. }
  366. static const char* GetSource(GLenum source) {
  367. #define RET(s) \
  368. case GL_DEBUG_SOURCE_##s: \
  369. return #s
  370. switch (source) {
  371. RET(API);
  372. RET(WINDOW_SYSTEM);
  373. RET(SHADER_COMPILER);
  374. RET(THIRD_PARTY);
  375. RET(APPLICATION);
  376. RET(OTHER);
  377. default:
  378. UNREACHABLE();
  379. return "Unknown source";
  380. }
  381. #undef RET
  382. }
  383. static const char* GetType(GLenum type) {
  384. #define RET(t) \
  385. case GL_DEBUG_TYPE_##t: \
  386. return #t
  387. switch (type) {
  388. RET(ERROR);
  389. RET(DEPRECATED_BEHAVIOR);
  390. RET(UNDEFINED_BEHAVIOR);
  391. RET(PORTABILITY);
  392. RET(PERFORMANCE);
  393. RET(OTHER);
  394. RET(MARKER);
  395. default:
  396. UNREACHABLE();
  397. return "Unknown type";
  398. }
  399. #undef RET
  400. }
  401. static void APIENTRY DebugHandler(GLenum source, GLenum type, GLuint id, GLenum severity,
  402. GLsizei length, const GLchar* message, const void* user_param) {
  403. const char format[] = "{} {} {}: {}";
  404. const char* const str_source = GetSource(source);
  405. const char* const str_type = GetType(type);
  406. switch (severity) {
  407. case GL_DEBUG_SEVERITY_HIGH:
  408. LOG_CRITICAL(Render_OpenGL, format, str_source, str_type, id, message);
  409. break;
  410. case GL_DEBUG_SEVERITY_MEDIUM:
  411. LOG_WARNING(Render_OpenGL, format, str_source, str_type, id, message);
  412. break;
  413. case GL_DEBUG_SEVERITY_NOTIFICATION:
  414. case GL_DEBUG_SEVERITY_LOW:
  415. LOG_DEBUG(Render_OpenGL, format, str_source, str_type, id, message);
  416. break;
  417. }
  418. }
  419. /// Initialize the renderer
  420. bool RendererOpenGL::Init() {
  421. ScopeAcquireGLContext acquire_context{render_window};
  422. if (GLAD_GL_KHR_debug) {
  423. glEnable(GL_DEBUG_OUTPUT);
  424. glDebugMessageCallback(DebugHandler, nullptr);
  425. }
  426. const char* gl_version{reinterpret_cast<char const*>(glGetString(GL_VERSION))};
  427. const char* gpu_vendor{reinterpret_cast<char const*>(glGetString(GL_VENDOR))};
  428. const char* gpu_model{reinterpret_cast<char const*>(glGetString(GL_RENDERER))};
  429. LOG_INFO(Render_OpenGL, "GL_VERSION: {}", gl_version);
  430. LOG_INFO(Render_OpenGL, "GL_VENDOR: {}", gpu_vendor);
  431. LOG_INFO(Render_OpenGL, "GL_RENDERER: {}", gpu_model);
  432. Core::Telemetry().AddField(Telemetry::FieldType::UserSystem, "GPU_Vendor", gpu_vendor);
  433. Core::Telemetry().AddField(Telemetry::FieldType::UserSystem, "GPU_Model", gpu_model);
  434. Core::Telemetry().AddField(Telemetry::FieldType::UserSystem, "GPU_OpenGL_Version", gl_version);
  435. if (!GLAD_GL_VERSION_4_3) {
  436. return false;
  437. }
  438. InitOpenGLObjects();
  439. CreateRasterizer();
  440. return true;
  441. }
  442. /// Shutdown the renderer
  443. void RendererOpenGL::ShutDown() {}
  444. } // namespace OpenGL