video_core: move buffer resize before GLES check

preventing the assert in FlushGLBuffer
This commit is contained in:
BreadFish64 2020-03-18 22:31:52 -05:00 committed by bunnei
parent 4f4213c530
commit 214f104fda

View File

@ -886,6 +886,12 @@ void CachedSurface::DownloadGLTexture(const Common::Rectangle<u32>& rect, GLuint
return;
}
MICROPROFILE_SCOPE(OpenGL_TextureDL);
if (gl_buffer.empty()) {
gl_buffer.resize(width * height * GetGLBytesPerPixel(pixel_format));
}
if (GLES) {
if (type == SurfaceType::Depth || type == SurfaceType::DepthStencil) {
// TODO(bunnei): This is unsupported on GLES right now, fixme
@ -894,12 +900,6 @@ void CachedSurface::DownloadGLTexture(const Common::Rectangle<u32>& rect, GLuint
}
}
MICROPROFILE_SCOPE(OpenGL_TextureDL);
if (gl_buffer.empty()) {
gl_buffer.resize(width * height * GetGLBytesPerPixel(pixel_format));
}
OpenGLState state = OpenGLState::GetCurState();
OpenGLState prev_state = state;
SCOPE_EXIT({ prev_state.Apply(); });
@ -1925,7 +1925,6 @@ Surface RasterizerCacheOpenGL::CreateSurface(const SurfaceParams& params) {
surface->texture.Create();
surface->gl_buffer.resize(0);
surface->invalid_regions.insert(surface->GetInterval());
AllocateSurfaceTexture(surface->texture.handle, GetFormatTuple(surface->pixel_format),
surface->GetScaledWidth(), surface->GetScaledHeight());