summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSubv <subv2112@gmail.com>2018-03-27 04:51:04 +0200
committerJames Rowe <jroweboy@gmail.com>2018-04-07 04:44:45 +0200
commitb258403f0d2fb224f32c0ea81ecb6842d783c658 (patch)
tree2eccb1a55c677ef609a61d10ded8b1bcda769dbf
parentGLCache: Support uploading compressed textures to the GPU. (diff)
downloadyuzu-b258403f0d2fb224f32c0ea81ecb6842d783c658.tar
yuzu-b258403f0d2fb224f32c0ea81ecb6842d783c658.tar.gz
yuzu-b258403f0d2fb224f32c0ea81ecb6842d783c658.tar.bz2
yuzu-b258403f0d2fb224f32c0ea81ecb6842d783c658.tar.lz
yuzu-b258403f0d2fb224f32c0ea81ecb6842d783c658.tar.xz
yuzu-b258403f0d2fb224f32c0ea81ecb6842d783c658.tar.zst
yuzu-b258403f0d2fb224f32c0ea81ecb6842d783c658.zip
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer_cache.cpp31
1 files changed, 28 insertions, 3 deletions
diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
index 942b12d70..5495cea45 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp
@@ -1018,9 +1018,34 @@ SurfaceRect_Tuple RasterizerCacheOpenGL::GetSurfaceSubRect(const SurfaceParams&
return std::make_tuple(surface, surface->GetScaledSubRect(params));
}
-Surface RasterizerCacheOpenGL::GetTextureSurface(const void* config) {
- UNREACHABLE();
- return {};
+Surface RasterizerCacheOpenGL::GetTextureSurface(const Tegra::Texture::FullTextureInfo& config) {
+ auto& gpu = Core::System::GetInstance().GPU();
+
+ SurfaceParams params;
+ params.addr = gpu.memory_manager->PhysicalToVirtualAddress(config.tic.Address());
+ params.width = config.tic.Width();
+ params.height = config.tic.Height();
+ params.is_tiled = config.tic.IsTiled();
+ params.pixel_format = SurfaceParams::PixelFormatFromTextureFormat(config.tic.format);
+ params.UpdateParams();
+
+ if (config.tic.Width() % 8 != 0 || config.tic.Height() % 8 != 0) {
+ Surface src_surface;
+ MathUtil::Rectangle<u32> rect;
+ std::tie(src_surface, rect) = GetSurfaceSubRect(params, ScaleMatch::Ignore, true);
+
+ params.res_scale = src_surface->res_scale;
+ Surface tmp_surface = CreateSurface(params);
+ BlitTextures(src_surface->texture.handle, rect, tmp_surface->texture.handle,
+ tmp_surface->GetScaledRect(),
+ SurfaceParams::GetFormatType(params.pixel_format), read_framebuffer.handle,
+ draw_framebuffer.handle);
+
+ remove_surfaces.emplace(tmp_surface);
+ return tmp_surface;
+ }
+
+ return GetSurface(params, ScaleMatch::Ignore, true);
}
SurfaceSurfaceRect_Tuple RasterizerCacheOpenGL::GetFramebufferSurfaces(