Skip to content

Commit

Permalink
GS-HW: SW Render CLUT draws
Browse files Browse the repository at this point in the history
  • Loading branch information
refractionpcsx2 committed Oct 30, 2022
1 parent 614c535 commit bc2f576
Show file tree
Hide file tree
Showing 18 changed files with 415 additions and 151 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/scripts/lint/gamedb/lint.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"texturePreloading",
"deinterlace",
"cpuSpriteRenderBW",
"cpuCLUTRender",
"gpuPaletteConversion",
]
gs_hw_fix_ranges = {
Expand All @@ -73,6 +74,7 @@
"roundSprite": (0, 2),
"deinterlace": (0, 7),
"cpuSpriteRenderBW": (1, 10),
"cpuCLUTRender": (1, 2),
"gpuPaletteConversion": (0, 2),
}
allowed_speed_hacks = ["mvuFlagSpeedHack", "InstantVU1SpeedHack", "MTVUSpeedHack"]
Expand Down
14 changes: 14 additions & 0 deletions bin/resources/GameIndex.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16837,6 +16837,8 @@ SLES-53556:
region: "PAL-M3"
gameFixes:
- BlitInternalFPSHack # Fixes internal FPS detection.
gsHWFixes:
cpuSpriteRenderBW: 2 # Fixes some bad textures.
SLES-53557:
name: "Need for Speed - Most Wanted"
region: "PAL-E"
Expand Down Expand Up @@ -18021,6 +18023,8 @@ SLES-54027:
region: "PAL-M3"
gameFixes:
- BlitInternalFPSHack # Fixes internal FPS detection.
gsHWFixes:
cpuSpriteRenderBW: 2 # Fixes some bad textures.
SLES-54030:
name: "Black"
region: "PAL-E"
Expand Down Expand Up @@ -23037,6 +23041,8 @@ SLKA-25341:
region: "NTSC-K"
gameFixes:
- BlitInternalFPSHack # Fixes internal FPS detection.
gsHWFixes:
cpuSpriteRenderBW: 2 # Fixes some bad textures.
SLKA-25342:
name: "Ryu ga Gotoku"
region: "NTSC-K"
Expand Down Expand Up @@ -31535,6 +31541,8 @@ SLPM-66567:
region: "NTSC-J"
gameFixes:
- BlitInternalFPSHack # Fixes internal FPS detection.
gsHWFixes:
cpuSpriteRenderBW: 2 # Fixes some bad textures.
SLPM-66568:
name: "Brothers In Arms - Road to Hill 30 [Ubisoft Best]"
region: "NTSC-J"
Expand Down Expand Up @@ -44695,6 +44703,8 @@ SLUS-21271:
compat: 5
gameFixes:
- BlitInternalFPSHack # Fixes internal FPS detection.
gsHWFixes:
cpuSpriteRenderBW: 2 # Fixes some bad textures.
SLUS-21272:
name: "Super Monkey Ball Adventure"
region: "NTSC-U"
Expand Down Expand Up @@ -45419,6 +45429,8 @@ SLUS-21399:
region: "NTSC-U"
gameFixes:
- BlitInternalFPSHack # Fixes internal FPS detection.
gsHWFixes:
cpuSpriteRenderBW: 2 # Fixes some bad textures.
SLUS-21400:
name: "Monster House"
region: "NTSC-U"
Expand Down Expand Up @@ -48537,6 +48549,8 @@ SLUS-29185:
region: "NTSC-U"
gameFixes:
- BlitInternalFPSHack # Fixes internal FPS detection.
gsHWFixes:
cpuSpriteRenderBW: 2 # Fixes some bad textures.
SLUS-29188:
name: "Steambot Chronicles [Regular Demo]"
region: "NTSC-U"
Expand Down
2 changes: 2 additions & 0 deletions pcsx2-qt/Settings/GraphicsSettingsWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
//////////////////////////////////////////////////////////////////////////
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.halfScreenFix, "EmuCore/GS", "UserHacks_Half_Bottom_Override", -1, -1);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cpuSpriteRenderBW, "EmuCore/GS", "UserHacks_CPUSpriteRenderBW", 0);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.cpuCLUTRender, "EmuCore/GS", "UserHacks_CPUCLUTRender", 0);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.skipDrawStart, "EmuCore/GS", "UserHacks_SkipDraw_Start", 0);
SettingWidgetBinder::BindWidgetToIntSetting(sif, m_ui.skipDrawEnd, "EmuCore/GS", "UserHacks_SkipDraw_End", 0);
SettingWidgetBinder::BindWidgetToBoolSetting(sif, m_ui.hwAutoFlush, "EmuCore/GS", "UserHacks_AutoFlush", false);
Expand Down Expand Up @@ -335,6 +336,7 @@ GraphicsSettingsWidget::GraphicsSettingsWidget(SettingsDialog* dialog, QWidget*
{
m_ui.upscalingFixesLayout->removeRow(2);
m_ui.hardwareFixesLayout->removeRow(2);
m_ui.hardwareFixesLayout->removeRow(1);
m_ui.skipDrawStart = nullptr;
m_ui.skipDrawEnd = nullptr;
m_ui.textureOffsetX = nullptr;
Expand Down
162 changes: 97 additions & 65 deletions pcsx2-qt/Settings/GraphicsSettingsWidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
<item>
<widget class="QTabWidget" name="hardwareRendererGroup">
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<property name="documentMode">
<bool>true</bool>
Expand Down Expand Up @@ -388,7 +388,7 @@
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="upscaleMultiplier" />
<widget class="QComboBox" name="upscaleMultiplier"/>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_6">
Expand Down Expand Up @@ -692,14 +692,80 @@
</item>
</widget>
</item>
<item row="2" column="0">
<item row="1" column="0">
<widget class="QLabel" name="label_36">
<property name="text">
<string>CPU Sprite Render Size:</string>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cpuSpriteRenderBW">
<item>
<property name="text">
<string>0 (Disabled)</string>
</property>
</item>
<item>
<property name="text">
<string>1 (64 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>2 (128 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>3 (192 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>4 (256 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>5 (320 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>6 (384 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>7 (448 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>8 (512 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>9 (576 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>10 (640 Max Width)</string>
</property>
</item>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_12">
<property name="text">
<string>Skipdraw Range:</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="3" column="1">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QSpinBox" name="skipDrawStart">
Expand All @@ -717,7 +783,7 @@
</item>
</layout>
</item>
<item row="3" column="0" colspan="2">
<item row="4" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0">
<widget class="QCheckBox" name="hwAutoFlush">
Expand Down Expand Up @@ -777,72 +843,38 @@
</item>
</layout>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_36">
<property name="text">
<string>CPU Sprite Render Size:</string>
<item row="2" column="1">
<widget class="QComboBox" name="cpuCLUTRender">
<property name="currentText">
<string extracomment="0 (Disabled)">0 (Disabled)</string>
</property>
<property name="currentIndex">
<number>0</number>
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QComboBox" name="cpuSpriteRenderBW">
<item>
<property name="text">
<string>0 (Disabled)</string>
</property>
</item>
<item>
<property name="text">
<string>1 (64 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>2 (128 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>3 (192 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>4 (256 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>5 (320 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>6 (384 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>7 (448 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>8 (512 Max Width)</string>
<string>1 (Normal)</string>
</property>
</item>
<item>
<property name="text">
<string>9 (576 Max Width)</string>
</property>
</item>
<item>
<property name="text">
<string>10 (640 Max Width)</string>
<string>2 (Aggressive)</string>
</property>
</item>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_16">
<property name="text">
<string>Software CLUT Render</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QGroupBox" name="upscalingFixesTab">
Expand Down Expand Up @@ -1537,6 +1569,13 @@
<string>Rendering</string>
</attribute>
<layout class="QFormLayout" name="formLayout_3">
<item row="0" column="0">
<widget class="QLabel" name="label_37">
<property name="text">
<string>Texture Filtering:</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="swTextureFiltering">
<property name="enabled">
Expand Down Expand Up @@ -1573,10 +1612,10 @@
</item>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="label_37">
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Texture Filtering:</string>
<string>Extra Rendering Threads:</string>
</property>
</widget>
</item>
Expand All @@ -1587,13 +1626,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_9">
<property name="text">
<string>Extra Rendering Threads:</string>
</property>
</widget>
</item>
<item row="2" column="0" colspan="2">
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="1">
Expand Down
1 change: 1 addition & 0 deletions pcsx2/Config.h
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,7 @@ struct Pcsx2Config
int UserHacks_TCOffsetX{0};
int UserHacks_TCOffsetY{0};
int UserHacks_CPUSpriteRenderBW{0};
int UserHacks_CPUCLUTRender{ 0 };
TriFiltering TriFilter{TriFiltering::Automatic};
int OverrideTextureBarriers{-1};
int OverrideGeometryShaders{-1};
Expand Down
3 changes: 3 additions & 0 deletions pcsx2/Frontend/FullscreenUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2683,6 +2683,7 @@ void FullscreenUI::DrawGraphicsSettingsPage()
static constexpr const char* s_cpu_sprite_render_bw_options[] = {"0 (Disabled)", "1 (64 Max Width)", "2 (128 Max Width)",
"3 (192 Max Width)", "4 (256 Max Width)", "5 (320 Max Width)", "6 (384 Max Width)", "7 (448 Max Width)",
"8 (512 Max Width)", "9 (576 Max Width)", "10 (640 Max Width)"};
static constexpr const char* s_cpu_clut_render_options[] = { "0 (Disabled)", "1 (Normal)", "2 (Aggressive)" };
static constexpr const char* s_half_pixel_offset_options[] = {
"Off (Default)", "Normal (Vertex)", "Special (Texture)", "Special (Texture - Aggressive)"};
static constexpr const char* s_round_sprite_options[] = {"Off (Default)", "Half", "Full"};
Expand All @@ -2691,6 +2692,8 @@ void FullscreenUI::DrawGraphicsSettingsPage()
"UserHacks_Half_Bottom_Override", -1, s_generic_options, std::size(s_generic_options), -1);
DrawIntListSetting(bsi, "CPU Sprite Render Size", "Uses sofware renderer to draw texture decompression-like sprites.",
"EmuCore/GS", "UserHacks_CPUSpriteRenderBW", 0, s_cpu_sprite_render_bw_options, std::size(s_cpu_sprite_render_bw_options));
DrawIntListSetting(bsi, "CPU Sprite Render Size", "Uses sofware renderer to draw texture decompression-like sprites.",
"EmuCore/GS", "UserHacks_CPUSpriteRenderBW", 0, s_cpu_clut_render_options, std::size(s_cpu_clut_render_options));
DrawIntRangeSetting(
bsi, "Skip Draw Start", "Object range to skip drawing.", "EmuCore/GS", "UserHacks_SkipDraw_Start", 0, 0, 5000);
DrawIntRangeSetting(bsi, "Skip Draw End", "Object range to skip drawing.", "EmuCore/GS", "UserHacks_SkipDraw_End", 0, 0, 5000);
Expand Down
2 changes: 2 additions & 0 deletions pcsx2/Frontend/ImGuiOverlays.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,8 @@ void ImGuiManager::DrawSettingsOverlay()
APPEND("TCO={}/{} ", GSConfig.UserHacks_TCOffsetX, GSConfig.UserHacks_TCOffsetY);
if (GSConfig.UserHacks_CPUSpriteRenderBW != 0)
APPEND("CSBW={} ", GSConfig.UserHacks_CPUSpriteRenderBW);
if (GSConfig.UserHacks_CPUCLUTRender != 0)
APPEND("CCD={} ", GSConfig.UserHacks_CPUCLUTRender);
if (GSConfig.SkipDrawStart != 0 || GSConfig.SkipDrawEnd != 0)
APPEND("SD={}/{} ", GSConfig.SkipDrawStart, GSConfig.SkipDrawEnd);
if (GSConfig.UserHacks_TextureInsideRt)
Expand Down
4 changes: 3 additions & 1 deletion pcsx2/GS/GS.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,8 @@ void GSUpdateConfig(const Pcsx2Config::GSOptions& new_config)
GSConfig.UserHacks_DisableDepthSupport != old_config.UserHacks_DisableDepthSupport ||
GSConfig.UserHacks_DisablePartialInvalidation != old_config.UserHacks_DisablePartialInvalidation ||
GSConfig.UserHacks_TextureInsideRt != old_config.UserHacks_TextureInsideRt ||
GSConfig.UserHacks_CPUSpriteRenderBW != old_config.UserHacks_CPUSpriteRenderBW)
GSConfig.UserHacks_CPUSpriteRenderBW != old_config.UserHacks_CPUSpriteRenderBW ||
GSConfig.UserHacks_CPUSpriteRenderBW != old_config.UserHacks_CPUCLUTRender)
{
g_gs_renderer->PurgeTextureCache();
g_gs_renderer->PurgePool();
Expand Down Expand Up @@ -1512,6 +1513,7 @@ void GSApp::Init()
m_default_configuration["UserHacks_Disable_Safe_Features"] = "0";
m_default_configuration["UserHacks_DisablePartialInvalidation"] = "0";
m_default_configuration["UserHacks_CPUSpriteRenderBW"] = "0";
m_default_configuration["UserHacks_CPUCLUTRender"] = "0";
m_default_configuration["UserHacks_CPU_FB_Conversion"] = "0";
m_default_configuration["UserHacks_Half_Bottom_Override"] = "-1";
m_default_configuration["UserHacks_HalfPixelOffset"] = "0";
Expand Down
Loading

0 comments on commit bc2f576

Please sign in to comment.