mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-08-26 08:26:50 +00:00
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:
@@ -2702,13 +2702,46 @@ namespace renderdocui.Windows
|
||||
|
||||
private void saveTex_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (saveTextureDialog.ShowDialog() == DialogResult.OK)
|
||||
//if (saveTextureDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
TextureSave sd = new TextureSave();
|
||||
|
||||
sd.destType = FileType.DDS;
|
||||
saveTextureDialog.FileName = "T:/tmp/a.dds";
|
||||
|
||||
sd.id = m_TexDisplay.texid;
|
||||
|
||||
sd.slice.sliceIndex = (int)m_TexDisplay.sliceFace;
|
||||
if (sd.destType == FileType.DDS)
|
||||
sd.slice.sliceIndex = -1;
|
||||
|
||||
sd.mip = (int)m_TexDisplay.mip;
|
||||
if (sd.destType == FileType.DDS)
|
||||
sd.mip = -1;
|
||||
|
||||
if (sd.destType == FileType.DDS)
|
||||
{
|
||||
sd.sample.mapToArray = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
sd.sample.mapToArray = false;
|
||||
sd.sample.sampleIndex = m_TexDisplay.sampleIdx;
|
||||
}
|
||||
|
||||
sd.comp.blackPoint = m_TexDisplay.rangemin;
|
||||
sd.comp.whitePoint = m_TexDisplay.rangemax;
|
||||
|
||||
sd.alphaCol = m_TexDisplay.lightBackgroundColour;
|
||||
sd.alphaColSecondary = m_TexDisplay.darkBackgroundColour;
|
||||
|
||||
sd.alpha = m_TexDisplay.Alpha ? AlphaMapping.BlendToCheckerboard : AlphaMapping.Discard;
|
||||
|
||||
bool ret = false;
|
||||
|
||||
m_Core.Renderer.Invoke((ReplayRenderer r) =>
|
||||
{
|
||||
ret = r.SaveTexture(m_TexDisplay.texid, m_TexDisplay.mip, saveTextureDialog.FileName);
|
||||
ret = r.SaveTexture(sd, saveTextureDialog.FileName);
|
||||
});
|
||||
|
||||
if(!ret)
|
||||
|
||||
Reference in New Issue
Block a user