1

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/current 'Format' values.

Agnel Kurian
  • 57,975
  • 43
  • 146
  • 217
  • Be warned your are unlikely to FIND that 32-bit depth buffer. Unless of course you mean D32F_LOCKABLE. Or D24X8/D24S8? Not seen a card support D32 since the Savage 3D ... – Goz Feb 05 '10 at 14:32
  • @Goz, DepthFormat::D32 works fine on my machine. The card is a "VIA/S3G DeltaChrome IGP". However, I am using Managed Direct3D here... Could that be the reason it works? – Agnel Kurian Feb 11 '10 at 09:34
  • Typical. Its an "S3" card and the Savage3D was an S3 card ;) Don't expect it to work on nVidia or ATI cards ... – Goz Feb 11 '10 at 10:42

1 Answers1

1

--

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;
}
Agnel Kurian
  • 57,975
  • 43
  • 146
  • 217