From 3cfa233b63dfcd734be2dd0ae4bd0d3e98109df6 Mon Sep 17 00:00:00 2001 From: JosJuice Date: Sat, 13 Apr 2024 18:29:52 +0200 Subject: VideoCommon: Use GetSpanForAddress safely in texture decoding Now only VertexLoader remains... But that one might be tricky. --- Source/Core/VideoCommon/TextureCacheBase.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.cpp') diff --git a/Source/Core/VideoCommon/TextureCacheBase.cpp b/Source/Core/VideoCommon/TextureCacheBase.cpp index d6fec6adc4..7184ea725e 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.cpp +++ b/Source/Core/VideoCommon/TextureCacheBase.cpp @@ -1319,6 +1319,9 @@ TCacheEntry* TextureCacheBase::LoadImpl(const TextureInfo& texture_info, bool fo RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSampleSize, const TextureInfo& texture_info) { + if (!texture_info.IsDataValid()) + return {}; + // Hash assigned to texcache entry (also used to generate filenames used for texture dumping and // custom texture lookup) u64 base_hash = TEXHASH_INVALID; @@ -1337,12 +1340,6 @@ RcTcacheEntry TextureCacheBase::GetTexture(const int textureCacheSafetyColorSamp // TODO: the texture cache lookup is based on address, but a texture from tmem has no reason // to have a unique and valid address. This could result in a regular texture and a tmem // texture aliasing onto the same texture cache entry. - if (!texture_info.GetData()) - { - ERROR_LOG_FMT(VIDEO, "Trying to use an invalid texture address {:#010x}", - texture_info.GetRawAddress()); - return {}; - } // If we are recording a FifoLog, keep track of what memory we read. FifoRecorder does // its own memory modification tracking independent of the texture hashing below. @@ -1916,7 +1913,7 @@ RcTcacheEntry TextureCacheBase::GetXFBTexture(u32 address, u32 width, u32 height entry->frameCount = FRAMECOUNT_INVALID; if (!g_ActiveConfig.UseGPUTextureDecoding() || !DecodeTextureOnGPU(entry, 0, src_data, total_size, entry->format.texfmt, width, height, - width, height, stride, texMem, entry->format.tlutfmt)) + width, height, stride, s_tex_mem.data(), entry->format.tlutfmt)) { const u32 decoded_size = width * height * sizeof(u32); CheckTempSize(decoded_size); -- cgit v1.2.3