[host] add new D12 capture interface

Note, this capture interface is not yet feature complete but does seem
to be stable.
This commit is contained in:
Geoffrey McRae committed 2024-01-31 00:29:55 +11:00
1 parent e376e6fb53
commit 72b25b99bc
20 files changed
+1919 -352

No files matched your search

@@ -31,6 +31,8 @@
typedef struct Downsample
{
ComScope * comScope;
ID3D11Device ** device;
ID3D11DeviceContext ** context;
bool shareable;
@@ -43,6 +45,9 @@ typedef struct Downsample
Downsample;
static Downsample this = {0};
#define comRef_toGlobal(dst, src) \
_comRef_toGlobal(this.comScope, dst, src)
typedef struct
{
ID3D11Texture2D ** tex;
@@ -73,11 +78,14 @@ static bool downsample_setup(
this.device = device;
this.context = context;
this.shareable = shareable;
comRef_initGlobalScope(10, this.comScope);
return true;
}
static void downsample_finish(void)
{
comRef_freeScope(&this.comScope);
memset(&this, 0, sizeof(this));
}
@@ -96,7 +104,7 @@ static bool downsample_configure(void * opaque,
return true;
HRESULT status;
comRef_scopePush();
comRef_scopePush(10);
if (!this.pshader)
{
@@ -29,6 +29,8 @@
typedef struct RGB24
{
ComScope * comScope;
ID3D11Device ** device;
ID3D11DeviceContext ** context;
bool shareable;
@@ -40,6 +42,9 @@ typedef struct RGB24
RGB24;
static RGB24 this = {0};
#define comRef_toGlobal(dst, src) \
_comRef_toGlobal(this.comScope, dst, src)
typedef struct
{
ID3D11Texture2D ** tex;
@@ -55,6 +60,7 @@ static bool rgb24_setup(
bool shareable
)
{
comRef_initGlobalScope(10, this.comScope);
this.device = device;
this.context = context;
this.shareable = shareable;
@@ -63,6 +69,7 @@ static bool rgb24_setup(
static void rgb24_finish(void)
{
comRef_freeScope(&this.comScope);
memset(&this, 0, sizeof(this));
}
@@ -74,7 +81,8 @@ static bool rgb24_configure(void * opaque,
RGB24Inst * inst = (RGB24Inst *)opaque;
HRESULT status;
comRef_scopePush();
comRef_scopePush(10);
if (!this.pshader)
{
@@ -29,6 +29,8 @@
typedef struct SDRWhiteLevel
{
ComScope * comScope;
ID3D11Device ** device;
ID3D11DeviceContext ** context;
@@ -43,6 +45,9 @@ typedef struct SDRWhiteLevel
SDRWhiteLevel;
static SDRWhiteLevel this = {0};
#define comRef_toGlobal(dst, src) \
_comRef_toGlobal(this.comScope, dst, src)
typedef struct
{
ID3D11Texture2D ** tex;
@@ -66,13 +71,15 @@ static bool sdrWhiteLevel_setup(
)
{
bool result = false;
comRef_scopePush();
HRESULT status;
this.device = device;
this.context = context;
this.shareable = shareable;
comRef_initGlobalScope(10, this.comScope);
comRef_scopePush(10);
comRef_defineLocal(IDXGIOutput6, output6);
status = IDXGIOutput_QueryInterface(
*output, &IID_IDXGIOutput6, (void **)output6);
@@ -139,9 +146,8 @@ static bool sdrWhiteLevel_setup(
.MaxLOD = D3D11_FLOAT32_MAX
};
status = ID3D11Device_CreateSamplerState(
*this.device, &samplerDesc,
(ID3D11SamplerState **)comRef_newGlobal(&this.sampler));
comRef_defineLocal(ID3D11SamplerState, sampler);
status = ID3D11Device_CreateSamplerState(*this.device, &samplerDesc, sampler);
if (FAILED(status))
{
@@ -156,9 +162,10 @@ static bool sdrWhiteLevel_setup(
.BindFlags = D3D11_BIND_CONSTANT_BUFFER,
};
comRef_defineLocal(ID3D11Buffer, buffer);
status = ID3D11Device_CreateBuffer(
*this.device, &bufferDesc, NULL,
(ID3D11Buffer **)comRef_newGlobal(&this.buffer));
buffer);
if (FAILED(status))
{
@@ -169,6 +176,8 @@ static bool sdrWhiteLevel_setup(
updateConsts();
DEBUG_INFO("SDR White Level : %f" , this.sdrWhiteLevel);
comRef_toGlobal(this.sampler, sampler);
comRef_toGlobal(this.buffer , buffer );
result = true;
exit:
@@ -178,6 +187,7 @@ exit:
static void sdrWhiteLevel_finish(void)
{
comRef_freeScope(&this.comScope);
memset(&this, 0, sizeof(this));
}
@@ -225,7 +235,7 @@ static bool sdrWhiteLevel_configure(void * opaque,
if (inst->tex)
return true;
comRef_scopePush();
comRef_scopePush(10);
// create the output texture
D3D11_TEXTURE2D_DESC texDesc =