mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-21 13:20:27 -06:00
AbstractTexture: Add support for depth textures/formats
This commit is contained in:
@ -64,6 +64,20 @@ bool AbstractTexture::IsCompressedFormat(AbstractTextureFormat format)
|
||||
}
|
||||
}
|
||||
|
||||
bool AbstractTexture::IsDepthFormat(AbstractTextureFormat format)
|
||||
{
|
||||
switch (format)
|
||||
{
|
||||
case AbstractTextureFormat::D16:
|
||||
case AbstractTextureFormat::D32F:
|
||||
case AbstractTextureFormat::D32F_S8:
|
||||
return true;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
size_t AbstractTexture::CalculateStrideForFormat(AbstractTextureFormat format, u32 row_length)
|
||||
{
|
||||
switch (format)
|
||||
@ -74,9 +88,16 @@ size_t AbstractTexture::CalculateStrideForFormat(AbstractTextureFormat format, u
|
||||
case AbstractTextureFormat::DXT5:
|
||||
case AbstractTextureFormat::BPTC:
|
||||
return static_cast<size_t>(std::max(1u, row_length / 4)) * 16;
|
||||
case AbstractTextureFormat::R16:
|
||||
case AbstractTextureFormat::D16:
|
||||
return static_cast<size_t>(row_length) * 2;
|
||||
case AbstractTextureFormat::RGBA8:
|
||||
case AbstractTextureFormat::BGRA8:
|
||||
case AbstractTextureFormat::R32F:
|
||||
case AbstractTextureFormat::D32F:
|
||||
return static_cast<size_t>(row_length) * 4;
|
||||
case AbstractTextureFormat::D32F_S8:
|
||||
return static_cast<size_t>(row_length) * 8;
|
||||
default:
|
||||
PanicAlert("Unhandled texture format.");
|
||||
return 0;
|
||||
@ -93,9 +114,16 @@ size_t AbstractTexture::GetTexelSizeForFormat(AbstractTextureFormat format)
|
||||
case AbstractTextureFormat::DXT5:
|
||||
case AbstractTextureFormat::BPTC:
|
||||
return 16;
|
||||
case AbstractTextureFormat::R16:
|
||||
case AbstractTextureFormat::D16:
|
||||
return 2;
|
||||
case AbstractTextureFormat::RGBA8:
|
||||
case AbstractTextureFormat::BGRA8:
|
||||
case AbstractTextureFormat::R32F:
|
||||
case AbstractTextureFormat::D32F:
|
||||
return 4;
|
||||
case AbstractTextureFormat::D32F_S8:
|
||||
return 8;
|
||||
default:
|
||||
PanicAlert("Unhandled texture format.");
|
||||
return 0;
|
||||
|
Reference in New Issue
Block a user