Implement Reinterpret Surface, to accurately blit 3D textures
This commit is contained in:
parent
dbc34db6ce
commit
cb9fdc7a26
|
@ -1123,8 +1123,8 @@ Surface RasterizerCacheOpenGL::GetSurface(const SurfaceParams& params, bool pres
|
||||||
} else if (preserve_contents) {
|
} else if (preserve_contents) {
|
||||||
// If surface parameters changed and we care about keeping the previous data, recreate
|
// If surface parameters changed and we care about keeping the previous data, recreate
|
||||||
// the surface from the old one
|
// the surface from the old one
|
||||||
Unregister(surface);
|
|
||||||
Surface new_surface{RecreateSurface(surface, params)};
|
Surface new_surface{RecreateSurface(surface, params)};
|
||||||
|
Unregister(surface);
|
||||||
Register(new_surface);
|
Register(new_surface);
|
||||||
return new_surface;
|
return new_surface;
|
||||||
} else {
|
} else {
|
||||||
|
@ -1214,7 +1214,6 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& old_surface,
|
||||||
const bool is_blit{old_params.pixel_format == new_params.pixel_format};
|
const bool is_blit{old_params.pixel_format == new_params.pixel_format};
|
||||||
|
|
||||||
switch (new_params.target) {
|
switch (new_params.target) {
|
||||||
case SurfaceParams::SurfaceTarget::Texture3D:
|
|
||||||
case SurfaceParams::SurfaceTarget::Texture2D:
|
case SurfaceParams::SurfaceTarget::Texture2D:
|
||||||
if (is_blit) {
|
if (is_blit) {
|
||||||
BlitSurface(old_surface, new_surface, read_framebuffer.handle, draw_framebuffer.handle);
|
BlitSurface(old_surface, new_surface, read_framebuffer.handle, draw_framebuffer.handle);
|
||||||
|
@ -1222,6 +1221,9 @@ Surface RasterizerCacheOpenGL::RecreateSurface(const Surface& old_surface,
|
||||||
CopySurface(old_surface, new_surface, copy_pbo.handle);
|
CopySurface(old_surface, new_surface, copy_pbo.handle);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SurfaceParams::SurfaceTarget::Texture3D:
|
||||||
|
AccurateCopySurface(old_surface, new_surface);
|
||||||
|
break;
|
||||||
case SurfaceParams::SurfaceTarget::TextureCubemap: {
|
case SurfaceParams::SurfaceTarget::TextureCubemap: {
|
||||||
if (old_params.rt.array_mode != 1) {
|
if (old_params.rt.array_mode != 1) {
|
||||||
// TODO(bunnei): This is used by Breath of the Wild, I'm not sure how to implement this
|
// TODO(bunnei): This is used by Breath of the Wild, I'm not sure how to implement this
|
||||||
|
|
Reference in New Issue