From 853acce6c5d424005efd8b0d495abd7ee2b756fb Mon Sep 17 00:00:00 2001 From: bunnei Date: Sat, 7 Sep 2019 02:43:20 -0400 Subject: [PATCH] android: renderer_opengl: Optimize GetTexImageOES and fix bugs. --- .../renderer_opengl/gl_rasterizer_cache.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp b/src/video_core/renderer_opengl/gl_rasterizer_cache.cpp index b8e017cfea..3b30ec4c40 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 GetTexImageOES(GLenum target, GLint level, GLenum format, GLenum typ GLenum texture_binding = GL_NONE; switch (target) { case GL_TEXTURE_2D: - texture_binding = GL_TEXTURE_BINDING_2D; + texture_binding = cur_state.texture_units[0].texture_2d; break; case GL_TEXTURE_CUBE_MAP_POSITIVE_X: case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: @@ -110,11 +110,11 @@ static void GetTexImageOES(GLenum target, GLint level, GLenum format, GLenum typ case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - texture_binding = GL_TEXTURE_BINDING_CUBE_MAP; + texture_binding = cur_state.texture_cube_unit.texture_cube; break; - case GL_TEXTURE_3D_OES: - texture_binding = GL_TEXTURE_BINDING_3D_OES; default: + LOG_CRITICAL(Render_OpenGL, "Unexpected target {:x}", target); + UNIMPLEMENTED(); return; } @@ -901,8 +901,17 @@ void CachedSurface::UploadGLTexture(Common::Rectangle rect, GLuint read_fb_ MICROPROFILE_DEFINE(OpenGL_TextureDL, "OpenGL", "Texture Download", MP_RGB(128, 192, 64)); void CachedSurface::DownloadGLTexture(const Common::Rectangle& rect, GLuint read_fb_handle, GLuint draw_fb_handle) { - if (type == SurfaceType::Fill) + if (type == SurfaceType::Fill) { return; + } + + if (GLES) { + if (type == SurfaceType::Depth || type == SurfaceType::DepthStencil) { + // TODO(bunnei): This is unsupported on GLES right now, fixme + LOG_WARNING(Render_OpenGL, "Unsupported depth/stencil surface download"); + return; + } + } MICROPROFILE_SCOPE(OpenGL_TextureDL);