diff options
author | Subv <subv2112@gmail.com> | 2018-03-27 04:51:56 +0200 |
---|---|---|
committer | James Rowe <jroweboy@gmail.com> | 2018-04-07 04:44:46 +0200 |
commit | 65faeb9b2a984268f248250424443902cdfa0fbd (patch) | |
tree | 1b0ae0e0535c991b48813ebf02a7055a592f0575 /src/video_core/renderer_opengl/gl_rasterizer_cache.cpp | |
parent | GLCache: Implemented GetTextureSurface. (diff) | |
download | yuzu-65faeb9b2a984268f248250424443902cdfa0fbd.tar yuzu-65faeb9b2a984268f248250424443902cdfa0fbd.tar.gz yuzu-65faeb9b2a984268f248250424443902cdfa0fbd.tar.bz2 yuzu-65faeb9b2a984268f248250424443902cdfa0fbd.tar.lz yuzu-65faeb9b2a984268f248250424443902cdfa0fbd.tar.xz yuzu-65faeb9b2a984268f248250424443902cdfa0fbd.tar.zst yuzu-65faeb9b2a984268f248250424443902cdfa0fbd.zip |
Diffstat (limited to '')
-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) { } template <bool morton_to_gl, PixelFormat format> -static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, VAddr base, VAddr start, VAddr end) { +void MortonCopy(u32 stride, u32 height, u8* gl_buffer, VAddr base, VAddr start, VAddr end) { constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(format) / 8; constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(format); @@ -113,6 +113,20 @@ static void MortonCopy(u32 stride, u32 height, u8* gl_buffer, VAddr base, VAddr Memory::GetPointer(base), gl_buffer, morton_to_gl); } +template <> +void MortonCopy<true, PixelFormat::DXT1>(u32 stride, u32 height, u8* gl_buffer, VAddr base, + VAddr start, VAddr end) { + constexpr u32 bytes_per_pixel = SurfaceParams::GetFormatBpp(PixelFormat::DXT1) / 8; + constexpr u32 gl_bytes_per_pixel = CachedSurface::GetGLBytesPerPixel(PixelFormat::DXT1); + + // TODO(bunnei): Assumes the default rendering GOB size of 16 (128 lines). We should check the + // configuration for this and perform more generic un/swizzle + LOG_WARNING(Render_OpenGL, "need to use correct swizzle/GOB parameters!"); + auto data = + Tegra::Texture::UnswizzleTexture(base, Tegra::Texture::TextureFormat::DXT1, stride, height); + std::memcpy(gl_buffer, data.data(), data.size()); +} + static constexpr std::array<void (*)(u32, u32, u8*, VAddr, VAddr, VAddr), 2> morton_to_gl_fns = { MortonCopy<true, PixelFormat::RGBA8>, MortonCopy<true, PixelFormat::DXT1>, |