简体   繁体   中英

How to get pixel shader version and vertex shader version in c++

as memtioned in title, I need to get pixel shader version and vertex shader version in c++ code.But I don't know how to do it. Is there anyone can help me?

What you create device you are passing an array of D3D_FEATURE_LEVEL values, when function succeeds the chosen feature level will be returned as through pFeatureLevel pointer. Returned feature level determines highest shader version supported by video adapter.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM