From 526fa9bc85e6297c0b82463820bd12fc9e204c4c Mon Sep 17 00:00:00 2001 From: Stenzek Date: Sat, 4 Mar 2017 22:36:33 +1000 Subject: [PATCH] D3D11: Use D3D11_USAGE_DEFAULT for all TextureCache textures --- Source/Core/VideoBackends/D3D/TextureCache.cpp | 14 ++------------ Source/Core/VideoBackends/D3D/TextureCache.h | 2 -- 2 files changed, 2 insertions(+), 14 deletions(-) diff --git a/Source/Core/VideoBackends/D3D/TextureCache.cpp b/Source/Core/VideoBackends/D3D/TextureCache.cpp index 116d849f41..daf39e9a1e 100644 --- a/Source/Core/VideoBackends/D3D/TextureCache.cpp +++ b/Source/Core/VideoBackends/D3D/TextureCache.cpp @@ -134,7 +134,7 @@ void TextureCache::TCacheEntry::Load(const u8* buffer, u32 width, u32 height, u3 u32 level) { unsigned int src_pitch = 4 * expanded_width; - D3D::ReplaceRGBATexture2D(texture->GetTex(), buffer, width, height, src_pitch, level, usage); + D3D::context->UpdateSubresource(texture->GetTex(), level, nullptr, buffer, src_pitch, 0); } TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntryConfig& config) @@ -149,18 +149,9 @@ TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntry } else { - D3D11_USAGE usage = D3D11_USAGE_DEFAULT; - D3D11_CPU_ACCESS_FLAG cpu_access = (D3D11_CPU_ACCESS_FLAG)0; - - if (config.levels == 1) - { - usage = D3D11_USAGE_DYNAMIC; - cpu_access = D3D11_CPU_ACCESS_WRITE; - } - const D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM, config.width, config.height, 1, - config.levels, D3D11_BIND_SHADER_RESOURCE, usage, cpu_access); + config.levels, D3D11_BIND_SHADER_RESOURCE, D3D11_USAGE_DEFAULT, 0); ID3D11Texture2D* pTexture; const HRESULT hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &pTexture); @@ -168,7 +159,6 @@ TextureCacheBase::TCacheEntryBase* TextureCache::CreateTexture(const TCacheEntry TCacheEntry* const entry = new TCacheEntry(config, new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE)); - entry->usage = usage; // TODO: better debug names D3D::SetDebugObjectName((ID3D11DeviceChild*)entry->texture->GetTex(), diff --git a/Source/Core/VideoBackends/D3D/TextureCache.h b/Source/Core/VideoBackends/D3D/TextureCache.h index a8273f03f0..bf82418208 100644 --- a/Source/Core/VideoBackends/D3D/TextureCache.h +++ b/Source/Core/VideoBackends/D3D/TextureCache.h @@ -20,8 +20,6 @@ private: { D3DTexture2D* const texture; - D3D11_USAGE usage; - TCacheEntry(const TCacheEntryConfig& config, D3DTexture2D* _tex) : TCacheEntryBase(config), texture(_tex) {