From d8cd2c3252ab6f2ce6c1656b5eb194863e834f52 Mon Sep 17 00:00:00 2001 From: Rodolfo Bogado Date: Mon, 29 Jun 2015 22:19:19 -0300 Subject: Implement scaled partial texture updates --- Source/Core/VideoCommon/TextureCacheBase.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 5d4f9204fc..0a51ef64b9 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -89,7 +89,10 @@ public: virtual void Bind(unsigned int stage) = 0; virtual bool Save(const std::string& filename, unsigned int level) = 0; - virtual void DoPartialTextureUpdate(TCacheEntryBase* entry, u32 x, u32 y) = 0; + virtual void CopyRectangleFromTexture( + const TCacheEntryBase* source, + const MathUtil::Rectangle &srcrect, + const MathUtil::Rectangle &dstrect) = 0; virtual void Load(unsigned int width, unsigned int height, unsigned int expanded_width, unsigned int level) = 0; @@ -100,8 +103,6 @@ public: bool OverlapsMemoryRange(u32 range_address, u32 range_size) const; - void DoPartialTextureUpdates(); - bool IsEfbCopy() const { return is_efb_copy; } }; @@ -140,7 +141,7 @@ protected: private: typedef std::multimap TexCache; typedef std::unordered_multimap TexPool; - + static TCacheEntryBase* DoPartialTextureUpdates(TexCache::iterator iter); static void DumpTexture(TCacheEntryBase* entry, std::string basename, unsigned int level); static void CheckTempSize(size_t required_size); -- cgit v1.2.3 From 52948bb3ef016abd7e35e775b17b7cf3f487d49c Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Tue, 1 Sep 2015 02:41:16 +1200 Subject: Cleanup and unify handling of efb copy stride. --- Source/Core/VideoCommon/TextureCacheBase.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 0a51ef64b9..6bb80f945c 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -53,7 +53,7 @@ public: u32 format; bool is_efb_copy; bool is_custom_tex; - u32 copyMipMapStrideChannels; + u32 copyStride; unsigned int native_width, native_height; // Texture dimensions from the GameCube's point of view unsigned int native_levels; @@ -96,7 +96,7 @@ public: virtual void Load(unsigned int width, unsigned int height, unsigned int expanded_width, unsigned int level) = 0; - virtual void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, + virtual void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, u32 dstStride, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf, unsigned int cbufid, const float *colmat) = 0; @@ -125,8 +125,8 @@ public: static TCacheEntryBase* Load(const u32 stage); static void UnbindTextures(); static void BindTextures(); - static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, PEControl::PixelFormat srcFormat, - const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); + static void CopyRenderTargetToTexture(u32 dstAddr, unsigned int dstFormat, u32 dstStride, + PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf); static void RequestInvalidateTextureCache(); -- cgit v1.2.3 From b9be3245e1bcd3929baf4d1c66fe5a14b336cdbc Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sat, 5 Sep 2015 02:45:29 +1200 Subject: Move common EFB copy code into VideoCommon Addded a few duplicated depth copy texture formats to the enum in TextureDecoder.h. These texture formats were already implemented in TextureCacheBase and the ogl/dx11 texture cache implementations. --- Source/Core/VideoCommon/TextureCacheBase.h | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 6bb80f945c..c012cad0fc 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -53,7 +53,7 @@ public: u32 format; bool is_efb_copy; bool is_custom_tex; - u32 copyStride; + u32 memory_stride; unsigned int native_width, native_height; // Texture dimensions from the GameCube's point of view unsigned int native_levels; @@ -76,6 +76,7 @@ public: native_width = _native_width; native_height = _native_height; native_levels = _native_levels; + memory_stride = _native_width; } void SetHashes(u64 _hash) @@ -83,6 +84,8 @@ public: hash = _hash; } + void SetEfbCopy(u32 stride); + TCacheEntryBase(const TCacheEntryConfig& c) : config(c) {} virtual ~TCacheEntryBase(); @@ -96,7 +99,7 @@ public: virtual void Load(unsigned int width, unsigned int height, unsigned int expanded_width, unsigned int level) = 0; - virtual void FromRenderTarget(u32 dstAddr, unsigned int dstFormat, u32 dstStride, + virtual void FromRenderTarget(u8* dst, unsigned int dstFormat, u32 dstStride, PEControl::PixelFormat srcFormat, const EFBRectangle& srcRect, bool isIntensity, bool scaleByHalf, unsigned int cbufid, const float *colmat) = 0; @@ -104,6 +107,11 @@ public: bool OverlapsMemoryRange(u32 range_address, u32 range_size) const; bool IsEfbCopy() const { return is_efb_copy; } + + u32 NumBlocksY() const; + u32 CacheLinesPerRow() const; + + void Memset(u8* ptr, u32 tag); }; virtual ~TextureCache(); // needs virtual for DX11 dtor @@ -115,7 +123,6 @@ public: static void Cleanup(int _frameCount); static void Invalidate(); - static void MakeRangeDynamic(u32 start_address, u32 size); virtual TCacheEntryBase* CreateTexture(const TCacheEntryConfig& config) = 0; -- cgit v1.2.3 From ee649c6d9f38510b2acad42dcce894400a8b4d4b Mon Sep 17 00:00:00 2001 From: Scott Mansell Date: Sun, 6 Sep 2015 02:03:49 +1200 Subject: Make efb2tex behave more like efb2ram. Instead of having special case code for efb2tex that ignores hashes, the only diffence between efb2tex and efb2ram now is that efb2tex writes zeros to the memory instead of actual texture data. Though keep in mind, all efb2tex copies will have hashes of zero as their hash. --- Source/Core/VideoCommon/TextureCacheBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index c012cad0fc..56e1f0b1e2 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -111,7 +111,7 @@ public: u32 NumBlocksY() const; u32 CacheLinesPerRow() const; - void Memset(u8* ptr, u32 tag); + void Zero(u8* ptr); }; virtual ~TextureCache(); // needs virtual for DX11 dtor -- cgit v1.2.3 From 8ce04f9a65612b7553015428e617ba7c53913175 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 5 Sep 2015 11:44:21 -0400 Subject: General: Replace GC_ALIGN macros with alignas Standard supported alignment -> out with compiler-specific. --- Source/Core/VideoCommon/TextureCacheBase.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index c012cad0fc..b0cd5f02b6 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -142,7 +142,7 @@ public: protected: TextureCache(); - static GC_ALIGNED16(u8 *temp); + alignas(16) static u8* temp; static size_t temp_size; private: -- cgit v1.2.3 From e408e0ab171ad5f55b9daa86f4701f29d1c54b2b Mon Sep 17 00:00:00 2001 From: mimimi085181 Date: Thu, 10 Sep 2015 22:28:59 +0200 Subject: Store the base hash for paletted textures in the texture cache entries --- Source/Core/VideoCommon/TextureCacheBase.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 56e1f0b1e2..52bb048ea3 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -49,7 +49,8 @@ public: // common members u32 addr; u32 size_in_bytes; - u64 hash; + u64 base_hash; + u64 hash; // for paletted textures, hash = base_hash ^ palette_hash u32 format; bool is_efb_copy; bool is_custom_tex; @@ -79,8 +80,9 @@ public: memory_stride = _native_width; } - void SetHashes(u64 _hash) + void SetHashes(u64 _base_hash, u64 _hash) { + base_hash = _base_hash; hash = _hash; } -- cgit v1.2.3 From e24b8c4ab728c50b3c6a1d8b0066bdbf2f9292d7 Mon Sep 17 00:00:00 2001 From: mimimi085181 Date: Sun, 13 Sep 2015 13:30:56 +0200 Subject: Respect the stride for efb copies when hashing them --- Source/Core/VideoCommon/TextureCacheBase.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Source/Core/VideoCommon/TextureCacheBase.h') diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h index 6ffcbb82dc..4fbaed8e15 100644 --- a/Source/Core/VideoCommon/TextureCacheBase.h +++ b/Source/Core/VideoCommon/TextureCacheBase.h @@ -114,6 +114,8 @@ public: u32 CacheLinesPerRow() const; void Zero(u8* ptr); + + u64 CalculateHash() const; }; virtual ~TextureCache(); // needs virtual for DX11 dtor -- cgit v1.2.3