MCPcopy Create free account
hub / github.com/baldurk/renderdoc / on_saveTex_clicked

Method on_saveTex_clicked

qrenderdoc/Windows/TextureViewer.cpp:4014–4099  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4012}
4013
4014void TextureViewer::on_saveTex_clicked()
4015{
4016 TextureDescription *texptr = GetCurrentTexture();
4017
4018 if(!texptr || !m_Output)
4019 return;
4020
4021 // overwrite save params with current texture display settings
4022 m_SaveConfig.resourceId = m_TexDisplay.resourceId;
4023 m_SaveConfig.typeCast = m_TexDisplay.typeCast;
4024 m_SaveConfig.slice.sliceIndex = (int)m_TexDisplay.subresource.slice;
4025 m_SaveConfig.mip = (int)m_TexDisplay.subresource.mip;
4026
4027 m_SaveConfig.channelExtract = -1;
4028 if(m_TexDisplay.red && !m_TexDisplay.green && !m_TexDisplay.blue && !m_TexDisplay.alpha)
4029 m_SaveConfig.channelExtract = 0;
4030 if(!m_TexDisplay.red && m_TexDisplay.green && !m_TexDisplay.blue && !m_TexDisplay.alpha)
4031 m_SaveConfig.channelExtract = 1;
4032 if(!m_TexDisplay.red && !m_TexDisplay.green && m_TexDisplay.blue && !m_TexDisplay.alpha)
4033 m_SaveConfig.channelExtract = 2;
4034 if(!m_TexDisplay.red && !m_TexDisplay.green && !m_TexDisplay.blue && m_TexDisplay.alpha)
4035 m_SaveConfig.channelExtract = 3;
4036
4037 m_SaveConfig.comp.blackPoint = m_TexDisplay.rangeMin;
4038 m_SaveConfig.comp.whitePoint = m_TexDisplay.rangeMax;
4039 m_SaveConfig.alphaCol = m_TexDisplay.backgroundColor;
4040
4041 if(m_TexDisplay.customShaderId != ResourceId())
4042 {
4043 ResourceId id;
4044 m_Ctx.Replay().BlockInvoke(
4045 [this, &id](IReplayController *r) { id = m_Output->GetCustomShaderTexID(); });
4046
4047 if(id != ResourceId())
4048 {
4049 m_SaveConfig.resourceId = id;
4050 m_SaveConfig.typeCast = CompType::Typeless;
4051 }
4052 }
4053
4054 ResourceId overlayTexID;
4055 if(m_TexDisplay.overlay != DebugOverlay::NoOverlay)
4056 {
4057 m_Ctx.Replay().BlockInvoke([this, &overlayTexID](IReplayController *r) {
4058 overlayTexID = m_Output->GetDebugOverlayTexID();
4059 });
4060 }
4061 const bool hasSelectedOverlay = (m_TexDisplay.overlay != DebugOverlay::NoOverlay);
4062 const bool hasOverlay = (hasSelectedOverlay && overlayTexID != ResourceId());
4063 TextureSaveDialog saveDialog(*texptr, hasOverlay, m_SaveConfig, this);
4064 int res = RDDialog::show(&saveDialog);
4065
4066 m_SaveConfig = saveDialog.config();
4067
4068 if(saveDialog.saveOverlayInstead())
4069 {
4070 m_SaveConfig.resourceId = overlayTexID;
4071 m_SaveConfig.typeCast = CompType::Typeless;

Callers

nothing calls this directly

Calls 12

criticalFunction · 0.85
BlockInvokeMethod · 0.80
GetCustomShaderTexIDMethod · 0.80
GetDebugOverlayTexIDMethod · 0.80
saveOverlayInsteadMethod · 0.80
SaveTextureMethod · 0.80
ResourceIdFunction · 0.50
showFunction · 0.50
trFunction · 0.50
configMethod · 0.45
filenameMethod · 0.45
argMethod · 0.45

Tested by

no test coverage detected