[add] Render Debugger
This commit is contained in:
@@ -34,14 +34,17 @@ void CBuildingContainer::Update(_float fTimeDelta)
|
||||
|
||||
void CBuildingContainer::Late_Update(_float fTimeDelta)
|
||||
{
|
||||
const _float fDepthOcclusionThreshold = m_pGameInstance->Get_DepthOcclusionThreshold();
|
||||
|
||||
if (m_pGameInstance->IsIn_WorldFrustum(XMVectorSetW(XMLoadFloat3(&m_vExtentWorldPosition), 1.f), m_fRadius)) {
|
||||
if (m_fCamDepth > 300.f)
|
||||
if (m_fCamDepth > fDepthOcclusionThreshold)
|
||||
{
|
||||
if (m_pOcclusionQueryCom->isDraw())
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
else
|
||||
else {
|
||||
__super::Late_Update(fTimeDelta);
|
||||
}
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::OCCLUSION, this);
|
||||
|
||||
|
||||
@@ -89,8 +89,8 @@ void CMapObject_Render::Late_Update(_float fTimeDelta)
|
||||
m_iNumMeshe = m_pModelComs[m_iLodIndex]->Get_NumMeshes();
|
||||
|
||||
m_pGameInstance->Add_RenderGroup(RENDER::NONBLEND, this);
|
||||
Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius()));
|
||||
}
|
||||
Set_Shadow(m_pGameInstance->IsIn_ShadowViewFrustum(m_pTransformCom->Get_State(STATE::POSITION), m_pTransformCom->Get_Radius()));
|
||||
}
|
||||
|
||||
HRESULT CMapObject_Render::Render()
|
||||
|
||||
@@ -253,6 +253,10 @@ void CRenderer::Render_Shadow()
|
||||
{
|
||||
COMPUTE_TIMEDELTA("Timer_Render_Shadow");
|
||||
EVENTSCOPE_("Render_Shadow");
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
m_ShadowNearBreakdown.Reset();
|
||||
m_ShadowMiddleBreakdown.Reset();
|
||||
#endif
|
||||
D3D11_VIEWPORT ViewPortOldDesc;
|
||||
_uint iNumViewOldPort = { 1 };
|
||||
ZeroMemory(&ViewPortOldDesc, sizeof(D3D11_VIEWPORT));
|
||||
@@ -292,7 +296,11 @@ void CRenderer::Render_Shadow()
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_NEAR)]) {
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR))) {
|
||||
const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render_Shadow(SHADOW::SHADOW_NEAR));
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
Collect_RenderBreakdown(m_ShadowNearBreakdown, pRenderObject, bRenderSuccess);
|
||||
#endif
|
||||
if (false == bRenderSuccess) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -326,7 +334,11 @@ void CRenderer::Render_Shadow()
|
||||
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::SHADOW_MIDDLE)]) {
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE))) {
|
||||
const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render_Shadow(SHADOW::SHADOW_MIDDLE));
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
Collect_RenderBreakdown(m_ShadowMiddleBreakdown, pRenderObject, bRenderSuccess);
|
||||
#endif
|
||||
if (false == bRenderSuccess) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -370,6 +382,9 @@ void CRenderer::Render_NonBlend()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_NonBlend");
|
||||
EVENTSCOPE_("Render_NonBlend");
|
||||
m_eType = RENDER::NONBLEND;
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
m_NonBlendBreakdown.Reset();
|
||||
#endif
|
||||
|
||||
if (FAILED(m_pGameInstance->Begin_MRT(TEXT("MRT_GameObjects")))) {
|
||||
return;
|
||||
@@ -378,7 +393,11 @@ void CRenderer::Render_NonBlend()
|
||||
for (auto& pRenderObject : m_RenderObjects[ENUM_CLASS(RENDER::NONBLEND)])
|
||||
{
|
||||
if (nullptr != pRenderObject) {
|
||||
if (FAILED(pRenderObject->Render())) {
|
||||
const _bool bRenderSuccess = SUCCEEDED(pRenderObject->Render());
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
Collect_RenderBreakdown(m_NonBlendBreakdown, pRenderObject, bRenderSuccess);
|
||||
#endif
|
||||
if (false == bRenderSuccess) {
|
||||
assert(false);
|
||||
}
|
||||
}
|
||||
@@ -393,6 +412,72 @@ void CRenderer::Render_NonBlend()
|
||||
COMPUTE_TIMEDELTA("Timer_Render_NonBlend");
|
||||
}
|
||||
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
void CRenderer::Collect_RenderBreakdown(RENDER_PASS_BREAKDOWN& Breakdown, CGameObject* pRenderObject, _bool bRenderResult)
|
||||
{
|
||||
if (nullptr == pRenderObject) {
|
||||
return;
|
||||
}
|
||||
|
||||
++Breakdown.iObjectCount;
|
||||
if (false == bRenderResult) {
|
||||
++Breakdown.iRenderFailCount;
|
||||
}
|
||||
|
||||
const _uint iObjectTag = pRenderObject->Get_ObjectTag();
|
||||
++Breakdown.ObjectTagCounts[iObjectTag];
|
||||
|
||||
const _string strTypeName = typeid(*pRenderObject).name();
|
||||
++Breakdown.ObjectTypeCounts[strTypeName];
|
||||
}
|
||||
|
||||
void CRenderer::Draw_RenderBreakdown(const _char* pTitle, const RENDER_PASS_BREAKDOWN& Breakdown, _uint iTopN)
|
||||
{
|
||||
if (nullptr == pTitle) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (GUI::TreeNode(pTitle))
|
||||
{
|
||||
GUI::Text("Objects: %u / Fail: %u", Breakdown.iObjectCount, Breakdown.iRenderFailCount);
|
||||
|
||||
if (GUI::TreeNode("Top Object Types"))
|
||||
{
|
||||
vector<pair<_string, _uint>> TypeCounts(
|
||||
Breakdown.ObjectTypeCounts.begin(), Breakdown.ObjectTypeCounts.end());
|
||||
sort(TypeCounts.begin(), TypeCounts.end(),
|
||||
[](const pair<_string, _uint>& Left, const pair<_string, _uint>& Right) {
|
||||
return Left.second > Right.second;
|
||||
});
|
||||
|
||||
const _uint iMaxCount = min<_uint>(iTopN, (_uint)TypeCounts.size());
|
||||
for (_uint i = 0; i < iMaxCount; ++i) {
|
||||
GUI::Text("%u) %s : %u", i + 1, TypeCounts[i].first.c_str(), TypeCounts[i].second);
|
||||
}
|
||||
GUI::TreePop();
|
||||
}
|
||||
|
||||
if (GUI::TreeNode("Top Object Tags"))
|
||||
{
|
||||
vector<pair<_uint, _uint>> TagCounts(
|
||||
Breakdown.ObjectTagCounts.begin(), Breakdown.ObjectTagCounts.end());
|
||||
sort(TagCounts.begin(), TagCounts.end(),
|
||||
[](const pair<_uint, _uint>& Left, const pair<_uint, _uint>& Right) {
|
||||
return Left.second > Right.second;
|
||||
});
|
||||
|
||||
const _uint iMaxCount = min<_uint>(iTopN, (_uint)TagCounts.size());
|
||||
for (_uint i = 0; i < iMaxCount; ++i) {
|
||||
GUI::Text("%u) Tag[%u] : %u", i + 1, TagCounts[i].first, TagCounts[i].second);
|
||||
}
|
||||
GUI::TreePop();
|
||||
}
|
||||
|
||||
GUI::TreePop();
|
||||
}
|
||||
}
|
||||
#endif // RELEASE_DEBUGGER
|
||||
|
||||
void CRenderer::Render_Decal()
|
||||
{
|
||||
m_pGameInstance->Copy_RenderTargetAToB(TEXT("Target_Normal"), TEXT("Target_NormalCopy"));
|
||||
|
||||
@@ -722,6 +722,10 @@ void CRenderer::Describe_Entitiy()
|
||||
GUI::DragFloat("SpecularMaximum", &m_fLightSpecularMaximum, 0.01f, 0.0f, 2.f, "%.3f");
|
||||
GUI::DragFloat("fMinShadowBrightness", &m_fMinShadowBrightness, 0.01f, 0.0f, 1.f, "%.3f");
|
||||
GUI::Checkbox("UsePhongShader", &m_bUsePhongShader);
|
||||
_float fDepthOcclusionThreshold = m_pGameInstance->Get_DepthOcclusionThreshold();
|
||||
if (GUI::SliderFloat("DepthOcclusionThreshold", &fDepthOcclusionThreshold, 50.f, 150.f, "%.1f")) {
|
||||
m_pGameInstance->Set_DepthOcclusionThreshold(fDepthOcclusionThreshold);
|
||||
}
|
||||
}
|
||||
if (GUI::CollapsingHeader("PostProcessing_Bloom"))
|
||||
{
|
||||
@@ -749,6 +753,16 @@ void CRenderer::Describe_Entitiy()
|
||||
GUI::SliderFloat("m_fMBMaxBlurRadius", &m_fMBMaxBlurRadius, 0.1f, (_float)m_iMBMaxSampleCount, "%.1f");
|
||||
GUI::SliderInt("g_iMBSampleCount", &m_iMBSampleCount, 0, m_iMBMaxSampleCount, "%d");
|
||||
}
|
||||
if (GUI::CollapsingHeader("Render_Breakdown"))
|
||||
{
|
||||
GUI::Checkbox("Show Breakdown", &m_bShowRenderBreakdown);
|
||||
if (m_bShowRenderBreakdown)
|
||||
{
|
||||
Draw_RenderBreakdown("NonBlend", m_NonBlendBreakdown, 10);
|
||||
Draw_RenderBreakdown("Shadow_Near", m_ShadowNearBreakdown, 10);
|
||||
Draw_RenderBreakdown("Shadow_Middle", m_ShadowMiddleBreakdown, 10);
|
||||
}
|
||||
}
|
||||
#ifdef _DEBUG
|
||||
if (GUI::Button("Refresh_Shader")) {
|
||||
m_pShader->Shader_Refresh();
|
||||
|
||||
@@ -32,6 +32,8 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
void Set_RenderCollider(_bool bRender) { m_bRenderCollider = bRender; }
|
||||
void Toggle_RenderCollider() { m_bRenderCollider = !m_bRenderCollider; }
|
||||
#endif RELEASE_DEBUGGER
|
||||
_float Get_DepthOcclusionThreshold() const { return m_fDepthOcclusionThreshold; }
|
||||
void Set_DepthOcclusionThreshold(_float fThreshold) { m_fDepthOcclusionThreshold = max(50.f, min(150.f, fThreshold)); }
|
||||
#pragma region GRAPHIC_DEVICE
|
||||
public:
|
||||
void Render_Begin(const _float4* pClearColor);
|
||||
@@ -392,6 +394,7 @@ class ENGINE_DLL CGameInstance final : public CBase
|
||||
#endif // _DEBUG
|
||||
_bool m_bRenderCollider = false;
|
||||
_bool m_bRenderSystem = false;
|
||||
_float m_fDepthOcclusionThreshold = 50.f;
|
||||
|
||||
map<const _char*, SaveModel> m_sModelMap;
|
||||
public:
|
||||
|
||||
@@ -39,6 +39,27 @@ class CRenderer final : public CBase
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
private:
|
||||
list<class CComponent*> m_DebugComponents;
|
||||
|
||||
struct RENDER_PASS_BREAKDOWN
|
||||
{
|
||||
_uint iObjectCount = 0;
|
||||
_uint iRenderFailCount = 0;
|
||||
unordered_map<_string, _uint> ObjectTypeCounts = {};
|
||||
unordered_map<_uint, _uint> ObjectTagCounts = {};
|
||||
|
||||
void Reset()
|
||||
{
|
||||
iObjectCount = 0;
|
||||
iRenderFailCount = 0;
|
||||
ObjectTypeCounts.clear();
|
||||
ObjectTagCounts.clear();
|
||||
}
|
||||
};
|
||||
|
||||
RENDER_PASS_BREAKDOWN m_NonBlendBreakdown = {};
|
||||
RENDER_PASS_BREAKDOWN m_ShadowNearBreakdown = {};
|
||||
RENDER_PASS_BREAKDOWN m_ShadowMiddleBreakdown = {};
|
||||
_bool m_bShowRenderBreakdown = true;
|
||||
#endif
|
||||
private:
|
||||
class CShader* m_pShader = { nullptr };
|
||||
@@ -146,6 +167,8 @@ class CRenderer final : public CBase
|
||||
#ifdef RELEASE_DEBUGGER
|
||||
private:
|
||||
void Render_Debug();
|
||||
void Collect_RenderBreakdown(RENDER_PASS_BREAKDOWN& Breakdown, CGameObject* pRenderObject, _bool bRenderResult);
|
||||
void Draw_RenderBreakdown(const _char* pTitle, const RENDER_PASS_BREAKDOWN& Breakdown, _uint iTopN = 10);
|
||||
#endif
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user