如标题中记载的那样,我需要在c ++代码中获得像素着色器版本和顶点着色器版本。但我不知道该怎么做。有没有人可以帮助我?
答案 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...
}