android: renderer_opengl: Optimize GetTexImageOES and fix bugs.

This commit is contained in:
bunnei 2019-09-07 02:43:20 -04:00 committed by SachinVin
parent 855d19a468
commit 853acce6c5

View File

@ -102,7 +102,7 @@ static void GetTexImageOES(GLenum target, GLint level, GLenum format, GLenum typ
GLenum texture_binding = GL_NONE; GLenum texture_binding = GL_NONE;
switch (target) { switch (target) {
case GL_TEXTURE_2D: case GL_TEXTURE_2D:
texture_binding = GL_TEXTURE_BINDING_2D; texture_binding = cur_state.texture_units[0].texture_2d;
break; break;
case GL_TEXTURE_CUBE_MAP_POSITIVE_X: case GL_TEXTURE_CUBE_MAP_POSITIVE_X:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_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_NEGATIVE_Y:
case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: case GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case GL_TEXTURE_CUBE_MAP_NEGATIVE_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; break;
case GL_TEXTURE_3D_OES:
texture_binding = GL_TEXTURE_BINDING_3D_OES;
default: default:
LOG_CRITICAL(Render_OpenGL, "Unexpected target {:x}", target);
UNIMPLEMENTED();
return; return;
} }
@ -901,8 +901,17 @@ void CachedSurface::UploadGLTexture(Common::Rectangle<u32> rect, GLuint read_fb_
MICROPROFILE_DEFINE(OpenGL_TextureDL, "OpenGL", "Texture Download", MP_RGB(128, 192, 64)); MICROPROFILE_DEFINE(OpenGL_TextureDL, "OpenGL", "Texture Download", MP_RGB(128, 192, 64));
void CachedSurface::DownloadGLTexture(const Common::Rectangle<u32>& rect, GLuint read_fb_handle, void CachedSurface::DownloadGLTexture(const Common::Rectangle<u32>& rect, GLuint read_fb_handle,
GLuint draw_fb_handle) { GLuint draw_fb_handle) {
if (type == SurfaceType::Fill) if (type == SurfaceType::Fill) {
return; 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); MICROPROFILE_SCOPE(OpenGL_TextureDL);