Skip to content

Commit d00c2df

Browse files
committed
GS: Clean up feedback shader flags
No more checking 3 different flags to decide one thing
1 parent f9af32f commit d00c2df

File tree

12 files changed

+96
-123
lines changed

12 files changed

+96
-123
lines changed

bin/resources/shaders/dx11/tfx.fx

Lines changed: 23 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#define AFAIL_ZB_ONLY 2
3333
#define AFAIL_RGB_ONLY 3
3434
#define AFAIL_RGB_ONLY_DSB 4
35+
#define AFAIL_RGB_ONLY_SW_Z 5
3536
#endif
3637

3738
#ifndef PS_ATST_NONE
@@ -93,7 +94,6 @@
9394
#define PS_DITHER_ADJUST 0
9495
#define PS_ZCLAMP 0
9596
#define PS_ZFLOOR 0
96-
#define PS_ZWRITE 0
9797
#define PS_SCANMSK 0
9898
#define PS_AUTOMATIC_LOD 0
9999
#define PS_MANUAL_LOD 0
@@ -102,15 +102,16 @@
102102
#define PS_NO_COLOR1 0
103103
#define PS_DATE 0
104104
#define PS_TEX_IS_FB 0
105-
#define PS_COLOR_FEEDBACK 0
106-
#define PS_DEPTH_FEEDBACK 0
107105
#endif
108106

109107
#define SW_BLEND (PS_BLEND_A || PS_BLEND_B || PS_BLEND_D)
110108
#define SW_BLEND_NEEDS_RT (SW_BLEND && (PS_BLEND_A == 1 || PS_BLEND_B == 1 || PS_BLEND_C == 1 || PS_BLEND_D == 1))
111109
#define SW_AD_TO_HW (PS_BLEND_C == 1 && PS_A_MASKED)
112-
#define AFAIL_NEEDS_RT (PS_AFAIL == AFAIL_ZB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY)
113-
#define AFAIL_NEEDS_DEPTH (PS_AFAIL == AFAIL_FB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY)
110+
#define NEEDS_RT_FOR_AFAIL (PS_AFAIL == AFAIL_ZB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
111+
#define NEEDS_DEPTH_FOR_AFAIL (PS_AFAIL == AFAIL_FB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
112+
#define NEEDS_DEPTH_FOR_ZTST (PS_ZTST == ZTST_GEQUAL || PS_ZTST == ZTST_GREATER)
113+
#define SW_DEPTH (NEEDS_DEPTH_FOR_AFAIL || NEEDS_DEPTH_FOR_ZTST)
114+
#define ZWRITE (PS_ZFLOOR || PS_ZCLAMP || SW_DEPTH)
114115

