diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index 5495cea45..a7f49c18b 100644 --- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |||
| @@ -102,7 +102,7 @@ static void MortonCopyTile(u32 stride, u8* tile_buffer, u8* gl_buffer) { | |||
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | template <bool morton_to_gl, PixelFormat format> | 104 | template <bool morton_to_gl, PixelFormat format> |
| 105 | static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, VAddr base, VAddr start, VAddr end) { | 105 | void MortonCopy(u32 stride, u32 height, u8* gl_buffer, VAddr base, VAddr start, VAddr end) { |
| 106 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / 8; | 106 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / 8; |
| 107 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); | 107 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); |
| 108 | 108 | ||
| @@ -113,6 +113,20 @@ static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, VAddr base, VAddr | |||
| 113 | Memory::GetPointer(base), gl_buffer, morton_to_gl); | 113 | Memory::GetPointer(base), gl_buffer, morton_to_gl); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | template <> | ||
| 117 | void MortonCopy<true, PixelFormat::DXT1>(u32 stride, u32 height, u8* gl_buffer, VAddr base, | ||
| 118 | VAddr start, VAddr end) { | ||
| 119 | constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(PixelFormat::DXT1) / 8; | ||
| 120 | constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(PixelFormat::DXT1); | ||
| 121 | |||
| 122 | // TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should check the | ||
| 123 | // configuration for this and perform more generic un/swizzle | ||
| 124 | LOG_WARNING(Render_OpenGL, "need to use correct swizzle/GOB parameters!"); | ||
| 125 | auto data = | ||
| 126 | Tegra::Texture::UnswizzleTexture(base, Tegra::Texture::TextureFormat::DXT1, stride, height); | ||
| 127 | std::memcpy(gl_buffer, data.data(), data.size()); | ||
| 128 | } | ||
| 129 | |||
| 116 | static constexpr std::array<void (*)(u32, u32, u8*, VAddr, VAddr, VAddr), 2> morton_to_gl_fns = { | 130 | static constexpr std::array<void (*)(u32, u32, u8*, VAddr, VAddr, VAddr), 2> morton_to_gl_fns = { |
| 117 | MortonCopy<true, PixelFormat::RGBA8>, | 131 | MortonCopy<true, PixelFormat::RGBA8>, |
| 118 | MortonCopy<true, PixelFormat::DXT1>, | 132 | MortonCopy<true, PixelFormat::DXT1>, |