forked from ShuriZma/suyu
TextureCache: Fix case where layer goes off bound.
The returned layer is expected to be between 0 and the depth of the surface, anything larger is off bounds.
This commit is contained in:
parent
406d298457
commit
544b15e8e4
|
@ -120,6 +120,9 @@ std::optional<std::pair<u32, u32>> SurfaceBaseImpl::GetLayerMipmap(
|
||||||
}
|
}
|
||||||
const auto relative_address{static_cast<GPUVAddr>(candidate_gpu_addr - gpu_addr)};
|
const auto relative_address{static_cast<GPUVAddr>(candidate_gpu_addr - gpu_addr)};
|
||||||
const auto layer{static_cast<u32>(relative_address / layer_size)};
|
const auto layer{static_cast<u32>(relative_address / layer_size)};
|
||||||
|
if (layer >= params.depth) {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
const GPUVAddr mipmap_address = relative_address - layer_size * layer;
|
const GPUVAddr mipmap_address = relative_address - layer_size * layer;
|
||||||
const auto mipmap_it =
|
const auto mipmap_it =
|
||||||
Common::BinaryFind(mipmap_offsets.begin(), mipmap_offsets.end(), mipmap_address);
|
Common::BinaryFind(mipmap_offsets.begin(), mipmap_offsets.end(), mipmap_address);
|
||||||
|
|
Loading…
Reference in New Issue