115116
struct VS_INPUT
116117
{
@@ -168,16 +169,16 @@ struct PS_OUTPUT
168169
#endif
169170
#endif
170171
#endif
171-
#if PS_ZWRITE
172+
#if ZWRITE
172173
// In DX12 we do depth feedback loops with a color copy.
173-
#if PS_DEPTH_FEEDBACK && PS_NO_COLOR1 && DX12
174+
#if SW_DEPTH && PS_NO_COLOR1 && DX12
174175
#if NUM_RTS > 0
175176
float depth_color : SV_Target1;
176177
#else
177178
float depth_color : SV_Target0;
178179
#endif
179180
#endif
180-
#if PS_HAS_CONSERVATIVE_DEPTH && !PS_DEPTH_FEEDBACK
181+
#if PS_HAS_CONSERVATIVE_DEPTH && !SW_DEPTH
181182
float depth : SV_DepthLessEqual;
182183
#else
183184
float depth : SV_Depth;
@@ -1067,16 +1068,13 @@ PS_OUTPUT ps_main(PS_INPUT input)
10671068
input.p.z = floor(input.p.z * exp2(32.0f)) * exp2(-32.0f);
10681069
#endif
10691070

1070-
#if PS_DEPTH_FEEDBACK && (PS_ZTST == ZTST_GEQUAL || PS_ZTST == ZTST_GREATER)
1071-
#if PS_ZTST == ZTST_GEQUAL
1072-
if (input.p.z < DepthTexture.Load(int3(input.p.xy, 0)).r)
1073-
discard;
1074-
#elif PS_ZTST == ZTST_GREATER
1075-
if (input.p.z <= DepthTexture.Load(int3(input.p.xy, 0)).r)
1076-
discard;
1077-
#endif
1078-
#endif // PS_ZTST
1079-
1071+
#if PS_ZTST == ZTST_GEQUAL
1072+
if (input.p.z < DepthTexture.Load(int3(input.p.xy, 0)).r)
1073+
discard;
1074+
#elif PS_ZTST == ZTST_GREATER
1075+
if (input.p.z <= DepthTexture.Load(int3(input.p.xy, 0)).r)
1076+
discard;
1077+
#endif
10801078
float4 C = ps_color(input);
10811079

10821080
#if PS_FIXED_ONE_A
@@ -1257,19 +1255,17 @@ PS_OUTPUT ps_main(PS_INPUT input)
12571255
#endif
12581256

12591257
// Alpha test with feedback
1260-
#if (PS_AFAIL == AFAIL_FB_ONLY) && PS_DEPTH_FEEDBACK && PS_ZWRITE
1258+
#if PS_AFAIL == AFAIL_FB_ONLY
12611259
if (!atst_pass)
12621260
input.p.z = DepthTexture.Load(int3(input.p.xy, 0)).r;
1263-
#elif (PS_AFAIL == AFAIL_ZB_ONLY) && PS_COLOR_FEEDBACK
1261+
#elif PS_AFAIL == AFAIL_ZB_ONLY
12641262
if (!atst_pass)
12651263
output.c0 = RtTexture.Load(int3(input.p.xy, 0));
1266-
#elif (PS_AFAIL == AFAIL_RGB_ONLY)
1264+
#elif PS_AFAIL == AFAIL_RGB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z
12671265
if (!atst_pass)
12681266
{
1269-
#if PS_COLOR_FEEDBACK
1270-
output.c0.a = RtTexture.Load(int3(input.p.xy, 0)).a;
1271-
#endif
1272-
#if PS_DEPTH_FEEDBACK && PS_ZWRITE
1267+
output.c0.a = RtTexture.Load(int3(input.p.xy, 0)).a;
1268+
#if PS_AFAIL == AFAIL_RGB_ONLY_SW_Z
12731269
input.p.z = DepthTexture.Load(int3(input.p.xy, 0)).r;
12741270
#endif
12751271
}
@@ -1283,8 +1279,8 @@ PS_OUTPUT ps_main(PS_INPUT input)
12831279
input.p.z = min(input.p.z, MaxDepthPS);
12841280
#endif
12851281

1286-
#if PS_ZWRITE
1287-
#if PS_DEPTH_FEEDBACK && PS_NO_COLOR1 && DX12
1282+
#if ZWRITE
1283+
#if SW_DEPTH && PS_NO_COLOR1 && DX12
12881284
// Output color clone for feedback as well as real depth.
12891285
output.depth_color = input.p.z;
12901286
#endif

bin/resources/shaders/opengl/tfx_fs.glsl

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
#define AFAIL_ZB_ONLY 2
2323
#define AFAIL_RGB_ONLY 3
2424
#define AFAIL_RGB_ONLY_DSB 4
25+
#define AFAIL_RGB_ONLY_SW_Z 5
2526
#endif
2627

2728
#ifndef PS_ATST_NONE
@@ -46,13 +47,14 @@
4647
#define SW_AD_TO_HW (PS_BLEND_C == 1 && PS_A_MASKED)
4748
#define PS_PRIMID_INIT (PS_DATE == 1 || PS_DATE == 2)
4849
#define NEEDS_RT_EARLY (PS_TEX_IS_FB == 1 || PS_DATE >= 5)
49-
#define NEEDS_RT_FOR_AFAIL (PS_AFAIL == PS_ZB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY)
50-
#define NEEDS_DEPTH_FOR_AFAIL (PS_AFAIL == AFAIL_FB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY)
50+
#define NEEDS_RT_FOR_AFAIL (PS_AFAIL == PS_ZB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
51+
#define NEEDS_DEPTH_FOR_AFAIL (PS_AFAIL == AFAIL_FB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
5152
#define NEEDS_DEPTH_FOR_ZTST (PS_ZTST == ZTST_GEQUAL || PS_ZTST == ZTST_GREATER)
5253

5354
#define NEEDS_RT (NEEDS_RT_EARLY || NEEDS_RT_FOR_AFAIL || (!PS_PRIMID_INIT && (PS_FBMASK || SW_BLEND_NEEDS_RT || SW_AD_TO_HW)) || PS_COLOR_FEEDBACK)
5455
#define NEEDS_TEX (PS_TFX != 4)
55-
#define NEEDS_DEPTH (PS_DEPTH_FEEDBACK && (NEEDS_DEPTH_FOR_AFAIL || NEEDS_DEPTH_FOR_ZTST))
56+
#define SW_DEPTH (NEEDS_DEPTH_FOR_AFAIL || NEEDS_DEPTH_FOR_ZTST)
57+
#define ZWRITE (SW_DEPTH || PS_ZCLAMP || PS_ZFLOOR)
5658

5759
layout(std140, binding = 0) uniform cb21
5860
{
@@ -124,7 +126,7 @@ in SHADER
124126

125127
// Depth feedback mode 2 is for depth as color.
126128
// Use FB fetch for the feedback if it's available.
127-
#if NEEDS_DEPTH && PS_NO_COLOR1 && (DEPTH_FEEDBACK_SUPPORT == 2)
129+
#if SW_DEPTH && PS_NO_COLOR1 && (DEPTH_FEEDBACK_SUPPORT == 2)
128130
#if HAS_FRAMEBUFFER_FETCH
129131
layout(location = 1) inout float SV_Target1;
130132
#else
@@ -148,11 +150,11 @@ layout(binding = 3) uniform sampler2D img_prim_min;
148150
// Depth feedback mode 1 binds depth buffer directly as a texture.
149151
// Depth feedback mode 2 (depth as color) can use FB fetch for the feedback,
150152
// in which case we don't need to explicitly bind depth as a texture.
151-
#if (DEPTH_FEEDBACK_SUPPORT == 1 || (DEPTH_FEEDBACK_SUPPORT == 2 && !HAS_FRAMEBUFFER_FETCH)) && NEEDS_DEPTH
153+
#if (DEPTH_FEEDBACK_SUPPORT == 1 || (DEPTH_FEEDBACK_SUPPORT == 2 && !HAS_FRAMEBUFFER_FETCH)) && SW_DEPTH
152154
layout(binding = 4) uniform sampler2D DepthSampler;
153155
#endif
154156

155-
#if PS_ZWRITE && PS_HAS_CONSERVATIVE_DEPTH && !NEEDS_DEPTH
157+
#if ZWRITE && PS_HAS_CONSERVATIVE_DEPTH && !SW_DEPTH
156158
layout(depth_less) out float gl_FragDepth;
157159
#endif
158160

@@ -169,7 +171,7 @@ vec4 sample_from_rt()
169171

170172
vec4 sample_from_depth()
171173
{
172-
#if !NEEDS_DEPTH
174+
#if !SW_DEPTH
173175
return vec4(0.0);
174176
#elif HAS_FRAMEBUFFER_FETCH && (DEPTH_FEEDBACK_SUPPORT == 2)
175177
return SV_Target1;
@@ -1040,15 +1042,13 @@ void ps_main()
10401042
input_z = floor(input_z * exp2(32.0f)) * exp2(-32.0f);
10411043
#endif
10421044

1043-
#if NEEDS_DEPTH && (PS_ZTST == ZTST_GEQUAL || PS_ZTST == ZTST_GREATER)
1044-
#if PS_ZTST == ZTST_GEQUAL
1045-
if (input_z < sample_from_depth().r)
1046-
discard;
1047-
#elif PS_ZTST == ZTST_GREATER
1048-
if (input_z <= sample_from_depth().r)
1049-
discard;
1050-
#endif
1051-
#endif // PS_ZTST
1045+
#if PS_ZTST == ZTST_GEQUAL
1046+
if (input_z < sample_from_depth().r)
1047+
discard;
1048+
#elif PS_ZTST == ZTST_GREATER
1049+
if (input_z <= sample_from_depth().r)
1050+
discard;
1051+
#endif
10521052

10531053
#if PS_SCANMSK & 2
10541054
// fail depth test on prohibited lines
@@ -1215,19 +1215,17 @@ void ps_main()
12151215
#endif
12161216

12171217
// Alpha test with feedback
1218-
#if (PS_AFAIL == AFAIL_FB_ONLY) && NEEDS_DEPTH && PS_ZWRITE
1218+
#if PS_AFAIL == AFAIL_FB_ONLY
12191219
if (!atst_pass)
12201220
input_z = sample_from_depth().r;
1221-
#elif (PS_AFAIL == AFAIL_ZB_ONLY) && NEEDS_RT
1221+
#elif PS_AFAIL == AFAIL_ZB_ONLY
12221222
if (!atst_pass)
12231223
C = sample_from_rt();
1224-
#elif (PS_AFAIL == AFAIL_RGB_ONLY)
1224+
#elif (PS_AFAIL == AFAIL_RGB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
12251225
if (!atst_pass)
12261226
{
1227-
#if NEEDS_RT
1228-
C.a = sample_from_rt().a;
1229-
#endif
1230-
#if NEEDS_DEPTH && PS_ZWRITE
1227+
C.a = sample_from_rt().a;
1228+
#if PS_AFAIL == AFAIL_RGB_ONLY_SW_Z
12311229
input_z = sample_from_depth().r;
12321230
#endif
12331231
}
@@ -1246,8 +1244,8 @@ void ps_main()
12461244
input_z = min(input_z, MaxDepthPS);
12471245
#endif
12481246

1249-
#if PS_ZWRITE
1250-
#if NEEDS_DEPTH && PS_NO_COLOR1 && (DEPTH_FEEDBACK_SUPPORT == 2)
1247+
#if ZWRITE
1248+
#if SW_DEPTH && PS_NO_COLOR1 && (DEPTH_FEEDBACK_SUPPORT == 2)
12511249
// Depth as color write. For depth as color feedback we write to both
12521250
// color copy and real depth to avoid having to copy back to real depth.
12531251
// Warning: do not write SV_Target1 until the end since the value might

bin/resources/shaders/vulkan/tfx.glsl

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,7 @@ void main()
256256
#define AFAIL_ZB_ONLY 2
257257
#define AFAIL_RGB_ONLY 3
258258
#define AFAIL_RGB_ONLY_DSB 4
259+
#define AFAIL_RGB_ONLY_SW_Z 5
259260
#endif
260261

261262
#ifndef PS_ATST_NONE
@@ -310,7 +311,6 @@ void main()
310311
#define PS_DITHER_ADJUST 0
311312
#define PS_ZCLAMP 0
312313
#define PS_ZFLOOR 0
313-
#define PS_ZWRITE 0
314314
#define PS_SCANMSK 0
315315
#define PS_AUTOMATIC_LOD 0
316316
#define PS_MANUAL_LOD 0
@@ -319,19 +319,18 @@ void main()
319319
#define PS_NO_COLOR1 0
320320
#define PS_DATE 0
321321
#define PS_TEX_IS_FB 0
322-
#define PS_COLOR_FEEDBACK 0
323-
#define PS_DEPTH_FEEDBACK 0
324322
#endif
325323

326324
#define SW_BLEND (PS_BLEND_A || PS_BLEND_B || PS_BLEND_D)
327325
#define SW_BLEND_NEEDS_RT (SW_BLEND && (PS_BLEND_A == 1 || PS_BLEND_B == 1 || PS_BLEND_C == 1 || PS_BLEND_D == 1))
328326
#define SW_AD_TO_HW (PS_BLEND_C == 1 && PS_A_MASKED)
329-
#define AFAIL_NEEDS_RT (PS_AFAIL == AFAIL_ZB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY)
330-
#define AFAIL_NEEDS_DEPTH (PS_AFAIL == AFAIL_FB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY)
327+
#define AFAIL_NEEDS_RT (PS_AFAIL == AFAIL_ZB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
328+
#define AFAIL_NEEDS_DEPTH (PS_AFAIL == AFAIL_FB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
331329
#define ZTST_NEEDS_DEPTH (PS_ZTST == ZTST_GEQUAL || PS_ZTST == ZTST_GREATER)
332330

333-
#define PS_FEEDBACK_LOOP_IS_NEEDED_RT (PS_TEX_IS_FB == 1 || AFAIL_NEEDS_RT || PS_FBMASK || SW_BLEND_NEEDS_RT || SW_AD_TO_HW || (PS_DATE >= 5) || PS_COLOR_FEEDBACK)
334-
#define PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH (PS_DEPTH_FEEDBACK && (AFAIL_NEEDS_DEPTH || ZTST_NEEDS_DEPTH))
331+
#define PS_FEEDBACK_LOOP_IS_NEEDED_RT (PS_TEX_IS_FB == 1 || AFAIL_NEEDS_RT || PS_FBMASK || SW_BLEND_NEEDS_RT || SW_AD_TO_HW || (PS_DATE >= 5) || AFAIL_NEEDS_RT)
332+
#define PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH (AFAIL_NEEDS_DEPTH || ZTST_NEEDS_DEPTH)
333+
#define ZWRITE (PS_ZCLAMP || PS_ZFLOOR || PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH)
335334

336335
#define NEEDS_TEX (PS_TFX != 4)
337336

@@ -411,7 +410,7 @@ layout(set = 1, binding = 1) uniform texture2D Palette;
411410
layout(set = 1, binding = 3) uniform texture2D PrimMinTexture;
412411
#endif
413412

414-
#if PS_ZWRITE && !PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH
413+
#if ZWRITE && !PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH
415414
layout(depth_less) out float gl_FragDepth;
416415
#endif
417416

@@ -1291,15 +1290,13 @@ void main()
12911290
input_z = floor(input_z * exp2(32.0f)) * exp2(-32.0f);
12921291
#endif
12931292

1294-
#if PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH && (PS_ZTST == ZTST_GEQUAL || PS_ZTST == ZTST_GREATER)
1295-
#if PS_ZTST == ZTST_GEQUAL
1296-
if (input_z < sample_from_depth().r)
1297-
discard;
1298-
#elif PS_ZTST == ZTST_GREATER
1299-
if (input_z <= sample_from_depth().r)
1300-
discard;
1301-
#endif
1302-
#endif // PS_ZTST
1293+
#if PS_ZTST == ZTST_GEQUAL
1294+
if (input_z < sample_from_depth().r)
1295+
discard;
1296+
#elif PS_ZTST == ZTST_GREATER
1297+
if (input_z <= sample_from_depth().r)
1298+
discard;
1299+
#endif
13031300

13041301
#if PS_SCANMSK & 2
13051302
// fail depth test on prohibited lines
@@ -1466,19 +1463,17 @@ void main()
14661463
#endif
14671464

14681465
// Alpha test with feedback
1469-
#if (PS_AFAIL == AFAIL_FB_ONLY) && PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH && PS_ZWRITE
1466+
#if PS_AFAIL == AFAIL_FB_ONLY
14701467
if (!atst_pass)
14711468
input_z = sample_from_depth().r;
1472-
#elif (PS_AFAIL == AFAIL_ZB_ONLY) && PS_FEEDBACK_LOOP_IS_NEEDED_RT
1469+
#elif PS_AFAIL == AFAIL_ZB_ONLY
14731470
if (!atst_pass)
14741471
o_col0 = sample_from_rt();
1475-
#elif (PS_AFAIL == AFAIL_RGB_ONLY)
1472+
#elif (PS_AFAIL == AFAIL_RGB_ONLY || PS_AFAIL == AFAIL_RGB_ONLY_SW_Z)
14761473
if (!atst_pass)
14771474
{
1478-
#if PS_FEEDBACK_LOOP_IS_NEEDED_RT
1479-
o_col0.a = sample_from_rt().a;
1480-
#endif
1481-
#if PS_FEEDBACK_LOOP_IS_NEEDED_DEPTH && PS_ZWRITE
1475+
o_col0.a = sample_from_rt().a;
1476+
#if PS_AFAIL == AFAIL_RGB_ONLY_SW_Z
14821477
input_z = sample_from_depth().r;
14831478
#endif
14841479
}
@@ -1489,7 +1484,7 @@ void main()
14891484
input_z = min(input_z, MaxDepthPS);
14901485
#endif
14911486

1492-
#if PS_ZWRITE
1487+
#if ZWRITE
14931488
gl_FragDepth = input_z;
14941489
#endif
14951490
#endif // PS_DATE

pcsx2/GS/Renderers/Common/GSDevice.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,11 +1191,12 @@ static const char* GetPSAFAILName(GSShader::PS_AFAIL afail)
11911191
using GSShader::PS_AFAIL;
11921192
switch (afail)
11931193
{
1194-
case PS_AFAIL::KEEP: return "KEEP";
1195-
case PS_AFAIL::FB_ONLY: return "FB_ONLY";
1196-
case PS_AFAIL::ZB_ONLY: return "ZB_ONLY";
1197-
case PS_AFAIL::RGB_ONLY: return "RGB_ONLY";
1198-
case PS_AFAIL::RGB_ONLY_DSB: return "RGB_ONLY_DSB";
1194+
case PS_AFAIL::KEEP: return "KEEP";
1195+
case PS_AFAIL::FB_ONLY: return "FB_ONLY";
1196+
case PS_AFAIL::ZB_ONLY: return "ZB_ONLY";
1197+
case PS_AFAIL::RGB_ONLY: return "RGB_ONLY";
1198+
case PS_AFAIL::RGB_ONLY_DSB: return "RGB_ONLY_DSB";
1199+
case PS_AFAIL::RGB_ONLY_SW_Z: return "RGB_ONLY_SW_Z";
11991200
};
12001201
return "UNKNOWN";
12011202
}

pcsx2/GS/Renderers/Common/GSDevice.h

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ struct alignas(16) GSHWDrawConfig
402402
// Depth writing
403403
u32 zclamp : 1;
404404
u32 zfloor : 1;
405-
u32 zwrite : 1;
406405

407406
// Hack
408407
u32 tcoffsethack : 1;
@@ -416,10 +415,6 @@ struct alignas(16) GSHWDrawConfig
416415

417416
// Scan mask
418417
u32 scanmsk : 2;
419-
420-
// Feedback
421-
u32 color_feedback : 1;
422-
u32 depth_feedback : 1;
423418
};
424419

425420
struct
@@ -438,12 +433,15 @@ struct alignas(16) GSHWDrawConfig
438433
{
439434
const u32 sw_blend_bits = blend_a | blend_b | blend_d;
440435
const bool sw_blend_needs_rt = (sw_blend_bits != 0 && ((sw_blend_bits | blend_c) & 1u)) || ((a_masked & blend_c) != 0);
441-
return color_feedback || channel_fb || tex_is_fb || fbmask || (date >= 5) || sw_blend_needs_rt;
436+
const bool afail_needs_rt = afail == PS_AFAIL::ZB_ONLY || afail == PS_AFAIL::RGB_ONLY || afail == PS_AFAIL::RGB_ONLY_SW_Z;
437+
return channel_fb || tex_is_fb || fbmask || (date >= 5) || sw_blend_needs_rt || afail_needs_rt;
442438
}
443439

444440
__fi bool IsFeedbackLoopDepth() const
445441
{
446-
return depth_feedback;
442+
const bool afail_needs_depth = afail == PS_AFAIL::FB_ONLY || afail == PS_AFAIL::RGB_ONLY_SW_Z;
443+
const bool ztst_needs_depth = ztst == ZTST_GEQUAL || ztst == ZTST_GREATER;
444+
return afail_needs_depth || ztst_needs_depth;
447445
}
448446

449447
/// Disables color output from the pixel shader, this is done when all channels are masked.

0 commit comments

Comments
 (0)