mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-22 23:02:47 +01:00
Merge pull request #3185 from ReinUsesLisp/oob-texture
texture_cache/surface_base: Fix out of bounds texture views
This commit is contained in:
commit
b2c7636710
1 changed files with 4 additions and 7 deletions
|
@ -254,16 +254,14 @@ public:
|
||||||
if (!layer_mipmap) {
|
if (!layer_mipmap) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const u32 end_layer{layer_mipmap->first};
|
const auto [end_layer, end_mipmap] = *layer_mipmap;
|
||||||
const u32 end_mipmap{layer_mipmap->second};
|
|
||||||
if (layer != end_layer) {
|
if (layer != end_layer) {
|
||||||
if (mipmap == 0 && end_mipmap == 0) {
|
if (mipmap == 0 && end_mipmap == 0) {
|
||||||
return GetView(ViewParams(view_params.target, layer, end_layer - layer + 1, 0, 1));
|
return GetView(ViewParams(view_params.target, layer, end_layer - layer, 0, 1));
|
||||||
}
|
}
|
||||||
return {};
|
return {};
|
||||||
} else {
|
} else {
|
||||||
return GetView(
|
return GetView(ViewParams(view_params.target, layer, 1, mipmap, end_mipmap - mipmap));
|
||||||
ViewParams(view_params.target, layer, 1, mipmap, end_mipmap - mipmap + 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,8 +276,7 @@ public:
|
||||||
if (!layer_mipmap) {
|
if (!layer_mipmap) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
const u32 layer{layer_mipmap->first};
|
const auto [layer, mipmap] = *layer_mipmap;
|
||||||
const u32 mipmap{layer_mipmap->second};
|
|
||||||
if (GetMipmapSize(mipmap) != candidate_size) {
|
if (GetMipmapSize(mipmap) != candidate_size) {
|
||||||
return EmplaceIrregularView(view_params, view_addr, candidate_size, mipmap, layer);
|
return EmplaceIrregularView(view_params, view_addr, candidate_size, mipmap, layer);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue