mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-01-10 16:19:28 +01:00
TexCache: don't load tex level 0 on creation
This reverts an optimization which isn't worth imo. Every texture uploads have to alloc vram and a staging buffer, so there is no need to do both in the same call.
This commit is contained in:
parent
8bdbe37c91
commit
614d058db1
@ -87,24 +87,18 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
|
||||
{
|
||||
D3D11_USAGE usage = D3D11_USAGE_DEFAULT;
|
||||
D3D11_CPU_ACCESS_FLAG cpu_access = (D3D11_CPU_ACCESS_FLAG)0;
|
||||
D3D11_SUBRESOURCE_DATA srdata, *data = nullptr;
|
||||
|
||||
if (tex_levels == 1)
|
||||
{
|
||||
usage = D3D11_USAGE_DYNAMIC;
|
||||
cpu_access = D3D11_CPU_ACCESS_WRITE;
|
||||
|
||||
srdata.pSysMem = TextureCache::temp;
|
||||
srdata.SysMemPitch = 4 * expanded_width;
|
||||
|
||||
data = &srdata;
|
||||
}
|
||||
|
||||
const D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||
width, height, 1, tex_levels, D3D11_BIND_SHADER_RESOURCE, usage, cpu_access);
|
||||
|
||||
ID3D11Texture2D *pTexture;
|
||||
const HRESULT hr = D3D::device->CreateTexture2D(&texdesc, data, &pTexture);
|
||||
const HRESULT hr = D3D::device->CreateTexture2D(&texdesc, nullptr, &pTexture);
|
||||
CHECK(SUCCEEDED(hr), "Create texture of the TextureCache");
|
||||
|
||||
TCacheEntry* const entry = new TCacheEntry(new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE));
|
||||
@ -116,9 +110,6 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
|
||||
|
||||
SAFE_RELEASE(pTexture);
|
||||
|
||||
if (tex_levels != 1)
|
||||
entry->Load(width, height, expanded_width, 0);
|
||||
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
@ -175,10 +175,7 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
|
||||
glBindTexture(GL_TEXTURE_2D_ARRAY, entry.texture);
|
||||
glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAX_LEVEL, tex_levels - 1);
|
||||
|
||||
entry.Load(width, height, expanded_width, 0);
|
||||
|
||||
// This isn't needed as Load() also reset the stage in the end
|
||||
//TextureCache::SetStage();
|
||||
TextureCache::SetStage();
|
||||
|
||||
return &entry;
|
||||
}
|
||||
|
@ -481,16 +481,14 @@ TextureCache::TCacheEntryBase* TextureCache::Load(unsigned int const stage,
|
||||
|
||||
GFX_DEBUGGER_PAUSE_AT(NEXT_NEW_TEXTURE, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// load texture (CreateTexture also loads level 0)
|
||||
entry->Load(width, height, expandedWidth, 0);
|
||||
}
|
||||
|
||||
entry->SetGeneralParameters(address, texture_size, full_format, entry->num_mipmaps, entry->num_layers);
|
||||
entry->SetDimensions(nativeW, nativeH, width, height);
|
||||
entry->hash = tex_hash;
|
||||
|
||||
// load texture
|
||||
entry->Load(width, height, expandedWidth, 0);
|
||||
|
||||
if (entry->IsEfbCopy() && !g_ActiveConfig.bCopyEFBToTexture)
|
||||
entry->type = TCET_EC_DYNAMIC;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user