GPU/HW: Work around fxc uninitialized variable false positive

This commit is contained in:
Stenzek 2025-06-13 20:23:48 +10:00
parent 824b91a1f8
commit ac0c4544e1
No known key found for this signature in database

View File

@ -901,44 +901,23 @@ void FilteredSampleFromVRAM(TEXPAGE_VALUE texpage, float2 coords, float4 uv_limi
uint Bl = luma(B), Dl = luma(D), El = luma(E), Fl = luma(F), Hl = luma(H);
#if MMPX_ENHANCED
// Default to use center pixel E
ialpha = float(E != 0u);
texcol = unpackUnorm4x8(E);
if (
// Check for "convex" patterns to avoid single-pixel spurs on long line edges
if (A == B && B == C && E == H && A != D && C != F && rgb_distance(D, F) < 0.2 && rgb_distance(B, E) > 0.6) {
return;
}
if (A == D && D == G && E == F && A != B && G != H && rgb_distance(B, H) < 0.2 && rgb_distance(D, E) > 0.6) {
return;
}
if (C == F && F == I && E == D && B != C && H != I && rgb_distance(B, H) < 0.2 && rgb_distance(E, F) > 0.6) {
return;
}
if (G == H && H == I && B == E && D != G && F != I && rgb_distance(D, F) < 0.2 && rgb_distance(E, H) > 0.6) {
return;
}
(A == B && B == C && E == H && A != D && C != F && rgb_distance(D, F) < 0.2 && rgb_distance(B, E) > 0.6) ||
(A == D && D == G && E == F && A != B && G != H && rgb_distance(B, H) < 0.2 && rgb_distance(D, E) > 0.6) ||
(C == F && F == I && E == D && B != C && H != I && rgb_distance(B, H) < 0.2 && rgb_distance(E, F) > 0.6) ||
(G == H && H == I && B == E && D != G && F != I && rgb_distance(D, F) < 0.2 && rgb_distance(E, H) > 0.6) ||
// Check each 4-pixel intersection in a "grid" pattern and pass five surrounding pixels for pattern judgment
if (A == E && B == D && A != B && countPatternMatches(A, B, C, F, I, H, G)) {
return;
}
if (C == E && B == F && C != B && countPatternMatches(C, B, A, D, G, H, I)) {
return;
}
if (G == E && D == H && G != H && countPatternMatches(G, H, I, F, C, B, A)) {
return;
}
if (I == E && F == H && I != H && countPatternMatches(I, H, G, D, A, B, C)) {
return;
}
(A == E && B == D && A != B && countPatternMatches(A, B, C, F, I, H, G)) ||
(C == E && B == F && C != B && countPatternMatches(C, B, A, D, G, H, I)) ||
(G == E && D == H && G != H && countPatternMatches(G, H, I, F, C, B, A)) ||
(I == E && F == H && I != H && countPatternMatches(I, H, G, D, A, B, C))
) {
// Default to use center pixel E
// Fall through, J/K/L/M are already set to E. Setting the outputs here bugs out fxc.
} else {
#endif
// Original MMPX logic
// 1:1 slope rules
@ -981,6 +960,9 @@ void FilteredSampleFromVRAM(TEXPAGE_VALUE texpage, float2 coords, float4 uv_limi
if (all_eq3(F, I, B, P) && none_eq2(F, H, src(-1, -2))) M = K;
}
} // F !== D
#if MMPX_ENHANCED
}
#endif
} // not constant
// select quadrant based on fractional part of texture coordinates