tweak code.
This commit is contained in:
@@ -84,7 +84,7 @@ private:
|
|||||||
Microsoft::WRL::ComPtr<IDXGIOutputDuplication> dupl_;
|
Microsoft::WRL::ComPtr<IDXGIOutputDuplication> dupl_;
|
||||||
Frame lastFrame_;
|
Frame lastFrame_;
|
||||||
UINT lastFrameId_ = 0;
|
UINT lastFrameId_ = 0;
|
||||||
bool isFrameAquired_ = false;
|
bool isFrameAcquired_ = false;
|
||||||
|
|
||||||
volatile bool shouldRun_ = false;
|
volatile bool shouldRun_ = false;
|
||||||
std::thread thread_;
|
std::thread thread_;
|
||||||
|
|||||||
@@ -81,32 +81,35 @@ void Monitor::Render()
|
|||||||
if (frame.id == lastFrameId_) return;
|
if (frame.id == lastFrameId_) return;
|
||||||
lastFrameId_ = frame.id;
|
lastFrameId_ = frame.id;
|
||||||
|
|
||||||
if (unityTexture_)
|
if (unityTexture_ == nullptr)
|
||||||
{
|
{
|
||||||
D3D11_TEXTURE2D_DESC srcDesc, dstDesc;
|
Debug::Error("Monitor::Render() => Target texture has not been set yet..");
|
||||||
frame.texture->GetDesc(&srcDesc);
|
return;
|
||||||
unityTexture_->GetDesc(&dstDesc);
|
}
|
||||||
if (srcDesc.Width != dstDesc.Width ||
|
|
||||||
srcDesc.Height != dstDesc.Height)
|
|
||||||
{
|
|
||||||
Debug::Error("Monitor::Render() => Texture sizes are defferent.");
|
|
||||||
Debug::Error(" Source : (", srcDesc.Width, ", ", srcDesc.Height, ")");
|
|
||||||
Debug::Error(" Dest : (", dstDesc.Width, ", ", dstDesc.Height, ")");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ComPtr<ID3D11DeviceContext> context;
|
|
||||||
GetDevice()->GetImmediateContext(&context);
|
|
||||||
context->CopyResource(unityTexture_, frame.texture.Get());
|
|
||||||
|
|
||||||
auto& manager = GetMonitorManager();
|
D3D11_TEXTURE2D_DESC srcDesc, dstDesc;
|
||||||
if (id_ == manager->GetCursorMonitorId())
|
frame.texture->GetDesc(&srcDesc);
|
||||||
{
|
unityTexture_->GetDesc(&dstDesc);
|
||||||
manager->GetCursor()->Draw(unityTexture_);
|
if (srcDesc.Width != dstDesc.Width ||
|
||||||
}
|
srcDesc.Height != dstDesc.Height)
|
||||||
}
|
{
|
||||||
}
|
Debug::Error("Monitor::Render() => Texture sizes are defferent.");
|
||||||
|
Debug::Error(" Source : (", srcDesc.Width, ", ", srcDesc.Height, ")");
|
||||||
|
Debug::Error(" Dest : (", dstDesc.Width, ", ", dstDesc.Height, ")");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ComPtr<ID3D11DeviceContext> context;
|
||||||
|
GetDevice()->GetImmediateContext(&context);
|
||||||
|
context->CopyResource(unityTexture_, frame.texture.Get());
|
||||||
|
|
||||||
|
auto& manager = GetMonitorManager();
|
||||||
|
if (id_ == manager->GetCursorMonitorId())
|
||||||
|
{
|
||||||
|
manager->GetCursor()->Draw(unityTexture_);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (UseGetPixels())
|
if (UseGetPixels())
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user