MCPcopy Create free account
hub / github.com/carbonengine/trinity / HandleRenderTick

Method HandleRenderTick

trinity/TriDevice11.cpp:20–149  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18
19
20void TriDevice::HandleRenderTick( Be::Time realTime, Be::Time simTime )
21{
22#if BLUE_WITH_PYTHON
23 AutoTasklet _at( PyOS->GetTaskletTimer(), "TriDevice::HandleRenderTick" );
24#endif
25
26 if( mDeviceLost )
27 {
28 ChangeDevice( mAdapter, mHwnd, nullptr );
29 return;
30 }
31
32 if( !Tr2RenderContext_GetMainThreadRenderContext().m_d3dDevice11 )
33 {
34 return;
35 }
36
37 if( ShouldSkipFrame() )
38 {
39 Throttle();
40 return;
41 }
42
43 HRESULT hr = Tr2RenderContext_GetMainThreadRenderContext().m_d3dDevice11->GetDeviceRemovedReason();
44 if( FAILED( hr ) || g_emulateDriverReset )
45 {
46 g_emulateDriverReset = false;
47 if( !mDeviceLost )
48 {
49 static uint32_t s_deviceLostCount = 0;
50 ++s_deviceLostCount;
51
52 Tr2RenderContextEnum::RenderContextStatus status = Tr2RenderContextEnum::CONTEXT_STATUS_INVALID;
53 std::string marker, markerMessage;
54 if( SUCCEEDED( Tr2RenderContext_GetMainThreadRenderContext().GetGpuStateMarker( status, marker ) ) )
55 {
56 markerMessage = ", GPU marker: " + marker;
57 }
58
59 Tr2RenderContextEnum::PixelFormat format;
60 uint64_t size;
61 uint32_t width;
62 uint32_t height;
63 uint32_t depth;
64 uint32_t mips;
65 bool hasPageFault = false;
66 char resourceDesc[256] = { 0 };
67 if( SUCCEEDED( Tr2RenderContext_GetMainThreadRenderContext().GetGpuPageFaultResource( format, size, width, height, depth, mips ) ) )
68 {
69 sprintf_s( resourceDesc, "fmt %i, size: %u, %ux%ux%u, mips: %u", int( format ), unsigned( size ), width, height, depth, mips );
70 markerMessage += ", Page Fault: ";
71 markerMessage += resourceDesc;
72 hasPageFault = true;
73 }
74
75 if( m_onDeviceRemoved.IsValid() )
76 {
77 m_onDeviceRemoved.CallVoid( (uint64_t)(unsigned long)hr, BeGetErrorMessage( ALResult( hr ) ), s_deviceLostCount, marker, resourceDesc, "" );

Callers

nothing calls this directly

Calls 10

to_stringFunction · 0.85
emptyMethod · 0.80
RunUpdateMethod · 0.80
BeGetErrorMessageFunction · 0.50
GetGpuStateMarkerMethod · 0.45
IsValidMethod · 0.45
UpdateMethod · 0.45
PresentMethod · 0.45
MarkFrameEventMethod · 0.45

Tested by

no test coverage detected