2010-02-05 5 views
1

나는 Manager::CheckDepthStencilMatch으로 전화하면 나에게 답을 주어야한다는 것을 이해하지만, 지금까지는이 호출을 효과적으로하기 위해 필요한 조각들을 모을 수 없었다.Managed Direct3D를 사용하여 32 비트 Z 버퍼를 확인하려면 어떻게합니까?

특히, adapterFormatrenderTargetFormat 인수에 대한 값을 가져와야합니다. 나는 장치를 생성하는 동안 특정 형식을 지정하지 않으므로 기본값/현재 '형식'값을 얻는 방법이 필요합니다.

+0

는 32 비트 깊이 버퍼 찾을 가능성을주의해야합니다. 물론 D32F_LOCKABLE을 의미하지 않는 한. 또는 D24X8/D24S8? Savage 3D 이후 카드 지원 D32는 보지 못했습니다 ... – Goz

+0

@Goz, DepthFormat :: D32는 제 컴퓨터에서 잘 작동합니다. 이 카드는 "VIA/S3G DeltaChrome IGP"입니다. 그러나 여기에서 Managed Direct3D를 사용하고 있습니다 ... 그것이 그 이유일까요? –

+0

대표. 그것의 "S3"카드와 Savage3D는 S3 카드였습니다;) nVidia 또는 ATI 카드에서 작동하지 않을 것입니다 ... – Goz

답변

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