Remove casts to integers for texture and EFB formats

The only remaining casts for these types that I know of are in TextureInfo (where format_name is set to the int version of the format, and since that affects filenames and probably would break resource packs, I'm not changing it) and in TextureDecoder_Common's TexDecoder_DrawOverlay, which will be handled separately.
This commit is contained in:
Pokechu22 2022-02-22 18:01:39 -08:00
parent 1da24f66fe
commit 290e62f179
6 changed files with 17 additions and 31 deletions

View File

@ -550,7 +550,7 @@ std::string GenerateTextureReinterpretShader(TextureFormat from_format, TextureF
break;
default:
WARN_LOG_FMT(VIDEO, "From format {} is not supported", static_cast<u32>(from_format));
WARN_LOG_FMT(VIDEO, "From format {} is not supported", from_format);
return "{}\n";
}
@ -602,7 +602,7 @@ std::string GenerateTextureReinterpretShader(TextureFormat from_format, TextureF
}
break;
default:
WARN_LOG_FMT(VIDEO, "To format {} is not supported", static_cast<u32>(to_format));
WARN_LOG_FMT(VIDEO, "To format {} is not supported", to_format);
return "{}\n";
}

View File

@ -276,8 +276,7 @@ TextureCacheBase::ApplyPaletteToEntry(TCacheEntry* entry, const u8* palette, TLU
const AbstractPipeline* pipeline = g_shader_cache->GetPaletteConversionPipeline(tlutfmt);
if (!pipeline)
{
ERROR_LOG_FMT(VIDEO, "Failed to get conversion pipeline for format {:#04X}",
static_cast<u32>(tlutfmt));
ERROR_LOG_FMT(VIDEO, "Failed to get conversion pipeline for format {}", tlutfmt);
return nullptr;
}
@ -345,9 +344,8 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::ReinterpretEntry(const TCacheEn
g_shader_cache->GetTextureReinterpretPipeline(existing_entry->format.texfmt, new_format);
if (!pipeline)
{
ERROR_LOG_FMT(VIDEO,
"Failed to obtain texture reinterpreting pipeline from format {:#04X} to {:#04X}",
static_cast<u32>(existing_entry->format.texfmt), static_cast<u32>(new_format));
ERROR_LOG_FMT(VIDEO, "Failed to obtain texture reinterpreting pipeline from format {} to {}",
existing_entry->format.texfmt, new_format);
return nullptr;
}

View File

@ -48,8 +48,7 @@ u16 GetEncodedSampleCount(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return 2;
default:
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEncodedSampleCount)",
static_cast<int>(format));
PanicAlertFmt("Invalid EFB Copy Format {}! (GetEncodedSampleCount)", format);
return 1;
}
}
@ -802,8 +801,7 @@ std::string GenerateEncodingShader(const EFBCopyParams& params, APIType api_type
WriteXFBEncoder(code, api_type, params);
break;
default:
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GenerateEncodingShader)",
static_cast<int>(params.copy_format));
PanicAlertFmt("Invalid EFB Copy Format {}! (GenerateEncodingShader)", params.copy_format);
break;
}

View File

@ -173,8 +173,7 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
break;
default:
ERROR_LOG_FMT(VIDEO, "Unknown copy zbuf format: {:#X}",
static_cast<int>(uid_data->dst_format));
ERROR_LOG_FMT(VIDEO, "Unknown copy zbuf format: {}", uid_data->dst_format);
out.Write(" ocol0 = float4(texcol.bgr, 0.0);\n");
break;
}
@ -207,8 +206,7 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
break;
default:
ERROR_LOG_FMT(VIDEO, "Unknown copy intensity format: {:#X}",
static_cast<int>(uid_data->dst_format));
ERROR_LOG_FMT(VIDEO, "Unknown copy intensity format: {}", uid_data->dst_format);
out.Write(" ocol0 = texcol;\n");
break;
}
@ -283,8 +281,7 @@ ShaderCode GeneratePixelShader(APIType api_type, const UidData* uid_data)
break;
default:
ERROR_LOG_FMT(VIDEO, "Unknown copy color format: {:#X}",
static_cast<int>(uid_data->dst_format));
ERROR_LOG_FMT(VIDEO, "Unknown copy color format: {}", uid_data->dst_format);
out.Write(" ocol0 = texcol;\n");
break;
}

View File

@ -50,8 +50,7 @@ int TexDecoder_GetTexelSizeInNibbles(TextureFormat format)
case TextureFormat::XFB:
return 4;
default:
PanicAlertFmt("Invalid Texture Format ({:#X})! (GetTexelSizeInNibbles)",
static_cast<int>(format));
PanicAlertFmt("Invalid Texture Format {}! (GetTexelSizeInNibbles)", format);
return 1;
}
}
@ -90,8 +89,7 @@ int TexDecoder_GetBlockWidthInTexels(TextureFormat format)
case TextureFormat::XFB:
return 16;
default:
PanicAlertFmt("Invalid Texture Format ({:#X})! (GetBlockWidthInTexels)",
static_cast<int>(format));
PanicAlertFmt("Invalid Texture Format {}! (GetBlockWidthInTexels)", format);
return 8;
}
}
@ -125,8 +123,7 @@ int TexDecoder_GetBlockHeightInTexels(TextureFormat format)
case TextureFormat::XFB:
return 1;
default:
PanicAlertFmt("Invalid Texture Format ({:#X})! (GetBlockHeightInTexels)",
static_cast<int>(format));
PanicAlertFmt("Invalid Texture Format {}! (GetBlockHeightInTexels)", format);
return 4;
}
}
@ -160,8 +157,7 @@ int TexDecoder_GetEFBCopyBlockWidthInTexels(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return 16;
default:
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEFBCopyBlockWidthInTexels)",
static_cast<int>(format));
PanicAlertFmt("Invalid EFB Copy Format {}! (GetEFBCopyBlockWidthInTexels)", format);
return 8;
}
}
@ -195,8 +191,7 @@ int TexDecoder_GetEFBCopyBlockHeightInTexels(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return 1;
default:
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEFBCopyBlockHeightInTexels)",
static_cast<int>(format));
PanicAlertFmt("Invalid EFB Copy Format {}! (GetEFBCopyBlockHeightInTexels)", format);
return 4;
}
}
@ -247,8 +242,7 @@ TextureFormat TexDecoder_GetEFBCopyBaseFormat(EFBCopyFormat format)
case EFBCopyFormat::XFB:
return TextureFormat::XFB;
default:
PanicAlertFmt("Invalid EFB Copy Format ({:#X})! (GetEFBCopyBaseFormat)",
static_cast<int>(format));
PanicAlertFmt("Invalid EFB Copy Format ()! (GetEFBCopyBaseFormat)", format);
return static_cast<TextureFormat>(format);
}
}

View File

@ -1495,8 +1495,7 @@ void _TexDecoder_DecodeImpl(u32* dst, const u8* src, int width, int height, Text
break;
default:
PanicAlertFmt("Invalid Texture Format ({:#X})! (_TexDecoder_DecodeImpl)",
static_cast<int>(texformat));
PanicAlertFmt("Invalid Texture Format {}! (_TexDecoder_DecodeImpl)", texformat);
break;
}
}