@@ -57,7 +57,7 @@ GSDevice11::GSDevice11()
5757
5858 m_features.primitive_id = true ;
5959 m_features.texture_barrier = false ;
60- m_features.multidraw_fb_copy = GSConfig. OverrideTextureBarriers != 0 ;
60+ m_features.multidraw_fb_copy = false ;
6161 m_features.provoking_vertex_last = false ;
6262 m_features.point_expand = false ;
6363 m_features.line_expand = false ;
@@ -68,7 +68,8 @@ GSDevice11::GSDevice11()
6868 m_features.stencil_buffer = true ;
6969 m_features.cas_sharpening = true ;
7070 m_features.test_and_sample_depth = false ;
71- m_features.depth_feedback = true ;
71+ m_features.depth_feedback = false ;
72+ m_features.aa1 = false ;
7273}
7374
7475GSDevice11::~GSDevice11 () = default ;
@@ -636,16 +637,19 @@ void GSDevice11::Destroy()
636637
637638void GSDevice11::SetFeatures (IDXGIAdapter1* adapter)
638639{
640+ // Check these first as others depend on them.
641+ m_features.multidraw_fb_copy = GSConfig.OverrideTextureBarriers != 0 ;
642+ m_features.vs_expand = (!GSConfig.DisableVertexShaderExpand && m_feature_level >= D3D_FEATURE_LEVEL_11_0);
643+
639644 // Check all three formats, since the feature means any can be used.
640645 m_features.dxt_textures = SupportsTextureFormat (m_dev.get (), DXGI_FORMAT_BC1_UNORM) &&
641646 SupportsTextureFormat (m_dev.get (), DXGI_FORMAT_BC2_UNORM) &&
642647 SupportsTextureFormat (m_dev.get (), DXGI_FORMAT_BC3_UNORM);
643648
644649 m_features.bptc_textures = SupportsTextureFormat (m_dev.get (), DXGI_FORMAT_BC7_UNORM);
645-
646- m_features.vs_expand = (!GSConfig.DisableVertexShaderExpand && m_feature_level >= D3D_FEATURE_LEVEL_11_0);
647650 m_features.cas_sharpening = (m_feature_level >= D3D_FEATURE_LEVEL_11_0);
648651 m_features.test_and_sample_depth = (m_feature_level >= D3D_FEATURE_LEVEL_11_0);
652+ m_features.depth_feedback = m_features.feedback_loops ();
649653 m_features.aa1 = GSConfig.HWAA1 && m_features.vs_expand && m_features.feedback_loops ();
650654
651655 m_max_texture_size = (m_feature_level >= D3D_FEATURE_LEVEL_11_0) ?
@@ -2945,22 +2949,29 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
29452949 }
29462950
29472951 const bool tex_is_fb = config.tex && config.tex == draw_rt;
2952+ const bool rt_feedbackloop_pass1 = config.ps .IsFeedbackLoopRT () || tex_is_fb;
2953+ const bool rt_feedbackloop_pass2 = config.alpha_second_pass .ps .IsFeedbackLoopRT () || tex_is_fb;
29482954 if (draw_rt && (((config.require_one_barrier || (config.require_full_barrier && m_features.multidraw_fb_copy )) &&
2949- (config. ps . IsFeedbackLoopRT () || config. alpha_second_pass . ps . IsFeedbackLoopRT ())) || tex_is_fb ))
2955+ (rt_feedbackloop_pass1 || rt_feedbackloop_pass2)) ))
29502956 {
29512957 config.require_one_barrier |= (tex_is_fb && !config.require_full_barrier );
2958+ config.alpha_second_pass .require_one_barrier |= (tex_is_fb && !config.require_full_barrier );
29522959
29532960 // Requires a copy of the RT.
29542961 draw_rt_clone = CreateTexture (rtsize.x , rtsize.y , 1 , draw_rt->GetFormat (), true );
2962+
29552963 if (!draw_rt_clone)
29562964 Console.Warning (" D3D11: Failed to allocate temp texture for RT copy." );
29572965 }
29582966
2959- if (draw_ds && (config.require_one_barrier || (config.require_full_barrier && m_features.multidraw_fb_copy )) &&
2960- m_features.depth_feedback && (config.ps .IsFeedbackLoopDepth () || config.alpha_second_pass .ps .IsFeedbackLoopDepth ()))
2967+ const bool ds_feedbackloop_pass1 = config.ps .IsFeedbackLoopDepth ();
2968+ const bool ds_feedbackloop_pass2 = config.alpha_second_pass .ps .IsFeedbackLoopDepth ();
2969+ if (draw_ds && m_features.depth_feedback && (config.require_one_barrier || (config.require_full_barrier && m_features.multidraw_fb_copy )) &&
2970+ (ds_feedbackloop_pass1 || ds_feedbackloop_pass2))
29612971 {
29622972 // Requires a copy of the DS.
29632973 draw_ds_clone = CreateTexture (rtsize.x , rtsize.y , 1 , draw_ds->GetFormat (), true );
2974+
29642975 if (!draw_ds_clone)
29652976 Console.Warning (" D3D11: Failed to allocate temp texture for DS copy." );
29662977 }
@@ -2973,7 +2984,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
29732984 if (config.destination_alpha == GSHWDrawConfig::DestinationAlphaMode::StencilOne && need_barrier)
29742985 m_ctx->ClearDepthStencilView (*static_cast <GSTexture11*>(draw_ds), D3D11_CLEAR_STENCIL, 0 .0f , 1 );
29752986
2976- SendHWDraw (config, draw_rt_clone, draw_rt, draw_ds_clone, draw_ds,
2987+ SendHWDraw (config, rt_feedbackloop_pass1 ? draw_rt_clone : nullptr , draw_rt, ds_feedbackloop_pass1 ? draw_ds_clone : nullptr , draw_ds,
29772988 config.require_one_barrier , config.require_full_barrier );
29782989
29792990 if (config.blend_multi_pass .enable )
@@ -3001,7 +3012,7 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
30013012
30023013 const bool one_barrier = config.alpha_second_pass .require_one_barrier && m_features.multidraw_fb_copy ;
30033014 SetupOM (config.alpha_second_pass .depth , OMBlendSelector (config.alpha_second_pass .colormask , config.blend ), config.blend .constant );
3004- SendHWDraw (config, draw_rt_clone, draw_rt, draw_ds_clone, draw_ds,
3015+ SendHWDraw (config, rt_feedbackloop_pass2 ? draw_rt_clone : nullptr , draw_rt, ds_feedbackloop_pass2 ? draw_ds_clone : nullptr , draw_ds,
30053016 one_barrier, config.alpha_second_pass .require_full_barrier );
30063017 }
30073018
0 commit comments