Move SaveTexture logic to replay layer

* Expand the abilities of the GetTextureData in replay drivers
  to be able to resolve samples and render down to RGBA8 unorm
  for file export to other programs.
* Greatly improve the ability to save textures - in theory any
  texture format/type/dimension/etc should now be mappable in
  sensible & useful ways to output formats.
This commit is contained in:
baldurk
2014-09-14 16:01:36 +01:00
parent 9f62428f7f
commit 326ca2ebe8
18 changed files with 1213 additions and 55 deletions
+9 -4
View File
@@ -703,7 +703,7 @@ void ProxySerialiser::EnsureCached(ResourceId texid, uint32_t arrayIdx, uint32_t
ResourceId proxyid = m_ProxyTextureIds[texid];
size_t size;
byte *data = GetTextureData(texid, arrayIdx, mip, size);
byte *data = GetTextureData(texid, arrayIdx, mip, false, false, 0.0f, 0.0f, size);
if(data)
m_Proxy->SetProxyTextureData(proxyid, arrayIdx, mip, data, size);
@@ -799,7 +799,7 @@ bool ProxySerialiser::Tick()
case eCommand_GetTextureData:
{
size_t dummy;
GetTextureData(ResourceId(), 0, 0, dummy);
GetTextureData(ResourceId(), 0, 0, false, false, 0.0f, 0.0f, dummy);
break;
}
case eCommand_InitPostVS:
@@ -1222,15 +1222,20 @@ vector<byte> ProxySerialiser::GetBufferData(ResourceId buff, uint32_t offset, ui
return ret;
}
byte *ProxySerialiser::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, size_t &dataSize)
byte *ProxySerialiser::GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip, bool resolve, bool forceRGBA8unorm,
float blackPoint, float whitePoint, size_t &dataSize)
{
m_ToReplaySerialiser->Serialise("", tex);
m_ToReplaySerialiser->Serialise("", arrayIdx);
m_ToReplaySerialiser->Serialise("", mip);
m_ToReplaySerialiser->Serialise("", resolve);
m_ToReplaySerialiser->Serialise("", forceRGBA8unorm);
m_ToReplaySerialiser->Serialise("", blackPoint);
m_ToReplaySerialiser->Serialise("", whitePoint);
if(m_ReplayHost)
{
byte *data = m_Remote->GetTextureData(tex, arrayIdx, mip, dataSize);
byte *data = m_Remote->GetTextureData(tex, arrayIdx, mip, resolve, forceRGBA8unorm, blackPoint, whitePoint, dataSize);
byte *compressed = new byte[dataSize+512];