mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-14 10:08:24 +00:00
[host] dxgi: fix comRef leak in the downsampler
This commit is contained in:
parent
09b6fee360
commit
8d7d5ba8fd
@ -85,12 +85,17 @@ static bool downsample_configure(void * opaque,
|
|||||||
int * cols , int * rows ,
|
int * cols , int * rows ,
|
||||||
CaptureFormat * format)
|
CaptureFormat * format)
|
||||||
{
|
{
|
||||||
|
bool result = false;
|
||||||
DownsampleInst * inst = (DownsampleInst *)opaque;
|
DownsampleInst * inst = (DownsampleInst *)opaque;
|
||||||
|
|
||||||
if (*format == CAPTURE_FMT_BGR)
|
if (*format == CAPTURE_FMT_BGR)
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
|
|
||||||
if (this.disabled)
|
if (this.disabled)
|
||||||
return true;
|
{
|
||||||
|
result = true;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
HRESULT status;
|
HRESULT status;
|
||||||
comRef_scopePush();
|
comRef_scopePush();
|
||||||
@ -101,7 +106,8 @@ static bool downsample_configure(void * opaque,
|
|||||||
if (!rule || (rule->targetX == *width && rule->targetY == *height))
|
if (!rule || (rule->targetX == *width && rule->targetY == *height))
|
||||||
{
|
{
|
||||||
this.disabled = true;
|
this.disabled = true;
|
||||||
return true;
|
result = true;
|
||||||
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.width = rule->targetX;
|
this.width = rule->targetX;
|
||||||
@ -122,7 +128,7 @@ static bool downsample_configure(void * opaque,
|
|||||||
|
|
||||||
comRef_defineLocal(ID3DBlob, byteCode);
|
comRef_defineLocal(ID3DBlob, byteCode);
|
||||||
if (!compileShader(byteCode, "main", "ps_5_0", pshaderSrc, NULL))
|
if (!compileShader(byteCode, "main", "ps_5_0", pshaderSrc, NULL))
|
||||||
goto fail;
|
goto exit;
|
||||||
|
|
||||||
comRef_defineLocal(ID3D11PixelShader, pshader);
|
comRef_defineLocal(ID3D11PixelShader, pshader);
|
||||||
HRESULT status = ID3D11Device_CreatePixelShader(
|
HRESULT status = ID3D11Device_CreatePixelShader(
|
||||||
@ -135,7 +141,7 @@ static bool downsample_configure(void * opaque,
|
|||||||
if (FAILED(status))
|
if (FAILED(status))
|
||||||
{
|
{
|
||||||
DEBUG_WINERROR("Failed to create the pixel shader", status);
|
DEBUG_WINERROR("Failed to create the pixel shader", status);
|
||||||
goto fail;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
const D3D11_SAMPLER_DESC samplerDesc =
|
const D3D11_SAMPLER_DESC samplerDesc =
|
||||||
@ -155,7 +161,7 @@ static bool downsample_configure(void * opaque,
|
|||||||
if (FAILED(status))
|
if (FAILED(status))
|
||||||
{
|
{
|
||||||
DEBUG_WINERROR("Failed to create the sampler state", status);
|
DEBUG_WINERROR("Failed to create the sampler state", status);
|
||||||
goto fail;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
comRef_toGlobal(this.pshader, pshader);
|
comRef_toGlobal(this.pshader, pshader);
|
||||||
@ -191,7 +197,7 @@ static bool downsample_configure(void * opaque,
|
|||||||
if (FAILED(status))
|
if (FAILED(status))
|
||||||
{
|
{
|
||||||
DEBUG_WINERROR("Failed to create the output texture", status);
|
DEBUG_WINERROR("Failed to create the output texture", status);
|
||||||
goto fail;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
comRef_defineLocal(ID3D11RenderTargetView, target);
|
comRef_defineLocal(ID3D11RenderTargetView, target);
|
||||||
@ -201,7 +207,7 @@ static bool downsample_configure(void * opaque,
|
|||||||
if (FAILED(status))
|
if (FAILED(status))
|
||||||
{
|
{
|
||||||
DEBUG_WINERROR("Failed to create the render target view", status);
|
DEBUG_WINERROR("Failed to create the render target view", status);
|
||||||
goto fail;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
*width = *cols = this.width;
|
*width = *cols = this.width;
|
||||||
@ -210,12 +216,9 @@ static bool downsample_configure(void * opaque,
|
|||||||
comRef_toGlobal(inst->tex , tex );
|
comRef_toGlobal(inst->tex , tex );
|
||||||
comRef_toGlobal(inst->target , target );
|
comRef_toGlobal(inst->target , target );
|
||||||
|
|
||||||
|
exit:
|
||||||
comRef_scopePop();
|
comRef_scopePop();
|
||||||
return true;
|
return result;
|
||||||
|
|
||||||
fail:
|
|
||||||
comRef_scopePop();
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool downsample_init(void ** opaque)
|
static bool downsample_init(void ** opaque)
|
||||||
|
Loading…
Reference in New Issue
Block a user