libobs-d3d11: Use discrete function to get shared handle
Allows us to reacquire the shared handle if the texture is rebuilt.
This commit is contained in:
parent
492f50ee87
commit
8f3ea18276
@ -369,6 +369,7 @@ struct gs_texture_2d : gs_texture {
|
|||||||
void InitResourceView();
|
void InitResourceView();
|
||||||
void InitRenderTargets();
|
void InitRenderTargets();
|
||||||
void BackupTexture(const uint8_t **data);
|
void BackupTexture(const uint8_t **data);
|
||||||
|
void GetSharedHandle(IDXGIResource *dxgi_res);
|
||||||
|
|
||||||
void RebuildSharedTextureFallback();
|
void RebuildSharedTextureFallback();
|
||||||
void Rebuild(ID3D11Device *dev);
|
void Rebuild(ID3D11Device *dev);
|
||||||
|
@ -71,6 +71,20 @@ void gs_texture_2d::BackupTexture(const uint8_t **data)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void gs_texture_2d::GetSharedHandle(IDXGIResource *dxgi_res)
|
||||||
|
{
|
||||||
|
HANDLE handle;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
hr = dxgi_res->GetSharedHandle(&handle);
|
||||||
|
if (FAILED(hr)) {
|
||||||
|
blog(LOG_WARNING, "GetSharedHandle: Failed to "
|
||||||
|
"get shared handle: %08lX", hr);
|
||||||
|
} else {
|
||||||
|
sharedHandle = (uint32_t)(uintptr_t)handle;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void gs_texture_2d::InitTexture(const uint8_t **data)
|
void gs_texture_2d::InitTexture(const uint8_t **data)
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@ -129,14 +143,7 @@ void gs_texture_2d::InitTexture(const uint8_t **data)
|
|||||||
blog(LOG_WARNING, "InitTexture: Failed to query "
|
blog(LOG_WARNING, "InitTexture: Failed to query "
|
||||||
"interface: %08lX", hr);
|
"interface: %08lX", hr);
|
||||||
} else {
|
} else {
|
||||||
HANDLE handle;
|
GetSharedHandle(dxgi_res);
|
||||||
hr = dxgi_res->GetSharedHandle(&handle);
|
|
||||||
if (FAILED(hr)) {
|
|
||||||
blog(LOG_WARNING, "InitTexture: Failed to "
|
|
||||||
"get shared handle: %08lX", hr);
|
|
||||||
} else {
|
|
||||||
sharedHandle = (uint32_t)(uintptr_t)handle;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (flags & GS_SHARED_KM_TEX) {
|
if (flags & GS_SHARED_KM_TEX) {
|
||||||
ComPtr<IDXGIKeyedMutex> km;
|
ComPtr<IDXGIKeyedMutex> km;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user