Просмотр исходного кода

renderer_opengl: Fix Morton copy byteswap, etc.

bunnei 8 лет назад
Родитель
Сommit
a992aac5eb
2 измененных файлов с 6 добавлено и 6 удалено
  1. 5 5
      src/video_core/renderer_opengl/renderer_opengl.cpp
  2. 1 1
      src/video_core/utils.h

+ 5 - 5
src/video_core/renderer_opengl/renderer_opengl.cpp

@@ -57,7 +57,7 @@ uniform sampler2D color_texture;
 void main() {
 void main() {
     // Swap RGBA -> ABGR so we don't have to do this on the CPU. This needs to change if we have to
     // Swap RGBA -> ABGR so we don't have to do this on the CPU. This needs to change if we have to
     // support more framebuffer pixel formats.
     // support more framebuffer pixel formats.
-    color = texture(color_texture, frag_tex_coord).abgr;
+    color = texture(color_texture, frag_tex_coord);
 }
 }
 )";
 )";
 
 
@@ -311,10 +311,10 @@ void RendererOpenGL::DrawScreenTriangles(const ScreenInfo& screen_info, float x,
         }
         }
 
 
     std::array<ScreenRectVertex, 4> vertices = {{
     std::array<ScreenRectVertex, 4> vertices = {{
-        ScreenRectVertex(x, y, texcoords.top, right),
-        ScreenRectVertex(x + w, y, texcoords.bottom, right),
-        ScreenRectVertex(x, y + h, texcoords.top, left),
-        ScreenRectVertex(x + w, y + h, texcoords.bottom, left),
+        ScreenRectVertex(x, y, texcoords.top, left),
+        ScreenRectVertex(x + w, y, texcoords.bottom, left),
+        ScreenRectVertex(x, y + h, texcoords.top, right),
+        ScreenRectVertex(x + w, y + h, texcoords.bottom, right),
     }};
     }};
 
 
     state.texture_units[0].texture_2d = screen_info.display_texture;
     state.texture_units[0].texture_2d = screen_info.display_texture;

+ 1 - 1
src/video_core/utils.h

@@ -151,7 +151,7 @@ static inline void MortonCopyPixels128(u32 width, u32 height, u32 bytes_per_pixe
             const u32 coarse_y = y & ~127;
             const u32 coarse_y = y & ~127;
             u32 morton_offset =
             u32 morton_offset =
                 GetMortonOffset128(x, y, bytes_per_pixel) + coarse_y * width * bytes_per_pixel;
                 GetMortonOffset128(x, y, bytes_per_pixel) + coarse_y * width * bytes_per_pixel;
-            u32 gl_pixel_index = (x + (height - 1 - y) * width) * gl_bytes_per_pixel;
+            u32 gl_pixel_index = (x + y * width) * gl_bytes_per_pixel;
 
 
             data_ptrs[morton_to_gl] = morton_data + morton_offset;
             data_ptrs[morton_to_gl] = morton_data + morton_offset;
             data_ptrs[!morton_to_gl] = &gl_data[gl_pixel_index];
             data_ptrs[!morton_to_gl] = &gl_data[gl_pixel_index];