mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-22 21:55:52 +00:00
Make minmax/histogram aware of custom shaders. Refs #385
* This moves those functions relative to an output instead of the renderer, so they pick up the settings etc from the output configuration.
This commit is contained in:
@@ -162,6 +162,10 @@ struct IReplayOutput
|
||||
virtual bool SetPixelContextLocation(uint32_t x, uint32_t y) = 0;
|
||||
virtual void DisablePixelContext() = 0;
|
||||
|
||||
virtual bool GetMinMax(PixelValue *minval, PixelValue *maxval) = 0;
|
||||
virtual bool GetHistogram(float minval, float maxval, bool channels[4],
|
||||
rdctype::array<uint32_t> *histogram) = 0;
|
||||
|
||||
virtual bool PickPixel(ResourceId texID, bool customShader, uint32_t x, uint32_t y,
|
||||
uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *val) = 0;
|
||||
};
|
||||
@@ -205,6 +209,13 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_DisablePixelContext(Repl
|
||||
extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_GetCustomShaderTexID(ReplayOutput *output,
|
||||
ResourceId *id);
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_GetMinMax(ReplayOutput *output,
|
||||
PixelValue *minval,
|
||||
PixelValue *maxval);
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
ReplayOutput_GetHistogram(ReplayOutput *output, float minval, float maxval, bool32 channels[4],
|
||||
rdctype::array<uint32_t> *histogram);
|
||||
|
||||
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);
|
||||
@@ -279,12 +290,6 @@ struct IReplayRenderer
|
||||
|
||||
virtual bool GetPostVSData(uint32_t instID, MeshDataStage stage, MeshFormat *data) = 0;
|
||||
|
||||
virtual bool GetMinMax(ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, PixelValue *minval, PixelValue *maxval) = 0;
|
||||
virtual bool GetHistogram(ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, float minval, float maxval,
|
||||
bool channels[4], rdctype::array<uint32_t> *histogram) = 0;
|
||||
|
||||
virtual bool GetBufferData(ResourceId buff, uint64_t offset, uint64_t len,
|
||||
rdctype::array<byte> *data) = 0;
|
||||
virtual bool GetTextureData(ResourceId tex, uint32_t arrayIdx, uint32_t mip,
|
||||
@@ -405,14 +410,6 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetPostVSData(Replay
|
||||
MeshDataStage stage,
|
||||
MeshFormat *data);
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetMinMax(
|
||||
ReplayRenderer *rend, ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, PixelValue *minval, PixelValue *maxval);
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
ReplayRenderer_GetHistogram(ReplayRenderer *rend, ResourceId tex, uint32_t sliceFace, uint32_t mip,
|
||||
uint32_t sample, FormatComponentType typeHint, float minval,
|
||||
float maxval, bool32 channels[4], rdctype::array<uint32_t> *histogram);
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetBufferData(
|
||||
ReplayRenderer *rend, ResourceId buff, uint64_t offset, uint64_t len, rdctype::array<byte> *data);
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
|
||||
@@ -292,6 +292,68 @@ bool ReplayOutput::AddThumbnail(WindowingSystem system, void *data, ResourceId t
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayOutput::GetMinMax(PixelValue *minval, PixelValue *maxval)
|
||||
{
|
||||
PixelValue *a = minval;
|
||||
PixelValue *b = maxval;
|
||||
|
||||
PixelValue dummy;
|
||||
|
||||
if(a == NULL)
|
||||
a = &dummy;
|
||||
if(b == NULL)
|
||||
b = &dummy;
|
||||
|
||||
ResourceId tex = m_pDevice->GetLiveID(m_RenderData.texDisplay.texid);
|
||||
|
||||
FormatComponentType typeHint = m_RenderData.texDisplay.typeHint;
|
||||
uint32_t slice = m_RenderData.texDisplay.sliceFace;
|
||||
uint32_t mip = m_RenderData.texDisplay.mip;
|
||||
uint32_t sample = m_RenderData.texDisplay.sampleIdx;
|
||||
|
||||
if(m_RenderData.texDisplay.CustomShader != ResourceId() && m_CustomShaderResourceId != ResourceId())
|
||||
{
|
||||
tex = m_CustomShaderResourceId;
|
||||
typeHint = eCompType_None;
|
||||
slice = 0;
|
||||
sample = 0;
|
||||
}
|
||||
|
||||
return m_pDevice->GetMinMax(tex, slice, mip, sample, typeHint, &a->value_f[0], &b->value_f[0]);
|
||||
}
|
||||
|
||||
bool ReplayOutput::GetHistogram(float minval, float maxval, bool channels[4],
|
||||
rdctype::array<uint32_t> *histogram)
|
||||
{
|
||||
if(histogram == NULL)
|
||||
return false;
|
||||
|
||||
vector<uint32_t> hist;
|
||||
|
||||
ResourceId tex = m_pDevice->GetLiveID(m_RenderData.texDisplay.texid);
|
||||
|
||||
FormatComponentType typeHint = m_RenderData.texDisplay.typeHint;
|
||||
uint32_t slice = m_RenderData.texDisplay.sliceFace;
|
||||
uint32_t mip = m_RenderData.texDisplay.mip;
|
||||
uint32_t sample = m_RenderData.texDisplay.sampleIdx;
|
||||
|
||||
if(m_RenderData.texDisplay.CustomShader != ResourceId() && m_CustomShaderResourceId != ResourceId())
|
||||
{
|
||||
tex = m_CustomShaderResourceId;
|
||||
typeHint = eCompType_None;
|
||||
slice = 0;
|
||||
sample = 0;
|
||||
}
|
||||
|
||||
bool ret =
|
||||
m_pDevice->GetHistogram(tex, slice, mip, sample, typeHint, minval, maxval, channels, hist);
|
||||
|
||||
if(ret)
|
||||
*histogram = hist;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ReplayOutput::PickPixel(ResourceId tex, bool customShader, uint32_t x, uint32_t y,
|
||||
uint32_t sliceFace, uint32_t mip, uint32_t sample, PixelValue *ret)
|
||||
{
|
||||
@@ -813,6 +875,20 @@ extern "C" RENDERDOC_API void RENDERDOC_CC ReplayOutput_GetCustomShaderTexID(Rep
|
||||
*id = output->GetCustomShaderTexID();
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayOutput_GetMinMax(ReplayOutput *output,
|
||||
PixelValue *minval,
|
||||
PixelValue *maxval)
|
||||
{
|
||||
return output->GetMinMax(minval, maxval);
|
||||
}
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
ReplayOutput_GetHistogram(ReplayOutput *output, float minval, float maxval, bool32 channels[4],
|
||||
rdctype::array<uint32_t> *histogram)
|
||||
{
|
||||
bool chans[4] = {channels[0] != 0, channels[1] != 0, channels[2] != 0, channels[3] != 0};
|
||||
return output->GetHistogram(minval, maxval, chans, histogram);
|
||||
}
|
||||
|
||||
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)
|
||||
|
||||
@@ -397,41 +397,6 @@ bool ReplayRenderer::GetPostVSData(uint32_t instID, MeshDataStage stage, MeshFor
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ReplayRenderer::GetMinMax(ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, PixelValue *minval, PixelValue *maxval)
|
||||
{
|
||||
PixelValue *a = minval;
|
||||
PixelValue *b = maxval;
|
||||
|
||||
PixelValue dummy;
|
||||
|
||||
if(a == NULL)
|
||||
a = &dummy;
|
||||
if(b == NULL)
|
||||
b = &dummy;
|
||||
|
||||
return m_pDevice->GetMinMax(m_pDevice->GetLiveID(tex), sliceFace, mip, sample, typeHint,
|
||||
&a->value_f[0], &b->value_f[0]);
|
||||
}
|
||||
|
||||
bool ReplayRenderer::GetHistogram(ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, float minval, float maxval,
|
||||
bool channels[4], rdctype::array<uint32_t> *histogram)
|
||||
{
|
||||
if(histogram == NULL)
|
||||
return false;
|
||||
|
||||
vector<uint32_t> hist;
|
||||
|
||||
bool ret = m_pDevice->GetHistogram(m_pDevice->GetLiveID(tex), sliceFace, mip, sample, typeHint,
|
||||
minval, maxval, channels, hist);
|
||||
|
||||
if(ret)
|
||||
*histogram = hist;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
bool ReplayRenderer::GetBufferData(ResourceId buff, uint64_t offset, uint64_t len,
|
||||
rdctype::array<byte> *data)
|
||||
{
|
||||
@@ -1892,21 +1857,6 @@ extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetPostVSData(Replay
|
||||
return rend->GetPostVSData(instID, stage, data);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetMinMax(
|
||||
ReplayRenderer *rend, ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, PixelValue *minval, PixelValue *maxval)
|
||||
{
|
||||
return rend->GetMinMax(tex, sliceFace, mip, sample, typeHint, minval, maxval);
|
||||
}
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC
|
||||
ReplayRenderer_GetHistogram(ReplayRenderer *rend, ResourceId tex, uint32_t sliceFace, uint32_t mip,
|
||||
uint32_t sample, FormatComponentType typeHint, float minval,
|
||||
float maxval, bool32 channels[4], rdctype::array<uint32_t> *histogram)
|
||||
{
|
||||
bool chans[4] = {channels[0] != 0, channels[1] != 0, channels[2] != 0, channels[3] != 0};
|
||||
return rend->GetHistogram(tex, sliceFace, mip, sample, typeHint, minval, maxval, chans, histogram);
|
||||
}
|
||||
|
||||
extern "C" RENDERDOC_API bool32 RENDERDOC_CC ReplayRenderer_GetBufferData(
|
||||
ReplayRenderer *rend, ResourceId buff, uint64_t offset, uint64_t len, rdctype::array<byte> *data)
|
||||
{
|
||||
|
||||
@@ -53,6 +53,10 @@ public:
|
||||
bool SetPixelContextLocation(uint32_t x, uint32_t y);
|
||||
void DisablePixelContext();
|
||||
|
||||
bool GetMinMax(PixelValue *minval, PixelValue *maxval);
|
||||
bool GetHistogram(float minval, float maxval, bool channels[4],
|
||||
rdctype::array<uint32_t> *histogram);
|
||||
|
||||
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);
|
||||
@@ -172,12 +176,6 @@ public:
|
||||
|
||||
bool GetPostVSData(uint32_t instID, MeshDataStage stage, MeshFormat *data);
|
||||
|
||||
bool GetMinMax(ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, PixelValue *minval, PixelValue *maxval);
|
||||
bool GetHistogram(ResourceId tex, uint32_t sliceFace, uint32_t mip, uint32_t sample,
|
||||
FormatComponentType typeHint, float minval, float maxval, bool channels[4],
|
||||
rdctype::array<uint32_t> *histogram);
|
||||
|
||||
bool GetUsage(ResourceId id, rdctype::array<EventUsage> *usage);
|
||||
|
||||
bool GetBufferData(ResourceId buff, uint64_t offset, uint64_t len, rdctype::array<byte> *data);
|
||||
|
||||
Reference in New Issue
Block a user