【问题标题】:How do I check for a 32-bit z-buffer using Managed Direct3D?如何使用托管 Direct3D 检查 32 位 z 缓冲区?
【发布时间】:2010-02-05 10:53:13
【问题描述】:

我知道拨打Manager::CheckDepthStencilMatch 应该会得到答复,但到目前为止,我还没有收集到有效拨打电话所需的资料。

特别是,我需要获取 adapterFormatrenderTargetFormat 参数的值。我在创建设备时没有指定任何特定格式,所以我需要一种方法来获取默认/当前的“格式”值。

【问题讨论】:

  • 请注意,您不太可能找到 32 位深度缓冲区。当然,除非您的意思是 D32F_LOCKABLE。还是 D24X8/D24S8?自 Savage 3D 以来,没有见过支持 D32 的卡 ...
  • @Goz,DepthFormat::D32 在我的机器上运行良好。该卡是“VIA/S3G DeltaChrome IGP”。但是,我在这里使用托管 Direct3D……这可能是它起作用的原因吗?
  • 典型。它是一张“S3”卡,而 Savage3D 是一张 S3 卡;)不要指望它可以在 nVidia 或 ATI 卡上工作......

标签: .net directx c++-cli direct3d managed-directx


【解决方案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;
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-09-05
    • 2011-05-28
    • 2010-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多