我知道来电Manager::CheckDepthStencilMatch
应该会给我一个答案,但到目前为止,我还没有收集到有效地拨打这个电话所需的资料。
特别是,我需要获取adapterFormat
andrenderTargetFormat
参数的值。我在创建设备时没有指定任何特定的格式,所以我需要一种方法来获取默认/当前的“格式”值。
我知道来电Manager::CheckDepthStencilMatch
应该会给我一个答案,但到目前为止,我还没有收集到有效地拨打这个电话所需的资料。
特别是,我需要获取adapterFormat
andrenderTargetFormat
参数的值。我在创建设备时没有指定任何特定的格式,所以我需要一种方法来获取默认/当前的“格式”值。
--
D3D::DepthFormat GetDepthFormat(){
D3D::AdapterInformation ^adapter = D3D::Manager::Adapters->Default;
D3D::DepthFormat depthFormat = D3D::DepthFormat::D32;
if(!D3D::Manager::CheckDepthStencilMatch(0,
D3D::DeviceType::Hardware, adapter->CurrentDisplayMode.Format,
adapter->CurrentDisplayMode.Format, depthFormat)){
depthFormat = D3D::DepthFormat::D16;
if(!D3D::Manager::CheckDepthStencilMatch(0,
D3D::DeviceType::Hardware, adapter->CurrentDisplayMode.Format,
adapter->CurrentDisplayMode.Format, depthFormat)){
throw gcnew Exception(L"Your hardware needs to be upgraded.");
}
}
return depthFormat;
}