mirror of
https://github.com/citra-emu/citra.git
synced 2024-11-15 07:10:05 +00:00
handle all cases more robustly
This commit is contained in:
parent
d04071d6b3
commit
b80c6f7534
@ -777,16 +777,27 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
OGLTexture temp_tex;
|
OGLTexture temp_tex;
|
||||||
if (need_texture_barrier && GLES) {
|
if (need_texture_barrier) {
|
||||||
temp_tex.Create();
|
temp_tex.Create();
|
||||||
AllocateSurfaceTexture(temp_tex.handle, GetFormatTuple(color_surface->pixel_format),
|
AllocateSurfaceTexture(temp_tex.handle, GetFormatTuple(color_surface->pixel_format),
|
||||||
color_surface->GetScaledWidth(), color_surface->GetScaledHeight());
|
color_surface->GetScaledWidth(), color_surface->GetScaledHeight());
|
||||||
glCopyImageSubData(color_surface->texture.handle, GL_TEXTURE_2D, 0, 0, 0, 0,
|
for (std::size_t mip{0}; mip <= color_surface->max_level; ++mip) {
|
||||||
temp_tex.handle, GL_TEXTURE_2D, 0, 0, 0, 0, color_surface->GetScaledWidth(),
|
glCopyImageSubData(color_surface->texture.handle, GL_TEXTURE_2D, mip, 0, 0, 0,
|
||||||
color_surface->GetScaledHeight(), 1);
|
temp_tex.handle, GL_TEXTURE_2D, mip, 0, 0, 0,
|
||||||
|
color_surface->GetScaledWidth() >> mip,
|
||||||
|
color_surface->GetScaledHeight() >> mip, 1);
|
||||||
|
}
|
||||||
for (auto& unit : state.texture_units) {
|
for (auto& unit : state.texture_units) {
|
||||||
if (unit.texture_2d == color_surface->texture.handle)
|
if (unit.texture_2d == color_surface->texture.handle) {
|
||||||
unit.texture_2d = temp_tex.handle;
|
unit.texture_2d = temp_tex.handle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for (auto shadow_unit : {&state.image_shadow_texture_nx, &state.image_shadow_texture_ny,
|
||||||
|
&state.image_shadow_texture_nz, &state.image_shadow_texture_px,
|
||||||
|
&state.image_shadow_texture_py, &state.image_shadow_texture_pz}) {
|
||||||
|
if (*shadow_unit == color_surface->texture.handle) {
|
||||||
|
*shadow_unit = temp_tex.handle;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,10 +875,6 @@ bool RasterizerOpenGL::Draw(bool accelerate, bool is_indexed) {
|
|||||||
GL_TEXTURE_UPDATE_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
|
GL_TEXTURE_UPDATE_BARRIER_BIT | GL_FRAMEBUFFER_BARRIER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (need_texture_barrier && GLAD_GL_ARB_texture_barrier) {
|
|
||||||
glTextureBarrier();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Mark framebuffer surfaces as dirty
|
// Mark framebuffer surfaces as dirty
|
||||||
Common::Rectangle<u32> draw_rect_unscaled{draw_rect.left / res_scale, draw_rect.top / res_scale,
|
Common::Rectangle<u32> draw_rect_unscaled{draw_rect.left / res_scale, draw_rect.top / res_scale,
|
||||||
draw_rect.right / res_scale,
|
draw_rect.right / res_scale,
|
||||||
|
Loading…
Reference in New Issue
Block a user