本文整理汇总了C++中TRefCountPtr::EnableDebugLayer方法的典型用法代码示例。如果您正苦于以下问题:C++ TRefCountPtr::EnableDebugLayer方法的具体用法?C++ TRefCountPtr::EnableDebugLayer怎么用?C++ TRefCountPtr::EnableDebugLayer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TRefCountPtr
的用法示例。
在下文中一共展示了TRefCountPtr::EnableDebugLayer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEXT
void FD3D12Device::InitD3DDevice()
{
check(IsInGameThread());
// Wait for the rendering thread to go idle.
SCOPED_SUSPEND_RENDERING_THREAD(false);
// If the device we were using has been removed, release it and the resources we created for it.
if (bDeviceRemoved)
{
check(Direct3DDevice);
HRESULT hRes = Direct3DDevice->GetDeviceRemovedReason();
const TCHAR* Reason = TEXT("?");
switch (hRes)
{
case DXGI_ERROR_DEVICE_HUNG: Reason = TEXT("HUNG"); break;
case DXGI_ERROR_DEVICE_REMOVED: Reason = TEXT("REMOVED"); break;
case DXGI_ERROR_DEVICE_RESET: Reason = TEXT("RESET"); break;
case DXGI_ERROR_DRIVER_INTERNAL_ERROR: Reason = TEXT("INTERNAL_ERROR"); break;
case DXGI_ERROR_INVALID_CALL: Reason = TEXT("INVALID_CALL"); break;
}
bDeviceRemoved = false;
// Cleanup the D3D device.
CleanupD3DDevice();
// We currently don't support removed devices because FTexture2DResource can't recreate its RHI resources from scratch.
// We would also need to recreate the viewport swap chains from scratch.
UE_LOG(LogD3D12RHI, Fatal, TEXT("The Direct3D 12 device that was being used has been removed (Error: %d '%s'). Please restart the game."), hRes, Reason);
}
// If we don't have a device yet, either because this is the first viewport, or the old device was removed, create a device.
if (!Direct3DDevice)
{
// Determine the adapter and device type to use.
TRefCountPtr<IDXGIAdapter> Adapter;
// In Direct3D 11, if you are trying to create a hardware or a software device, set pAdapter != NULL which constrains the other inputs to be:
// DriverType must be D3D_DRIVER_TYPE_UNKNOWN
// Software must be NULL.
D3D_DRIVER_TYPE DriverType = D3D_DRIVER_TYPE_UNKNOWN;
// Use a debug device if specified on the command line.
const bool bWithD3DDebug = D3D12RHI_ShouldCreateWithD3DDebug();
if (bWithD3DDebug)
{
TRefCountPtr<ID3D12Debug> DebugController;
VERIFYD3D11RESULT(D3D12GetDebugInterface(IID_PPV_ARGS(DebugController.GetInitReference())));
DebugController->EnableDebugLayer();
UE_LOG(LogD3D12RHI, Log, TEXT("InitD3DDevice: -D3DDebug = %s"), bWithD3DDebug ? TEXT("on") : TEXT("off"));
}
TRefCountPtr<IDXGIAdapter> EnumAdapter;
if (DXGIFactory->EnumAdapters(GetAdapterIndex(), EnumAdapter.GetInitReference()) != DXGI_ERROR_NOT_FOUND)
{
if (EnumAdapter)
{
if (SUCCEEDED(EnumAdapter->GetDesc(&AdapterDesc)))
{
Adapter = EnumAdapter;
const bool bIsPerfHUD = !FCString::Stricmp(AdapterDesc.Description, TEXT("NVIDIA PerfHUD"));
if (bIsPerfHUD)
{
DriverType = D3D_DRIVER_TYPE_REFERENCE;
}
VERIFYD3D11RESULT(EnumAdapter->QueryInterface(_uuidof(DxgiAdapter3), (void **)DxgiAdapter3.GetInitReference()));
}
else
{
check(!"Internal error, GetDesc() failed but before it worked")
}
}
}
else
{