Proxy texture fixups - set cubemap, name, work for 1D/3D

This commit is contained in:
baldurk
2014-09-25 16:21:19 +01:00
parent 98fd2bf114
commit 95bd75d915
2 changed files with 29 additions and 0 deletions
@@ -398,6 +398,12 @@ HRESULT WrappedID3D11Device::CreateTexture1D(
record->AddChunk(chunk);
record->SetDataPtr(chunk->GetData());
}
else
{
WrappedID3D11Texture1D *w = (WrappedID3D11Texture1D *)wrapped;
GetResourceManager()->AddLiveResource(w->GetResourceID(), wrapped);
}
*ppTexture1D = wrapped;
}
@@ -606,6 +612,12 @@ HRESULT WrappedID3D11Device::CreateTexture3D(
record->AddChunk(chunk);
record->SetDataPtr(chunk->GetData());
}
else
{
WrappedID3D11Texture3D *w = (WrappedID3D11Texture3D *)wrapped;
GetResourceManager()->AddLiveResource(w->GetResourceID(), wrapped);
}
*ppTexture3D = wrapped;
}
+17
View File
@@ -1369,6 +1369,8 @@ ResourceId D3D11Replay::CreateProxyTexture(FetchTexture templateTex)
{
ResourceId ret;
ID3D11Resource *resource = NULL;
if(templateTex.dimension == 1)
{
ID3D11Texture1D *throwaway = NULL;
@@ -1393,6 +1395,8 @@ ResourceId D3D11Replay::CreateProxyTexture(FetchTexture templateTex)
RDCERR("Failed to create 1D proxy texture");
return ResourceId();
}
resource = throwaway;
if(templateTex.creationFlags & eTextureCreate_DSV)
desc.Format = GetTypelessFormat(desc.Format);
@@ -1426,6 +1430,9 @@ ResourceId D3D11Replay::CreateProxyTexture(FetchTexture templateTex)
desc.Format = GetTypelessFormat(desc.Format);
}
if(templateTex.cubemap)
desc.MiscFlags |= D3D11_RESOURCE_MISC_TEXTURECUBE;
HRESULT hr = m_pDevice->CreateTexture2D(&desc, NULL, &throwaway);
if(FAILED(hr))
{
@@ -1433,6 +1440,8 @@ ResourceId D3D11Replay::CreateProxyTexture(FetchTexture templateTex)
return ResourceId();
}
resource = throwaway;
ret = ((WrappedID3D11Texture2D *)throwaway)->GetResourceID();
if(templateTex.creationFlags & eTextureCreate_DSV)
WrappedID3D11Texture2D::m_TextureList[ret].m_Type = TEXDISPLAY_DEPTH_TARGET;
@@ -1463,6 +1472,8 @@ ResourceId D3D11Replay::CreateProxyTexture(FetchTexture templateTex)
return ResourceId();
}
resource = throwaway;
ret = ((WrappedID3D11Texture3D *)throwaway)->GetResourceID();
}
else
@@ -1470,6 +1481,12 @@ ResourceId D3D11Replay::CreateProxyTexture(FetchTexture templateTex)
RDCERR("Invalid texture dimension: %d", templateTex.dimension);
}
if(resource != NULL && templateTex.customName)
{
string name = narrow(wstring(templateTex.name.elems));
SetDebugName(resource, name.c_str());
}
return ret;
}