MMPX Enhanced/Advanced clamp-to-transparent out-of-bounds mapping (#3774)

MMPX Enhanced/Advanced clamp-to-transparent out-of-bounds mapping
This commit is contained in:
crashGG
2026-07-10 11:51:51 +03:00
committed by GitHub
parent 94f11f9ba7
commit 2880f88d88
+11 -3
View File
@@ -836,7 +836,11 @@ void FilteredSampleFromVRAM(TEXPAGE_VALUE texpage, float2 coords, float4 uv_limi
else if (texture_filter == GPUTextureFilter::MMPXEnhanced) else if (texture_filter == GPUTextureFilter::MMPXEnhanced)
{ {
ss << R"( ss << R"(
#define srcf(xoffs,yoffs) SampleFromVRAM(texpage, bcoords + float2((xoffs), (yoffs)), uv_limits) #define srcf(xoffs,yoffs) \
SampleFromVRAM(texpage, bcoords + float2(xoffs, yoffs), uv_limits) * \
step(abs(bcoords.x + xoffs - clamp(bcoords.x + xoffs, uv_limits.x, uv_limits.z)), 0.001) * \
step(abs(bcoords.y + yoffs - clamp(bcoords.y + yoffs, uv_limits.y, uv_limits.w)), 0.001)
#define src(xoffs,yoffs) packUnorm4x8(srcf(xoffs,yoffs)) #define src(xoffs,yoffs) packUnorm4x8(srcf(xoffs,yoffs))
)"; )";
@@ -1047,7 +1051,11 @@ skiprest = skiprest||slope1||slope2||slope3||slope4||E==0u||B==0u||D==0u||F==0u|
else if (texture_filter == GPUTextureFilter::MMPXAdvanced) else if (texture_filter == GPUTextureFilter::MMPXAdvanced)
{ {
ss << R"( ss << R"(
#define srcf(xoffs,yoffs) SampleFromVRAM(texpage, bcoords + float2((xoffs), (yoffs)), uv_limits) #define srcf(xoffs,yoffs) \
SampleFromVRAM(texpage, bcoords + float2(xoffs, yoffs), uv_limits) * \
step(abs(bcoords.x + xoffs - clamp(bcoords.x + xoffs, uv_limits.x, uv_limits.z)), 0.001) * \
step(abs(bcoords.y + yoffs - clamp(bcoords.y + yoffs, uv_limits.y, uv_limits.w)), 0.001)
#define src(xoffs,yoffs) packUnorm4x8(srcf(xoffs,yoffs)) #define src(xoffs,yoffs) packUnorm4x8(srcf(xoffs,yoffs))
)"; )";
@@ -3406,4 +3414,4 @@ std::string GPU_HW_ShaderGen::GenerateReplacementMergeFragmentShader(bool replac
)"; )";
return std::move(ss).str(); return std::move(ss).str();
} }