mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
Compare commits
6 Commits
gs_dx11__c
...
gs_align2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
094088e038 | ||
|
|
b4293a40d2 | ||
|
|
9acadb21fe | ||
|
|
e82fa0bba5 | ||
|
|
45490d903a | ||
|
|
76dadf792a |
Binary file not shown.
File diff suppressed because it is too large
Load Diff
@@ -139,12 +139,15 @@ The clamp modes are also numerically based.
|
||||
|
||||
### GS Hardware Mipmap Fixes
|
||||
|
||||
* mipmap [`0` or `1` or `2`] {Off, Basic, Full} Default: Automatic (No value, looks up GameDB)
|
||||
* mipmap [`0` or `1`] {Off, On} Default: On (looks up GameDB)
|
||||
* trilinearFiltering [`0` or `1` or `2`] {None, Trilinear, Trilinear Ultra} Default: None (`0`)
|
||||
|
||||
### GS Hardware General Fixes
|
||||
|
||||
* beforeDraw {`OI` with suffix } {None unless specific game GSC} Default: Automatic (No value, looks up GameDB) with valid variable name (ex. OI_BurnoutGames)
|
||||
|
||||
* moveHandler {`MV` with suffix } {None unless specific game GSC} Default: Automatic (No value, looks up GameDB) with valid variable name (ex. MV_Ico)
|
||||
|
||||
* afterDraw {`OO` with suffix } {None unless specific game GSC} Default: Automatic (No value, looks up GameDB) with valid variable name
|
||||
* conservativeFramebuffer [`0` or `1`] {Off or On} Default: On (`1`)
|
||||
* texturePreloading [`0` or `1` or `2`] {None, Partial or Full Hash Cache} Default: None (`0`)
|
||||
@@ -153,11 +156,17 @@ The clamp modes are also numerically based.
|
||||
### GS Hardware Renderer Fixes
|
||||
|
||||
* autoFlush [`0` or `1` or `2`] {Disabled, Enabled (Sprites Only), Enabled (All Primitives)} Default: Off (`0`)
|
||||
* partialTargetInvalidation [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
* PCRTCOffsets [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
|
||||
* PCRTCOverscan [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
|
||||
* disableDepthSupport [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
* disablePartialInvalidation [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
* cpuFramebufferConversion [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
* preloadFrameData [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
* textureInsideRT [`0` or `1`] {Disabled, Inside Targets, Merge Targets} Default: Off (`0`)
|
||||
* textureInsideRT [`0` or `1`or `2`] {Disabled, Inside Targets, Merge Targets} Default: Off (`0`)
|
||||
* PCRTCOverscan [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
* PCRTCOverscan [`0` or `1`] {Off, On} Default: Off (`0`)
|
||||
* cpuCLUTRender [`0` or `1` or `2`] {Disabled, Normal, Aggressive} Default: Disabled (`0`)
|
||||
* cpuSpriteRenderBW [Value between `0` to `10`] {Disabled, 1 (64), 2 (128), 3 (192), 4 (256), 5 (320), 6 (384), 7 (448), 8 (512), 9 (576), 10 (640)} Default: Off (`0`)
|
||||
|
||||
@@ -229,11 +229,6 @@
|
||||
"minimum": 0,
|
||||
"maximum": 100000
|
||||
},
|
||||
"halfBottomOverride": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"maximum": 1
|
||||
},
|
||||
"halfPixelOffset": {
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
|
||||
@@ -3560,7 +3560,7 @@ __forceinline bool AreTrianglesQuad(const GSVertex* RESTRICT vin, const u16* RES
|
||||
return are_quad;
|
||||
}
|
||||
|
||||
__forceinline bool AreTrianglesQuadNonAA(const GSVertex* RESTRICT vin, const u16* RESTRICT index0, const u16* RESTRICT index1)
|
||||
bool GSState::AreTrianglesQuadNonAA(const GSVertex* RESTRICT vin, const u16* RESTRICT index0, const u16* RESTRICT index1)
|
||||
{
|
||||
u32 v0[3] = {
|
||||
vin[index0[0]].XYZ.U32[0],
|
||||
|
||||
@@ -478,6 +478,7 @@ public:
|
||||
|
||||
template<bool shuffle_check>
|
||||
bool TrianglesAreQuadsImpl();
|
||||
bool AreTrianglesQuadNonAA(const GSVertex* RESTRICT vin, const u16* RESTRICT index0, const u16* RESTRICT index1);
|
||||
bool TrianglesAreQuads(bool shuffle_check = false);
|
||||
template <u32 primclass>
|
||||
PRIM_OVERLAP GetPrimitiveOverlapDrawlistImpl(bool save_drawlist = false, bool save_bbox = false, float bbox_scale = 1.0f);
|
||||
|
||||
@@ -1383,7 +1383,7 @@ void GSDevice11::PresentRect(GSTexture* sTex, const GSVector4& sRect, GSTexture*
|
||||
cb.SetSource(sRect, sTex->GetSize());
|
||||
cb.SetTarget(dRect, ds);
|
||||
cb.SetTime(shaderTime);
|
||||
UpdateSubresource(m_present.ps_cb.get(), &cb, &m_present.cb_uniforms, sizeof(cb));
|
||||
m_ctx->UpdateSubresource(m_present.ps_cb.get(), 0, nullptr, &cb, 0, 0);
|
||||
|
||||
// om
|
||||
|
||||
@@ -1435,7 +1435,7 @@ void GSDevice11::UpdateCLUTTexture(GSTexture* sTex, float sScale, u32 offsetX, u
|
||||
u32 pad2;
|
||||
};
|
||||
const Uniforms cb = {sScale, {}, offsetX, offsetY, dOffset, 0};
|
||||
UpdateSubresource(m_merge.cb.get(), &cb, &m_merge.cb_uniforms, sizeof(cb));
|
||||
m_ctx->UpdateSubresource(m_merge.cb.get(), 0, nullptr, &cb, 0, 0);
|
||||
|
||||
const GSVector4 dRect(0, 0, dSize, 1);
|
||||
const ShaderConvert shader = (dSize == 16) ? ShaderConvert::CLUT_4 : ShaderConvert::CLUT_8;
|
||||
@@ -1454,7 +1454,7 @@ void GSDevice11::ConvertToIndexedTexture(GSTexture* sTex, float sScale, u32 offs
|
||||
};
|
||||
|
||||
const Uniforms cb = {sScale, {}, SBW, DBW, SPSM, 0};
|
||||
UpdateSubresource(m_merge.cb.get(), &cb, &m_merge.cb_uniforms, sizeof(cb));
|
||||
m_ctx->UpdateSubresource(m_merge.cb.get(), 0, nullptr, &cb, 0, 0);
|
||||
|
||||
const GSVector4 dRect(0, 0, dTex->GetWidth(), dTex->GetHeight());
|
||||
const ShaderConvert shader = ((SPSM & 0xE) == 0) ? ShaderConvert::RGBA_TO_8I : ShaderConvert::RGB5A1_TO_8I;
|
||||
@@ -1475,7 +1475,7 @@ void GSDevice11::FilteredDownsampleTexture(GSTexture* sTex, GSTexture* dTex, u32
|
||||
|
||||
const Uniforms cb = {
|
||||
static_cast<float>(downsample_factor * downsample_factor), (GSConfig.UserHacks_NativeScaling > GSNativeScaling::Aggressive) ? 2.0f : 1.0f, {}, clamp_min, static_cast<int>(downsample_factor), 0};
|
||||
UpdateSubresource(m_merge.cb.get(), &cb, &m_merge.cb_uniforms, sizeof(cb));
|
||||
m_ctx->UpdateSubresource(m_merge.cb.get(), 0, nullptr, &cb, 0, 0);
|
||||
|
||||
const ShaderConvert shader = ShaderConvert::DOWNSAMPLE_COPY;
|
||||
DoStretchRect(sTex, GSVector4::zero(), dTex, dRect, m_convert.ps[static_cast<int>(shader)].get(), m_merge.cb.get(), nullptr, false);
|
||||
@@ -1567,6 +1567,7 @@ void GSDevice11::DoMultiStretchRects(const MultiStretchRect* rects, u32 num_rect
|
||||
DrawIndexedPrimitive();
|
||||
}
|
||||
|
||||
|
||||
void GSDevice11::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex, GSVector4* dRect, const GSRegPMODE& PMODE, const GSRegEXTBUF& EXTBUF, u32 c, const bool linear)
|
||||
{
|
||||
const GSVector4 full_r(0.0f, 0.0f, 1.0f, 1.0f);
|
||||
@@ -1583,7 +1584,7 @@ void GSDevice11::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex,
|
||||
if (feedback_write_2 || feedback_write_1 || sTex[0])
|
||||
{
|
||||
const MergeConstantBuffer cb = {GSVector4::unorm8(c), EXTBUF.EMODA, EXTBUF.EMODC};
|
||||
UpdateSubresource(m_merge.cb.get(), &cb, &m_merge.cb_uniforms, sizeof(cb));
|
||||
m_ctx->UpdateSubresource(m_merge.cb.get(), 0, nullptr, &cb, 0, 0);
|
||||
}
|
||||
|
||||
if (sTex[1] && (PMODE.SLBG == 0 || feedback_write_2_but_blend_bg))
|
||||
@@ -1619,7 +1620,7 @@ void GSDevice11::DoMerge(GSTexture* sTex[3], GSVector4* sRect, GSTexture* dTex,
|
||||
|
||||
void GSDevice11::DoInterlace(GSTexture* sTex, const GSVector4& sRect, GSTexture* dTex, const GSVector4& dRect, ShaderInterlace shader, bool linear, const InterlaceConstantBuffer& cb)
|
||||
{
|
||||
UpdateSubresource(m_interlace.cb.get(), &cb, &m_interlace.cb_uniforms, sizeof(cb));
|
||||
m_ctx->UpdateSubresource(m_interlace.cb.get(), 0, nullptr, &cb, 0, 0);
|
||||
|
||||
DoStretchRect(sTex, sRect, dTex, dRect, m_interlace.ps[static_cast<int>(shader)].get(), m_interlace.cb.get(), linear);
|
||||
}
|
||||
@@ -1657,7 +1658,7 @@ void GSDevice11::DoShadeBoost(GSTexture* sTex, GSTexture* dTex, const float para
|
||||
const GSVector4 sRect(0, 0, 1, 1);
|
||||
const GSVector4 dRect(0, 0, s.x, s.y);
|
||||
|
||||
UpdateSubresource(m_shadeboost.cb.get(), ¶ms, &m_shadeboost.cb_uniforms, sizeof(float) * 4);
|
||||
m_ctx->UpdateSubresource(m_shadeboost.cb.get(), 0, nullptr, params, 0, 0);
|
||||
|
||||
DoStretchRect(sTex, sRect, dTex, dRect, m_shadeboost.ps.get(), m_shadeboost.cb.get(), false);
|
||||
}
|
||||
@@ -2079,7 +2080,7 @@ void GSDevice11::RenderImGui()
|
||||
};
|
||||
// clang-format on
|
||||
|
||||
UpdateSubresource(m_imgui.vs_cb.get(), &ortho_projection, &m_imgui.vs_cb_uniforms, sizeof(ortho_projection));
|
||||
m_ctx->UpdateSubresource(m_imgui.vs_cb.get(), 0, nullptr, ortho_projection, 0, 0);
|
||||
|
||||
const UINT vb_stride = sizeof(ImDrawVert);
|
||||
const UINT vb_offset = 0;
|
||||
@@ -2569,15 +2570,6 @@ void GSDevice11::SetScissor(const GSVector4i& scissor)
|
||||
}
|
||||
}
|
||||
|
||||
void GSDevice11::UpdateSubresource(ID3D11Buffer* buffer, const void* cb_uniforms, void* cached_cb_uniforms, size_t cb_uniforms_size)
|
||||
{
|
||||
if (memcmp(cb_uniforms, cached_cb_uniforms, cb_uniforms_size) != 0)
|
||||
{
|
||||
memcpy(cached_cb_uniforms, cb_uniforms, cb_uniforms_size);
|
||||
m_ctx->UpdateSubresource(buffer, 0, nullptr, cached_cb_uniforms, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void GSDevice11::ShaderMacro::AddMacro(const char* n, int d)
|
||||
{
|
||||
AddMacro(n, std::to_string(d));
|
||||
|
||||
@@ -189,7 +189,6 @@ private:
|
||||
wil::com_ptr_nothrow<ID3D11VertexShader> vs;
|
||||
wil::com_ptr_nothrow<ID3D11PixelShader> ps[static_cast<int>(PresentShader::Count)];
|
||||
wil::com_ptr_nothrow<ID3D11Buffer> ps_cb;
|
||||
DisplayConstantBuffer cb_uniforms{};
|
||||
} m_present;
|
||||
|
||||
struct
|
||||
@@ -197,14 +196,12 @@ private:
|
||||
wil::com_ptr_nothrow<ID3D11PixelShader> ps[2];
|
||||
wil::com_ptr_nothrow<ID3D11Buffer> cb;
|
||||
wil::com_ptr_nothrow<ID3D11BlendState> bs;
|
||||
MergeConstantBuffer cb_uniforms{};
|
||||
} m_merge;
|
||||
|
||||
struct
|
||||
{
|
||||
wil::com_ptr_nothrow<ID3D11PixelShader> ps[NUM_INTERLACE_SHADERS];
|
||||
wil::com_ptr_nothrow<ID3D11Buffer> cb;
|
||||
InterlaceConstantBuffer cb_uniforms{};
|
||||
} m_interlace;
|
||||
|
||||
wil::com_ptr_nothrow<ID3D11PixelShader> m_fxaa_ps;
|
||||
@@ -213,7 +210,6 @@ private:
|
||||
{
|
||||
wil::com_ptr_nothrow<ID3D11PixelShader> ps;
|
||||
wil::com_ptr_nothrow<ID3D11Buffer> cb;
|
||||
float cb_uniforms[4]{};
|
||||
} m_shadeboost;
|
||||
|
||||
struct
|
||||
@@ -237,7 +233,6 @@ private:
|
||||
wil::com_ptr_nothrow<ID3D11PixelShader> ps;
|
||||
wil::com_ptr_nothrow<ID3D11BlendState> bs;
|
||||
wil::com_ptr_nothrow<ID3D11Buffer> vs_cb;
|
||||
GSVector4 vs_cb_uniforms[4]{};
|
||||
} m_imgui;
|
||||
|
||||
// Shaders...
|
||||
@@ -345,8 +340,6 @@ public:
|
||||
void SetViewport(const GSVector2i& viewport);
|
||||
void SetScissor(const GSVector4i& scissor);
|
||||
|
||||
void UpdateSubresource(ID3D11Buffer* buffer, const void* cb_uniforms, void* cached_cb_uniforms, size_t cb_uniforms_size);
|
||||
|
||||
void SetupVS(VSSelector sel, const GSHWDrawConfig::VSConstantBuffer* cb);
|
||||
void SetupPS(const PSSelector& sel, const GSHWDrawConfig::PSConstantBuffer* cb, PSSamplerSelector ssel);
|
||||
void SetupOM(OMDepthStencilSelector dssel, OMBlendSelector bsel, u8 afix);
|
||||
|
||||
@@ -4715,31 +4715,207 @@ void GSRendererHW::Draw()
|
||||
// Note: second hack corrects only the texture coordinate
|
||||
// Be careful to not correct downscaled targets, this can get messy and break post processing
|
||||
// but it still needs to adjust native stuff from memory as it's not been compensated for upscaling (Dragon Quest 8 font for example).
|
||||
if (CanUpscale() && (m_vt.m_primclass == GS_SPRITE_CLASS) && rt && rt->GetScale() > 1.0f)
|
||||
if (CanUpscale() && ((m_vt.m_primclass == GS_SPRITE_CLASS) || ((m_index.tail % 6 == 0) && m_vt.m_primclass == GS_TRIANGLE_CLASS && m_vt.m_eq.z)) && rt && rt->GetScale() > 1.0f)
|
||||
{
|
||||
const u32 count = m_vertex.next;
|
||||
GSVertex* v = &m_vertex.buff[0];
|
||||
bool valid_format = true;
|
||||
|
||||
// Hack to avoid vertical black line in various games (ace combat/tekken)
|
||||
if (GSConfig.UserHacks_AlignSpriteX)
|
||||
if (m_vt.m_primclass == GS_TRIANGLE_CLASS)
|
||||
{
|
||||
// Note for performance reason I do the check only once on the first
|
||||
// primitive
|
||||
const int win_position = v[1].XYZ.X - context->XYOFFSET.OFX;
|
||||
const bool unaligned_position = ((win_position & 0xF) == 8);
|
||||
const bool unaligned_texture = ((v[1].U & 0xF) == 0) && PRIM->FST; // I'm not sure this check is useful
|
||||
const bool hole_in_vertex = (count < 4) || (v[1].XYZ.X != v[2].XYZ.X);
|
||||
if (hole_in_vertex && unaligned_position && (unaligned_texture || !PRIM->FST))
|
||||
const GSVertex* RESTRICT v = m_vertex.buff;
|
||||
const u16* RESTRICT index = m_index.buff;
|
||||
const size_t count = m_index.tail;
|
||||
|
||||
for (int i = 0; i < count; i += 6)
|
||||
{
|
||||
// Normaly vertex are aligned on full pixels and texture in half
|
||||
// pixels. Let's extend the coverage of an half-pixel to avoid
|
||||
// hole after upscaling
|
||||
for (u32 i = 0; i < count; i += 2)
|
||||
// Non-axis aligned check when only two triangles
|
||||
if (!AreTrianglesQuadNonAA(v, &index[i], &index[i + 3]))
|
||||
{
|
||||
v[i + 1].XYZ.X += 8;
|
||||
// I really don't know if it is a good idea. Neither what to do for !PRIM->FST
|
||||
if (unaligned_texture)
|
||||
v[i + 1].U += 8;
|
||||
valid_format = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (valid_format)
|
||||
{
|
||||
const u32 count = m_vertex.next;
|
||||
GSVertex* v = &m_vertex.buff[0];
|
||||
u16* idx = &m_index.buff[0];
|
||||
|
||||
// Hack to avoid vertical black line in various games (ace combat/tekken)
|
||||
if (GSConfig.UserHacks_AlignSpriteX)
|
||||
{
|
||||
// Note for performance reason I do the check only once on the first
|
||||
// primitive
|
||||
const int win_position0 = v[idx[0]].XYZ.X - context->XYOFFSET.OFX;
|
||||
const int win_position1 = v[idx[1]].XYZ.X - context->XYOFFSET.OFX;
|
||||
const bool unaligned_position = ((win_position0 & 0xf) != 0) || ((win_position1 & 0xF) != 0);
|
||||
const int first_s = (v[idx[0]].ST.S / v[idx[0]].RGBAQ.Q) * static_cast<int>(1 << m_cached_ctx.TEX0.TW);
|
||||
const bool unaligned_texture = (PRIM->FST && ((v[1].U & 0xF) == 0)) || (!PRIM->FST && (first_s & 0xF) == 0); // I'm not sure this check is useful
|
||||
const bool hole_in_vertex = (count < 4) || ((v[1].XYZ.X != v[2].XYZ.X) && std::abs(static_cast<int>(v[1].XYZ.X) - static_cast<int>(v[2].XYZ.X)) < 16);
|
||||
const bool is_tri = m_vt.m_primclass == GS_TRIANGLE_CLASS;
|
||||
const bool indexed_texture = src && src->m_scale == 1.0f && GSLocalMemory::m_psm[src->m_TEX0.PSM].pal > 0;
|
||||
const int skip = is_tri ? 3 : 2;
|
||||
|
||||
if (m_lod.y == 0)
|
||||
{
|
||||
bool can_disable_linear = true;
|
||||
const GSVector2 gradient = GSVector2(1.0f, 1.0f);
|
||||
for (u32 i = 0; i < m_index.tail; i += skip)
|
||||
{
|
||||
const int x_offset = (is_tri && v[idx[i]].XYZ.X == v[idx[i + 1]].XYZ.X) ? 2 : 1;
|
||||
const int y_offset = (is_tri && v[idx[i]].XYZ.Y == v[idx[i + 1]].XYZ.Y) ? 2 : 1;
|
||||
|
||||
GSVector2 vert = GSVector2(std::abs(static_cast<float>(v[idx[i]].XYZ.X - v[idx[i + x_offset]].XYZ.X)), std::abs(static_cast<float>(v[idx[i]].XYZ.Y - v[idx[i + y_offset]].XYZ.Y)));
|
||||
GSVector2 tex;
|
||||
|
||||
if (!PRIM->FST)
|
||||
{
|
||||
const int s_offset = (is_tri && (v[idx[i]].ST.S / v[idx[i]].RGBAQ.Q) == (v[idx[i + 1]].ST.S / v[idx[i + 1]].RGBAQ.Q)) ? 2 : 1;
|
||||
const int t_offset = (is_tri && (v[idx[i]].ST.T / v[idx[i]].RGBAQ.Q) == (v[idx[i + 1]].ST.T / v[idx[i + 1]].RGBAQ.Q)) ? 2 : 1;
|
||||
GSVector2 v0, v1;
|
||||
float s = std::min((v[idx[i]].ST.S / v[idx[i]].RGBAQ.Q), 1.0f);
|
||||
float t = std::min((v[idx[i]].ST.T / v[idx[i]].RGBAQ.Q), 1.0f);
|
||||
v0.x = static_cast<int>((1 << m_cached_ctx.TEX0.TW) * s * 16.0f);
|
||||
v0.y = static_cast<int>((1 << m_cached_ctx.TEX0.TH) * t * 16.0f);
|
||||
|
||||
s = std::min((v[idx[i + s_offset]].ST.S / v[idx[i + s_offset]].RGBAQ.Q), 1.0f);
|
||||
t = std::min((v[idx[i + t_offset]].ST.T / v[idx[i + t_offset]].RGBAQ.Q), 1.0f);
|
||||
v1.x = static_cast<int>((1 << m_cached_ctx.TEX0.TW) * s * 16.0f);
|
||||
v1.y = static_cast<int>((1 << m_cached_ctx.TEX0.TH) * t * 16.0f);
|
||||
|
||||
tex = GSVector2(std::abs(v1.x - v0.x), std::abs(v1.y - v0.y));
|
||||
}
|
||||
else
|
||||
{
|
||||
const int u_offset = (is_tri && v[idx[i]].U == v[idx[i + 1]].U) ? 2 : 1;
|
||||
const int v_offset = (is_tri && v[idx[i]].V == v[idx[i + 1]].V) ? 2 : 1;
|
||||
tex = GSVector2(std::abs(static_cast<float>(v[idx[i]].U - v[idx[i + u_offset]].U)), std::abs(static_cast<float>(v[idx[i]].V - v[idx[i + v_offset]].V)));
|
||||
}
|
||||
|
||||
GSVector2 grad = tex / vert;
|
||||
if (grad.x != gradient.x || grad.y != gradient.y)
|
||||
{
|
||||
can_disable_linear = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (can_disable_linear)
|
||||
{
|
||||
m_vt.m_filter.linear = 0;
|
||||
m_vt.m_filter.opt_linear = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if ((m_vt.m_primclass == GS_SPRITE_CLASS) && hole_in_vertex && unaligned_position && (unaligned_texture || !PRIM->FST))
|
||||
{
|
||||
// Normaly vertex are aligned on full pixels and texture in half
|
||||
// pixels. Let's extend the coverage of an half-pixel to avoid
|
||||
// hole after upscaling
|
||||
for (u32 i = 0; i < count; i += 2)
|
||||
{
|
||||
v[i + 1].XYZ.X += 8;
|
||||
// I really don't know if it is a good idea. Neither what to do for !PRIM->FST
|
||||
if (unaligned_texture)
|
||||
v[i + 1].U += 8;
|
||||
}
|
||||
}
|
||||
else if (indexed_texture)
|
||||
{
|
||||
const int comparitor = unaligned_position ? 0 : 8;
|
||||
|
||||
if (!PRIM->FST)
|
||||
{
|
||||
int s_offset = (is_tri && (v[idx[0]].ST.S / v[idx[0]].RGBAQ.Q) == (v[idx[1]].ST.S / v[idx[1]].RGBAQ.Q)) ? 2 : 1;
|
||||
int t_offset = (is_tri && (v[idx[0]].ST.T / v[idx[0]].RGBAQ.Q) == (v[idx[1]].ST.T / v[idx[1]].RGBAQ.Q)) ? 2 : 1;
|
||||
GSVector2i v0, v1;
|
||||
float q = v[idx[0]].RGBAQ.Q == 0 ? FLT_MIN : v[idx[0]].RGBAQ.Q;
|
||||
float s = v[idx[0]].ST.S / q;
|
||||
float t = v[idx[0]].ST.T / q;
|
||||
v0.x = static_cast<int>((1 << m_cached_ctx.TEX0.TW) * s * 16.0f);
|
||||
v0.y = static_cast<int>((1 << m_cached_ctx.TEX0.TH) * t * 16.0f);
|
||||
|
||||
q = v[idx[s_offset]].RGBAQ.Q == 0 ? FLT_MIN : v[idx[s_offset]].RGBAQ.Q;
|
||||
s = v[idx[s_offset]].ST.S / q;
|
||||
t = v[idx[t_offset]].ST.T / q;
|
||||
v1.x = static_cast<int>((1 << m_cached_ctx.TEX0.TW) * s * 16.0f);
|
||||
v1.y = static_cast<int>((1 << m_cached_ctx.TEX0.TH) * t * 16.0f);
|
||||
bool small_texture = std::abs(v1.x - v0.x) <= (64 * 16) || std::abs(v1.y - v0.y) <= (64 * 16);
|
||||
bool offset_texture_x = (m_vt.IsLinear() || ((v0.x & 0x8) && (v1.x & 0x8))) && small_texture; // Keep them relatively small to avoid full screen stuff.
|
||||
bool offset_texture_y = (m_vt.IsLinear() || ((v0.y & 0x8) && (v1.y & 0x8))) && small_texture;
|
||||
|
||||
if (offset_texture_x && offset_texture_y)
|
||||
{
|
||||
for (u32 i = m_index.buff[0]; i < count; i += skip)
|
||||
{
|
||||
GSVector2 st;
|
||||
|
||||
float largest_s = std::max(is_tri ? (v[i + 2].ST.S / v[i + 2].RGBAQ.Q) : static_cast<float>(0), std::max((v[i].ST.S / v[i].RGBAQ.Q), (v[i + 1].ST.S / v[i + 1].RGBAQ.Q)));
|
||||
float smallest_s = std::min(is_tri ? (v[i + 2].ST.S / v[i + 2].RGBAQ.Q) : static_cast<float>(0), std::min((v[i].ST.S / v[i].RGBAQ.Q), (v[i + 1].ST.S / v[i + 1].RGBAQ.Q)));
|
||||
|
||||
for (int j = 0; j < skip; j++)
|
||||
{
|
||||
q = v[i + j].RGBAQ.Q == 0 ? FLT_MIN : v[i + j].RGBAQ.Q;
|
||||
float s = v[i + j].ST.S / q;
|
||||
st.x = static_cast<float>(1 << m_cached_ctx.TEX0.TW) * s;
|
||||
if ((v[i + j].ST.S / q) == largest_s)
|
||||
v[i + j].ST.S = ((st.x - 0.5f) / static_cast<float>(1 << m_cached_ctx.TEX0.TW)) * q;
|
||||
// Check the minimap in Persona 3.
|
||||
if ((static_cast<int>(st.x * 16) & 0x8) == comparitor && (v[i + j].ST.S / q) == smallest_s)
|
||||
v[i + j].ST.S = (std::max(0.0f, (st.x - 0.5f)) / static_cast<float>(1 << m_cached_ctx.TEX0.TW)) * q;
|
||||
}
|
||||
|
||||
float largest_t = std::max(is_tri ? (v[i + 2].ST.T / v[i + 2].RGBAQ.Q) : static_cast<float>(0), std::max((v[i].ST.T / v[i].RGBAQ.Q), (v[i + 1].ST.T / v[i + 1].RGBAQ.Q)));
|
||||
float smallest_t = std::min(is_tri ? (v[i + 2].ST.T / v[i + 2].RGBAQ.Q) : static_cast<float>(0), std::min((v[i].ST.T / v[i].RGBAQ.Q), (v[i + 1].ST.T / v[i + 1].RGBAQ.Q)));
|
||||
for (int j = 0; j < skip; j++)
|
||||
{
|
||||
q = v[i + j].RGBAQ.Q == 0 ? FLT_MIN : v[i + j].RGBAQ.Q;
|
||||
float t = v[i + j].ST.T / q;
|
||||
st.y = static_cast<float>(1 << m_cached_ctx.TEX0.TH) * t;
|
||||
if ((v[i + j].ST.T / q) == largest_t)
|
||||
v[i + j].ST.T = ((st.y - 0.5f) / static_cast<float>(1 << m_cached_ctx.TEX0.TH)) * q;
|
||||
// Check the minimap in Persona 3.
|
||||
if ((static_cast<int>(st.y * 16) & 0x8) == comparitor && (v[i + j].ST.T / q) == smallest_t)
|
||||
v[i + j].ST.T = (std::max(0.0f, (st.y - 0.5f)) / static_cast<float>(1 << m_cached_ctx.TEX0.TH)) * q;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int u_offset = (is_tri && (v[0].U == v[1].U)) ? 2 : 1;
|
||||
int v_offset = (is_tri && (v[0].V == v[1].V)) ? 2 : 1;
|
||||
bool small_texture = std::abs(static_cast<int>(v[idx[u_offset]].U) - static_cast<int>(v[idx[0]].U)) <= (64 * 16) || std::abs(static_cast<int>(v[idx[v_offset]].V) - static_cast<int>(v[idx[0]].V)) <= (64 * 16);
|
||||
bool offset_texture_x = (m_vt.IsLinear() || ((v[0].U & 0x8) && (v[idx[u_offset]].U & 0x8))) && small_texture;
|
||||
bool offset_texture_y = (m_vt.IsLinear() || ((v[0].V & 0x8) && (v[idx[v_offset]].V & 0x8))) && small_texture;
|
||||
|
||||
if (offset_texture_x && offset_texture_y)
|
||||
{
|
||||
for (u32 i = m_index.buff[0]; i < m_index.tail; i += skip)
|
||||
{
|
||||
u16 largest_u = std::max(is_tri ? v[idx[i + 2]].U : static_cast<u16>(0), std::max(v[idx[i]].U, v[idx[i + 1]].U));
|
||||
|
||||
if ((v[idx[i]].U & 0x8) == comparitor && v[idx[i]].U == largest_u)
|
||||
v[idx[i]].U = std::max(static_cast<int>(v[idx[i]].U) - 8, 0);
|
||||
|
||||
if ((v[idx[i + 1]].U & 0x8) == comparitor && v[idx[i + 1]].U == largest_u)
|
||||
v[idx[i + 1]].U = std::max(static_cast<int>(v[idx[i + 1]].U) - 8, 0);
|
||||
|
||||
if (is_tri && (v[idx[i + 2]].U & 0x8) == comparitor && v[idx[i + 2]].U == largest_u)
|
||||
v[idx[i + 2]].U = std::max(static_cast<int>(v[idx[i + 2]].U) - 8, 0);
|
||||
|
||||
u16 largest_v = std::max(is_tri ? v[idx[i + 2]].V : static_cast<u16>(0), std::max(v[idx[i]].V, v[idx[i + 1]].V));
|
||||
|
||||
if ((v[idx[i]].V & 0x8) == comparitor && v[idx[i]].V == largest_v)
|
||||
v[idx[i]].V = std::max(static_cast<int>(v[idx[i]].V) - 8, 0);
|
||||
|
||||
if ((v[idx[i + 1]].V & 0x8) == comparitor && v[idx[i + 1]].V == largest_v)
|
||||
v[idx[i + 1]].V = std::max(static_cast<int>(v[idx[i + 1]].V) - 8, 0);
|
||||
|
||||
if (is_tri && (v[idx[i + 2]].V & 0x8) == comparitor && v[idx[i + 2]].V == largest_v)
|
||||
v[idx[i + 2]].V = std::max(static_cast<int>(v[idx[i + 2]].V) - 8, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5910,6 +6086,7 @@ void GSRendererHW::EmulateBlending(int rt_alpha_min, int rt_alpha_max, const boo
|
||||
{
|
||||
case AccBlendLevel::Maximum:
|
||||
sw_blending |= true;
|
||||
accumulation_blend &= (GSLocalMemory::m_psm[m_cached_ctx.FRAME.PSM].bpp == 32);
|
||||
[[fallthrough]];
|
||||
case AccBlendLevel::Full:
|
||||
sw_blending |= m_conf.ps.blend_a != m_conf.ps.blend_b && alpha_c0_high_max_one;
|
||||
|
||||
@@ -380,7 +380,6 @@ static const char* s_gs_hw_fix_names[] = {
|
||||
"trilinearFiltering",
|
||||
"skipDrawStart",
|
||||
"skipDrawEnd",
|
||||
"halfBottomOverride",
|
||||
"halfPixelOffset",
|
||||
"roundSprite",
|
||||
"nativeScaling",
|
||||
|
||||
@@ -65,7 +65,6 @@ namespace GameDatabaseSchema
|
||||
TrilinearFiltering,
|
||||
SkipDrawStart,
|
||||
SkipDrawEnd,
|
||||
HalfBottomOverride,
|
||||
HalfPixelOffset,
|
||||
RoundSprite,
|
||||
NativeScaling,
|
||||
|
||||
@@ -163,7 +163,7 @@ void V_Core::StartADMAWrite(u16* pMem, u32 sz)
|
||||
if ((AutoDMACtrl & (Index + 1)) == 0)
|
||||
{
|
||||
ActiveTSA = 0x2000 + (Index << 10);
|
||||
DMAICounter = size * 4;
|
||||
DMAICounter = size * 48;
|
||||
LastClock = psxRegs.cycle;
|
||||
}
|
||||
else if (size >= 256)
|
||||
@@ -191,7 +191,7 @@ void V_Core::StartADMAWrite(u16* pMem, u32 sz)
|
||||
if (SPU2::MsgToConsole())
|
||||
SPU2::ConLog("ADMA%c Error Size of %x too small\n", GetDmaIndexChar(), size);
|
||||
InputDataLeft = 0;
|
||||
DMAICounter = size * 4;
|
||||
DMAICounter = size * 48;
|
||||
LastClock = psxRegs.cycle;
|
||||
}
|
||||
}
|
||||
@@ -248,7 +248,7 @@ void V_Core::FinishDMAwrite()
|
||||
DMA7LogWrite(DMAPtr, ReadSize << 1);
|
||||
#endif
|
||||
|
||||
u32 buff1end = ActiveTSA + std::min(ReadSize, (u32)0x100 + std::abs(DMAICounter / 4));
|
||||
u32 buff1end = ActiveTSA + std::min(ReadSize, (u32)0x100 + std::abs(DMAICounter / 48));
|
||||
u32 buff2end = 0;
|
||||
if (buff1end > 0x100000)
|
||||
{
|
||||
@@ -343,7 +343,7 @@ void V_Core::FinishDMAwrite()
|
||||
DMAPtr += TDA - ActiveTSA;
|
||||
ReadSize -= TDA - ActiveTSA;
|
||||
|
||||
DMAICounter = (DMAICounter - ReadSize) * 4;
|
||||
DMAICounter = (DMAICounter - ReadSize) * 48;
|
||||
|
||||
CounterUpdate(DMAICounter);
|
||||
|
||||
@@ -354,7 +354,7 @@ void V_Core::FinishDMAwrite()
|
||||
|
||||
void V_Core::FinishDMAread()
|
||||
{
|
||||
u32 buff1end = ActiveTSA + std::min(ReadSize, (u32)0x100 + std::abs(DMAICounter / 4));
|
||||
u32 buff1end = ActiveTSA + std::min(ReadSize, (u32)0x100 + std::abs(DMAICounter / 48));
|
||||
u32 buff2end = 0;
|
||||
|
||||
if (buff1end > 0x100000)
|
||||
@@ -426,9 +426,9 @@ void V_Core::FinishDMAread()
|
||||
|
||||
// DMA Reads are done AFTER the delay, so to get the timing right we need to scheule one last DMA to catch IRQ's
|
||||
if (ReadSize)
|
||||
DMAICounter = std::min(ReadSize, (u32)0x100) * 4;
|
||||
DMAICounter = std::min(ReadSize, (u32)0x100) * 48;
|
||||
else
|
||||
DMAICounter = 4;
|
||||
DMAICounter = 48;
|
||||
|
||||
CounterUpdate(DMAICounter);
|
||||
|
||||
@@ -446,7 +446,7 @@ void V_Core::DoDMAread(u16* pMem, u32 size)
|
||||
ReadSize = size;
|
||||
IsDMARead = true;
|
||||
LastClock = psxRegs.cycle;
|
||||
DMAICounter = std::min(ReadSize, (u32)0x100) * 4;
|
||||
DMAICounter = (std::min(ReadSize, (u32)0x100) * 48);
|
||||
Regs.STATX &= ~0x80;
|
||||
Regs.STATX |= 0x400;
|
||||
//Regs.ATTR |= 0x30;
|
||||
@@ -470,7 +470,7 @@ void V_Core::DoDMAwrite(u16* pMem, u32 size)
|
||||
{
|
||||
Regs.STATX &= ~0x80;
|
||||
//Regs.ATTR |= 0x30;
|
||||
DMAICounter = 1 * 4;
|
||||
DMAICounter = 1 * 48;
|
||||
LastClock = psxRegs.cycle;
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user