Merge remote-tracking branch 'upstream/master' into merge-upstream

# Conflicts:
#	CMakeLists.txt
#	CMakeSettings.json
#	Data/Sys/GameSettings/GLR.ini
#	Data/Sys/GameSettings/HA9.ini
#	Data/Sys/GameSettings/MB3.ini
#	Data/Sys/GameSettings/MBA.ini
#	Data/Sys/GameSettings/MCV.ini
#	Data/Sys/GameSettings/MCY.ini
#	Data/Sys/GameSettings/NAK.ini
#	Data/Sys/GameSettings/NAL.ini
#	Data/Sys/GameSettings/NAT.ini
#	Data/Sys/GameSettings/R8P.ini
#	Data/Sys/GameSettings/R9I.ini
#	Data/Sys/GameSettings/REF.ini
#	Data/Sys/GameSettings/RES.ini
#	Data/Sys/GameSettings/RMHE08.ini
#	Data/Sys/GameSettings/RMHP08.ini
#	Data/Sys/GameSettings/SE2.ini
#	Data/Sys/GameSettings/WW2.ini
#	Data/Sys/GameSettings/WW3.ini
#	Data/Sys/GameSettings/WWI.ini
#	Externals/Bochs_disasm/Bochs_disasm.vcxproj
#	Externals/FreeSurround/FreeSurround.vcxproj
#	Externals/LZO/LZO.vcxproj
#	Externals/SFML/build/vc2010/SFML_Network.vcxproj
#	Externals/bzip2/bzip2.vcxproj
#	Externals/cpp-optparse/cpp-optparse.vcxproj
#	Externals/cubeb/msvc/cubeb.vcxproj
#	Externals/curl/curl.vcxproj
#	Externals/curl/lib/CMakeLists.txt
#	Externals/discord-rpc/src/discord-rpc.vcxproj
#	Externals/ed25519/ed25519.vcxproj
#	Externals/enet/enet.vcxproj
#	Externals/glslang/glslang.vcxproj
#	Externals/imgui/imgui.vcxproj
#	Externals/liblzma/liblzma.vcxproj
#	Externals/libpng/png/png.vcxproj
#	Externals/libusb/libusb_static_2013.vcxproj
#	Externals/mbedtls/mbedTLS.vcxproj
#	Externals/miniupnpc/miniupnpc.vcxproj
#	Externals/minizip/minizip.vcxproj
#	Externals/picojson/picojson.vcxproj
#	Externals/pugixml/pugixml.vcxproj
#	Externals/soundtouch/SoundTouch.vcxproj
#	Externals/xxhash/xxhash.vcxproj
#	Externals/zlib/zlib.vcxproj
#	Externals/zstd/zstd.vcxproj
#	Languages/Languages.vcxproj
#	Source/Android/jni/MainAndroid.cpp
#	Source/Core/AudioCommon/AudioCommon.vcxproj
#	Source/Core/Common/Common.vcxproj
#	Source/Core/Common/Common.vcxproj.filters
#	Source/Core/Common/Logging/Log.h
#	Source/Core/Common/StringUtil.cpp
#	Source/Core/Core/CMakeLists.txt
#	Source/Core/Core/ConfigManager.cpp
#	Source/Core/Core/ConfigManager.h
#	Source/Core/Core/Core.vcxproj
#	Source/Core/Core/Core.vcxproj.filters
#	Source/Core/Core/HotkeyManager.cpp
#	Source/Core/Core/State.cpp
#	Source/Core/DiscIO/DiscIO.vcxproj
#	Source/Core/DolphinNoGUI/DolphinNoGUI.vcxproj
#	Source/Core/DolphinQt/Config/Graphics/GeneralWidget.cpp
#	Source/Core/DolphinQt/DolphinQt.vcxproj
#	Source/Core/InputCommon/InputCommon.vcxproj
#	Source/Core/InputCommon/InputCommon.vcxproj.filters
#	Source/Core/UICommon/UICommon.vcxproj
#	Source/Core/UpdaterCommon/UpdaterCommon.vcxproj
#	Source/Core/VideoBackends/D3D/D3D.vcxproj
#	Source/Core/VideoBackends/D3D12/D3D12.vcxproj
#	Source/Core/VideoBackends/D3DCommon/D3DCommon.vcxproj
#	Source/Core/VideoBackends/Null/Null.vcxproj
#	Source/Core/VideoBackends/OGL/OGL.vcxproj
#	Source/Core/VideoBackends/Software/Software.vcxproj
#	Source/Core/VideoBackends/Vulkan/Vulkan.vcxproj
#	Source/Core/VideoCommon/OnScreenDisplay.cpp
#	Source/Core/VideoCommon/OnScreenDisplay.h
#	Source/Core/VideoCommon/VideoCommon.vcxproj
#	Source/Core/WinUpdater/WinUpdater.vcxproj
#	Source/DSPTool/DSPTool.vcxproj
#	Source/PCH/pch.vcxproj
#	Source/UnitTests/UnitTests.vcxproj
This commit is contained in:
JosJuice 2020-12-01 22:54:36 +01:00
commit 24a62eec41
970 changed files with 99364 additions and 88078 deletions

