Skip to content

Commit

Permalink
Added missing draw call information to Reflex latency markers in D3D1…
Browse files Browse the repository at this point in the history
…1 games
  • Loading branch information
Kaldaien committed Dec 26, 2024
1 parent 6a30acb commit ea98b7e
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 55 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
24.12.26.2
24.12.26.3
==========
+ Added missing draw call information to Reflex latency markers in D3D11 games

24.12.26.2
==========
+ Small optimization to text OSD
+ Optimized D3D11 state tracking for SetShaderResources and removed unnecessary
Expand Down
4 changes: 2 additions & 2 deletions include/SpecialK/DLL_VERSION.H
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
#define SK_YEAR 24
#define SK_MONTH 12
#define SK_DATE 26
#define SK_REV_N 2
#define SK_REV 2
#define SK_REV_N 3
#define SK_REV 3

#ifndef _A2
#define _A2(a) #a
Expand Down
62 changes: 12 additions & 50 deletions src/render/d3d11/d3d11.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4330,8 +4330,7 @@ SK_D3D11_DrawAuto_Impl (_In_ ID3D11DeviceContext *pDevCtx, BOOL bWrapped, UINT d

bool early_out =
(! bMustNotIgnore) ||
SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);

(! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::Auto));

if (early_out)
{
Expand All @@ -4341,12 +4340,6 @@ SK_D3D11_DrawAuto_Impl (_In_ ID3D11DeviceContext *pDevCtx, BOOL bWrapped, UINT d

SK_TLS *pTLS = nullptr;

if (! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::Auto))
{
return
_Finish ();
}

auto draw_action =
SK_D3D11_DrawHandler (pDevCtx, SK_D3D11DrawType::Auto, 0, &pTLS, dev_idx);

Expand Down Expand Up @@ -4481,7 +4474,8 @@ SK_D3D11_Draw_Impl (ID3D11DeviceContext* pDevCtx,

bool early_out =
(! bMustNotIgnore) ||
SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);
(! SK_D3D11_ShouldTrackDrawCall ( pDevCtx,
SK_D3D11DrawType::PrimList, dev_idx ));


if (early_out)
Expand Down Expand Up @@ -4539,13 +4533,6 @@ SK_D3D11_Draw_Impl (ID3D11DeviceContext* pDevCtx,
}
}

if (! SK_D3D11_ShouldTrackDrawCall ( pDevCtx,
SK_D3D11DrawType::PrimList, dev_idx ))
{
return
_Finish ();
}

auto draw_action =
SK_D3D11_DrawHandler (pDevCtx, SK_D3D11DrawType::PrimList, VertexCount, &pTLS, dev_idx);

Expand Down Expand Up @@ -4662,7 +4649,7 @@ SK_D3D11_DrawIndexed_Impl (
};

bool early_out =
(! bMustNotIgnore);// ||
(! bMustNotIgnore) || (! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::Indexed));// ||
//SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);

if (early_out)
Expand Down Expand Up @@ -4755,11 +4742,6 @@ SK_D3D11_DrawIndexed_Impl (
}
}

if (! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::Indexed))
{
return _Finish ();
}

SK_TLS* pTLS = nullptr;

auto draw_action =
Expand Down Expand Up @@ -4804,20 +4786,15 @@ SK_D3D11_DrawIndexedInstanced_Impl (

bool early_out =
(! bMustNotIgnore) ||
SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);
! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::IndexedInstanced);
//SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);

if (early_out)
{
return
_Finish ();
}

if (! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::IndexedInstanced))
{
return
_Finish ();
}

SK_TLS *pTLS = nullptr;

auto draw_action =
Expand Down Expand Up @@ -4857,20 +4834,15 @@ SK_D3D11_DrawIndexedInstancedIndirect_Impl (

bool early_out =
(! bMustNotIgnore) ||
SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);
(! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::IndexedInstancedIndirect));
//SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);

if (early_out)
{
return
_Finish ();
}

if (! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::IndexedInstancedIndirect))
{
return
_Finish ();
}

SK_TLS *pTLS = nullptr;

auto draw_action =
Expand Down Expand Up @@ -4914,20 +4886,15 @@ SK_D3D11_DrawInstanced_Impl (

bool early_out =
(! bMustNotIgnore) ||
SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);
(! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::Instanced));
//SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);

if (early_out)
{
return
_Finish ();
}

if (! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::Instanced))
{
return
_Finish ();
}

SK_TLS *pTLS = nullptr;

auto draw_action =
Expand Down Expand Up @@ -4966,20 +4933,15 @@ SK_D3D11_DrawInstancedIndirect_Impl (

bool early_out =
(! bMustNotIgnore) ||
SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);
(! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::InstancedIndirect));
//SK_D3D11_IgnoreWrappedOrDeferred (bWrapped, bIsDevCtxDeferred, pDevCtx);

if (early_out)
{
return
_Finish ();
}

if (! SK_D3D11_ShouldTrackDrawCall (pDevCtx, SK_D3D11DrawType::InstancedIndirect))
{
return
_Finish ();
}

SK_TLS *pTLS = nullptr;

auto draw_action =
Expand Down
8 changes: 6 additions & 2 deletions src/render/d3d11/d3d11_state_tracker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -598,8 +598,12 @@ SK_D3D11_ShouldTrackDrawCall ( ID3D11DeviceContext* pDevCtx,
static ULONG64 last_frame = 0;
if (std::exchange (last_frame, frame_id) < frame_id)
{
rb.setLatencyMarkerNV (SIMULATION_END);
rb.setLatencyMarkerNV (RENDERSUBMIT_START);
if ( InterlockedExchange (&SK_Reflex_LastFrameMarked, frame_id) <
frame_id )
{
rb.setLatencyMarkerNV (SIMULATION_END);
rb.setLatencyMarkerNV (RENDERSUBMIT_START);
}
}
}

Expand Down

0 comments on commit ea98b7e

Please sign in to comment.