mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 11:02:28 +02:00
Don't load level 0 twice for 1-level textures in DX11.
This commit is contained in:
parent
718a1b5ded
commit
294cb165ba
@ -70,24 +70,19 @@ TextureCache::TCacheEntryBase* TextureCache::CreateTexture(unsigned int width,
|
|||||||
{
|
{
|
||||||
D3D11_USAGE usage = D3D11_USAGE_DEFAULT;
|
D3D11_USAGE usage = D3D11_USAGE_DEFAULT;
|
||||||
D3D11_CPU_ACCESS_FLAG cpu_access = (D3D11_CPU_ACCESS_FLAG)0;
|
D3D11_CPU_ACCESS_FLAG cpu_access = (D3D11_CPU_ACCESS_FLAG)0;
|
||||||
D3D11_SUBRESOURCE_DATA srdata, *data = NULL;
|
|
||||||
|
|
||||||
|
// This is just an optimization apparently?
|
||||||
if (tex_levels == 1)
|
if (tex_levels == 1)
|
||||||
{
|
{
|
||||||
usage = D3D11_USAGE_DYNAMIC;
|
usage = D3D11_USAGE_DYNAMIC;
|
||||||
cpu_access = D3D11_CPU_ACCESS_WRITE;
|
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,
|
const D3D11_TEXTURE2D_DESC texdesc = CD3D11_TEXTURE2D_DESC(DXGI_FORMAT_R8G8B8A8_UNORM,
|
||||||
width, height, 1, tex_levels, D3D11_BIND_SHADER_RESOURCE, usage, cpu_access);
|
width, height, 1, tex_levels, D3D11_BIND_SHADER_RESOURCE, usage, cpu_access);
|
||||||
|
|
||||||
ID3D11Texture2D *pTexture;
|
ID3D11Texture2D *pTexture;
|
||||||
const HRESULT hr = D3D::device->CreateTexture2D(&texdesc, data, &pTexture);
|
const HRESULT hr = D3D::device->CreateTexture2D(&texdesc, NULL, &pTexture);
|
||||||
CHECK(SUCCEEDED(hr), "Create texture of the TextureCache");
|
CHECK(SUCCEEDED(hr), "Create texture of the TextureCache");
|
||||||
|
|
||||||
TCacheEntry* const entry = new TCacheEntry(new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE));
|
TCacheEntry* const entry = new TCacheEntry(new D3DTexture2D(pTexture, D3D11_BIND_SHADER_RESOURCE));
|
||||||
|
Loading…
Reference in New Issue
Block a user