This commit is contained in:
R2DLiu 2021-11-26 19:48:26 -05:00
commit 9cf53410c7
3 changed files with 33 additions and 38 deletions

View file

@ -27,11 +27,6 @@ static std::mutex ack_mutex;
SlippiNetplayClient* SLIPPI_NETPLAY = nullptr;
static bool IsOnline()
{
return SLIPPI_NETPLAY != nullptr;
}
// called from ---GUI--- thread
SlippiNetplayClient::~SlippiNetplayClient()
{
@ -66,7 +61,7 @@ SlippiNetplayClient::SlippiNetplayClient(const std::string& address, const u16 r
: m_qos_handle(nullptr), m_qos_flow_id(0)
#endif
{
WARN_LOG_FMT(SLIPPI_ONLINE, "Initializing Slippi Netplay for port: %d, with host: %s", localPort,
WARN_LOG_FMT(SLIPPI_ONLINE, "Initializing Slippi Netplay for port: {}, with host: {}", localPort,
isDecider ? "true" : "false");
this->isDecider = isDecider;
@ -291,7 +286,7 @@ unsigned int SlippiNetplayClient::OnData(sf::Packet& packet)
break;
default:
WARN_LOG_FMT(SLIPPI_ONLINE, "Unknown message received with id : %d", mid);
WARN_LOG_FMT(SLIPPI_ONLINE, "Unknown message received with id : {}", mid);
break;
}
@ -422,7 +417,7 @@ void SlippiNetplayClient::ThreadFunc()
break;
}
WARN_LOG_FMT(SLIPPI_ONLINE, "[Netplay] Not yet connected. Res: %d, Type: %d", net,
WARN_LOG_FMT(SLIPPI_ONLINE, "[Netplay] Not yet connected. Res: {}, Type: {}", net,
netEvent.type);
// Time out after enough time has passed

View file

@ -207,4 +207,7 @@ private:
extern SlippiNetplayClient* SLIPPI_NETPLAY; // singleton static pointer
static bool IsOnline();
inline bool IsOnline()
{
return SLIPPI_NETPLAY != nullptr;
}

View file

@ -1785,7 +1785,10 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
TextureCacheBase::TCacheEntry*
TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
MathUtil::Rectangle<int>* display_rect, float gamma, const MathUtil::Rectangle<int>& src_rect, const CopyFilterCoefficients::Values& copy_filter_coefficients, float y_scale, bool clamp_top, bool clamp_bottom)
MathUtil::Rectangle<int>* display_rect, float gamma,
const MathUtil::Rectangle<int>& src_rect,
const CopyFilterCoefficients::Values& copy_filter_coefficients,
float y_scale, bool clamp_top, bool clamp_bottom)
{
auto filter_coefficients = GetVRAMCopyFilterCoefficients(copy_filter_coefficients);
const u8* src_data = Memory::GetPointer(address);
@ -1798,10 +1801,6 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
u32 scaled_tex_w = g_renderer->EFBToScaledX(width);
u32 scaled_tex_h = g_renderer->EFBToScaledY(height);
// Compute total texture size. XFB textures aren't tiled, so this is simple.
const u32 total_size = height * stride;
const u64 hash = Common::GetHash64(src_data, total_size, 0);
TCacheEntry* entry = nullptr;
const TextureConfig config(scaled_tex_w, scaled_tex_h, 1, g_framebuffer_manager->GetEFBLayers(),
1, AbstractTextureFormat::RGBA8, AbstractTextureFlag_RenderTarget);
@ -1826,7 +1825,8 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
if (entry)
{
entry->SetGeneralParameters(address, 0, TexDecoder_GetEFBCopyBaseFormat(EFBCopyFormat::XFB), true);
entry->SetGeneralParameters(address, 0, TexDecoder_GetEFBCopyBaseFormat(EFBCopyFormat::XFB),
true);
entry->SetDimensions(width, height, 1);
entry->frameCount = FRAMECOUNT_INVALID;
entry->should_force_safe_hashing = true;
@ -1834,7 +1834,6 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
entry->may_have_overlapping_textures = false;
entry->is_custom_tex = false;
///////////////////////
// Flush EFB pokes first, as they're expected to be included.
g_framebuffer_manager->FlushEFBPokes();
@ -1842,8 +1841,7 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
// Get the pipeline which we will be using. If the compilation failed, this will be null.
const AbstractPipeline* copy_pipeline =
g_shader_cache->GetEFBCopyToVRAMPipeline(TextureConversionShaderGen::GetShaderUid(
EFBCopyFormat::XFB, false, false, false,
NeedsCopyFilterInShader(filter_coefficients)));
EFBCopyFormat::XFB, false, false, false, NeedsCopyFilterInShader(filter_coefficients)));
if (!copy_pipeline)
{
WARN_LOG(VIDEO, "Skipping EFB copy to VRAM due to missing pipeline.");
@ -1905,8 +1903,7 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
{
static int xfb_count = 0;
entry->texture->Save(
fmt::format("{}xfb_copy_{}.png", File::GetUserPath(D_DUMPTEXTURES_IDX), xfb_count++),
0);
fmt::format("{}xfb_copy_{}.png", File::GetUserPath(D_DUMPTEXTURES_IDX), xfb_count++), 0);
}
u8* dst = Memory::GetPointer(address);
UninitializeXFBMemory(dst, stride, bytes_per_row, num_blocks_y);
@ -1972,8 +1969,8 @@ TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height, u32 stride,
}
}
// Even if the copy is deferred, still compute the hash. This way if the copy is used as a texture
// in a subsequent draw before it is flushed, it will have the same hash.
// Even if the copy is deferred, still compute the hash. This way if the copy is used as a
// texture in a subsequent draw before it is flushed, it will have the same hash.
if (entry)
{
const u64 entry_hash = entry->CalculateHash();