Función D3DKMTGetSharedPrimaryHandle (d3dkmthk.h)
La función D3DKMTGetSharedPrimaryHandle recupera el identificador compartido global de la superficie principal.
Sintaxis
NTSTATUS D3DKMTGetSharedPrimaryHandle(
D3DKMT_GETSHAREDPRIMARYHANDLE *unnamedParam1
);
Parámetros
unnamedParam1
pData [in, out]
Puntero a una estructura D3DKMT_GETSHAREDPRIMARYHANDLE que describe los parámetros necesarios para recuperar el identificador compartido.
Valor devuelto
D3DKMTGetSharedPrimaryHandle devuelve uno de los siguientes valores:
Código devuelto | Descripción |
---|---|
STATUS_SUCCESS | El identificador se recuperó correctamente. |
STATUS_DEVICE_REMOVED | El adaptador de gráficos se detuvo o se restableció el dispositivo de pantalla. |
STATUS_INVALID_PARAMETER | Los parámetros se validaron y determinaron que son incorrectos. |
Esta función también puede devolver otros valores NTSTATUS.
Observaciones
La superficie principal se crea normalmente mediante el subsistema del kernel de gráficos de Microsoft DirectX (Dxgkrnl.sys) cada vez que cambia el modo de presentación (aunque, en algunas situaciones, es posible que no exista la principal compartida). Si una aplicación openGL intenta crear una superficie principal, normalmente debe abrir la principal compartida existente. Para abrir la principal compartida, la aplicación OpenGL debe usar D3DKMTGetSharedPrimaryHandle para recuperar el identificador compartido global de la superficie principal.
de ejemplo de
En el ejemplo de código siguiente se muestra cómo un ICD de OpenGL puede usar D3DKMTGetSharedPrimaryHandle para crear una superficie principal abriendo el identificador compartido.
HRESULT OpenSharedPrimarySurface(D3DKMT_HANDLE hAdapter,
D3DDDI_VIDEO_PRESENT_SOURCE_ID VidPnSourceId,
D3DKMT_HANDLE hDevice,
VOID* pPrivateDriverData,
UINT PrivateDriverDataSize,
D3DKMT_HANDLE* phResource,
D3DKMT_HANDLE* phAllocation)
{
D3DKMT_CREATEALLOCATION CreateAllocation;
D3DDDI_ALLOCATIONINFO AllocationInfo;
D3DKMT_GETSHAREDPRIMARYHANDLE GetHandleData;
*phResource = 0;
*phAllocation = 0;
// Get the shared handle.
GetHandleData.hAdapter = hAdapter;
GetHandleData.VidPnSourceId = VidPnSourceId;
if (!NT_SUCCESS((*pfnKTGetSharedPrimaryHandle)(&GetHandleData))) {
return E_FAIL;
}
// Was a shared primary created by the kernel?
if (GetHandleData.hSharedPrimary == NULL) {
return E_FAIL;
}
CreateAllocation.hDevice = hDevice;
CreateAllocation.hResource = NULL;
CreateAllocation.hGlobalShare = GetHandleData.hSharedPrimary;
CreateAllocation.Flags.CreateResource =
CreateAllocation.Flags.CreateShared = TRUE;
CreateAllocation.pPrivateRuntimeData = NULL;
CreateAllocation.PrivateRuntimeDataSize = 0;
CreateAllocation.pPrivateDriverData = NULL;
CreateAllocation.PrivateDriverDataSize = 0;
CreateAllocation.NumAllocations = 1;
CreateAllocation.pAllocationInfo = &AllocationInfo;
AllocationInfo.hAllocation = NULL;
AllocationInfo.pSystemMem = NULL;
AllocationInfo.pPrivateDriverData = pPrivateData;
AllocationInfo.PrivateDriverDataSize = PrivateDataSize;
if (NT_SUCCESS((*pfnKTCreateAllocation)(&CreateAllocation))) {
*phResource = CreateAllocation.hResource;
*phAllocation = AllocationInfo.hAllocation;
return S_OK;
}
return E_FAIL;
}
Requisitos
Requisito | Valor |
---|---|
cliente mínimo admitido | Windows Vista |
de la plataforma de destino de | Universal |
encabezado de | d3dkmthk.h (incluya D3dkmthk.h) |
biblioteca de | Gdi32.lib |
DLL de | Gdi32.dll |