texture_cache: Handle 3D texture blits with one layer

This commit is contained in:
ReinUsesLisp 2020-06-01 04:49:35 -03:00
parent c95c254f3e
commit 3c2ae53b4c
3 changed files with 10 additions and 5 deletions

View file

@ -557,8 +557,8 @@ void TextureCacheOpenGL::ImageBlit(View& src_view, View& dst_view,
const Tegra::Engines::Fermi2D::Config& copy_config) { const Tegra::Engines::Fermi2D::Config& copy_config) {
const auto& src_params{src_view->GetSurfaceParams()}; const auto& src_params{src_view->GetSurfaceParams()};
const auto& dst_params{dst_view->GetSurfaceParams()}; const auto& dst_params{dst_view->GetSurfaceParams()};
UNIMPLEMENTED_IF(src_params.target == SurfaceTarget::Texture3D); UNIMPLEMENTED_IF(src_params.depth != 1);
UNIMPLEMENTED_IF(dst_params.target == SurfaceTarget::Texture3D); UNIMPLEMENTED_IF(dst_params.depth != 1);
state_tracker.NotifyScissor0(); state_tracker.NotifyScissor0();
state_tracker.NotifyFramebuffer(); state_tracker.NotifyFramebuffer();

View file

@ -246,8 +246,8 @@ SurfaceParams SurfaceParams::CreateForFermiCopySurface(
params.width = config.width; params.width = config.width;
params.height = config.height; params.height = config.height;
params.pitch = config.pitch; params.pitch = config.pitch;
// TODO(Rodrigo): Try to guess the surface target from depth and layer parameters // TODO(Rodrigo): Try to guess texture arrays from parameters
params.target = SurfaceTarget::Texture2D; params.target = params.block_depth > 0 ? SurfaceTarget::Texture3D : SurfaceTarget::Texture2D;
params.depth = 1; params.depth = 1;
params.num_levels = 1; params.num_levels = 1;
params.emulated_levels = 1; params.emulated_levels = 1;

View file

@ -755,6 +755,8 @@ private:
} }
TSurface new_surface = GetUncachedSurface(gpu_addr, params); TSurface new_surface = GetUncachedSurface(gpu_addr, params);
LoadSurface(new_surface);
bool modified = false; bool modified = false;
for (auto& surface : overlaps) { for (auto& surface : overlaps) {
const SurfaceParams& src_params = surface->GetSurfaceParams(); const SurfaceParams& src_params = surface->GetSurfaceParams();
@ -763,7 +765,10 @@ private:
src_params.block_height != params.block_height) { src_params.block_height != params.block_height) {
return std::nullopt; return std::nullopt;
} }
modified |= surface->IsModified(); if (!surface->IsModified()) {
continue;
}
modified = true;
const u32 offset = static_cast<u32>(surface->GetCpuAddr() - cpu_addr); const u32 offset = static_cast<u32>(surface->GetCpuAddr() - cpu_addr);
const u32 slice = std::get<2>(params.GetBlockOffsetXYZ(offset)); const u32 slice = std::get<2>(params.GetBlockOffsetXYZ(offset));