View file

@ -114,7 +114,7 @@ bool TextureCacheBase::Initialize()
{
if (!CreateUtilityTextures())
{
PanicAlert("Failed to create utility textures.");
PanicAlertFmt("Failed to create utility textures.");
return false;
}
@ -137,6 +137,17 @@ void TextureCacheBase::Invalidate()
texture_pool.clear();
}
void TextureCacheBase::ForceReload()
{
Invalidate();
// Clear all current hires textures, they are invalid
HiresTexture::Clear();
// Load fresh
HiresTexture::Update();
}
void TextureCacheBase::OnConfigChanged(const VideoConfig& config)
{
if (config.bHiresTextures != backup_config.hires_textures ||
@ -257,8 +268,8 @@ TextureCacheBase::ApplyPaletteToEntry(TCacheEntry* entry, u8* palette, TLUTForma
const AbstractPipeline* pipeline = g_shader_cache->GetPaletteConversionPipeline(tlutfmt);
if (!pipeline)
{
ERROR_LOG(VIDEO, "Failed to get conversion pipeline for format 0x%02X",
static_cast<u32>(tlutfmt));
ERROR_LOG_FMT(VIDEO, "Failed to get conversion pipeline for format {:#04X}",
static_cast<u32>(tlutfmt));
return nullptr;
}
@ -310,7 +321,7 @@ TextureCacheBase::ApplyPaletteToEntry(TCacheEntry* entry, u8* palette, TLUTForma
}
else
{
ERROR_LOG(VIDEO, "Texel buffer upload of %u bytes failed", palette_size);
ERROR_LOG_FMT(VIDEO, "Texel buffer upload of {} bytes failed", palette_size);
g_renderer->EndUtilityDrawing();
}
@ -326,9 +337,9 @@ TextureCacheBase::TCacheEntry* TextureCacheBase::ReinterpretEntry(const TCacheEn
g_shader_cache->GetTextureReinterpretPipeline(existing_entry->format.texfmt, new_format);
if (!pipeline)
{
ERROR_LOG(VIDEO,
"Failed to obtain texture reinterpreting pipeline from format 0x%02X to 0x%02X",
static_cast<u32>(existing_entry->format.texfmt), static_cast<u32>(new_format));
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));
return nullptr;
}
@ -377,7 +388,7 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(TextureCacheBase::TCacheEntry* e
const u32 max = g_ActiveConfig.backend_info.MaxTextureSize;
if (max < new_width || max < new_height)
{
ERROR_LOG(VIDEO, "Texture too big, width = %d, height = %d", new_width, new_height);
ERROR_LOG_FMT(VIDEO, "Texture too big, width = {}, height = {}", new_width, new_height);
return;
}
@ -386,7 +397,7 @@ void TextureCacheBase::ScaleTextureCacheEntryTo(TextureCacheBase::TCacheEntry* e
std::optional<TexPoolEntry> new_texture = AllocateTexture(newconfig);
if (!new_texture)
{
ERROR_LOG(VIDEO, "Scaling failed due to texture allocation failure");
ERROR_LOG_FMT(VIDEO, "Scaling failed due to texture allocation failure");
return;
}
@ -454,7 +465,7 @@ void TextureCacheBase::SerializeTexture(AbstractTexture* tex, const TextureConfi
}
else
{
PanicAlert("Failed to create staging texture for serialization");
PanicAlertFmt("Failed to create staging texture for serialization");
}
p.Do(texture_data);
@ -474,7 +485,7 @@ std::optional<TextureCacheBase::TexPoolEntry> TextureCacheBase::DeserializeTextu
auto tex = AllocateTexture(config);
if (!tex)
{
PanicAlert("Failed to create texture for deserialization");
PanicAlertFmt("Failed to create texture for deserialization");
return std::nullopt;
}
@ -483,13 +494,13 @@ std::optional<TextureCacheBase::TexPoolEntry> TextureCacheBase::DeserializeTextu
{
for (u32 level = 0; level < config.levels; level++)
{
u32 level_width = std::max(config.width >> level, 1u);
u32 level_height = std::max(config.height >> level, 1u);
size_t stride = AbstractTexture::CalculateStrideForFormat(config.format, level_width);
size_t size = stride * level_height;
const u32 level_width = std::max(config.width >> level, 1u);
const u32 level_height = std::max(config.height >> level, 1u);
const size_t stride = AbstractTexture::CalculateStrideForFormat(config.format, level_width);
const size_t size = stride * level_height;
if ((start + size) > texture_data.size())
{
ERROR_LOG(VIDEO, "Insufficient texture data for layer %u level %u", layer, level);
ERROR_LOG_FMT(VIDEO, "Insufficient texture data for layer {} level {}", layer, level);
return tex;
}
@ -920,8 +931,15 @@ void TextureCacheBase::DumpTexture(TCacheEntry* entry, std::string basename, uns
if (level > 0)
{
if (!g_ActiveConfig.bDumpMipmapTextures)
return;
basename += fmt::format("_mip{}", level);
}
else
{
if (!g_ActiveConfig.bDumpBaseTextures)
return;
}
const std::string filename = fmt::format("{}/{}.png", szDir, basename);
if (File::Exists(filename))
@ -1255,7 +1273,7 @@ TextureCacheBase::GetTexture(u32 address, u32 width, u32 height, const TextureFo
if (!src_data)
{
ERROR_LOG(VIDEO, "Trying to use an invalid texture address 0x%8x", address);
ERROR_LOG_FMT(VIDEO, "Trying to use an invalid texture address {:#010x}", address);
return nullptr;
}
@ -1700,7 +1718,7 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
const u8* src_data = Memory::GetPointer(address);
if (!src_data)
{
ERROR_LOG(VIDEO, "Trying to load XFB texture from invalid address 0x%8x", address);
ERROR_LOG_FMT(VIDEO, "Trying to load XFB texture from invalid address {:#010x}", address);
return nullptr;
}
@ -2069,7 +2087,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
u8* dst = Memory::GetPointer(dstAddr);
if (dst == nullptr)
{
ERROR_LOG(VIDEO, "Trying to copy from EFB to invalid address 0x%8x", dstAddr);
ERROR_LOG_FMT(VIDEO, "Trying to copy from EFB to invalid address {:#010x}", dstAddr);
return;
}
@ -2127,7 +2145,7 @@ void TextureCacheBase::CopyRenderTargetToTexture(
// To avoid a "incorrect" result, we simply skip doing the copy_to_vram code path
// so if the game does try to use the scrambled texture, dolphin will grab the scrambled
// texture (or black if copy_to_ram is also disabled) out of ram.
ERROR_LOG(VIDEO, "Memory stride too small (%i < %i)", dstStride, bytes_per_row);
ERROR_LOG_FMT(VIDEO, "Memory stride too small ({} < {})", dstStride, bytes_per_row);
copy_to_vram = false;
}
@ -2390,7 +2408,7 @@ std::unique_ptr<AbstractStagingTexture> TextureCacheBase::GetEFBCopyStagingTextu
std::unique_ptr<AbstractStagingTexture> tex = g_renderer->CreateStagingTexture(
StagingTextureType::Readback, m_efb_encoding_texture->GetConfig());
if (!tex)
WARN_LOG(VIDEO, "Failed to create EFB copy staging texture");
WARN_LOG_FMT(VIDEO, "Failed to create EFB copy staging texture");
return tex;
}
@ -2460,8 +2478,8 @@ TextureCacheBase::AllocateTexture(const TextureConfig& config)
std::unique_ptr<AbstractTexture> texture = g_renderer->CreateTexture(config);
if (!texture)
{
WARN_LOG(VIDEO, "Failed to allocate a %ux%ux%u texture", config.width, config.height,
config.layers);
WARN_LOG_FMT(VIDEO, "Failed to allocate a {}x{}x{} texture", config.width, config.height,
config.layers);
return {};
}
@ -2471,8 +2489,8 @@ TextureCacheBase::AllocateTexture(const TextureConfig& config)
framebuffer = g_renderer->CreateFramebuffer(texture.get(), nullptr);
if (!framebuffer)
{
WARN_LOG(VIDEO, "Failed to allocate a %ux%ux%u framebuffer", config.width, config.height,
config.layers);
WARN_LOG_FMT(VIDEO, "Failed to allocate a {}x{}x{} framebuffer", config.width, config.height,
config.layers);
return {};
}
}
@ -2633,7 +2651,7 @@ void TextureCacheBase::CopyEFBToCacheEntry(TCacheEntry* entry, bool is_depth_cop
NeedsCopyFilterInShader(filter_coefficients)));
if (!copy_pipeline)
{
WARN_LOG(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
WARN_LOG_FMT(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
return;
}
@ -2701,7 +2719,7 @@ void TextureCacheBase::CopyEFB(AbstractStagingTexture* dst, const EFBCopyParams&
const AbstractPipeline* copy_pipeline = g_shader_cache->GetEFBCopyToRAMPipeline(params);
if (!copy_pipeline)
{
WARN_LOG(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
WARN_LOG_FMT(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
return;
}