Reputation: 53
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?
Upvotes: 0
Views: 815
Reputation: 37513
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
Upvotes: 1