mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-01-15 11:25:13 +00:00
hotfix: Constrain view layers to actual layers.
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
Some checks are pending
Build and Release / reuse (push) Waiting to run
Build and Release / clang-format (push) Waiting to run
Build and Release / get-info (push) Waiting to run
Build and Release / windows-sdl (push) Blocked by required conditions
Build and Release / windows-qt (push) Blocked by required conditions
Build and Release / macos-sdl (push) Blocked by required conditions
Build and Release / macos-qt (push) Blocked by required conditions
Build and Release / linux-sdl (push) Blocked by required conditions
Build and Release / linux-qt (push) Blocked by required conditions
Build and Release / linux-sdl-gcc (push) Blocked by required conditions
Build and Release / linux-qt-gcc (push) Blocked by required conditions
Build and Release / pre-release (push) Blocked by required conditions
This commit is contained in:
parent
6ec68f66a9
commit
5c845d4ecc
|
@ -227,11 +227,13 @@ struct Image {
|
||||||
}
|
}
|
||||||
|
|
||||||
[[nodiscard]] u32 NumLayers() const noexcept {
|
[[nodiscard]] u32 NumLayers() const noexcept {
|
||||||
|
// Depth is the number of layers for Array images.
|
||||||
u32 slices = depth + 1;
|
u32 slices = depth + 1;
|
||||||
const auto img_type = static_cast<ImageType>(type);
|
if (GetType() == ImageType::Color3D) {
|
||||||
if (img_type == ImageType::Color3D) {
|
// Depth is the actual texture depth for 3D images.
|
||||||
slices = 1;
|
slices = 1;
|
||||||
} else if (img_type == ImageType::Cube) {
|
} else if (IsCube()) {
|
||||||
|
// Depth is the number of full cubes for Cube images.
|
||||||
slices *= 6;
|
slices *= 6;
|
||||||
}
|
}
|
||||||
if (pow2pad) {
|
if (pow2pad) {
|
||||||
|
@ -315,7 +317,9 @@ struct Image {
|
||||||
case ImageType::Color2DMsaaArray:
|
case ImageType::Color2DMsaaArray:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return last_level - base_level + 1;
|
// Constrain to actual number of available levels.
|
||||||
|
const auto max_level = std::min<u32>(last_level + 1, NumLevels());
|
||||||
|
return max_level > base_level ? max_level - base_level : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -327,7 +331,9 @@ struct Image {
|
||||||
case ImageType::Color3D:
|
case ImageType::Color3D:
|
||||||
return 1;
|
return 1;
|
||||||
default:
|
default:
|
||||||
return last_array - base_array + 1;
|
// Constrain to actual number of available layers.
|
||||||
|
const auto max_array = std::min<u32>(last_array + 1, NumLayers());
|
||||||
|
return max_array > base_array ? max_array - base_array : 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue