Remove kinda-duplicate function.

This commit is contained in:
Henrik Rydgård 2023-02-24 21:53:12 +01:00
parent f5d844d282
commit 1b5148bb6c
10 changed files with 14 additions and 32 deletions

View file

@ -817,7 +817,7 @@ void TextureCacheCommon::HandleTextureChange(TexCacheEntry *const entry, const c
gpuStats.numTextureInvalidations++; gpuStats.numTextureInvalidations++;
DEBUG_LOG(G3D, "Texture different or overwritten, reloading at %08x: %s", entry->addr, reason); DEBUG_LOG(G3D, "Texture different or overwritten, reloading at %08x: %s", entry->addr, reason);
if (doDelete) { if (doDelete) {
InvalidateLastTexture(); ForgetLastTexture();
ReleaseTexture(entry, true); ReleaseTexture(entry, true);
entry->status &= ~TexCacheEntry::STATUS_IS_SCALED; entry->status &= ~TexCacheEntry::STATUS_IS_SCALED;
} }
@ -1990,7 +1990,7 @@ void TextureCacheCommon::ApplyTexture() {
TexCacheEntry *entry = nextTexture_; TexCacheEntry *entry = nextTexture_;
if (!entry) { if (!entry) {
// Maybe we bound a framebuffer? // Maybe we bound a framebuffer?
InvalidateLastTexture(); ForgetLastTexture();
if (failedTexture_) { if (failedTexture_) {
// Backends should handle this by binding a black texture with 0 alpha. // Backends should handle this by binding a black texture with 0 alpha.
BindTexture(nullptr); BindTexture(nullptr);
@ -2050,7 +2050,7 @@ void TextureCacheCommon::ApplyTexture() {
if (nextNeedsRebuild_) { if (nextNeedsRebuild_) {
_assert_(!entry->texturePtr); _assert_(!entry->texturePtr);
BuildTexture(entry); BuildTexture(entry);
InvalidateLastTexture(); ForgetLastTexture();
} }
if (entry->status & TexCacheEntry::STATUS_CLUT_GPU) { if (entry->status & TexCacheEntry::STATUS_CLUT_GPU) {
@ -2205,7 +2205,7 @@ void TextureCacheCommon::ApplyTextureFramebuffer(VirtualFramebuffer *framebuffer
gstate_c.SetTextureFullAlpha(alphaStatus == CHECKALPHA_FULL); gstate_c.SetTextureFullAlpha(alphaStatus == CHECKALPHA_FULL);
draw_->Invalidate(InvalidationFlags::CACHED_RENDER_STATE); draw_->Invalidate(InvalidationFlags::CACHED_RENDER_STATE);
InvalidateLastTexture(); ForgetLastTexture();
return; return;
} }

View file

@ -329,7 +329,6 @@ public:
TextureShaderCache *GetTextureShaderCache() { return textureShaderCache_; } TextureShaderCache *GetTextureShaderCache() { return textureShaderCache_; }
virtual void ForgetLastTexture() = 0; virtual void ForgetLastTexture() = 0;
virtual void InvalidateLastTexture() = 0;
virtual void Clear(bool delete_them); virtual void Clear(bool delete_them);
virtual void NotifyConfigChanged(); virtual void NotifyConfigChanged();
virtual void ApplySamplingParams(const SamplerCacheKey &key) = 0; virtual void ApplySamplingParams(const SamplerCacheKey &key) = 0;

View file

@ -179,20 +179,16 @@ void TextureCacheD3D11::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
} }
void TextureCacheD3D11::ForgetLastTexture() { void TextureCacheD3D11::ForgetLastTexture() {
InvalidateLastTexture(); lastBoundTexture = INVALID_TEX;
ID3D11ShaderResourceView *nullTex[4]{}; ID3D11ShaderResourceView *nullTex[4]{};
context_->PSSetShaderResources(0, 4, nullTex); context_->PSSetShaderResources(0, 4, nullTex);
} }
void TextureCacheD3D11::InvalidateLastTexture() {
lastBoundTexture = INVALID_TEX;
}
void TextureCacheD3D11::StartFrame() { void TextureCacheD3D11::StartFrame() {
TextureCacheCommon::StartFrame(); TextureCacheCommon::StartFrame();
InvalidateLastTexture(); lastBoundTexture = INVALID_TEX;
timesInvalidatedAllThisFrame_ = 0; timesInvalidatedAllThisFrame_ = 0;
replacementTimeThisFrame_ = 0.0; replacementTimeThisFrame_ = 0.0;
@ -268,9 +264,7 @@ void TextureCacheD3D11::ApplySamplingParams(const SamplerCacheKey &key) {
} }
void TextureCacheD3D11::Unbind() { void TextureCacheD3D11::Unbind() {
ID3D11ShaderResourceView *nullView = nullptr; ForgetLastTexture();
context_->PSSetShaderResources(0, 1, &nullView);
InvalidateLastTexture();
} }
void TextureCacheD3D11::BindAsClutTexture(Draw::Texture *tex, bool smooth) { void TextureCacheD3D11::BindAsClutTexture(Draw::Texture *tex, bool smooth) {

View file

@ -51,7 +51,6 @@ public:
void SetFramebufferManager(FramebufferManagerD3D11 *fbManager); void SetFramebufferManager(FramebufferManagerD3D11 *fbManager);
void ForgetLastTexture() override; void ForgetLastTexture() override;
void InvalidateLastTexture() override;
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override; bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;

View file

@ -111,7 +111,7 @@ void TextureCacheDX9::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
} }
} }
void TextureCacheDX9::InvalidateLastTexture() { void TextureCacheDX9::ForgetLastTexture() {
lastBoundTexture = INVALID_TEX; lastBoundTexture = INVALID_TEX;
} }
@ -154,7 +154,7 @@ void TextureCacheDX9::ApplySamplingParams(const SamplerCacheKey &key) {
void TextureCacheDX9::StartFrame() { void TextureCacheDX9::StartFrame() {
TextureCacheCommon::StartFrame(); TextureCacheCommon::StartFrame();
InvalidateLastTexture(); lastBoundTexture = nullptr;
timesInvalidatedAllThisFrame_ = 0; timesInvalidatedAllThisFrame_ = 0;
replacementTimeThisFrame_ = 0.0; replacementTimeThisFrame_ = 0.0;
@ -229,7 +229,7 @@ void TextureCacheDX9::BindTexture(TexCacheEntry *entry) {
void TextureCacheDX9::Unbind() { void TextureCacheDX9::Unbind() {
device_->SetTexture(0, nullptr); device_->SetTexture(0, nullptr);
InvalidateLastTexture(); ForgetLastTexture();
} }
void TextureCacheDX9::BindAsClutTexture(Draw::Texture *tex, bool smooth) { void TextureCacheDX9::BindAsClutTexture(Draw::Texture *tex, bool smooth) {

View file

@ -38,10 +38,7 @@ public:
void SetFramebufferManager(FramebufferManagerDX9 *fbManager); void SetFramebufferManager(FramebufferManagerDX9 *fbManager);
void ForgetLastTexture() override { void ForgetLastTexture() override;
InvalidateLastTexture();
}
void InvalidateLastTexture() override;
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override; bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;

View file

@ -143,7 +143,7 @@ static void ConvertColors(void *dstBuf, const void *srcBuf, Draw::DataFormat dst
void TextureCacheGLES::StartFrame() { void TextureCacheGLES::StartFrame() {
TextureCacheCommon::StartFrame(); TextureCacheCommon::StartFrame();
InvalidateLastTexture(); ForgetLastTexture();
timesInvalidatedAllThisFrame_ = 0; timesInvalidatedAllThisFrame_ = 0;
replacementTimeThisFrame_ = 0.0; replacementTimeThisFrame_ = 0.0;
@ -234,7 +234,7 @@ void TextureCacheGLES::BindTexture(TexCacheEntry *entry) {
void TextureCacheGLES::Unbind() { void TextureCacheGLES::Unbind() {
render_->BindTexture(TEX_SLOT_PSP_TEXTURE, nullptr); render_->BindTexture(TEX_SLOT_PSP_TEXTURE, nullptr);
InvalidateLastTexture(); ForgetLastTexture();
} }
void TextureCacheGLES::BindAsClutTexture(Draw::Texture *tex, bool smooth) { void TextureCacheGLES::BindAsClutTexture(Draw::Texture *tex, bool smooth) {
@ -385,7 +385,7 @@ Draw::DataFormat TextureCacheGLES::GetDestFormat(GETextureFormat format, GEPalet
} }
bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) { bool TextureCacheGLES::GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) {
InvalidateLastTexture(); ForgetLastTexture();
SetTexture(); SetTexture();
if (!nextTexture_) { if (!nextTexture_) {
return GetCurrentFramebufferTextureDebug(buffer, isFramebuffer); return GetCurrentFramebufferTextureDebug(buffer, isFramebuffer);

View file

@ -51,9 +51,6 @@ public:
void ForgetLastTexture() override { void ForgetLastTexture() override {
lastBoundTexture = nullptr; lastBoundTexture = nullptr;
} }
void InvalidateLastTexture() override {
lastBoundTexture = nullptr;
}
bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override; bool GetCurrentTextureDebug(GPUDebugBuffer &buffer, int level, bool *isFramebuffer) override;

View file

@ -329,7 +329,6 @@ static const VkFilter MagFiltVK[2] = {
void TextureCacheVulkan::StartFrame() { void TextureCacheVulkan::StartFrame() {
TextureCacheCommon::StartFrame(); TextureCacheCommon::StartFrame();
InvalidateLastTexture();
textureShaderCache_->Decimate(); textureShaderCache_->Decimate();
timesInvalidatedAllThisFrame_ = 0; timesInvalidatedAllThisFrame_ = 0;
@ -419,7 +418,6 @@ void TextureCacheVulkan::ApplySamplingParams(const SamplerCacheKey &key) {
void TextureCacheVulkan::Unbind() { void TextureCacheVulkan::Unbind() {
imageView_ = VK_NULL_HANDLE; imageView_ = VK_NULL_HANDLE;
curSampler_ = VK_NULL_HANDLE; curSampler_ = VK_NULL_HANDLE;
InvalidateLastTexture();
} }
void TextureCacheVulkan::BindAsClutTexture(Draw::Texture *tex, bool smooth) { void TextureCacheVulkan::BindAsClutTexture(Draw::Texture *tex, bool smooth) {

View file

@ -72,8 +72,6 @@ public:
} }
void ForgetLastTexture() override {} void ForgetLastTexture() override {}
void InvalidateLastTexture() override {}
void NotifyConfigChanged() override; void NotifyConfigChanged() override;
void GetVulkanHandles(VkImageView &imageView, VkSampler &sampler) { void GetVulkanHandles(VkImageView &imageView, VkSampler &sampler) {