mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-24 22:37:19 +00:00
[host] dxgi: add nanosecond-scale sleep capability to d3d12
The nsleep() call lets d3d12 sleep for a more precise amount of time while maintaining the current millisecond-scale sleep interface in the configuration file.
This commit is contained in:
parent
48cf099638
commit
36f97f08ad
@ -23,6 +23,7 @@
|
|||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <d3d12.h>
|
#include <d3d12.h>
|
||||||
#include <d3d12sdklayers.h>
|
#include <d3d12sdklayers.h>
|
||||||
|
#include "common/time.h"
|
||||||
#include "common/debug.h"
|
#include "common/debug.h"
|
||||||
#include "common/option.h"
|
#include "common/option.h"
|
||||||
#include "common/windebug.h"
|
#include "common/windebug.h"
|
||||||
@ -44,7 +45,7 @@ struct D3D12Texture
|
|||||||
|
|
||||||
struct D3D12Backend
|
struct D3D12Backend
|
||||||
{
|
{
|
||||||
int copySleep;
|
float copySleep;
|
||||||
ID3D12Device * device;
|
ID3D12Device * device;
|
||||||
ID3D12InfoQueue1 * debugInfoQueue;
|
ID3D12InfoQueue1 * debugInfoQueue;
|
||||||
ID3D12CommandQueue * commandQueue;
|
ID3D12CommandQueue * commandQueue;
|
||||||
@ -120,8 +121,8 @@ static bool d3d12_create(struct DXGIInterface * intf)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
this->copySleep = option_get_int("dxgi", "d3d12CopySleep");
|
this->copySleep = option_get_float("dxgi", "d3d12CopySleep");
|
||||||
DEBUG_INFO("Sleep before copy : %d ms", this->copySleep);
|
DEBUG_INFO("Sleep before copy : %f ms", this->copySleep);
|
||||||
|
|
||||||
status = D3D12CreateDevice((IUnknown *) dxgi->adapter, D3D_FEATURE_LEVEL_11_0,
|
status = D3D12CreateDevice((IUnknown *) dxgi->adapter, D3D_FEATURE_LEVEL_11_0,
|
||||||
&IID_ID3D12Device, (void **)&this->device);
|
&IID_ID3D12Device, (void **)&this->device);
|
||||||
@ -346,7 +347,7 @@ static bool d3d12_copyFrame(Texture * parent, ID3D11Texture2D * src)
|
|||||||
HRESULT status;
|
HRESULT status;
|
||||||
|
|
||||||
if (this->copySleep > 0)
|
if (this->copySleep > 0)
|
||||||
Sleep(this->copySleep);
|
nsleep((uint64_t)(this->copySleep * 1000000));
|
||||||
|
|
||||||
HANDLE handle = INVALID_HANDLE_VALUE;
|
HANDLE handle = INVALID_HANDLE_VALUE;
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ static void dxgi_initOptions(void)
|
|||||||
.module = "dxgi",
|
.module = "dxgi",
|
||||||
.name = "d3d12CopySleep",
|
.name = "d3d12CopySleep",
|
||||||
.description = "Milliseconds to sleep before copying frame with d3d12",
|
.description = "Milliseconds to sleep before copying frame with d3d12",
|
||||||
.type = OPTION_TYPE_INT,
|
.type = OPTION_TYPE_FLOAT,
|
||||||
.value.x_int = 5
|
.value.x_int = 5
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user