Skip to content

Commit 6ba48eb

Browse files
committed
bfi/alpha2
1 parent a13d871 commit 6ba48eb

File tree

5 files changed

+20
-9
lines changed

5 files changed

+20
-9
lines changed

ShaderGlass/CaptureManager.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,9 @@ void CaptureManager::Exit()
386386
m_shaderGlass->Stop();
387387
delete m_shaderGlass.release();
388388

389+
m_renderContext->ClearState();
390+
m_renderContext->Flush();
391+
389392
if(m_debug)
390393
{
391394
m_debug->ReportLiveDeviceObjects(D3D11_RLDO_DETAIL | D3D11_RLDO_IGNORE_INTERNAL);
@@ -629,6 +632,8 @@ void CaptureManager::SetGraphicsAdapters(int captureNo, int renderNo, LUID& capt
629632
m_defaultAdapter = (captureNo == 0 && renderNo == 0);
630633
m_captureDevice = nullptr;
631634
m_renderDevice = nullptr;
635+
636+
Sleep(1000);
632637
if(active)
633638
StartSession();
634639
}

ShaderGlass/CaptureSession.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,8 @@ CaptureSession::CaptureSession(winrt::com_ptr<ID3D11Device> captureDevice,
3737
m_device = CreateDirect3DDevice(dxgiDevice.get());
3838

3939
m_contentSize = m_item.Size();
40-
m_framePool = winrt::Direct3D11CaptureFramePool::CreateFreeThreaded(m_device, pixelFormat, 2, m_contentSize);
40+
//m_framePool = winrt::Direct3D11CaptureFramePool::CreateFreeThreaded(m_device, pixelFormat, 2, m_contentSize);
41+
m_framePool = winrt::Direct3D11CaptureFramePool::Create(m_device, pixelFormat, 2, m_contentSize);
4142
m_session = m_framePool.CreateCaptureSession(m_item);
4243

4344
// try to disable yellow border
@@ -56,15 +57,15 @@ CaptureSession::CaptureSession(winrt::com_ptr<ID3D11Device> captureDevice,
5657
try
5758
{
5859
// max 250Hz?
59-
const auto minInterval = maxCaptureRate ? std::chrono::milliseconds(4) : std::chrono::milliseconds(15);
60+
const auto minInterval = maxCaptureRate ? std::chrono::milliseconds(1) : std::chrono::milliseconds(15);
6061
m_session.MinUpdateInterval(winrt::Windows::Foundation::TimeSpan(minInterval));
6162
}
6263
catch(...)
6364
{ }
6465
}
6566

6667
Reset();
67-
m_framePool.FrameArrived({this, &CaptureSession::OnFrameArrived});
68+
//m_framePool.FrameArrived({this, &CaptureSession::OnFrameArrived});
6869
m_session.StartCapture();
6970

7071
WINRT_ASSERT(m_session != nullptr);
@@ -97,6 +98,8 @@ void CaptureSession::OnFrameArrived(winrt::Direct3D11CaptureFramePool const& sen
9798
return;
9899

99100
auto frame = sender.TryGetNextFrame();
101+
if(!frame)
102+
return;
100103
auto inputFrame = GetDXGIInterfaceFromObject<ID3D11Texture2D>(frame.Surface());
101104

102105
auto contentSize = frame.ContentSize();
@@ -111,7 +114,7 @@ void CaptureSession::OnFrameArrived(winrt::Direct3D11CaptureFramePool const& sen
111114

112115
m_textureBridge.PutInputFrame(inputFrame, resized);
113116

114-
SetEvent(m_frameEvent);
117+
//SetEvent(m_frameEvent);
115118
OnInputFrame();
116119
}
117120

@@ -137,6 +140,7 @@ void CaptureSession::ProcessInput()
137140
}
138141
else
139142
{
143+
OnFrameArrived(m_framePool, nullptr);
140144
m_shaderGlass.Process(m_textureBridge.GetInputFrame(), m_frameTicks, m_numInputFrames);
141145
}
142146
}

ShaderGlass/ShaderGlass.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ GNU General Public License v3.0
1212
#include "Helpers.h"
1313
#include "resource.h"
1414

15-
#define TIMING_DUMP
15+
//#define TIMING_DUMP
1616

1717
static HRESULT hr;
1818
static const float background_colour[4] = {0, 0, 0, 1.0f};
@@ -31,7 +31,9 @@ ShaderGlass::~ShaderGlass()
3131
DestroyPasses();
3232
DestroyTargets();
3333

34+
m_context->ClearState();
3435
m_context->Flush();
36+
m_context = nullptr;
3537
}
3638

3739
void ShaderGlass::Initialize(HWND outputWindow,

ShaderGlass/ShaderGlass.rc

16 Bytes
Binary file not shown.

ShaderGlass/ShaderWindow.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1328,7 +1328,7 @@ void ShaderWindow::UpdateTitle()
13281328
snprintf(inFPSdisplay, 20, "%d->", inFPS);
13291329
_snwprintf_s(title,
13301330
200,
1331-
_T("ShaderGlass (%s%S, %Spx, %S%%, ~%S, %S%dfps%S)"),
1331+
_T("ShaderGlass/BFI (%s%S, %Spx, %S%%, ~%S, %S%dfps%S)"),
13321332
windowName,
13331333
shader->Name.c_str(),
13341334
pixelSize.mnemonic,
@@ -1341,7 +1341,7 @@ void ShaderWindow::UpdateTitle()
13411341
}
13421342
else
13431343
{
1344-
SetWindowTextW(m_mainWindow, _T("ShaderGlass (stopped)"));
1344+
SetWindowTextW(m_mainWindow, _T("ShaderGlass/BFI (stopped)"));
13451345
}
13461346
}
13471347

@@ -2063,8 +2063,8 @@ LRESULT CALLBACK ShaderWindow::WndProc(HWND hWnd, UINT message, WPARAM wParam, L
20632063
auto captureNo = (wmId - WM_GPU(0, 0)) / MAX_GPU;
20642064
auto renderNo = (wmId - WM_GPU(0, 0)) % MAX_GPU;
20652065
LUID captureId, renderId;
2066-
m_captureManager.SetGraphicsAdapters(captureNo, renderNo, captureId, renderId);
20672066
SaveGPUs(captureId, renderId);
2067+
m_captureManager.SetGraphicsAdapters(captureNo, renderNo, captureId, renderId);
20682068
UpdateGPUName();
20692069
}
20702070
}
@@ -2634,7 +2634,7 @@ void ShaderWindow::SaveMaxCaptureRateState(bool state)
26342634

26352635
bool ShaderWindow::GetMaxCaptureRateState()
26362636
{
2637-
return GetRegistryOption(TEXT("Max Capture Rate"), false);
2637+
return GetRegistryOption(TEXT("Max Capture Rate"), true);
26382638
}
26392639

26402640
void ShaderWindow::SaveUseHDRState(bool state)

0 commit comments

Comments
 (0)