TextureCacheBase: Eliminate static state

This commit is contained in:
Lioncash
2016-09-06 18:57:58 -04:00
parent 1fa61af413
commit 58a5395173
21 changed files with 141 additions and 163 deletions

View File

@ -559,7 +559,7 @@ void Renderer::SwapImpl(u32 xfb_addr, u32 fb_width, u32 fb_stride, u32 fb_height
CheckForTargetResize(fb_width, fb_stride, fb_height);
// Clean up stale textures.
TextureCacheBase::Cleanup(frameCount);
TextureCache::GetInstance()->Cleanup(frameCount);
}
void Renderer::DrawFrame(VkRenderPass render_pass, const TargetRectangle& target_rect,
@ -1112,7 +1112,7 @@ void Renderer::CheckForConfigChanges()
bool aspect_changed = old_aspect_ratio != g_ActiveConfig.iAspectRatio;
// Update texture cache settings with any changed options.
TextureCache::OnConfigChanged(g_ActiveConfig);
TextureCache::GetInstance()->OnConfigChanged(g_ActiveConfig);
// Handle internal resolution changes.
if (efb_scale_changed)

View File

@ -328,7 +328,7 @@ TextureCache::TCacheEntry::~TCacheEntry()
g_command_buffer_mgr->DeferFramebufferDestruction(m_framebuffer);
}
void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
void TextureCache::TCacheEntry::Load(const u8* buffer, unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level)
{
// Can't copy data larger than the texture extents.
@ -383,7 +383,7 @@ void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
u8* image_upload_buffer_pointer = upload_buffer->GetCurrentHostPointer();
// Copy to the buffer using the stride from the subresource layout
const u8* source_ptr = TextureCache::temp;
const u8* source_ptr = buffer;
if (upload_pitch != source_pitch)
{
VkDeviceSize copy_pitch = std::min(source_pitch, upload_pitch);
@ -429,7 +429,7 @@ void TextureCache::TCacheEntry::Load(unsigned int width, unsigned int height,
}
// Copy data to staging texture first, then to the "real" texture.
staging_texture->WriteTexels(0, 0, width, height, TextureCache::temp, source_pitch);
staging_texture->WriteTexels(0, 0, width, height, buffer, source_pitch);
staging_texture->CopyToImage(g_command_buffer_mgr->GetCurrentInitCommandBuffer(),
m_texture->GetImage(), VK_IMAGE_ASPECT_COLOR_BIT, 0, 0, width,
height, level, 0);

View File

@ -27,8 +27,8 @@ public:
Texture2D* GetTexture() const { return m_texture.get(); }
VkFramebuffer GetFramebuffer() const { return m_framebuffer; }
void Load(unsigned int width, unsigned int height, unsigned int expanded_width,
unsigned int level) override;
void Load(const u8* buffer, unsigned int width, unsigned int height,
unsigned int expanded_width, unsigned int level) override;
void FromRenderTarget(u8* dst, PEControl::PixelFormat src_format, const EFBRectangle& src_rect,
bool scale_by_half, unsigned int cbufid, const float* colmat) override;
void CopyRectangleFromTexture(const TCacheEntryBase* source,