如何在c ++中获取像素着色器版本和顶点着色器版本

时间:2017-12-14 08:40:04

标签: c++ directx version shader pixel

如标题中记载的那样,我需要在c ++代码中获得像素着色器版本和顶点着色器版本。但我不知道该怎么做。有没有人可以帮助我?

1 个答案:

答案 0 :(得分:1)

您创建的设备传递的是D3D_FEATURE_LEVEL值数组,当函数成功时,所选的功能级别将通过pFeatureLevel指针返回。返回的功能级别确定视频适配器支持的最高着色器版本。

constexpr const ::std::array<::D3D_FEATURE_LEVEL, 4> feature_levels
{
    ::D3D_FEATURE_LEVEL_11_0
,   ::D3D_FEATURE_LEVEL_11_0
,   ::D3D_FEATURE_LEVEL_10_1
,   ::D3D_FEATURE_LEVEL_10
};
::ID3D11Device * naked_p_device{};
::D3D_FEATURE_LEVEL selected_feature_level{};
::ID3D11DeviceContext * naked_p_device_context{};
if
(
    SUCCEEDED
    (
        ::D3D11CreateDevice
        (
            p_adapter
        ,   D3D_DRIVER_TYPE_UNKNOWN
        ,   nullptr
        ,   creation_flags
        ,   feature_levels.data()
        ,   static_cast< ::UINT >(feature_levels.size())
        ,   D3D11_SDK_VERSION
        ,   ::std::addressof(naked_p_device)
        ,   ::std::addressof(selected_feature_level)
        ,   ::std::addressof(naked_p_device_context)
        )
    )
)
{
    // inspect selected_feature_level...
}

Table of feature level capabilities