mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-22 05:27:20 +00:00
[host] d12: pass back rotation metadata to the client
This commit is contained in:
parent
57ac020c8c
commit
c7f1aadb9e
@ -62,7 +62,8 @@ struct D12Backend
|
|||||||
D12Backend * instance,
|
D12Backend * instance,
|
||||||
unsigned frameBufferIndex,
|
unsigned frameBufferIndex,
|
||||||
RECT ** dirtyRects,
|
RECT ** dirtyRects,
|
||||||
unsigned * nbDirtyRects);
|
unsigned * nbDirtyRects,
|
||||||
|
CaptureRotation * rotation);
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline bool d12_backendCreate(const D12Backend * backend,
|
static inline bool d12_backendCreate(const D12Backend * backend,
|
||||||
@ -97,9 +98,10 @@ static inline CaptureResult d12_backendSync(D12Backend * instance,
|
|||||||
{ return instance->sync(instance, commandQueue); }
|
{ return instance->sync(instance, commandQueue); }
|
||||||
|
|
||||||
static inline ID3D12Resource * d12_backendFetch(D12Backend * instance,
|
static inline ID3D12Resource * d12_backendFetch(D12Backend * instance,
|
||||||
unsigned frameBufferIndex, RECT ** dirtyRects, unsigned * nbDirtyRects)
|
unsigned frameBufferIndex, RECT ** dirtyRects, unsigned * nbDirtyRects,
|
||||||
|
CaptureRotation * rotation)
|
||||||
{ return instance->fetch(instance, frameBufferIndex, dirtyRects,
|
{ return instance->fetch(instance, frameBufferIndex, dirtyRects,
|
||||||
nbDirtyRects); }
|
nbDirtyRects, rotation); }
|
||||||
|
|
||||||
// Backend defines
|
// Backend defines
|
||||||
|
|
||||||
|
@ -66,6 +66,7 @@ typedef struct DDInstance
|
|||||||
ID3D11Device5 ** device;
|
ID3D11Device5 ** device;
|
||||||
ID3D11DeviceContext4 ** context;
|
ID3D11DeviceContext4 ** context;
|
||||||
IDXGIOutputDuplication ** dup;
|
IDXGIOutputDuplication ** dup;
|
||||||
|
CaptureRotation rotation;
|
||||||
bool release;
|
bool release;
|
||||||
|
|
||||||
DDCacheInfo cache[CACHE_SIZE];
|
DDCacheInfo cache[CACHE_SIZE];
|
||||||
@ -261,6 +262,28 @@ static bool d12_dd_init(
|
|||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DXGI_OUTDUPL_DESC dupDesc;
|
||||||
|
IDXGIOutputDuplication_GetDesc(*dup, &dupDesc);
|
||||||
|
switch(dupDesc.Rotation)
|
||||||
|
{
|
||||||
|
case DXGI_MODE_ROTATION_UNSPECIFIED:
|
||||||
|
case DXGI_MODE_ROTATION_IDENTITY:
|
||||||
|
this->rotation = CAPTURE_ROT_0;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE90:
|
||||||
|
this->rotation = CAPTURE_ROT_90;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE180:
|
||||||
|
this->rotation = CAPTURE_ROT_180;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case DXGI_MODE_ROTATION_ROTATE270:
|
||||||
|
this->rotation = CAPTURE_ROT_270;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ID3D12Device3_AddRef(device);
|
ID3D12Device3_AddRef(device);
|
||||||
comRef_toGlobal(this->d12device, &device );
|
comRef_toGlobal(this->d12device, &device );
|
||||||
comRef_toGlobal(this->device , d11device5 );
|
comRef_toGlobal(this->device , d11device5 );
|
||||||
@ -419,7 +442,7 @@ static CaptureResult d12_dd_sync(D12Backend * instance,
|
|||||||
|
|
||||||
static ID3D12Resource * d12_dd_fetch(D12Backend * instance,
|
static ID3D12Resource * d12_dd_fetch(D12Backend * instance,
|
||||||
unsigned frameBufferIndex, RECT * dirtyRects[static D12_MAX_DIRTY_RECTS],
|
unsigned frameBufferIndex, RECT * dirtyRects[static D12_MAX_DIRTY_RECTS],
|
||||||
unsigned * nbDirtyRects)
|
unsigned * nbDirtyRects, CaptureRotation * rotation)
|
||||||
{
|
{
|
||||||
DDInstance * this = UPCAST(DDInstance, instance);
|
DDInstance * this = UPCAST(DDInstance, instance);
|
||||||
|
|
||||||
@ -428,6 +451,7 @@ static ID3D12Resource * d12_dd_fetch(D12Backend * instance,
|
|||||||
|
|
||||||
*dirtyRects = this->current->dirtyRects;
|
*dirtyRects = this->current->dirtyRects;
|
||||||
*nbDirtyRects = this->current->nbDirtyRects;
|
*nbDirtyRects = this->current->nbDirtyRects;
|
||||||
|
*rotation = this->rotation;
|
||||||
|
|
||||||
ID3D12Resource_AddRef(*this->current->d12Res);
|
ID3D12Resource_AddRef(*this->current->d12Res);
|
||||||
return *this->current->d12Res;
|
return *this->current->d12Res;
|
||||||
|
@ -430,10 +430,11 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
|
|||||||
|
|
||||||
RECT * dirtyRects;
|
RECT * dirtyRects;
|
||||||
unsigned nbDirtyRects;
|
unsigned nbDirtyRects;
|
||||||
|
CaptureRotation rotation;
|
||||||
|
|
||||||
comRef_defineLocal(ID3D12Resource, src);
|
comRef_defineLocal(ID3D12Resource, src);
|
||||||
*src = d12_backendFetch(this->backend, frameBufferIndex,
|
*src = d12_backendFetch(this->backend, frameBufferIndex,
|
||||||
&dirtyRects, &nbDirtyRects);
|
&dirtyRects, &nbDirtyRects, &rotation);
|
||||||
if (!*src)
|
if (!*src)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("D12 backend failed to produce an expected frame: %u",
|
DEBUG_ERROR("D12 backend failed to produce an expected frame: %u",
|
||||||
@ -503,7 +504,7 @@ static CaptureResult d12_waitFrame(unsigned frameBufferIndex,
|
|||||||
CAPTURE_FMT_BGR_32 : CAPTURE_FMT_BGRA;
|
CAPTURE_FMT_BGR_32 : CAPTURE_FMT_BGRA;
|
||||||
frame->hdr = false;
|
frame->hdr = false;
|
||||||
frame->hdrPQ = false;
|
frame->hdrPQ = false;
|
||||||
frame->rotation = CAPTURE_ROT_0;
|
frame->rotation = rotation;
|
||||||
|
|
||||||
{
|
{
|
||||||
// create a clean list of rects
|
// create a clean list of rects
|
||||||
@ -545,10 +546,11 @@ static CaptureResult d12_getFrame(unsigned frameBufferIndex,
|
|||||||
|
|
||||||
RECT * dirtyRects;
|
RECT * dirtyRects;
|
||||||
unsigned nbDirtyRects;
|
unsigned nbDirtyRects;
|
||||||
|
CaptureRotation rotation;
|
||||||
|
|
||||||
comRef_defineLocal(ID3D12Resource, src);
|
comRef_defineLocal(ID3D12Resource, src);
|
||||||
*src = d12_backendFetch(this->backend, frameBufferIndex,
|
*src = d12_backendFetch(this->backend, frameBufferIndex,
|
||||||
&dirtyRects, &nbDirtyRects);
|
&dirtyRects, &nbDirtyRects, &rotation);
|
||||||
if (!*src)
|
if (!*src)
|
||||||
{
|
{
|
||||||
DEBUG_ERROR("D12 backend failed to produce an expected frame: %u",
|
DEBUG_ERROR("D12 backend failed to produce an expected frame: %u",
|
||||||
|
Loading…
Reference in New Issue
Block a user