开发者

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

开发者 https://www.devze.com 2022-12-19 01:11 出处:网络
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.

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

精彩评论

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

关注公众号