mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-05 14:31:24 +12:00
rsx: Do not use VTC tiling on NPOT textures
- Seems to be ignored for 'normal' textures. Mostly verified through games.
This commit is contained in:
parent
8af694da2e
commit
0ec526c5f1
2 changed files with 15 additions and 2 deletions
|
@ -689,7 +689,10 @@ namespace rsx
|
||||||
|
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
|
case CELL_GCM_TEXTURE_COMPRESSED_DXT1:
|
||||||
{
|
{
|
||||||
if (depth > 1 && !caps.supports_vtc_decoding)
|
if (depth > 1 &&
|
||||||
|
utils::is_power_of_2(src_layout.width_in_texel) &&
|
||||||
|
utils::is_power_of_2(src_layout.height_in_texel) &&
|
||||||
|
!caps.supports_vtc_decoding)
|
||||||
{
|
{
|
||||||
// PS3 uses the Nvidia VTC memory layout for compressed 3D textures.
|
// PS3 uses the Nvidia VTC memory layout for compressed 3D textures.
|
||||||
// This is only supported using Nvidia OpenGL.
|
// This is only supported using Nvidia OpenGL.
|
||||||
|
@ -711,7 +714,10 @@ namespace rsx
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
|
case CELL_GCM_TEXTURE_COMPRESSED_DXT23:
|
||||||
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
|
case CELL_GCM_TEXTURE_COMPRESSED_DXT45:
|
||||||
{
|
{
|
||||||
if (depth > 1 && !caps.supports_vtc_decoding)
|
if (depth > 1 &&
|
||||||
|
utils::is_power_of_2(src_layout.width_in_texel) &&
|
||||||
|
utils::is_power_of_2(src_layout.height_in_texel) &&
|
||||||
|
!caps.supports_vtc_decoding)
|
||||||
{
|
{
|
||||||
// PS3 uses the Nvidia VTC memory layout for compressed 3D textures.
|
// PS3 uses the Nvidia VTC memory layout for compressed 3D textures.
|
||||||
// This is only supported using Nvidia OpenGL.
|
// This is only supported using Nvidia OpenGL.
|
||||||
|
|
|
@ -385,6 +385,13 @@ namespace utils
|
||||||
return static_cast<T>(value / align + (value > 0 ? T{(value % align) > (align / 2)} : 0 - T{(value % align) < (align / 2)}));
|
return static_cast<T>(value / align + (value > 0 ? T{(value % align) > (align / 2)} : 0 - T{(value % align) < (align / 2)}));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Returns true if input is an unsigned integer with a power of 2
|
||||||
|
template <typename T> requires(std::is_integral_v<T> && std::is_unsigned_v<T>)
|
||||||
|
constexpr T is_power_of_2(T value)
|
||||||
|
{
|
||||||
|
return !(value & (value - 1));
|
||||||
|
}
|
||||||
|
|
||||||
// Hack. Pointer cast util to workaround UB. Use with extreme care.
|
// Hack. Pointer cast util to workaround UB. Use with extreme care.
|
||||||
template <typename T, typename U>
|
template <typename T, typename U>
|
||||||
[[nodiscard]] T* bless(U* ptr)
|
[[nodiscard]] T* bless(U* ptr)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue