diff options
| author | 2019-11-28 20:11:03 -0300 | |
|---|---|---|
| committer | 2019-11-28 20:11:03 -0300 | |
| commit | 4589582eaf9aa5a1d9bc4e74ed71b0bf7903a1d2 (patch) | |
| tree | a2ac5e7712b859821c0925f212810ff7e26539e9 /src | |
| parent | Merge pull request #3169 from lioncash/memory (diff) | |
| download | yuzu-4589582eaf9aa5a1d9bc4e74ed71b0bf7903a1d2.tar.gz yuzu-4589582eaf9aa5a1d9bc4e74ed71b0bf7903a1d2.tar.xz yuzu-4589582eaf9aa5a1d9bc4e74ed71b0bf7903a1d2.zip | |
renderer_opengl: Move commentaries to header file
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 19 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 14 |
2 files changed, 13 insertions, 20 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index a57a564f7..69fd735bd 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -62,9 +62,7 @@ void main() { | |||
| 62 | } | 62 | } |
| 63 | )"; | 63 | )"; |
| 64 | 64 | ||
| 65 | /** | 65 | /// Vertex structure that the drawn screen rectangles are composed of. |
| 66 | * Vertex structure that the drawn screen rectangles are composed of. | ||
| 67 | */ | ||
| 68 | struct ScreenRectVertex { | 66 | struct ScreenRectVertex { |
| 69 | ScreenRectVertex(GLfloat x, GLfloat y, GLfloat u, GLfloat v) { | 67 | ScreenRectVertex(GLfloat x, GLfloat y, GLfloat u, GLfloat v) { |
| 70 | position[0] = x; | 68 | position[0] = x; |
| @@ -138,9 +136,6 @@ void RendererOpenGL::SwapBuffers(const Tegra::FramebufferConfig* framebuffer) { | |||
| 138 | prev_state.Apply(); | 136 | prev_state.Apply(); |
| 139 | } | 137 | } |
| 140 | 138 | ||
| 141 | /** | ||
| 142 | * Loads framebuffer from emulated memory into the active OpenGL texture. | ||
| 143 | */ | ||
| 144 | void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) { | 139 | void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer) { |
| 145 | // Framebuffer orientation handling | 140 | // Framebuffer orientation handling |
| 146 | framebuffer_transform_flags = framebuffer.transform_flags; | 141 | framebuffer_transform_flags = framebuffer.transform_flags; |
| @@ -181,19 +176,12 @@ void RendererOpenGL::LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuf | |||
| 181 | glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); | 176 | glPixelStorei(GL_UNPACK_ROW_LENGTH, 0); |
| 182 | } | 177 | } |
| 183 | 178 | ||
| 184 | /** | ||
| 185 | * Fills active OpenGL texture with the given RGB color. Since the color is solid, the texture can | ||
| 186 | * be 1x1 but will stretch across whatever it's rendered on. | ||
| 187 | */ | ||
| 188 | void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, | 179 | void RendererOpenGL::LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, |
| 189 | const TextureInfo& texture) { | 180 | const TextureInfo& texture) { |
| 190 | const u8 framebuffer_data[4] = {color_a, color_b, color_g, color_r}; | 181 | const u8 framebuffer_data[4] = {color_a, color_b, color_g, color_r}; |
| 191 | glClearTexImage(texture.resource.handle, 0, GL_RGBA, GL_UNSIGNED_BYTE, framebuffer_data); | 182 | glClearTexImage(texture.resource.handle, 0, GL_RGBA, GL_UNSIGNED_BYTE, framebuffer_data); |
| 192 | } | 183 | } |
| 193 | 184 | ||
| 194 | /** | ||
| 195 | * Initializes the OpenGL state and creates persistent objects. | ||
| 196 | */ | ||
| 197 | void RendererOpenGL::InitOpenGLObjects() { | 185 | void RendererOpenGL::InitOpenGLObjects() { |
| 198 | glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue, | 186 | glClearColor(Settings::values.bg_red, Settings::values.bg_green, Settings::values.bg_blue, |
| 199 | 0.0f); | 187 | 0.0f); |
| @@ -351,9 +339,6 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, | |||
| 351 | state.Apply(); | 339 | state.Apply(); |
| 352 | } | 340 | } |
| 353 | 341 | ||
| 354 | /** | ||
| 355 | * Draws the emulated screens to the emulator window. | ||
| 356 | */ | ||
| 357 | void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { | 342 | void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { |
| 358 | if (renderer_settings.set_background_color) { | 343 | if (renderer_settings.set_background_color) { |
| 359 | // Update background color before drawing | 344 | // Update background color before drawing |
| @@ -381,7 +366,6 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { | |||
| 381 | m_current_frame++; | 366 | m_current_frame++; |
| 382 | } | 367 | } |
| 383 | 368 | ||
| 384 | /// Updates the framerate | ||
| 385 | void RendererOpenGL::UpdateFramerate() {} | 369 | void RendererOpenGL::UpdateFramerate() {} |
| 386 | 370 | ||
| 387 | void RendererOpenGL::CaptureScreenshot() { | 371 | void RendererOpenGL::CaptureScreenshot() { |
| @@ -495,7 +479,6 @@ bool RendererOpenGL::Init() { | |||
| 495 | return true; | 479 | return true; |
| 496 | } | 480 | } |
| 497 | 481 | ||
| 498 | /// Shutdown the renderer | ||
| 499 | void RendererOpenGL::ShutDown() {} | 482 | void RendererOpenGL::ShutDown() {} |
| 500 | 483 | ||
| 501 | } // namespace OpenGL | 484 | } // namespace OpenGL |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index cf26628ca..6bb620a31 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -59,21 +59,31 @@ public: | |||
| 59 | void ShutDown() override; | 59 | void ShutDown() override; |
| 60 | 60 | ||
| 61 | private: | 61 | private: |
| 62 | /// Initializes the OpenGL state and creates persistent objects. | ||
| 62 | void InitOpenGLObjects(); | 63 | void InitOpenGLObjects(); |
| 64 | |||
| 63 | void AddTelemetryFields(); | 65 | void AddTelemetryFields(); |
| 66 | |||
| 64 | void CreateRasterizer(); | 67 | void CreateRasterizer(); |
| 65 | 68 | ||
| 66 | void ConfigureFramebufferTexture(TextureInfo& texture, | 69 | void ConfigureFramebufferTexture(TextureInfo& texture, |
| 67 | const Tegra::FramebufferConfig& framebuffer); | 70 | const Tegra::FramebufferConfig& framebuffer); |
| 71 | |||
| 72 | /// Draws the emulated screens to the emulator window. | ||
| 68 | void DrawScreen(const Layout::FramebufferLayout& layout); | 73 | void DrawScreen(const Layout::FramebufferLayout& layout); |
| 74 | |||
| 69 | void DrawScreenTriangles(const ScreenInfo& screen_info, float x, float y, float w, float h); | 75 | void DrawScreenTriangles(const ScreenInfo& screen_info, float x, float y, float w, float h); |
| 76 | |||
| 77 | /// Updates the framerate. | ||
| 70 | void UpdateFramerate(); | 78 | void UpdateFramerate(); |
| 71 | 79 | ||
| 72 | void CaptureScreenshot(); | 80 | void CaptureScreenshot(); |
| 73 | 81 | ||
| 74 | // Loads framebuffer from emulated memory into the display information structure | 82 | /// Loads framebuffer from emulated memory into the active OpenGL texture. |
| 75 | void LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer); | 83 | void LoadFBToScreenInfo(const Tegra::FramebufferConfig& framebuffer); |
| 76 | // Fills active OpenGL texture with the given RGBA color. | 84 | |
| 85 | /// Fills active OpenGL texture with the given RGB color.Since the color is solid, the texture | ||
| 86 | /// can be 1x1 but will stretch across whatever it's rendered on. | ||
| 77 | void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, | 87 | void LoadColorToActiveGLTexture(u8 color_r, u8 color_g, u8 color_b, u8 color_a, |
| 78 | const TextureInfo& texture); | 88 | const TextureInfo& texture); |
| 79 | 89 | ||