GPU: UI scaling mode config dropdown, overrides fast stretched mode for UX clarity

This commit is contained in:
logarithm
2019-11-28 16:19:27 +02:00
parent ea203e8ca5
commit 46b7c02f74
3 changed files with 58 additions and 4 deletions

View File

@@ -76,6 +76,7 @@ import net.runelite.client.plugins.PluginInstantiationException;
import net.runelite.client.plugins.PluginManager;
import static net.runelite.client.plugins.gpu.GLUtil.*;
import net.runelite.client.plugins.gpu.config.AntiAliasingMode;
import net.runelite.client.plugins.gpu.config.UIScalingMode;
import net.runelite.client.plugins.gpu.template.Template;
import net.runelite.client.ui.DrawManager;
import net.runelite.client.util.OSType;
@@ -1181,7 +1182,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
glDpiAwareViewport(0, 0, canvasWidth, canvasHeight);
}
if (client.isStretchedEnabled() && !client.isStretchedFast()) {
if (client.isStretchedEnabled() && config.uiScalingMode() == UIScalingMode.CATMULL_ROM) {
// Use the texture bound in the first pass
gl.glUseProgram(glUiBicubicProgram);
gl.glUniform1i(uniTexBicubic, 0);
@@ -1197,8 +1198,7 @@ public class GpuPlugin extends Plugin implements DrawCallbacks
// See https://www.khronos.org/opengl/wiki/Sampler_Object for details.
if (client.isStretchedEnabled())
{
// This needs adjustments if we want to give the option of linear sampling in fast mode, now that slow mode is actually a more demanding sampler
final int function = client.isStretchedFast() ? gl.GL_NEAREST : gl.GL_LINEAR;
final int function = config.uiScalingMode() == UIScalingMode.LINEAR ? gl.GL_LINEAR : gl.GL_NEAREST;
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MIN_FILTER, function);
gl.glTexParameteri(gl.GL_TEXTURE_2D, gl.GL_TEXTURE_MAG_FILTER, function);
}

View File

@@ -31,6 +31,7 @@ import net.runelite.client.config.Range;
import static net.runelite.client.plugins.gpu.GpuPlugin.MAX_FOG_DEPTH;
import net.runelite.client.plugins.gpu.config.AntiAliasingMode;
import static net.runelite.client.plugins.gpu.GpuPlugin.MAX_DISTANCE;
import net.runelite.client.plugins.gpu.config.UIScalingMode;
@ConfigGroup("gpu")
public interface GpuPluginConfig extends Config
@@ -71,6 +72,17 @@ public interface GpuPluginConfig extends Config
return AntiAliasingMode.DISABLED;
}
@ConfigItem(
keyName = "uiScalingMode",
name = "UI scaling mode",
description = "Sampling function to use for the UI in stretched mode",
position = 4
)
default UIScalingMode uiScalingMode()
{
return UIScalingMode.CATMULL_ROM;
}
@Range(
max = MAX_FOG_DEPTH
)
@@ -78,7 +90,7 @@ public interface GpuPluginConfig extends Config
keyName = "fogDepth",
name = "Fog depth",
description = "Distance from the scene edge the fog starts",
position = 4
position = 5
)
default int fogDepth()
{

View File

@@ -0,0 +1,42 @@
/*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package net.runelite.client.plugins.gpu.config;
import lombok.Getter;
import lombok.RequiredArgsConstructor;
@Getter
@RequiredArgsConstructor
public enum UIScalingMode
{
NEAREST("Nearest Neighbor"),
LINEAR("Bilinear"),
CATMULL_ROM("Bicubic (Catmull-Rom)");
private final String name;
@Override
public String toString()
{
return name;
}
}