diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index aa837eb95..bba16afaf 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -66,17 +66,12 @@ constexpr GLint PositionLocation = 0; | |||
| 66 | constexpr GLint TexCoordLocation = 1; | 66 | constexpr GLint TexCoordLocation = 1; |
| 67 | constexpr GLint ModelViewMatrixLocation = 0; | 67 | constexpr GLint ModelViewMatrixLocation = 0; |
| 68 | 68 | ||
| 69 | /// Vertex structure that the drawn screen rectangles are composed of. | ||
| 70 | struct ScreenRectVertex { | 69 | struct ScreenRectVertex { |
| 71 | ScreenRectVertex(GLfloat x, GLfloat y, GLfloat u, GLfloat v) { | 70 | constexpr ScreenRectVertex(GLfloat x, GLfloat y, GLfloat u, GLfloat v) |
| 72 | position[0] = x; | 71 | : position{{x, y}}, tex_coord{{u, v}} {} |
| 73 | position[1] = y; | ||
| 74 | tex_coord[0] = u; | ||
| 75 | tex_coord[1] = v; | ||
| 76 | } | ||
| 77 | 72 | ||
| 78 | GLfloat position[2]; | 73 | std::array<GLfloat, 2> position; |
| 79 | GLfloat tex_coord[2]; | 74 | std::array<GLfloat, 2> tex_coord; |
| 80 | }; | 75 | }; |
| 81 | 76 | ||
| 82 | /** | 77 | /** |
| @@ -383,18 +378,18 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x, | |||
| 383 | static_cast<f32>(screen_info.texture.height); | 378 | static_cast<f32>(screen_info.texture.height); |
| 384 | } | 379 | } |
| 385 | 380 | ||
| 386 | std::array<ScreenRectVertex, 4> vertices = {{ | 381 | const std::array vertices = { |
| 387 | ScreenRectVertex(x, y, texcoords.top * scale_u, left * scale_v), | 382 | ScreenRectVertex(x, y, texcoords.top * scale_u, left * scale_v), |
| 388 | ScreenRectVertex(x + w, y, texcoords.bottom * scale_u, left * scale_v), | 383 | ScreenRectVertex(x + w, y, texcoords.bottom * scale_u, left * scale_v), |
| 389 | ScreenRectVertex(x, y + h, texcoords.top * scale_u, right * scale_v), | 384 | ScreenRectVertex(x, y + h, texcoords.top * scale_u, right * scale_v), |
| 390 | ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v), | 385 | ScreenRectVertex(x + w, y + h, texcoords.bottom * scale_u, right * scale_v), |
| 391 | }}; | 386 | }; |
| 392 | 387 | ||
| 393 | state.textures[0] = screen_info.display_texture; | 388 | state.textures[0] = screen_info.display_texture; |
| 394 | state.framebuffer_srgb.enabled = screen_info.display_srgb; | 389 | state.framebuffer_srgb.enabled = screen_info.display_srgb; |
| 395 | state.AllDirty(); | 390 | state.AllDirty(); |
| 396 | state.Apply(); | 391 | state.Apply(); |
| 397 | glNamedBufferSubData(vertex_buffer.handle, 0, sizeof(vertices), vertices.data()); | 392 | glNamedBufferSubData(vertex_buffer.handle, 0, sizeof(vertices), std::data(vertices)); |
| 398 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); | 393 | glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); |
| 399 | // Restore default state | 394 | // Restore default state |
| 400 | state.framebuffer_srgb.enabled = false; | 395 | state.framebuffer_srgb.enabled = false; |