Texcache: Cleanup last bound tex invalidation.

When we're deleting, we're always about to bind a new tex.
This commit is contained in:
Unknown W. Brackets 2017-03-25 11:34:21 -07:00
parent 6a88d6c5a4
commit 7fb7a4877d
5 changed files with 14 additions and 11 deletions

View File

@ -219,7 +219,6 @@ void TextureCacheCommon::SetTexture(bool force) {
if (!Memory::IsValidAddress(texaddr)) {
// Bind a null texture and return.
Unbind();
InvalidateLastTexture();
return;
}
@ -482,7 +481,7 @@ bool TextureCacheCommon::HandleTextureChange(TexCacheEntry *const entry, const c
// Instead, let's use glTexSubImage to replace the images.
replaceImages = true;
} else {
InvalidateLastTexture(entry);
InvalidateLastTexture();
ReleaseTexture(entry, true);
entry->status &= ~TexCacheEntry::STATUS_IS_SCALED;
}

View File

@ -143,7 +143,7 @@ void TextureCacheD3D11::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
}
void TextureCacheD3D11::ForgetLastTexture() {
lastBoundTexture = INVALID_TEX;
InvalidateLastTexture();
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
ID3D11ShaderResourceView *nullTex = nullptr;
context_->PSSetShaderResources(0, 1, &nullTex);
@ -201,7 +201,7 @@ void TextureCacheD3D11::SetFramebufferSamplingParams(u16 bufferWidth, u16 buffer
}
void TextureCacheD3D11::StartFrame() {
lastBoundTexture = INVALID_TEX;
InvalidateLastTexture();
timesInvalidatedAllThisFrame_ = 0;
if (texelsScaledThisFrame_) {
@ -264,6 +264,7 @@ void TextureCacheD3D11::BindTexture(TexCacheEntry *entry) {
void TextureCacheD3D11::Unbind() {
ID3D11ShaderResourceView *nullView = nullptr;
context_->PSSetShaderResources(0, 1, &nullView);
InvalidateLastTexture();
}
class TextureShaderApplierD3D11 {
@ -438,7 +439,7 @@ void TextureCacheD3D11::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFra
SetFramebufferSamplingParams(framebuffer->bufferWidth, framebuffer->bufferHeight, samplerKey);
ID3D11SamplerState *state = samplerCache_.GetOrCreateSampler(device_, samplerKey);
context_->PSSetSamplers(0, 1, &state);
lastBoundTexture = INVALID_TEX;
InvalidateLastTexture();
}

View File

@ -96,7 +96,7 @@ void TextureCacheDX9::ReleaseTexture(TexCacheEntry *entry, bool delete_them) {
}
void TextureCacheDX9::ForgetLastTexture() {
lastBoundTexture = INVALID_TEX;
InvalidateLastTexture();
gstate_c.Dirty(DIRTY_TEXTURE_PARAMS);
}
@ -213,7 +213,7 @@ void TextureCacheDX9::SetFramebufferSamplingParams(u16 bufferWidth, u16 bufferHe
}
void TextureCacheDX9::StartFrame() {
lastBoundTexture = INVALID_TEX;
InvalidateLastTexture();
timesInvalidatedAllThisFrame_ = 0;
if (texelsScaledThisFrame_) {
@ -279,6 +279,7 @@ void TextureCacheDX9::BindTexture(TexCacheEntry *entry) {
void TextureCacheDX9::Unbind() {
device_->SetTexture(0, NULL);
InvalidateLastTexture();
}
class TextureShaderApplierDX9 {
@ -458,7 +459,7 @@ void TextureCacheDX9::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFrame
framebufferManagerDX9_->RebindFramebuffer();
SetFramebufferSamplingParams(framebuffer->bufferWidth, framebuffer->bufferHeight);
lastBoundTexture = INVALID_TEX;
InvalidateLastTexture();
}
void TextureCacheDX9::BuildTexture(TexCacheEntry *const entry, bool replaceImages) {

View File

@ -340,6 +340,7 @@ void TextureCacheGLES::BindTexture(TexCacheEntry *entry) {
void TextureCacheGLES::Unbind() {
glBindTexture(GL_TEXTURE_2D, 0);
InvalidateLastTexture();
}
class TextureShaderApplier {
@ -522,7 +523,7 @@ void TextureCacheGLES::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFram
CHECK_GL_ERROR_IF_DEBUG();
lastBoundTexture = INVALID_TEX;
InvalidateLastTexture();
}
ReplacedTextureFormat FromGLESFormat(GLenum fmt, bool useBGRA = false) {

View File

@ -271,7 +271,7 @@ void TextureCacheVulkan::SetFramebufferSamplingParams(u16 bufferWidth, u16 buffe
}
void TextureCacheVulkan::StartFrame() {
lastBoundTexture = nullptr;
InvalidateLastTexture();
timesInvalidatedAllThisFrame_ = 0;
texelsScaledThisFrame_ = 0;
@ -342,6 +342,7 @@ void TextureCacheVulkan::BindTexture(TexCacheEntry *entry) {
void TextureCacheVulkan::Unbind() {
imageView_ = VK_NULL_HANDLE;
sampler_ = VK_NULL_HANDLE;
InvalidateLastTexture();
}
void TextureCacheVulkan::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFramebuffer *framebuffer) {
@ -452,7 +453,7 @@ void TextureCacheVulkan::ApplyTextureFramebuffer(TexCacheEntry *entry, VirtualFr
key.mipEnable = false;
sampler_ = samplerCache_.GetOrCreateSampler(key);
lastBoundTexture = nullptr;
InvalidateLastTexture();
}
}