diff options
Diffstat (limited to 'src/video_core')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer.cpp | 21 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_gen.cpp | 2 |
2 files changed, 11 insertions, 12 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 822739088..23d9517da 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp | |||
| @@ -596,12 +596,12 @@ void RasterizerOpenGL::SyncCullMode() { | |||
| 596 | 596 | ||
| 597 | case Pica::Regs::CullMode::KeepClockWise: | 597 | case Pica::Regs::CullMode::KeepClockWise: |
| 598 | state.cull.enabled = true; | 598 | state.cull.enabled = true; |
| 599 | state.cull.mode = GL_BACK; | 599 | state.cull.front_face = GL_CW; |
| 600 | break; | 600 | break; |
| 601 | 601 | ||
| 602 | case Pica::Regs::CullMode::KeepCounterClockWise: | 602 | case Pica::Regs::CullMode::KeepCounterClockWise: |
| 603 | state.cull.enabled = true; | 603 | state.cull.enabled = true; |
| 604 | state.cull.mode = GL_FRONT; | 604 | state.cull.front_face = GL_CCW; |
| 605 | break; | 605 | break; |
| 606 | 606 | ||
| 607 | default: | 607 | default: |
| @@ -692,9 +692,8 @@ void RasterizerOpenGL::SyncDrawState() { | |||
| 692 | // OpenGL uses different y coordinates, so negate corner offset and flip origin | 692 | // OpenGL uses different y coordinates, so negate corner offset and flip origin |
| 693 | // TODO: Ensure viewport_corner.x should not be negated or origin flipped | 693 | // TODO: Ensure viewport_corner.x should not be negated or origin flipped |
| 694 | // TODO: Use floating-point viewports for accuracy if supported | 694 | // TODO: Use floating-point viewports for accuracy if supported |
| 695 | glViewport((GLsizei)static_cast<float>(regs.viewport_corner.x), | 695 | glViewport((GLsizei)regs.viewport_corner.x, |
| 696 | -(GLsizei)static_cast<float>(regs.viewport_corner.y) | 696 | (GLsizei)regs.viewport_corner.y, |
| 697 | + regs.framebuffer.GetHeight() - viewport_height, | ||
| 698 | viewport_width, viewport_height); | 697 | viewport_width, viewport_height); |
| 699 | 698 | ||
| 700 | // Sync bound texture(s), upload if not cached | 699 | // Sync bound texture(s), upload if not cached |
| @@ -733,7 +732,7 @@ void RasterizerOpenGL::ReloadColorBuffer() { | |||
| 733 | for (int x = 0; x < fb_color_texture.width; ++x) { | 732 | for (int x = 0; x < fb_color_texture.width; ++x) { |
| 734 | const u32 coarse_y = y & ~7; | 733 | const u32 coarse_y = y & ~7; |
| 735 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel; | 734 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel; |
| 736 | u32 gl_pixel_index = (x + y * fb_color_texture.width) * bytes_per_pixel; | 735 | u32 gl_pixel_index = (x + (fb_color_texture.height - 1 - y) * fb_color_texture.width) * bytes_per_pixel; |
| 737 | 736 | ||
| 738 | u8* pixel = color_buffer + dst_offset; | 737 | u8* pixel = color_buffer + dst_offset; |
| 739 | memcpy(&temp_fb_color_buffer[gl_pixel_index], pixel, bytes_per_pixel); | 738 | memcpy(&temp_fb_color_buffer[gl_pixel_index], pixel, bytes_per_pixel); |
| @@ -779,7 +778,7 @@ void RasterizerOpenGL::ReloadDepthBuffer() { | |||
| 779 | for (int x = 0; x < fb_depth_texture.width; ++x) { | 778 | for (int x = 0; x < fb_depth_texture.width; ++x) { |
| 780 | const u32 coarse_y = y & ~7; | 779 | const u32 coarse_y = y & ~7; |
| 781 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; | 780 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; |
| 782 | u32 gl_pixel_index = (x + y * fb_depth_texture.width); | 781 | u32 gl_pixel_index = (x + (fb_depth_texture.height - 1 - y) * fb_depth_texture.width); |
| 783 | 782 | ||
| 784 | u8* pixel = depth_buffer + dst_offset; | 783 | u8* pixel = depth_buffer + dst_offset; |
| 785 | u32 depth_stencil = *(u32*)pixel; | 784 | u32 depth_stencil = *(u32*)pixel; |
| @@ -791,7 +790,7 @@ void RasterizerOpenGL::ReloadDepthBuffer() { | |||
| 791 | for (int x = 0; x < fb_depth_texture.width; ++x) { | 790 | for (int x = 0; x < fb_depth_texture.width; ++x) { |
| 792 | const u32 coarse_y = y & ~7; | 791 | const u32 coarse_y = y & ~7; |
| 793 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; | 792 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; |
| 794 | u32 gl_pixel_index = (x + y * fb_depth_texture.width) * gl_bpp; | 793 | u32 gl_pixel_index = (x + (fb_depth_texture.height - 1 - y) * fb_depth_texture.width) * gl_bpp; |
| 795 | 794 | ||
| 796 | u8* pixel = depth_buffer + dst_offset; | 795 | u8* pixel = depth_buffer + dst_offset; |
| 797 | memcpy(&temp_fb_depth_data[gl_pixel_index], pixel, bytes_per_pixel); | 796 | memcpy(&temp_fb_depth_data[gl_pixel_index], pixel, bytes_per_pixel); |
| @@ -846,7 +845,7 @@ void RasterizerOpenGL::CommitColorBuffer() { | |||
| 846 | for (int x = 0; x < fb_color_texture.width; ++x) { | 845 | for (int x = 0; x < fb_color_texture.width; ++x) { |
| 847 | const u32 coarse_y = y & ~7; | 846 | const u32 coarse_y = y & ~7; |
| 848 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel; | 847 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_color_texture.width * bytes_per_pixel; |
| 849 | u32 gl_pixel_index = x * bytes_per_pixel + y * fb_color_texture.width * bytes_per_pixel; | 848 | u32 gl_pixel_index = x * bytes_per_pixel + (fb_color_texture.height - 1 - y) * fb_color_texture.width * bytes_per_pixel; |
| 850 | 849 | ||
| 851 | u8* pixel = color_buffer + dst_offset; | 850 | u8* pixel = color_buffer + dst_offset; |
| 852 | memcpy(pixel, &temp_gl_color_buffer[gl_pixel_index], bytes_per_pixel); | 851 | memcpy(pixel, &temp_gl_color_buffer[gl_pixel_index], bytes_per_pixel); |
| @@ -888,7 +887,7 @@ void RasterizerOpenGL::CommitDepthBuffer() { | |||
| 888 | for (int x = 0; x < fb_depth_texture.width; ++x) { | 887 | for (int x = 0; x < fb_depth_texture.width; ++x) { |
| 889 | const u32 coarse_y = y & ~7; | 888 | const u32 coarse_y = y & ~7; |
| 890 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; | 889 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; |
| 891 | u32 gl_pixel_index = (x + y * fb_depth_texture.width); | 890 | u32 gl_pixel_index = (x + (fb_depth_texture.height - 1 - y) * fb_depth_texture.width); |
| 892 | 891 | ||
| 893 | u8* pixel = depth_buffer + dst_offset; | 892 | u8* pixel = depth_buffer + dst_offset; |
| 894 | u32 depth_stencil = ((u32*)temp_gl_depth_data)[gl_pixel_index]; | 893 | u32 depth_stencil = ((u32*)temp_gl_depth_data)[gl_pixel_index]; |
| @@ -900,7 +899,7 @@ void RasterizerOpenGL::CommitDepthBuffer() { | |||
| 900 | for (int x = 0; x < fb_depth_texture.width; ++x) { | 899 | for (int x = 0; x < fb_depth_texture.width; ++x) { |
| 901 | const u32 coarse_y = y & ~7; | 900 | const u32 coarse_y = y & ~7; |
| 902 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; | 901 | u32 dst_offset = VideoCore::GetMortonOffset(x, y, bytes_per_pixel) + coarse_y * fb_depth_texture.width * bytes_per_pixel; |
| 903 | u32 gl_pixel_index = (x + y * fb_depth_texture.width) * gl_bpp; | 902 | u32 gl_pixel_index = (x + (fb_depth_texture.height - 1 - y) * fb_depth_texture.width) * gl_bpp; |
| 904 | 903 | ||
| 905 | u8* pixel = depth_buffer + dst_offset; | 904 | u8* pixel = depth_buffer + dst_offset; |
| 906 | memcpy(pixel, &temp_gl_depth_data[gl_pixel_index], bytes_per_pixel); | 905 | memcpy(pixel, &temp_gl_depth_data[gl_pixel_index], bytes_per_pixel); |
diff --git a/src/video_core/renderer_opengl/gl_shader_gen.cpp b/src/video_core/renderer_opengl/gl_shader_gen.cpp index 498c506e7..38de5d469 100644 --- a/src/video_core/renderer_opengl/gl_shader_gen.cpp +++ b/src/video_core/renderer_opengl/gl_shader_gen.cpp | |||
| @@ -382,7 +382,7 @@ void main() { | |||
| 382 | texcoord[0] = vert_texcoord0; | 382 | texcoord[0] = vert_texcoord0; |
| 383 | texcoord[1] = vert_texcoord1; | 383 | texcoord[1] = vert_texcoord1; |
| 384 | texcoord[2] = vert_texcoord2; | 384 | texcoord[2] = vert_texcoord2; |
| 385 | gl_Position = vec4(vert_position.x, -vert_position.y, -vert_position.z, vert_position.w); | 385 | gl_Position = vec4(vert_position.x, vert_position.y, -vert_position.z, vert_position.w); |
| 386 | } | 386 | } |
| 387 | )"; | 387 | )"; |
| 388 | 388 | ||