mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-05 01:20:42 +00:00
If displaying via a custom shader when saving texture, save that output
This commit is contained in:
@@ -152,6 +152,8 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetPixelContext(Replay
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetPixelContextLocation(ReplayOutput *output, uint32_t x, uint32_t y);
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_DisablePixelContext(ReplayOutput *output);
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_GetCustomShaderTexID(ReplayOutput *output, ResourceId *id);
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_PickPixel(ReplayOutput *output, ResourceId texID, bool32 customShader,
|
||||
uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *val);
|
||||
extern "C" RENDERDOC_API uint32_t RENDERDOC_CC ReplayOutput_PickVertex(ReplayOutput *output, uint32_t frameID, uint32_t eventID, uint32_t x, uint32_t y);
|
||||
|
||||
@@ -669,6 +669,9 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_SetPixelContextLocatio
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_DisablePixelContext(ReplayOutput *output)
|
||||
{ output->DisablePixelContext(); }
|
||||
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_GetCustomShaderTexID(ReplayOutput *output, ResourceId *id)
|
||||
{ if(id) *id = output->GetCustomShaderTexID(); }
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_PickPixel(ReplayOutput *output, ResourceId texID, bool32 customShader,
|
||||
uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *val)
|
||||
{ return output->PickPixel(texID, customShader != 0, x, y, sliceFace, mip, sample, val); }
|
||||
|
||||
@@ -55,6 +55,8 @@ public:
|
||||
bool SetPixelContextLocation(uint32_t x, uint32_t y);
|
||||
void DisablePixelContext();
|
||||
|
||||
ResourceId GetCustomShaderTexID() { return m_CustomShaderResourceId; }
|
||||
|
||||
bool PickPixel(ResourceId texID, bool customShader,
|
||||
uint32_t x, uint32_t y, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
PixelValue *val);
|
||||
|
||||
@@ -98,6 +98,9 @@ namespace renderdoc
|
||||
private static extern bool ReplayOutput_SetPixelContextLocation(IntPtr real, UInt32 x, UInt32 y);
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void ReplayOutput_DisablePixelContext(IntPtr real);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern void ReplayOutput_GetCustomShaderTexID(IntPtr real, ref ResourceId texid);
|
||||
|
||||
[DllImport("renderdoc.dll", CharSet = CharSet.Unicode, CallingConvention = CallingConvention.Cdecl)]
|
||||
private static extern bool ReplayOutput_PickPixel(IntPtr real, ResourceId texID, bool customShader,
|
||||
@@ -149,6 +152,15 @@ namespace renderdoc
|
||||
ReplayOutput_DisablePixelContext(m_Real);
|
||||
}
|
||||
|
||||
public ResourceId GetCustomShaderTexID()
|
||||
{
|
||||
ResourceId ret = ResourceId.Null;
|
||||
|
||||
ReplayOutput_GetCustomShaderTexID(m_Real, ref ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public PixelValue PickPixel(ResourceId texID, bool customShader, UInt32 x, UInt32 y, UInt32 sliceFace, UInt32 mip, UInt32 sample)
|
||||
{
|
||||
IntPtr mem = CustomMarshal.Alloc(typeof(PixelValue));
|
||||
|
||||
@@ -3417,6 +3417,16 @@ namespace renderdocui.Windows
|
||||
if (m_TexDisplay.Alpha && !checkerBack.Checked) m_SaveDialog.saveData.alpha = AlphaMapping.BlendToColour;
|
||||
m_SaveDialog.tex = CurrentTexture;
|
||||
|
||||
if (m_TexDisplay.CustomShader != ResourceId.Null)
|
||||
{
|
||||
m_Core.Renderer.Invoke((ReplayRenderer r) =>
|
||||
{
|
||||
ResourceId id = m_Output.GetCustomShaderTexID();
|
||||
if(id != ResourceId.Null)
|
||||
m_SaveDialog.saveData.id = id;
|
||||
});
|
||||
}
|
||||
|
||||
if(m_SaveDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
Reference in New Issue
Block a user