Use a checkerboard instead of a fixed colour for unbound thumbnails

This commit is contained in:
baldurk
2020-07-15 17:27:06 +01:00
parent f0e397bb99
commit ee17cfee65
13 changed files with 49 additions and 40 deletions
+4 -1
View File
@@ -107,7 +107,10 @@ public:
void BindOutputWindow(uint64_t id, bool depth) { m_Proxy->BindOutputWindow(id, depth); }
bool IsOutputWindowVisible(uint64_t id) { return m_Proxy->IsOutputWindowVisible(id); }
void FlipOutputWindow(uint64_t id) { m_Proxy->FlipOutputWindow(id); }
void RenderCheckerboard() { m_Proxy->RenderCheckerboard(); }
void RenderCheckerboard(FloatVector dark, FloatVector light)
{
m_Proxy->RenderCheckerboard(dark, light);
}
void RenderHighlightBox(float w, float h, float scale)
{
m_Proxy->RenderHighlightBox(w, h, scale);
+2 -1
View File
@@ -2509,7 +2509,8 @@ void ReplayProxy::RefreshPreviewWindow()
int32_t winHeight = 1;
m_Replay->GetOutputWindowDimensions(m_PreviewOutput, winWidth, winHeight);
m_Replay->RenderCheckerboard();
m_Replay->RenderCheckerboard(RenderDoc::Inst().DarkCheckerboardColor(),
RenderDoc::Inst().LightCheckerboardColor());
const DrawcallDescription *curDraw = FindDraw(m_FrameRecord.drawcallList, m_EventID);
+2 -2
View File
@@ -236,10 +236,10 @@ public:
return m_Proxy->FlipOutputWindow(id);
}
void RenderCheckerboard()
void RenderCheckerboard(FloatVector dark, FloatVector light)
{
if(m_Proxy)
return m_Proxy->RenderCheckerboard();
return m_Proxy->RenderCheckerboard(dark, light);
}
void RenderHighlightBox(float w, float h, float scale)
+3 -3
View File
@@ -2701,14 +2701,14 @@ bool D3D11Replay::RenderTexture(TextureDisplay cfg)
return RenderTextureInternal(cfg, eTexDisplay_BlendAlpha);
}
void D3D11Replay::RenderCheckerboard()
void D3D11Replay::RenderCheckerboard(FloatVector dark, FloatVector light)
{
D3D11RenderStateTracker tracker(m_pImmediateContext);
CheckerboardCBuffer pixelData = {};
pixelData.PrimaryColor = ConvertSRGBToLinear(RenderDoc::Inst().DarkCheckerboardColor());
pixelData.SecondaryColor = ConvertSRGBToLinear(RenderDoc::Inst().LightCheckerboardColor());
pixelData.PrimaryColor = ConvertSRGBToLinear(dark);
pixelData.SecondaryColor = ConvertSRGBToLinear(light);
pixelData.CheckerSquareDimension = 64.0f;
ID3D11Buffer *psBuf = GetDebugManager()->MakeCBuffer(&pixelData, sizeof(pixelData));
+1 -1
View File
@@ -221,7 +221,7 @@ public:
bool RenderTexture(TextureDisplay cfg);
void RenderCheckerboard();
void RenderCheckerboard(FloatVector dark, FloatVector light);
void RenderHighlightBox(float w, float h, float scale);
+3 -3
View File
@@ -1680,12 +1680,12 @@ void D3D12Replay::RenderHighlightBox(float w, float h, float scale)
}
}
void D3D12Replay::RenderCheckerboard()
void D3D12Replay::RenderCheckerboard(FloatVector dark, FloatVector light)
{
CheckerboardCBuffer pixelData = {};
pixelData.PrimaryColor = ConvertSRGBToLinear(RenderDoc::Inst().DarkCheckerboardColor());
pixelData.SecondaryColor = ConvertSRGBToLinear(RenderDoc::Inst().LightCheckerboardColor());
pixelData.PrimaryColor = ConvertSRGBToLinear(dark);
pixelData.SecondaryColor = ConvertSRGBToLinear(light);
pixelData.CheckerSquareDimension = 64.0f;
D3D12_GPU_VIRTUAL_ADDRESS ps = GetDebugManager()->UploadConstants(&pixelData, sizeof(pixelData));
+1 -1
View File
@@ -176,7 +176,7 @@ public:
bool RenderTexture(TextureDisplay cfg);
void RenderCheckerboard();
void RenderCheckerboard(FloatVector dark, FloatVector light);
void RenderHighlightBox(float w, float h, float scale);
+3 -3
View File
@@ -2634,7 +2634,7 @@ uint32_t GLReplay::PickVertex(uint32_t eventId, int32_t width, int32_t height,
return ret;
}
void GLReplay::RenderCheckerboard()
void GLReplay::RenderCheckerboard(FloatVector dark, FloatVector light)
{
MakeCurrentReplayContext(m_DebugCtx);
@@ -2659,8 +2659,8 @@ void GLReplay::RenderCheckerboard()
ubo->CheckerSquareDimension = 64.0f;
ubo->InnerColor = Vec4f();
ubo->PrimaryColor = ConvertSRGBToLinear(RenderDoc::Inst().DarkCheckerboardColor());
ubo->SecondaryColor = ConvertSRGBToLinear(RenderDoc::Inst().LightCheckerboardColor());
ubo->PrimaryColor = ConvertSRGBToLinear(dark);
ubo->SecondaryColor = ConvertSRGBToLinear(light);
drv.glUnmapBuffer(eGL_UNIFORM_BUFFER);
+1 -1
View File
@@ -208,7 +208,7 @@ public:
bool RenderTexture(TextureDisplay cfg);
bool RenderTextureInternal(TextureDisplay cfg, TexDisplayFlags flags);
void RenderCheckerboard();
void RenderCheckerboard(FloatVector dark, FloatVector light);
void RenderHighlightBox(float w, float h, float scale);
+8 -12
View File
@@ -720,7 +720,7 @@ rdcstr VulkanReplay::DisassembleShader(ResourceId pipeline, const ShaderReflecti
return StringFormat::Fmt("; Invalid disassembly target %s", target.c_str());
}
void VulkanReplay::RenderCheckerboard()
void VulkanReplay::RenderCheckerboard(FloatVector dark, FloatVector light)
{
auto it = m_OutputWindows.find(m_ActiveWinID);
if(m_ActiveWinID == 0 || it == m_OutputWindows.end())
@@ -768,8 +768,8 @@ void VulkanReplay::RenderCheckerboard()
data->CheckerSquareDimension = 64.0f;
data->InnerColor = Vec4f();
data->PrimaryColor = ConvertSRGBToLinear(RenderDoc::Inst().DarkCheckerboardColor());
data->SecondaryColor = ConvertSRGBToLinear(RenderDoc::Inst().LightCheckerboardColor());
data->PrimaryColor = ConvertSRGBToLinear(light);
data->SecondaryColor = ConvertSRGBToLinear(dark);
m_Overlay.m_CheckerUBO.Unmap();
vt->CmdBindPipeline(Unwrap(cmd), VK_PIPELINE_BIND_POINT_GRAPHICS,
@@ -797,13 +797,9 @@ void VulkanReplay::RenderCheckerboard()
// some mobile chips fail to create the checkerboard pipeline. Use an alternate approach with
// CmdClearAttachment and many rects.
Vec4f lightCol = RenderDoc::Inst().LightCheckerboardColor();
Vec4f darkCol = RenderDoc::Inst().DarkCheckerboardColor();
VkClearAttachment light = {
VK_IMAGE_ASPECT_COLOR_BIT, 0, {{{lightCol.x, lightCol.y, lightCol.z, lightCol.w}}}};
VkClearAttachment dark = {
VK_IMAGE_ASPECT_COLOR_BIT, 0, {{{darkCol.x, darkCol.y, darkCol.z, darkCol.w}}}};
VkClearAttachment lightCol = {
VK_IMAGE_ASPECT_COLOR_BIT, 0, {{{light.x, light.y, light.z, light.w}}}};
VkClearAttachment darkCol = {VK_IMAGE_ASPECT_COLOR_BIT, 0, {{{dark.x, dark.y, dark.z, dark.w}}}};
VkClearRect fullRect = {{
{0, 0}, {outw.width, outw.height},
@@ -811,7 +807,7 @@ void VulkanReplay::RenderCheckerboard()
0,
1};
vt->CmdClearAttachments(Unwrap(cmd), 1, &light, 1, &fullRect);
vt->CmdClearAttachments(Unwrap(cmd), 1, &lightCol, 1, &fullRect);
rdcarray<VkClearRect> squares;
@@ -833,7 +829,7 @@ void VulkanReplay::RenderCheckerboard()
}
}
vt->CmdClearAttachments(Unwrap(cmd), 1, &dark, (uint32_t)squares.size(), squares.data());
vt->CmdClearAttachments(Unwrap(cmd), 1, &darkCol, (uint32_t)squares.size(), squares.data());
}
vt->CmdEndRenderPass(Unwrap(cmd));
+1 -1
View File
@@ -366,7 +366,7 @@ public:
bool RenderTexture(TextureDisplay cfg);
void RenderCheckerboard();
void RenderCheckerboard(FloatVector dark, FloatVector light);
void RenderHighlightBox(float w, float h, float scale);
+1 -1
View File
@@ -270,7 +270,7 @@ public:
CompType typeCast) = 0;
virtual void FreeCustomShader(ResourceId id) = 0;
virtual void RenderCheckerboard() = 0;
virtual void RenderCheckerboard(FloatVector dark, FloatVector light) = 0;
virtual void RenderHighlightBox(float w, float h, float scale) = 0;
+19 -10
View File
@@ -492,7 +492,8 @@ void ReplayOutput::ClearBackground(uint64_t outputID, const FloatVector &backgro
m_RenderData.texDisplay.backgroundColor.y == 0.0f &&
m_RenderData.texDisplay.backgroundColor.z == 0.0f &&
m_RenderData.texDisplay.backgroundColor.w == 0.0f)
m_pDevice->RenderCheckerboard();
m_pDevice->RenderCheckerboard(RenderDoc::Inst().DarkCheckerboardColor(),
RenderDoc::Inst().LightCheckerboardColor());
else
m_pDevice->ClearOutputWindowColor(outputID, m_RenderData.texDisplay.backgroundColor);
}
@@ -619,14 +620,20 @@ void ReplayOutput::Display()
{
m_pDevice->BindOutputWindow(m_Thumbnails[i].outputID, false);
Vec4f dark = RenderDoc::Inst().DarkCheckerboardColor();
Vec4f light = RenderDoc::Inst().LightCheckerboardColor();
FloatVector dark = RenderDoc::Inst().DarkCheckerboardColor();
FloatVector light = RenderDoc::Inst().LightCheckerboardColor();
color.x = light.x;
color.y = dark.y;
color.z = dark.z;
color.w = 0.4f;
m_pDevice->ClearOutputWindowColor(m_Thumbnails[i].outputID, color);
FloatVector dark2;
dark2.x = light.x;
dark2.y = dark.y;
dark2.z = dark.z;
dark2.w = 0.4f;
FloatVector light2;
light2.x = dark.x;
light2.y = light.y;
light2.z = light.z;
light2.w = 0.4f;
m_pDevice->RenderCheckerboard(dark2, light2);
m_pDevice->FlipOutputWindow(m_Thumbnails[i].outputID);
continue;
@@ -770,7 +777,8 @@ void ReplayOutput::DisplayMesh()
m_pDevice->BindOutputWindow(m_MainOutput.outputID, false);
m_pDevice->ClearOutputWindowColor(m_MainOutput.outputID, color);
m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);
m_pDevice->RenderCheckerboard();
m_pDevice->RenderCheckerboard(RenderDoc::Inst().DarkCheckerboardColor(),
RenderDoc::Inst().LightCheckerboardColor());
return;
}
@@ -785,7 +793,8 @@ void ReplayOutput::DisplayMesh()
m_pDevice->BindOutputWindow(m_MainOutput.outputID, true);
m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);
m_pDevice->RenderCheckerboard();
m_pDevice->RenderCheckerboard(RenderDoc::Inst().DarkCheckerboardColor(),
RenderDoc::Inst().LightCheckerboardColor());
m_pDevice->ClearOutputWindowDepth(m_MainOutput.outputID, 1.0f, 0);