Fix ImGui procedural filtering. (#188)

This commit is contained in:
Skyth (Asilkan) 2025-01-25 18:28:43 +03:00 committed by GitHub
parent e88ed2502c
commit d041e2ba30
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 15 deletions

View file

@ -61,16 +61,16 @@ float4 SampleLinear(float2 uvTexspace)
float4 PixelAntialiasing(float2 uvTexspace) float4 PixelAntialiasing(float2 uvTexspace)
{ {
float2 seam = floor(uvTexspace + 0.5);
uvTexspace = (uvTexspace - seam) / fwidth(uvTexspace) + seam;
uvTexspace = clamp(uvTexspace, seam - 0.5, seam + 0.5);
if ((g_PushConstants.InverseDisplaySize.y / g_PushConstants.InverseDisplaySize.x) >= (4.0 / 3.0)) if ((g_PushConstants.InverseDisplaySize.y / g_PushConstants.InverseDisplaySize.x) >= (4.0 / 3.0))
uvTexspace *= g_PushConstants.InverseDisplaySize.y * 720.0f; uvTexspace *= g_PushConstants.InverseDisplaySize.y * 720.0f;
else else
uvTexspace *= g_PushConstants.InverseDisplaySize.x * 960.0f; uvTexspace *= g_PushConstants.InverseDisplaySize.x * 960.0f;
return SampleLinear(uvTexspace); float2 seam = floor(uvTexspace + 0.5);
uvTexspace = (uvTexspace - seam) / fwidth(uvTexspace) + seam;
uvTexspace = clamp(uvTexspace, seam - 0.5, seam + 0.5);
return SampleLinear(uvTexspace - 0.5);
} }
float median(float r, float g, float b) float median(float r, float g, float b)
@ -81,7 +81,7 @@ float median(float r, float g, float b)
float4 main(in Interpolators interpolators) : SV_Target float4 main(in Interpolators interpolators) : SV_Target
{ {
float4 color = interpolators.Color; float4 color = interpolators.Color;
color *= PixelAntialiasing(interpolators.Position.xy - (g_PushConstants.ProceduralOrigin + 0.5)); color *= PixelAntialiasing(interpolators.Position.xy - g_PushConstants.ProceduralOrigin);
if (g_PushConstants.Texture2DDescriptorIndex != 0) if (g_PushConstants.Texture2DDescriptorIndex != 0)
{ {

View file

@ -639,8 +639,8 @@ static void DrawDescriptionContainer()
auto drawList = ImGui::GetForegroundDrawList(); auto drawList = ImGui::GetForegroundDrawList();
auto fontSize = Scale(26.0f); auto fontSize = Scale(26.0f);
ImVec2 descriptionMin = { g_aspectRatioOffsetX + Scale(CONTAINER_X), g_aspectRatioOffsetY + Scale(CONTAINER_Y) }; ImVec2 descriptionMin = { round(g_aspectRatioOffsetX + Scale(CONTAINER_X)), round(g_aspectRatioOffsetY + Scale(CONTAINER_Y)) };
ImVec2 descriptionMax = { g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH), g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT) }; ImVec2 descriptionMax = { round(g_aspectRatioOffsetX + Scale(CONTAINER_X + CONTAINER_WIDTH)), round(g_aspectRatioOffsetY + Scale(CONTAINER_Y + CONTAINER_HEIGHT)) };
SetProceduralOrigin(descriptionMin); SetProceduralOrigin(descriptionMin);
DrawContainer(descriptionMin, descriptionMax, true); DrawContainer(descriptionMin, descriptionMax, true);

View file

@ -1230,17 +1230,17 @@ void OptionsMenu::Draw()
float totalGridCount = settingsGridCount + paddingGridCount + infoGridCount; float totalGridCount = settingsGridCount + paddingGridCount + infoGridCount;
float offsetX = (1280.0f - ((GRID_SIZE * totalGridCount) - 1)) / 2.0f; float offsetX = (1280.0f - ((GRID_SIZE * totalGridCount) - 1)) / 2.0f;
float minY = g_aspectRatioOffsetY + Scale(CONTAINER_POS_Y); float minY = round(g_aspectRatioOffsetY + Scale(CONTAINER_POS_Y));
float maxY = g_aspectRatioOffsetY + Scale((720.0f - CONTAINER_POS_Y + 1.0f)); float maxY = round(g_aspectRatioOffsetY + Scale((720.0f - CONTAINER_POS_Y + 1.0f)));
DrawSettingsPanel( DrawSettingsPanel(
{ g_aspectRatioOffsetX + Scale(offsetX), minY }, { round(g_aspectRatioOffsetX + Scale(offsetX)), minY },
{ g_aspectRatioOffsetX + Scale(offsetX + settingsGridCount * GRID_SIZE), maxY } { round(g_aspectRatioOffsetX + Scale(offsetX + settingsGridCount * GRID_SIZE)), maxY }
); );
DrawInfoPanel( DrawInfoPanel(
{ g_aspectRatioOffsetX + Scale(offsetX + (settingsGridCount + paddingGridCount) * GRID_SIZE), minY }, { round(g_aspectRatioOffsetX + Scale(offsetX + (settingsGridCount + paddingGridCount) * GRID_SIZE)), minY },
{ g_aspectRatioOffsetX + Scale(offsetX + totalGridCount * GRID_SIZE), maxY } { round(g_aspectRatioOffsetX + Scale(offsetX + totalGridCount * GRID_SIZE)), maxY }
); );
if (g_isStage) if (g_isStage)