1
0
mirror of https://github.com/blawar/GLideN64.git synced 2024-06-25 22:09:35 +00:00

Add config option enableNativeResTexrects.

Support in GUI and mupen64plus settings.
This commit is contained in:
Sergey Lipskiy 2016-05-30 22:18:25 +06:00
parent 5df6498405
commit 99a075eae7
9 changed files with 78 additions and 8 deletions

View File

@ -35,6 +35,7 @@ void Config::resetToDefaults()
generalEmulation.enableCustomSettings = 1;
generalEmulation.enableShadersStorage = 1;
generalEmulation.correctTexrectCoords = tcDisable;
generalEmulation.enableNativeResTexrects = 0;
generalEmulation.hacks = 0;
#ifdef ANDROID
generalEmulation.forcePolygonOffset = 0;

View File

@ -4,7 +4,7 @@
#include <string>
#include "Types.h"
#define CONFIG_VERSION_CURRENT 9U
#define CONFIG_VERSION_CURRENT 10U
#define BILINEAR_3POINT 0
#define BILINEAR_STANDARD 1
@ -48,6 +48,7 @@ struct Config
u32 enableCustomSettings;
u32 enableShadersStorage;
u32 correctTexrectCoords;
u32 enableNativeResTexrects;
u32 hacks;
#ifdef ANDROID
u32 forcePolygonOffset;

View File

@ -127,6 +127,13 @@ void ConfigDialog::_init()
ui->fixTexrectForceRadioButton->setChecked(true);
break;
}
ui->nativeRes2D_checkBox->setChecked(config.generalEmulation.enableNativeResTexrects != 0);
if (ui->nativeRes2D_checkBox->isChecked()) {
ui->texrectsBlackLinesLabel->setEnabled(false);
ui->fixTexrectDisableRadioButton->setEnabled(false);
ui->fixTexrectSmartRadioButton->setEnabled(false);
ui->fixTexrectForceRadioButton->setEnabled(false);
}
ui->bufferSwapComboBox->setCurrentIndex(config.frameBufferEmulation.bufferSwapMode);
ui->frameBufferGroupBox->setChecked(config.frameBufferEmulation.enable != 0);
@ -324,6 +331,7 @@ void ConfigDialog::accept()
config.generalEmulation.correctTexrectCoords = Config::tcSmart;
else if (ui->fixTexrectForceRadioButton->isChecked())
config.generalEmulation.correctTexrectCoords = Config::tcForce;
config.generalEmulation.enableNativeResTexrects = ui->nativeRes2D_checkBox->isChecked() ? 1 : 0;
config.frameBufferEmulation.bufferSwapMode = ui->bufferSwapComboBox->currentIndex();
config.frameBufferEmulation.enable = ui->frameBufferGroupBox->isChecked() ? 1 : 0;
@ -487,3 +495,11 @@ void ConfigDialog::on_windowedResolutionComboBox_currentIndexChanged(int index)
ui->windowHeightSpinBox->setValue(bCustom ? config.video.windowedHeight : WindowedModes[index].height);
ui->windowHeightSpinBox->setEnabled(bCustom);
}
void ConfigDialog::on_nativeRes2D_checkBox_toggled(bool checked)
{
ui->texrectsBlackLinesLabel->setEnabled(!checked);
ui->fixTexrectDisableRadioButton->setEnabled(!checked);
ui->fixTexrectSmartRadioButton->setEnabled(!checked);
ui->fixTexrectForceRadioButton->setEnabled(!checked);
}

View File

@ -37,6 +37,8 @@ private slots:
void on_windowedResolutionComboBox_currentIndexChanged(int index);
void on_nativeRes2D_checkBox_toggled(bool checked);
private:
void _init();
void _getTranslations(QStringList & _translationFiles) const;

View File

@ -42,6 +42,7 @@ void _loadSettings(QSettings & settings)
config.generalEmulation.enableShadersStorage = settings.value("enableShadersStorage", config.generalEmulation.enableShadersStorage).toInt();
config.generalEmulation.enableCustomSettings = settings.value("enableCustomSettings", config.generalEmulation.enableCustomSettings).toInt();
config.generalEmulation.correctTexrectCoords = settings.value("correctTexrectCoords", config.generalEmulation.correctTexrectCoords).toInt();
config.generalEmulation.enableNativeResTexrects = settings.value("enableNativeResTexrects", config.generalEmulation.enableNativeResTexrects).toInt();
settings.endGroup();
settings.beginGroup("frameBufferEmulation");
@ -157,6 +158,7 @@ void writeSettings(const QString & _strIniFolder)
settings.setValue("enableShadersStorage", config.generalEmulation.enableShadersStorage);
settings.setValue("enableCustomSettings", config.generalEmulation.enableCustomSettings);
settings.setValue("correctTexrectCoords", config.generalEmulation.correctTexrectCoords);
settings.setValue("enableNativeResTexrects", config.generalEmulation.enableNativeResTexrects);
settings.endGroup();
settings.beginGroup("frameBufferEmulation");

View File

