mirror of https://github.com/PCSX2/pcsx2.git
GS: Make TC offset changable without recreating
This commit is contained in:
parent
1e86ba4120
commit
6c33b73cdd
|
@ -809,7 +809,11 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="textureOffsetX"/>
|
<widget class="QSpinBox" name="textureOffsetX">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_18">
|
<widget class="QLabel" name="label_18">
|
||||||
|
@ -819,7 +823,11 @@
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QSpinBox" name="textureOffsetY"/>
|
<widget class="QSpinBox" name="textureOffsetY">
|
||||||
|
<property name="maximum">
|
||||||
|
<number>1000</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
|
|
@ -767,9 +767,6 @@ void GSUpdateConfig(const Pcsx2Config::GSOptions& new_config)
|
||||||
GSConfig.SWExtraThreads != old_config.SWExtraThreads ||
|
GSConfig.SWExtraThreads != old_config.SWExtraThreads ||
|
||||||
GSConfig.SWExtraThreadsHeight != old_config.SWExtraThreadsHeight ||
|
GSConfig.SWExtraThreadsHeight != old_config.SWExtraThreadsHeight ||
|
||||||
|
|
||||||
GSConfig.UserHacks_TCOffsetX != old_config.UserHacks_TCOffsetX ||
|
|
||||||
GSConfig.UserHacks_TCOffsetY != old_config.UserHacks_TCOffsetY ||
|
|
||||||
|
|
||||||
GSConfig.ShadeBoost_Brightness != old_config.ShadeBoost_Brightness ||
|
GSConfig.ShadeBoost_Brightness != old_config.ShadeBoost_Brightness ||
|
||||||
GSConfig.ShadeBoost_Contrast != old_config.ShadeBoost_Contrast ||
|
GSConfig.ShadeBoost_Contrast != old_config.ShadeBoost_Contrast ||
|
||||||
GSConfig.ShadeBoost_Saturation != old_config.ShadeBoost_Saturation ||
|
GSConfig.ShadeBoost_Saturation != old_config.ShadeBoost_Saturation ||
|
||||||
|
@ -793,16 +790,8 @@ void GSUpdateConfig(const Pcsx2Config::GSOptions& new_config)
|
||||||
s_gs->SetGameCRC(s_gs->GetGameCRC(), s_gs->GetGameCRCOptions());
|
s_gs->SetGameCRC(s_gs->GetGameCRC(), s_gs->GetGameCRCOptions());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
// renderer-specific options (e.g. auto flush, TC offset)
|
||||||
GSConfig.AutoFlushSW != old_config.AutoFlushSW ||
|
s_gs->UpdateSettings(old_config);
|
||||||
GSConfig.UserHacks_AutoFlush != old_config.UserHacks_AutoFlush ||
|
|
||||||
GSConfig.UserHacks_WildHack != old_config.UserHacks_WildHack)
|
|
||||||
{
|
|
||||||
s_gs->ResetHandlers();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (GSConfig.Mipmap != old_config.Mipmap || GSConfig.HWMipmap != old_config.HWMipmap)
|
|
||||||
s_gs->UpdateMipmapEnabled();
|
|
||||||
|
|
||||||
// reload texture cache when trilinear filtering or TC options change
|
// reload texture cache when trilinear filtering or TC options change
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -132,7 +132,6 @@ GSState::GSState()
|
||||||
Reset();
|
Reset();
|
||||||
|
|
||||||
ResetHandlers();
|
ResetHandlers();
|
||||||
UpdateMipmapEnabled();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GSState::~GSState()
|
GSState::~GSState()
|
||||||
|
@ -315,9 +314,17 @@ void GSState::ResetHandlers()
|
||||||
m_fpGIFRegHandlers[GIF_A_D_REG_LABEL] = &GSState::GIFRegHandlerNull;
|
m_fpGIFRegHandlers[GIF_A_D_REG_LABEL] = &GSState::GIFRegHandlerNull;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GSState::UpdateMipmapEnabled()
|
void GSState::UpdateSettings(const Pcsx2Config::GSOptions& old_config)
|
||||||
{
|
{
|
||||||
m_mipmap = GSConfig.UseHardwareRenderer() ? (GSConfig.HWMipmap >= HWMipmapLevel::Basic) : GSConfig.Mipmap;
|
m_mipmap = GSConfig.Mipmap;
|
||||||
|
|
||||||
|
if (
|
||||||
|
GSConfig.AutoFlushSW != old_config.AutoFlushSW ||
|
||||||
|
GSConfig.UserHacks_AutoFlush != old_config.UserHacks_AutoFlush ||
|
||||||
|
GSConfig.UserHacks_WildHack != old_config.UserHacks_WildHack)
|
||||||
|
{
|
||||||
|
ResetHandlers();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GSState::isinterlaced()
|
bool GSState::isinterlaced()
|
||||||
|
|
|
@ -260,7 +260,6 @@ public:
|
||||||
virtual ~GSState();
|
virtual ~GSState();
|
||||||
|
|
||||||
void ResetHandlers();
|
void ResetHandlers();
|
||||||
void UpdateMipmapEnabled();
|
|
||||||
|
|
||||||
int GetFramebufferHeight();
|
int GetFramebufferHeight();
|
||||||
void SaturateOutputSize(GSVector4i& r);
|
void SaturateOutputSize(GSVector4i& r);
|
||||||
|
@ -274,6 +273,8 @@ public:
|
||||||
float GetTvRefreshRate();
|
float GetTvRefreshRate();
|
||||||
|
|
||||||
virtual void Reset();
|
virtual void Reset();
|
||||||
|
virtual void UpdateSettings(const Pcsx2Config::GSOptions& old_config);
|
||||||
|
|
||||||
void Flush();
|
void Flush();
|
||||||
void FlushPrim();
|
void FlushPrim();
|
||||||
void FlushWrite();
|
void FlushWrite();
|
||||||
|
|
|
@ -35,13 +35,7 @@ GSRendererHW::GSRendererHW()
|
||||||
, m_lod(GSVector2i(0, 0))
|
, m_lod(GSVector2i(0, 0))
|
||||||
{
|
{
|
||||||
m_mipmap = (GSConfig.HWMipmap >= HWMipmapLevel::Basic);
|
m_mipmap = (GSConfig.HWMipmap >= HWMipmapLevel::Basic);
|
||||||
|
SetTCOffset();
|
||||||
if (GSConfig.UserHacks)
|
|
||||||
{
|
|
||||||
m_userhacks_tcoffset_x = GSConfig.UserHacks_TCOffsetX / -1000.0f;
|
|
||||||
m_userhacks_tcoffset_y = GSConfig.UserHacks_TCOffsetY / -1000.0f;
|
|
||||||
m_userhacks_tcoffset = m_userhacks_tcoffset_x < 0.0f || m_userhacks_tcoffset_y < 0.0f;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!GSConfig.UpscaleMultiplier) // Custom Resolution
|
if (!GSConfig.UpscaleMultiplier) // Custom Resolution
|
||||||
{
|
{
|
||||||
|
@ -158,6 +152,13 @@ void GSRendererHW::CustomResolutionScaling()
|
||||||
printf("Frame buffer size set to %dx%d (%dx%d)\n", scissored_buffer_size.x, scissored_buffer_size.y, m_width, m_height);
|
printf("Frame buffer size set to %dx%d (%dx%d)\n", scissored_buffer_size.x, scissored_buffer_size.y, m_width, m_height);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSRendererHW::SetTCOffset()
|
||||||
|
{
|
||||||
|
m_userhacks_tcoffset_x = std::max<s32>(GSConfig.UserHacks_TCOffsetX, 0) / -1000.0f;
|
||||||
|
m_userhacks_tcoffset_y = std::max<s32>(GSConfig.UserHacks_TCOffsetY, 0) / -1000.0f;
|
||||||
|
m_userhacks_tcoffset = m_userhacks_tcoffset_x < 0.0f || m_userhacks_tcoffset_y < 0.0f;
|
||||||
|
}
|
||||||
|
|
||||||
GSRendererHW::~GSRendererHW()
|
GSRendererHW::~GSRendererHW()
|
||||||
{
|
{
|
||||||
delete m_tc;
|
delete m_tc;
|
||||||
|
@ -215,6 +216,13 @@ void GSRendererHW::Reset()
|
||||||
GSRenderer::Reset();
|
GSRenderer::Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GSRendererHW::UpdateSettings(const Pcsx2Config::GSOptions& old_config)
|
||||||
|
{
|
||||||
|
GSRenderer::UpdateSettings(old_config);
|
||||||
|
m_mipmap = (GSConfig.HWMipmap >= HWMipmapLevel::Basic);
|
||||||
|
SetTCOffset();
|
||||||
|
}
|
||||||
|
|
||||||
void GSRendererHW::VSync(u32 field, bool registers_written)
|
void GSRendererHW::VSync(u32 field, bool registers_written)
|
||||||
{
|
{
|
||||||
if (m_reset)
|
if (m_reset)
|
||||||
|
|
|
@ -141,6 +141,8 @@ protected:
|
||||||
|
|
||||||
virtual void DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex) = 0;
|
virtual void DrawPrims(GSTexture* rt, GSTexture* ds, GSTextureCache::Source* tex) = 0;
|
||||||
|
|
||||||
|
void SetTCOffset();
|
||||||
|
|
||||||
bool m_userhacks_tcoffset;
|
bool m_userhacks_tcoffset;
|
||||||
float m_userhacks_tcoffset_x;
|
float m_userhacks_tcoffset_x;
|
||||||
float m_userhacks_tcoffset_y;
|
float m_userhacks_tcoffset_y;
|
||||||
|
@ -175,6 +177,7 @@ public:
|
||||||
GSVector2i GetTargetSize();
|
GSVector2i GetTargetSize();
|
||||||
|
|
||||||
void Reset() override;
|
void Reset() override;
|
||||||
|
void UpdateSettings(const Pcsx2Config::GSOptions& old_config) override;
|
||||||
void VSync(u32 field, bool registers_written) override;
|
void VSync(u32 field, bool registers_written) override;
|
||||||
|
|
||||||
GSTexture* GetOutput(int i, int& y_offset) override;
|
GSTexture* GetOutput(int i, int& y_offset) override;
|
||||||
|
|
Loading…
Reference in New Issue