Skip to content

Commit

Permalink
image: Add Depth_MicroTiled and Display_MicroTiled tiling modes.
Browse files Browse the repository at this point in the history
  • Loading branch information
squidbus committed Dec 28, 2024
1 parent ee97441 commit 4c1cb91
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/video_core/amdgpu/resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,9 @@ constexpr std::string_view NameOf(ImageType type) {

enum class TilingMode : u32 {
Depth_MacroTiled = 0u,
Depth_MicroTiled = 0x5u,
Display_Linear = 0x8u,
Display_MicroTiled = 0x9u,
Display_MacroTiled = 0xAu,
Texture_MicroTiled = 0xDu,
Texture_MacroTiled = 0xEu,
Expand All @@ -131,10 +133,14 @@ enum class TilingMode : u32 {

constexpr std::string_view NameOf(TilingMode type) {
switch (type) {
case TilingMode::Depth_MicroTiled:
return "Depth_MicroTiled";
case TilingMode::Depth_MacroTiled:
return "Depth_MacroTiled";
case TilingMode::Display_Linear:
return "Display_Linear";
case TilingMode::Display_MicroTiled:
return "Display_MicroTiled";
case TilingMode::Display_MacroTiled:
return "Display_MacroTiled";
case TilingMode::Texture_MicroTiled:
Expand Down Expand Up @@ -294,7 +300,7 @@ struct Image {

TilingMode GetTilingMode() const {
if (tiling_index >= 0 && tiling_index <= 7) {
return tiling_index == 5 ? TilingMode::Texture_MicroTiled
return tiling_index == 5 ? TilingMode::Depth_MicroTiled
: TilingMode::Depth_MacroTiled;
}
return static_cast<TilingMode>(tiling_index);
Expand Down
2 changes: 2 additions & 0 deletions src/video_core/texture_cache/image_info.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -369,6 +369,8 @@ void ImageInfo::UpdateSize() {
case AmdGpu::TilingMode::Texture_Volume:
mip_d += (-mip_d) & 3u;
[[fallthrough]];
case AmdGpu::TilingMode::Depth_MicroTiled:
case AmdGpu::TilingMode::Display_MicroTiled:
case AmdGpu::TilingMode::Texture_MicroTiled: {
std::tie(mip_info.pitch, mip_info.size) =
ImageSizeMicroTiled(mip_w, mip_h, bpp, num_samples);
Expand Down
2 changes: 2 additions & 0 deletions src/video_core/texture_cache/tile_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ const DetilerContext* TileManager::GetDetiler(const Image& image) const {
const auto format = DemoteImageFormatForDetiling(image.info.pixel_format);

switch (image.info.tiling_mode) {
case AmdGpu::TilingMode::Depth_MicroTiled:
case AmdGpu::TilingMode::Display_MicroTiled:
case AmdGpu::TilingMode::Texture_MicroTiled:
switch (format) {
case vk::Format::eR8Uint:
Expand Down

0 comments on commit 4c1cb91

Please sign in to comment.