@ -724,9 +724,43 @@
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_22">
<layout class="QHBoxLayout" name="horizontalLayout_24">
<item>
<widget class="QLabel" name="label_33">
<widget class="Line" name="line_11">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_34">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>2D Fixes</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line_10">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="texrectsBlackLinesHorizontalLayout">
<item>
<widget class="QLabel" name="texrectsBlackLinesLabel">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Fix black lines between texrect:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Most games draw 2D backgrounds using texrect command. Texrect stands for textured rectangle. In some games, texrects coordinates not aligned: there is half-pixel split between adjacent texrects. It is not visible in native resolution, but resulted as black lines when image upscaled. This option enables texrect coordinates correction to avoid black lines issue.&lt;/p&gt;&lt;p&gt;* disable - do not correct texrect coordinates&lt;/p&gt;&lt;p&gt;* smart - apply correction only for polygons, which need it. Use it for games, which have black lines issue.&lt;/p&gt;&lt;p&gt;* force - apply correction for all texrects. Use it when &lt;span style=&quot; font-style:italic;&quot;&gt;smart&lt;/span&gt; does not help.&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;game dependant, mostly off&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
@ -773,6 +807,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="nativeRes2D_checkBox">
<property name="toolTip">
<string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;&lt;span style=&quot; font-weight:600;&quot;&gt;Render texrects in native resolution:&lt;/span&gt;&lt;/p&gt;&lt;p&gt;Most games draw 2D backgrounds and other 2D graphics using texrect command. Texrect stands for textured rectangle. 2D images represented by texrects often look distorted and unaligned in high resolution because of texture filtering. When this option is on, plugin renders texrects in native resolution and then copies the result to main buffer. Rendering in native resolution eliminates issues with 2D, but hardware load increases noticably.&lt;/p&gt;&lt;p&gt;Note: this option uses heuristics to detect adjucent texrects. The heuristics do not work for some games.&lt;/p&gt;&lt;p&gt;[Recommended: &lt;span style=&quot; font-style:italic;&quot;&gt;mostly on, if your hardware can handle it&lt;/span&gt;]&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
<property name="text">
<string>Render texrects in native resolution</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
@ -1851,10 +1895,10 @@
</connections>
<buttongroups>
<buttongroup name="screenshotButtonGroup"/>
<buttongroup name="fixTexrectCoordsButtonGroup"/>
<buttongroup name="bilinearButtonGroup"/>
<buttongroup name="bloomBlendModeButtonGroup"/>
<buttongroup name="aspectButtonGroup"/>
<buttongroup name="bilinearButtonGroup"/>
<buttongroup name="fixTexrectCoordsButtonGroup"/>
<buttongroup name="copyFrameBufferButtonGroup"/>
<buttongroup name="bloomBlendModeButtonGroup"/>
</buttongroups>
</ui>

View File

@ -1495,7 +1495,8 @@ void OGLRender::drawTexturedRect(const TexturedRectParams & _params)
OGLVideo & ogl = video();
TextureCache & cache = textureCache();
const bool bUseBilinear = (gDP.otherMode.textureFilter | (gSP.objRendermode&G_OBJRM_BILERP)) != 0;
const bool bUseTexrectDrawer = bUseBilinear
const bool bUseTexrectDrawer = config.generalEmulation.enableNativeResTexrects != 0
&& bUseBilinear
&& pCurrentCombiner->usesTexture()
&& (pCurrentBuffer == NULL || !pCurrentBuffer->m_cfb)
&& (cache.current[0] != NULL)

View File

@ -873,7 +873,7 @@ void gDPTextureRectangle(f32 ulx, f32 uly, f32 lrx, f32 lry, s32 tile, f32 s, f3
OGLRender::TexturedRectParams params(ulx, uly, lrx, lry, s, t, lrs, lrt, fabsf(dsdx), fabsf(dtdy),
flip, false, true, frameBufferList().getCurrent());
OGLRender & render = video().getRender();
if (config.generalEmulation.correctTexrectCoords != Config::tcDisable)
if (config.generalEmulation.enableNativeResTexrects == 0 && config.generalEmulation.correctTexrectCoords != Config::tcDisable)
render.correctTexturedRectParams(params);
render.drawTexturedRect(params);

View File

@ -72,6 +72,8 @@ bool Config_SetDefault()
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultInt(g_configVideoGliden64, "CorrectTexrectCoords", config.generalEmulation.correctTexrectCoords, "Make texrect coordinates continuous to avoid black lines between them. (0=Off, 1=Auto, 2=Force)");
assert(res == M64ERR_SUCCESS);
res = ConfigSetDefaultBool(g_configVideoGliden64, "enableNativeResTexrects", config.generalEmulation.enableNativeResTexrects, "Render 2D texrects in native resolution to fix misalignment between parts of 2D image.");
assert(res == M64ERR_SUCCESS);
#ifdef ANDROID
res = ConfigSetDefaultBool(g_configVideoGliden64, "ForcePolygonOffset", config.generalEmulation.forcePolygonOffset, "If true, use polygon offset values specified below");
assert(res == M64ERR_SUCCESS);
@ -202,6 +204,7 @@ void Config_LoadConfig()
config.generalEmulation.enableHWLighting = ConfigGetParamBool(g_configVideoGliden64, "EnableHWLighting");
config.generalEmulation.enableShadersStorage = ConfigGetParamBool(g_configVideoGliden64, "EnableShadersStorage");
config.generalEmulation.correctTexrectCoords = ConfigGetParamInt(g_configVideoGliden64, "CorrectTexrectCoords");
config.generalEmulation.enableNativeResTexrects = ConfigGetParamBool(g_configVideoGliden64, "enableNativeResTexrects");
#ifdef ANDROID
config.generalEmulation.forcePolygonOffset = ConfigGetParamBool(g_configVideoGliden64, "ForcePolygonOffset");
config.generalEmulation.polygonOffsetFactor = ConfigGetParamFloat(g_configVideoGliden64, "PolygonOffsetFactor");