开发者

How do I check for a 32-bit z-buffer using Managed Direct3D?

I understand that a call to Manager::CheckDepthStencilMatch should get me an answer, but so far I have not been able to gather the pieces required to make this call effectively.

In particular, I need to obtain values for the adapterFormat and renderTargetFormat arguments. I am not specifying any particular format while creating the device so I need a way to get the default/curr开发者_运维技巧ent 'Format' values.


--

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;
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