mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
79d22a8d77 | ||
|
|
9914212600 | ||
|
|
765f55e67b | ||
|
|
2d922cc035 | ||
|
|
42e0625ab3 | ||
|
|
c72e894fc7 | ||
|
|
5bc2342d47 | ||
|
|
ea2b0b5e59 | ||
|
|
d70cc0221a |
4
.github/workflows/linux_build_flatpak.yml
vendored
4
.github/workflows/linux_build_flatpak.yml
vendored
@@ -132,7 +132,7 @@ jobs:
|
||||
|
||||
- name: Push to Flathub (beta)
|
||||
if: ${{ inputs.publish == true && (inputs.stableBuild == false || inputs.stableBuild == 'false') }}
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@10a3c29f0162516f0f68006be14c92f34bd4fa6c
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@10a3c29f0162516f0f68006be14c92f34bd4fa6c
|
||||
with:
|
||||
flat-manager-url: https://hub.flathub.org/
|
||||
repository: beta
|
||||
@@ -141,7 +141,7 @@ jobs:
|
||||
|
||||
- name: Push to Flathub (stable)
|
||||
if: ${{ inputs.publish == true && (inputs.stableBuild == true || inputs.stableBuild == 'true') }}
|
||||
uses: flatpak/flatpak-github-actions/flatpak-builder@10a3c29f0162516f0f68006be14c92f34bd4fa6c
|
||||
uses: flatpak/flatpak-github-actions/flat-manager@10a3c29f0162516f0f68006be14c92f34bd4fa6c
|
||||
with:
|
||||
flat-manager-url: https://hub.flathub.org/
|
||||
repository: stable
|
||||
|
||||
@@ -17254,7 +17254,7 @@ The saves will not be recoverable.</source>
|
||||
<name>MemoryCard</name>
|
||||
<message>
|
||||
<location filename="../../pcsx2/SIO/Memcard/MemoryCardFile.cpp" line="289"/>
|
||||
<location filename="../../pcsx2/SIO/Memcard/MemoryCardFile.cpp" line="969"/>
|
||||
<location filename="../../pcsx2/SIO/Memcard/MemoryCardFile.cpp" line="970"/>
|
||||
<source>Memory Card Creation Failed</source>
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
@@ -17287,7 +17287,7 @@ Close any other instances of PCSX2, or restart your computer.
|
||||
<translation type="unfinished"></translation>
|
||||
</message>
|
||||
<message>
|
||||
<location filename="../../pcsx2/SIO/Memcard/MemoryCardFile.cpp" line="970"/>
|
||||
<location filename="../../pcsx2/SIO/Memcard/MemoryCardFile.cpp" line="971"/>
|
||||
<source>Failed to create memory card. The error was:
|
||||
{}</source>
|
||||
<translation type="unfinished"></translation>
|
||||
|
||||
@@ -249,7 +249,6 @@ void CTC1() {
|
||||
|
||||
void CVT_S() {
|
||||
_FdValf_ = (float)_FsValSl_;
|
||||
_FdValf_ = fpuDouble( _FdValUl_ );
|
||||
}
|
||||
|
||||
void CVT_W() {
|
||||
|
||||
@@ -2507,15 +2507,17 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
config.colclip_update_area = config.drawarea;
|
||||
|
||||
const GSVector4 dRect = GSVector4((config.colclip_mode == GSHWDrawConfig::ColClipMode::ConvertOnly) ? GSVector4i::loadh(rtsize) : config.drawarea);
|
||||
const GSVector4 sRect = dRect / GSVector4(rtsize.x, rtsize.y).xyxy();
|
||||
colclip_rt = CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip);
|
||||
if (!colclip_rt)
|
||||
{
|
||||
Console.Warning("D3D11: Failed to allocate ColorClip render target, aborting draw.");
|
||||
return;
|
||||
}
|
||||
|
||||
g_gs_device->SetColorClipTexture(colclip_rt);
|
||||
// Warning: StretchRect must be called before BeginScene otherwise
|
||||
// vertices will be overwritten. Trust me you don't want to do that.
|
||||
|
||||
const GSVector4 dRect = GSVector4((config.colclip_mode == GSHWDrawConfig::ColClipMode::ConvertOnly) ? GSVector4i::loadh(rtsize) : config.drawarea);
|
||||
const GSVector4 sRect = dRect / GSVector4(rtsize.x, rtsize.y).xyxy();
|
||||
StretchRect(config.rt, sRect, colclip_rt, dRect, ShaderConvert::COLCLIP_INIT, false);
|
||||
g_perfmon.Put(GSPerfMon::TextureCopies, 1);
|
||||
}
|
||||
@@ -2526,7 +2528,10 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
primid_tex = CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::PrimID, false);
|
||||
if (!primid_tex)
|
||||
{
|
||||
Console.WriteLn("D3D11: Failed to allocate DATE image, aborting draw.");
|
||||
return;
|
||||
}
|
||||
|
||||
StretchRect(colclip_rt ? colclip_rt : config.rt, GSVector4(config.drawarea) / GSVector4(rtsize).xyxy(),
|
||||
primid_tex, GSVector4(config.drawarea), m_date.primid_init_ps[static_cast<u8>(config.datm)].get(), nullptr, false);
|
||||
@@ -2617,6 +2622,9 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
||||
if (config.tex && config.tex == config.rt)
|
||||
PSSetShaderResource(0, draw_rt_clone);
|
||||
}
|
||||
else
|
||||
Console.Warning("D3D11: Failed to allocate temp texture for RT copy.");
|
||||
|
||||
}
|
||||
|
||||
GSTexture* draw_ds_clone = nullptr;
|
||||
@@ -2630,6 +2638,8 @@ void GSDevice11::RenderHW(GSHWDrawConfig& config)
|
||||
CopyRect(config.ds, draw_ds_clone, config.drawarea, config.drawarea.left, config.drawarea.top);
|
||||
PSSetShaderResource(0, draw_ds_clone);
|
||||
}
|
||||
else
|
||||
Console.Warning("D3D11: Failed to allocate temp texture for DS copy.");
|
||||
}
|
||||
|
||||
SetupVS(config.vs, &config.cb_vs);
|
||||
|
||||
@@ -3849,7 +3849,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
colclip_rt->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
|
||||
draw_rt = static_cast<GSTexture12*>(config.rt);
|
||||
OMSetRenderTargets(draw_rt, draw_ds, config.scissor);
|
||||
OMSetRenderTargets(draw_rt, draw_ds, config.colclip_update_area);
|
||||
|
||||
// if this target was cleared and never drawn to, perform the clear as part of the resolve here.
|
||||
BeginRenderPass(GetLoadOpForTexture(draw_rt), D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE,
|
||||
@@ -3917,7 +3917,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
EndRenderPass();
|
||||
|
||||
GL_PUSH("Copy RT to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top,
|
||||
GL_PUSH("D3D12: Copy RT to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top,
|
||||
config.drawarea.width(), config.drawarea.height());
|
||||
|
||||
draw_rt_clone->SetState(GSTexture::State::Invalidated);
|
||||
@@ -3927,6 +3927,8 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
if (config.tex && config.tex == config.rt)
|
||||
PSSetShaderResource(0, draw_rt_clone, true);
|
||||
}
|
||||
else
|
||||
Console.Warning("D3D12: Failed to allocate temp texture for RT copy.");
|
||||
}
|
||||
|
||||
if (config.tex && config.tex == config.ds)
|
||||
@@ -3937,13 +3939,15 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
EndRenderPass();
|
||||
|
||||
GL_PUSH("Copy RT to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top,
|
||||
GL_PUSH("D3D12: Copy DS to temp texture {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top,
|
||||
config.drawarea.width(), config.drawarea.height());
|
||||
|
||||
draw_ds_clone->SetState(GSTexture::State::Invalidated);
|
||||
CopyRect(config.ds, draw_ds_clone, config.drawarea, config.drawarea.left, config.drawarea.top);
|
||||
PSSetShaderResource(0, draw_ds_clone, true);
|
||||
}
|
||||
else
|
||||
Console.Warning("D3D12: Failed to allocate temp texture for DS copy.");
|
||||
}
|
||||
|
||||
// Switch to colclip target for colclip hw rendering
|
||||
@@ -3958,7 +3962,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
colclip_rt = static_cast<GSTexture12*>(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip, false));
|
||||
if (!colclip_rt)
|
||||
{
|
||||
Console.WriteLn("D3D12: Failed to allocate ColorClip render target, aborting draw.");
|
||||
Console.Warning("D3D12: Failed to allocate ColorClip render target, aborting draw.");
|
||||
|
||||
if (date_image)
|
||||
Recycle(date_image);
|
||||
@@ -4038,6 +4042,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
// rt -> colclip hw blit if enabled
|
||||
if (colclip_rt && (config.colclip_mode == GSHWDrawConfig::ColClipMode::ConvertOnly || config.colclip_mode == GSHWDrawConfig::ColClipMode::ConvertAndResolve) && config.rt->GetState() == GSTexture::State::Dirty)
|
||||
{
|
||||
OMSetRenderTargets(draw_rt, draw_ds, GSVector4i::loadh(rtsize));
|
||||
SetUtilityTexture(static_cast<GSTexture12*>(config.rt), m_point_sampler_cpu);
|
||||
SetPipeline(m_colclip_setup_pipelines[pipe.ds].get());
|
||||
|
||||
@@ -4047,8 +4052,10 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
g_perfmon.Put(GSPerfMon::TextureCopies, 1);
|
||||
|
||||
GL_POP();
|
||||
}
|
||||
|
||||
// Restore original scissor, not sure if needed since the render pass has already been started. But to be safe.
|
||||
OMSetRenderTargets(draw_rt, draw_ds, config.scissor);
|
||||
}
|
||||
// VB/IB upload, if we did DATE setup and it's not colclip hw this has already been done
|
||||
SetPrimitiveTopology(s_primitive_topology_mapping[static_cast<u8>(config.topology)]);
|
||||
if (!date_image || colclip_rt)
|
||||
@@ -4111,7 +4118,7 @@ void GSDevice12::RenderHW(GSHWDrawConfig& config)
|
||||
colclip_rt->TransitionToState(D3D12_RESOURCE_STATE_PIXEL_SHADER_RESOURCE);
|
||||
|
||||
draw_rt = static_cast<GSTexture12*>(config.rt);
|
||||
OMSetRenderTargets(draw_rt, draw_ds, config.scissor);
|
||||
OMSetRenderTargets(draw_rt, draw_ds, config.colclip_update_area);
|
||||
|
||||
// if this target was cleared and never drawn to, perform the clear as part of the resolve here.
|
||||
BeginRenderPass(GetLoadOpForTexture(draw_rt), D3D12_RENDER_PASS_ENDING_ACCESS_TYPE_PRESERVE,
|
||||
|
||||
@@ -1588,14 +1588,13 @@ GSTextureCache::Source* GSTextureCache::LookupSource(const bool is_color, const
|
||||
// DevCon.Warning("Expected %x Got %x shuffle %d draw %d", psm, t_psm, possible_shuffle, GSState::s_n);
|
||||
if (match)
|
||||
{
|
||||
// It is a complex to convert the code in shader. As a reference, let's do it on the CPU, it will be slow but
|
||||
// 1/ it just works :)
|
||||
// 2/ even with upscaling
|
||||
// 3/ for both Direct3D and OpenGL
|
||||
if (psm == PSMT4 || (GSConfig.UserHacks_CPUFBConversion && psm == PSMT8))
|
||||
// It is a complex to convert the code in shader. As a reference, let's do it on the CPU,
|
||||
// it will be slow but can work even with upscaling, also fine tune it so it's not enabled when not needed.
|
||||
if (psm == PSMT4 || (GSConfig.UserHacks_CPUFBConversion && psm == PSMT8 && (!possible_shuffle || GSLocalMemory::m_psm[t->m_TEX0.PSM].bpp != 32)))
|
||||
{
|
||||
// Forces 4-bit and 8-bit frame buffer conversion to be done on the CPU instead of the GPU, but performance will be slower.
|
||||
// There is no dedicated shader to handle 4-bit conversion (Stuntman has been confirmed to use 4-bit).
|
||||
// There is no dedicated shader to handle 4-bit conversion (Beyond Good and Evil and Stuntman).
|
||||
// Note: Stuntman no longer hits the PSMT4 code path.
|
||||
// Direct3D10/11 and OpenGL support 8-bit fb conversion but don't render some corner cases properly (Harry Potter games).
|
||||
// The hack can fix glitches in some games.
|
||||
if (!t->m_drawn_since_read.rempty())
|
||||
|
||||
@@ -2424,7 +2424,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
const GSVector4 dRect(config.colclip_update_area);
|
||||
const GSVector4 sRect = dRect / GSVector4(size.x, size.y).xyxy();
|
||||
StretchRect(colclip_rt, sRect, config.rt, dRect, ShaderConvert::COLCLIP_RESOLVE, false);
|
||||
|
||||
g_perfmon.Put(GSPerfMon::TextureCopies, 1);
|
||||
Recycle(colclip_rt);
|
||||
|
||||
g_gs_device->SetColorClipTexture(nullptr);
|
||||
@@ -2444,6 +2444,14 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
config.colclip_update_area = config.drawarea;
|
||||
|
||||
colclip_rt = CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip, false);
|
||||
|
||||
if (!colclip_rt)
|
||||
{
|
||||
Console.Warning("GL: Failed to allocate ColorClip render target, aborting draw.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
OMSetRenderTargets(colclip_rt, config.ds, nullptr);
|
||||
|
||||
g_gs_device->SetColorClipTexture(colclip_rt);
|
||||
@@ -2451,6 +2459,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
const GSVector4 dRect = GSVector4((config.colclip_mode == GSHWDrawConfig::ColClipMode::ConvertOnly) ? GSVector4i::loadh(rtsize) : config.drawarea);
|
||||
const GSVector4 sRect = dRect / GSVector4(rtsize.x, rtsize.y).xyxy();
|
||||
StretchRect(config.rt, sRect, colclip_rt, dRect, ShaderConvert::COLCLIP_INIT, false);
|
||||
g_perfmon.Put(GSPerfMon::TextureCopies, 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2462,6 +2471,11 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
break; // No setup
|
||||
case GSHWDrawConfig::DestinationAlphaMode::PrimIDTracking:
|
||||
primid_texture = InitPrimDateTexture(colclip_rt ? colclip_rt : config.rt, config.drawarea, config.datm);
|
||||
if (!primid_texture)
|
||||
{
|
||||
Console.WriteLn("GL: Failed to allocate DATE image, aborting draw.");
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GSHWDrawConfig::DestinationAlphaMode::StencilOne:
|
||||
if (m_features.texture_barrier)
|
||||
@@ -2498,6 +2512,8 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
config.drawarea.width(), config.drawarea.height());
|
||||
CopyRect(colclip_rt ? colclip_rt : config.rt, draw_rt_clone, config.drawarea, config.drawarea.left, config.drawarea.top);
|
||||
}
|
||||
else
|
||||
Console.Warning("GL: Failed to allocate temp texture for RT copy.");
|
||||
}
|
||||
|
||||
IASetVertexBuffer(config.verts, config.nverts);
|
||||
@@ -2713,7 +2729,7 @@ void GSDeviceOGL::RenderHW(GSHWDrawConfig& config)
|
||||
const GSVector4 dRect(config.colclip_update_area);
|
||||
const GSVector4 sRect = dRect / GSVector4(size.x, size.y).xyxy();
|
||||
StretchRect(colclip_rt, sRect, config.rt, dRect, ShaderConvert::COLCLIP_RESOLVE, false);
|
||||
|
||||
g_perfmon.Put(GSPerfMon::TextureCopies, 1);
|
||||
Recycle(colclip_rt);
|
||||
|
||||
g_gs_device->SetColorClipTexture(nullptr);
|
||||
|
||||
@@ -5625,7 +5625,7 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
|
||||
date_image = SetupPrimitiveTrackingDATE(config);
|
||||
if (!date_image)
|
||||
{
|
||||
Console.WriteLn("Failed to allocate DATE image, aborting draw.");
|
||||
Console.WriteLn("VK: Failed to allocate DATE image, aborting draw.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5726,12 +5726,14 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
|
||||
{
|
||||
EndRenderPass();
|
||||
|
||||
GL_PUSH("Copy RT to temp texture for fbmask {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top,
|
||||
GL_PUSH("VK: Copy RT to temp texture for fbmask {%d,%d %dx%d}", config.drawarea.left, config.drawarea.top,
|
||||
config.drawarea.width(), config.drawarea.height());
|
||||
|
||||
CopyRect(draw_rt, draw_rt_clone, config.drawarea, config.drawarea.left, config.drawarea.top);
|
||||
PSSetShaderResource(2, draw_rt_clone, true);
|
||||
}
|
||||
else
|
||||
Console.Warning("VK: Failed to allocate temp texture for RT copy.");
|
||||
}
|
||||
|
||||
// Switch to colclip target for colclip hw rendering
|
||||
@@ -5744,7 +5746,7 @@ void GSDeviceVK::RenderHW(GSHWDrawConfig& config)
|
||||
colclip_rt = static_cast<GSTextureVK*>(CreateRenderTarget(rtsize.x, rtsize.y, GSTexture::Format::ColorClip, false));
|
||||
if (!colclip_rt)
|
||||
{
|
||||
Console.WriteLn("Failed to allocate ColorClip render target, aborting draw.");
|
||||
Console.Warning("VK: Failed to allocate ColorClip render target, aborting draw.");
|
||||
|
||||
if (date_image)
|
||||
Recycle(date_image);
|
||||
|
||||
@@ -887,6 +887,7 @@ std::vector<AvailableMcdInfo> FileMcd_GetAvailableCards(bool include_in_use_card
|
||||
}
|
||||
}
|
||||
|
||||
std::sort(mcds.begin(), mcds.end(), [](auto& a, auto& b) { return a.name < b.name; });
|
||||
return mcds;
|
||||
}
|
||||
|
||||
|
||||
@@ -879,12 +879,10 @@ static __fi u32 floatToInt(u32 uvalue)
|
||||
float fvalue = std::bit_cast<float>(uvalue);
|
||||
if (Offset)
|
||||
fvalue *= std::bit_cast<float>(0x3f800000 + (Offset << 23));
|
||||
s32 svalue = std::bit_cast<s32>(fvalue);
|
||||
uvalue = std::bit_cast<u32>(fvalue);
|
||||
|
||||
if (svalue >= static_cast<s32>(0x4f000000))
|
||||
return 0x7fffffff;
|
||||
else if (svalue <= static_cast<s32>(0xcf000000))
|
||||
return 0x80000000;
|
||||
if ((uvalue & 0x7f800000) >= 0x4f000000)
|
||||
return (uvalue & 0x80000000) ? 0x80000000 : 0x7fffffff;
|
||||
else
|
||||
return static_cast<u32>(static_cast<s32>(fvalue));
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@ namespace DOUBLE
|
||||
void recC_EQ_xmm(int info);
|
||||
void recC_LE_xmm(int info);
|
||||
void recC_LT_xmm(int info);
|
||||
void recCVT_S_xmm(int info);
|
||||
void recCVT_W();
|
||||
void recDIV_S_xmm(int info);
|
||||
void recMADD_S_xmm(int info);
|
||||
void recMADDA_S_xmm(int info);
|
||||
@@ -993,15 +991,16 @@ void recCVT_S_xmm(int info)
|
||||
}
|
||||
}
|
||||
|
||||
FPURECOMPILE_CONSTCODE(CVT_S, XMMINFO_WRITED | XMMINFO_READS);
|
||||
void recCVT_S()
|
||||
{
|
||||
// Float version is fully accurate, no double version
|
||||
eeFPURecompileCode(recCVT_S_xmm, R5900::Interpreter::OpcodeImpl::COP1::CVT_S, XMMINFO_WRITED | XMMINFO_READS);
|
||||
}
|
||||
|
||||
void recCVT_W()
|
||||
{
|
||||
if (CHECK_FPU_FULL)
|
||||
{
|
||||
DOUBLE::recCVT_W();
|
||||
return;
|
||||
}
|
||||
// Float version is fully accurate, no double version
|
||||
|
||||
// If we have the following EmitOP() on the top then it'll get calculated twice when CHECK_FPU_FULL is true
|
||||
// as we also have an EmitOP() at recCVT_W() on iFPUd.cpp. hence we have it below the possible return.
|
||||
EE::Profiler.EmitOp(eeOpcode::CVTW);
|
||||
@@ -1010,26 +1009,23 @@ void recCVT_W()
|
||||
|
||||
if (regs >= 0)
|
||||
{
|
||||
if (CHECK_FPU_EXTRA_OVERFLOW)
|
||||
fpuFloat2(regs);
|
||||
xCVTTSS2SI(eax, xRegisterSSE(regs));
|
||||
xMOVMSKPS(edx, xRegisterSSE(regs)); //extract the signs
|
||||
xAND(edx, 1); // keep only LSB
|
||||
xMOVD(edx, xRegisterSSE(regs));
|
||||
}
|
||||
else
|
||||
{
|
||||
xCVTTSS2SI(eax, ptr32[&fpuRegs.fpr[_Fs_]]);
|
||||
xMOV(edx, ptr[&fpuRegs.fpr[_Fs_]]);
|
||||
xSHR(edx, 31); // mov sign to lsb
|
||||
}
|
||||
|
||||
//kill register allocation for dst because we write directly to fpuRegs.fpr[_Fd_]
|
||||
_deleteFPtoXMMreg(_Fd_, DELETE_REG_FREE_NO_WRITEBACK);
|
||||
|
||||
xADD(edx, 0x7FFFFFFF); // 0x7FFFFFFF if positive, 0x8000 0000 if negative
|
||||
|
||||
xCMP(eax, 0x80000000); // If the result is indefinitive
|
||||
xCMOVE(eax, edx); // Saturate it
|
||||
// cvttss2si converts unrepresentable values to 0x80000000, so negative values are already handled.
|
||||
// So we just need to handle positive values.
|
||||
xCMP(edx, 0x4f000000); // If the input is greater than INT_MAX
|
||||
xMOV(edx, 0x7fffffff);
|
||||
xCMOVGE(eax, edx); // Saturate it
|
||||
|
||||
//Write the result
|
||||
xMOV(ptr[&fpuRegs.fpr[_Fd_]], eax);
|
||||
|
||||
@@ -540,57 +540,10 @@ FPURECOMPILE_CONSTCODE(C_LT, XMMINFO_READS | XMMINFO_READT);
|
||||
//------------------------------------------------------------------
|
||||
// CVT.x XMM
|
||||
//------------------------------------------------------------------
|
||||
void recCVT_S_xmm(int info)
|
||||
{
|
||||
EE::Profiler.EmitOp(eeOpcode::CVTS_F);
|
||||
|
||||
if (info & PROCESS_EE_D)
|
||||
{
|
||||
if (info & PROCESS_EE_S)
|
||||
xCVTDQ2PS(xRegisterSSE(EEREC_D), xRegisterSSE(EEREC_S));
|
||||
else
|
||||
xCVTSI2SS(xRegisterSSE(EEREC_D), ptr32[&fpuRegs.fpr[_Fs_]]);
|
||||
}
|
||||
else
|
||||
{
|
||||
const int temp = _allocTempXMMreg(XMMT_FPS);
|
||||
xCVTSI2SS(xRegisterSSE(temp), ptr32[&fpuRegs.fpr[_Fs_]]);
|
||||
xMOVSS(ptr32[&fpuRegs.fpr[_Fd_]], xRegisterSSE(temp));
|
||||
_freeXMMreg(temp);
|
||||
}
|
||||
}
|
||||
// CVT.S: Identical to non-double variant, omitted
|
||||
// CVT.W: Identical to non-double variant, omitted
|
||||
|
||||
FPURECOMPILE_CONSTCODE(CVT_S, XMMINFO_WRITED | XMMINFO_READS);
|
||||
|
||||
void recCVT_W() //called from iFPU.cpp's recCVT_W
|
||||
{
|
||||
EE::Profiler.EmitOp(eeOpcode::CVTW);
|
||||
int regs = _checkXMMreg(XMMTYPE_FPREG, _Fs_, MODE_READ);
|
||||
|
||||
if (regs >= 0)
|
||||
{
|
||||
xCVTTSS2SI(eax, xRegisterSSE(regs));
|
||||
xMOVMSKPS(edx, xRegisterSSE(regs)); // extract the signs
|
||||
xAND(edx, 1); // keep only LSB
|
||||
}
|
||||
else
|
||||
{
|
||||
xCVTTSS2SI(eax, ptr32[&fpuRegs.fpr[_Fs_]]);
|
||||
xMOV(edx, ptr[&fpuRegs.fpr[_Fs_]]);
|
||||
xSHR(edx, 31); //mov sign to lsb
|
||||
}
|
||||
|
||||
//kill register allocation for dst because we write directly to fpuRegs.fpr[_Fd_]
|
||||
_deleteFPtoXMMreg(_Fd_, DELETE_REG_FREE_NO_WRITEBACK);
|
||||
|
||||
xADD(edx, 0x7FFFFFFF); // 0x7FFFFFFF if positive, 0x8000 0000 if negative
|
||||
|
||||
xCMP(eax, 0x80000000); // If the result is indefinitive
|
||||
xCMOVE(eax, edx); // Saturate it
|
||||
|
||||
//Write the result
|
||||
xMOV(ptr[&fpuRegs.fpr[_Fd_]], eax);
|
||||
}
|
||||
//------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
@@ -42,6 +42,7 @@ struct mVU_Globals
|
||||
u32 E4 [4] = __four(0x3933e553);
|
||||
u32 E5 [4] = __four(0x36b63510);
|
||||
u32 E6 [4] = __four(0x353961ac);
|
||||
u32 I32MAXF [4] = __four(0x4effffff);
|
||||
float FTOI_4 [4] = __four(16.0);
|
||||
float FTOI_12 [4] = __four(4096.0);
|
||||
float FTOI_15 [4] = __four(32768.0);
|
||||
|
||||
@@ -484,23 +484,19 @@ static void mVU_FTOIx(mP, const float* addr, microOpcode opEnum)
|
||||
return;
|
||||
const xmm& Fs = mVU.regAlloc->allocReg(_Fs_, _Ft_, _X_Y_Z_W, !((_Fs_ == _Ft_) && (_X_Y_Z_W == 0xf)));
|
||||
const xmm& t1 = mVU.regAlloc->allocReg();
|
||||
const xmm& t2 = mVU.regAlloc->allocReg();
|
||||
|
||||
// Note: For help understanding this algorithm see recVUMI_FTOI_Saturate()
|
||||
xMOVAPS(t1, Fs);
|
||||
// cvttps2dq returns 0x8000000 for any unrepresentable values.
|
||||
// We want it to return 0x8000000 for negative and 0x7fffffff for positive.
|
||||
// So for unrepresentable positive values, xor with 0xffffffff to turn 0x80000000 into 0x7fffffff.
|
||||
if (addr)
|
||||
xMUL.PS(Fs, ptr128[addr]);
|
||||
xMOVAPS(t1, Fs);
|
||||
xPCMP.GTD(t1, ptr128[mVUglob.I32MAXF]);
|
||||
xCVTTPS2DQ(Fs, Fs);
|
||||
xPXOR(t1, ptr128[mVUglob.signbit]);
|
||||
xPSRA.D(t1, 31);
|
||||
xMOVAPS(t2, Fs);
|
||||
xPCMP.EQD(t2, ptr128[mVUglob.signbit]);
|
||||
xAND.PS(t1, t2);
|
||||
xPADD.D(Fs, t1);
|
||||
xPXOR(Fs, t1);
|
||||
|
||||
mVU.regAlloc->clearNeeded(Fs);
|
||||
mVU.regAlloc->clearNeeded(t1);
|
||||
mVU.regAlloc->clearNeeded(t2);
|
||||
mVU.profiler.EmitOp(opEnum);
|
||||
}
|
||||
pass3
|
||||
|
||||
Reference in New Issue
Block a user