summaryrefslogtreecommitdiff
path: root/Source/Core/VideoCommon/TextureCacheBase.h
diff options
context:
space:
mode:
authoriwubcode <iwubcode@users.noreply.github.com>2017-09-29 00:32:04 -0500
committeriwubcode <iwubcode@users.noreply.github.com>2017-11-17 22:11:32 -0600
commit74610646ce678ed0644617c2de23544b446ea6dd (patch)
tree3adc6212510727b0ed34f8fcbaed793e55656868 /Source/Core/VideoCommon/TextureCacheBase.h
parent4964fc87ae15600252cea8a07df5799e91c11875 (diff)
TextureCacheBase: Add XFB specific functions
Diffstat (limited to 'Source/Core/VideoCommon/TextureCacheBase.h')
-rw-r--r--Source/Core/VideoCommon/TextureCacheBase.h52
1 files changed, 52 insertions, 0 deletions
diff --git a/Source/Core/VideoCommon/TextureCacheBase.h b/Source/Core/VideoCommon/TextureCacheBase.h
index a6aea52e9e..c248f75dd9 100644
--- a/Source/Core/VideoCommon/TextureCacheBase.h
+++ b/Source/Core/VideoCommon/TextureCacheBase.h
@@ -8,6 +8,8 @@
#include <bitset>
#include <map>
#include <memory>
+#include <optional>
+#include <string>
#include <tuple>
#include <unordered_map>
#include <unordered_set>
@@ -64,6 +66,44 @@ struct EFBCopyParams
float y_scale;
};
+struct TextureLookupInformation
+{
+ u32 address;
+
+ u32 block_width;
+ u32 block_height;
+ u32 bytes_per_block;
+
+ u32 expanded_width;
+ u32 expanded_height;
+ u32 native_width;
+ u32 native_height;
+ u32 total_bytes;
+ u32 native_levels = 1;
+ u32 computed_levels;
+
+ u64 base_hash;
+ u64 full_hash;
+
+ TextureAndTLUTFormat full_format;
+ u32 tlut_address = 0;
+
+ bool is_palette_texture = false;
+ u32 palette_size = 0;
+
+ bool use_mipmaps = false;
+
+ bool from_tmem = false;
+ u32 tmem_address_even = 0;
+ u32 tmem_address_odd = 0;
+
+ int texture_cache_safety_color_sample_size = 0; // Default to safe hashing
+
+ u8* src_data;
+
+ std::string dump_base_name;
+};
+
class TextureCacheBase
{
private:
@@ -92,6 +132,8 @@ public:
float gamma = 1.0f;
u64 id;
+ bool reference_changed = false; // used by xfb to determine when a reference xfb changed
+
unsigned int native_width,
native_height; // Texture dimensions from the GameCube's point of view
unsigned int native_levels;
@@ -190,6 +232,16 @@ public:
TLUTFormat tlutfmt = TLUTFormat::IA8, bool use_mipmaps = false,
u32 tex_levels = 1, bool from_tmem = false, u32 tmem_address_even = 0,
u32 tmem_address_odd = 0);
+
+ TCacheEntry* GetXFBTexture(u32 address, u32 width, u32 height, TextureFormat texformat,
+ int textureCacheSafetyColorSampleSize);
+ std::optional<TextureLookupInformation> ComputeTextureInformation(u32 address, u32 width, u32 height, TextureFormat texformat,
+ int textureCacheSafetyColorSampleSize, bool from_tmem, u32 tmem_address_even, u32 tmem_address_odd, u32 tlutaddr, TLUTFormat tlutfmt, u32 levels);
+ TCacheEntry* GetXFBFromCache(const TextureLookupInformation& tex_info);
+ bool LoadTextureFromOverlappingTextures(TCacheEntry* entry_to_update, const TextureLookupInformation& tex_info);
+ TCacheEntry* CreateNormalTexture(const TextureLookupInformation& tex_info);
+ void LoadTextureFromMemory(TCacheEntry* entry_to_update, const TextureLookupInformation& tex_info);
+ void LoadTextureLevelZeroFromMemory(TCacheEntry* entry_to_update, const TextureLookupInformation& tex_info, bool decode_on_gpu);
virtual void BindTextures();
void CopyRenderTargetToTexture(u32 dstAddr, EFBCopyFormat dstFormat, u32 dstStride,
bool is_depth_copy, const EFBRectangle& srcRect, bool isIntensity,