mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-04-09 11:01:29 -06:00
Merge branch 'master' into friendly
This commit is contained in:
commit
ba49105da2
4
3rdparty/CMakeLists.txt
vendored
4
3rdparty/CMakeLists.txt
vendored
@ -249,8 +249,8 @@ if(USE_FAUDIO)
|
||||
message(STATUS "RPCS3: Using builtin FAudio")
|
||||
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared library")
|
||||
add_subdirectory(FAudio EXCLUDE_FROM_ALL)
|
||||
target_compile_definitions(FAudio INTERFACE -DHAVE_FAUDIO)
|
||||
set(FAUDIO_TARGET FAudio)
|
||||
target_compile_definitions(FAudio-static INTERFACE -DHAVE_FAUDIO)
|
||||
set(FAUDIO_TARGET FAudio-static)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
2
3rdparty/FAudio
vendored
2
3rdparty/FAudio
vendored
@ -1 +1 @@
|
||||
Subproject commit b6e699d736e28ac208d2d40c23708adc2d11c2d9
|
||||
Subproject commit 54bff0446152a9646965e4892c0c00d45b94076f
|
||||
2
3rdparty/libsdl-org/SDL
vendored
2
3rdparty/libsdl-org/SDL
vendored
@ -1 +1 @@
|
||||
Subproject commit 9519b9916cd29a14587af0507292f2bd31dd5752
|
||||
Subproject commit 79ec168f3c1e2fe27335cb8886439f7ef676fb49
|
||||
5
3rdparty/zstd/zstd.vcxproj
vendored
5
3rdparty/zstd/zstd.vcxproj
vendored
@ -115,7 +115,7 @@
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<Import Project="$(SolutionDir)\buildfiles\msvc\common_default_macros.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<ConfigurationType>StaticLibrary</ConfigurationType>
|
||||
<UseDebugLibraries>true</UseDebugLibraries>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
</PropertyGroup>
|
||||
@ -153,10 +153,13 @@
|
||||
</PrecompiledHeader>
|
||||
<WarningLevel>Level4</WarningLevel>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<AdditionalOptions>/DZSTD_MULTITHREAD %(AdditionalOptions)</AdditionalOptions>
|
||||
<PreprocessorDefinitions>ZSTD_MULTITHREAD=1;ZSTD_LEGACY_SUPPORT=5;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<TreatWarningAsError>true</TreatWarningAsError>
|
||||
<EnablePREfast>false</EnablePREfast>
|
||||
<EnableEnhancedInstructionSet>$(InstructionSet)</EnableEnhancedInstructionSet>
|
||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
||||
@ -3729,6 +3729,22 @@ public:
|
||||
return result;
|
||||
}
|
||||
|
||||
template <typename T1, typename T2, typename T3>
|
||||
value_t<f32[4]> vfixupimmps(T1 a, T2 b, T3 c, u8 d, u8 e)
|
||||
{
|
||||
value_t<f32[4]> result;
|
||||
|
||||
const auto data0 = a.eval(m_ir);
|
||||
const auto data1 = b.eval(m_ir);
|
||||
const auto data2 = c.eval(m_ir);
|
||||
const auto immediate = (llvm_const_int<u32>{d});
|
||||
const auto imm32 = immediate.eval(m_ir);
|
||||
const auto immediate2 = (llvm_const_int<u8>{e});
|
||||
const auto imm8 = immediate2.eval(m_ir);
|
||||
result.value = m_ir->CreateCall(get_intrinsic(llvm::Intrinsic::x86_avx512_mask_fixupimm_ps_128), {data0, data1, data2, imm32, imm8});
|
||||
return result;
|
||||
}
|
||||
|
||||
llvm::Value* load_const(llvm::GlobalVariable* g, llvm::Value* i, llvm::Type* type = nullptr)
|
||||
{
|
||||
return m_ir->CreateLoad(type ? type : g->getValueType(), m_ir->CreateGEP(g->getValueType(), g, {m_ir->getInt64(0), m_ir->CreateZExtOrTrunc(i, get_type<u64>())}));
|
||||
|
||||
@ -813,7 +813,7 @@ void cell_audio_thread::operator()()
|
||||
|
||||
if (time_left > cfg.period_comparison_margin)
|
||||
{
|
||||
thread_ctrl::wait_for(get_thread_wait_delay(time_left));
|
||||
thread_ctrl::wait_for(time_left - cfg.period_comparison_margin);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
@ -886,7 +886,7 @@ void cell_audio_thread::operator()()
|
||||
const s64 time_left = m_dynamic_period - time_since_last_period;
|
||||
if (time_left > cfg.period_comparison_margin)
|
||||
{
|
||||
thread_ctrl::wait_for(get_thread_wait_delay(time_left));
|
||||
thread_ctrl::wait_for(time_left - cfg.period_comparison_margin);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@ -251,7 +251,12 @@ struct cell_audio_config
|
||||
|
||||
static constexpr f32 period_average_alpha = 0.02f; // alpha factor for the m_average_period rolling average
|
||||
|
||||
static constexpr s64 period_comparison_margin = 250; // when comparing the current period time with the desired period, if it is below this number of usecs we do not wait any longer
|
||||
// when comparing the current period time with the desired period, if it is below this number of usecs we do not wait any longer(quantum dependent)
|
||||
#ifdef _WIN32
|
||||
static constexpr s64 period_comparison_margin = 250;
|
||||
#else
|
||||
static constexpr s64 period_comparison_margin = 5;
|
||||
#endif
|
||||
|
||||
u64 fully_untouched_timeout = 0; // timeout if the game has not touched any audio buffer yet
|
||||
u64 partially_untouched_timeout = 0; // timeout if the game has not touched all audio buffers yet
|
||||
@ -373,11 +378,6 @@ private:
|
||||
void mix(float* out_buffer, s32 offset = 0);
|
||||
void finish_port_volume_stepping();
|
||||
|
||||
constexpr static u64 get_thread_wait_delay(u64 time_left)
|
||||
{
|
||||
return (time_left > 350) ? time_left - 250 : 100;
|
||||
}
|
||||
|
||||
void update_config(bool backend_changed);
|
||||
void reset_counters();
|
||||
|
||||
|
||||
@ -124,7 +124,6 @@ class spu_llvm_recompiler : public spu_recompiler_base, public cpu_translator
|
||||
|
||||
// Global LUTs
|
||||
llvm::GlobalVariable* m_spu_frest_fraction_lut{};
|
||||
llvm::GlobalVariable* m_spu_frest_exponent_lut{};
|
||||
llvm::GlobalVariable* m_spu_frsqest_fraction_lut{};
|
||||
llvm::GlobalVariable* m_spu_frsqest_exponent_lut{};
|
||||
|
||||
@ -1507,7 +1506,6 @@ public:
|
||||
{
|
||||
// LUTs for some instructions
|
||||
m_spu_frest_fraction_lut = new llvm::GlobalVariable(*m_module, llvm::ArrayType::get(GetType<u32>(), 32), true, llvm::GlobalValue::PrivateLinkage, llvm::ConstantDataArray::get(m_context, spu_frest_fraction_lut));
|
||||
m_spu_frest_exponent_lut = new llvm::GlobalVariable(*m_module, llvm::ArrayType::get(GetType<u32>(), 256), true, llvm::GlobalValue::PrivateLinkage, llvm::ConstantDataArray::get(m_context, spu_frest_exponent_lut));
|
||||
m_spu_frsqest_fraction_lut = new llvm::GlobalVariable(*m_module, llvm::ArrayType::get(GetType<u32>(), 64), true, llvm::GlobalValue::PrivateLinkage, llvm::ConstantDataArray::get(m_context, spu_frsqest_fraction_lut));
|
||||
m_spu_frsqest_exponent_lut = new llvm::GlobalVariable(*m_module, llvm::ArrayType::get(GetType<u32>(), 256), true, llvm::GlobalValue::PrivateLinkage, llvm::ConstantDataArray::get(m_context, spu_frsqest_exponent_lut));
|
||||
}
|
||||
@ -6040,23 +6038,22 @@ public:
|
||||
const auto a = bitcast<u32[4]>(value<f32[4]>(ci->getOperand(0)));
|
||||
|
||||
const auto a_fraction = (a >> splat<u32[4]>(18)) & splat<u32[4]>(0x1F);
|
||||
const auto a_exponent = (a >> splat<u32[4]>(23)) & splat<u32[4]>(0xFF);
|
||||
const auto a_exponent = (a & splat<u32[4]>(0x7F800000u));
|
||||
const auto r_exponent = sub_sat(build<u16[8]>(0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80), bitcast<u16[8]>(a_exponent));
|
||||
const auto fix_exponent = select((a_exponent > 0), bitcast<u32[4]>(r_exponent), splat<u32[4]>(0x7F800000u));
|
||||
const auto a_sign = (a & splat<u32[4]>(0x80000000));
|
||||
value_t<u32[4]> final_result = eval(splat<u32[4]>(0));
|
||||
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
const auto eval_fraction = eval(extract(a_fraction, i));
|
||||
const auto eval_exponent = eval(extract(a_exponent, i));
|
||||
const auto eval_sign = eval(extract(a_sign, i));
|
||||
|
||||
value_t<u32> r_fraction = load_const<u32>(m_spu_frest_fraction_lut, eval_fraction);
|
||||
value_t<u32> r_exponent = load_const<u32>(m_spu_frest_exponent_lut, eval_exponent);
|
||||
|
||||
final_result = eval(insert(final_result, i, eval(r_fraction | eval_sign | r_exponent)));
|
||||
final_result = eval(insert(final_result, i, r_fraction));
|
||||
}
|
||||
|
||||
return bitcast<f32[4]>(final_result);
|
||||
return bitcast<f32[4]>(bitcast<u32[4]>(final_result | bitcast<u32[4]>(fix_exponent) | a_sign));
|
||||
});
|
||||
|
||||
set_vr(op.rt, frest(get_vr<f32[4]>(op.ra)));
|
||||
@ -6704,24 +6701,39 @@ public:
|
||||
}
|
||||
});
|
||||
|
||||
register_intrinsic("spu_re_acc", [&](llvm::CallInst* ci)
|
||||
if (m_use_avx512)
|
||||
{
|
||||
const auto div = value<f32[4]>(ci->getOperand(0));
|
||||
const auto the_one = value<f32[4]>(ci->getOperand(1));
|
||||
register_intrinsic("spu_re_acc", [&](llvm::CallInst* ci)
|
||||
{
|
||||
const auto div = value<f32[4]>(ci->getOperand(0));
|
||||
const auto the_one = value<f32[4]>(ci->getOperand(1));
|
||||
|
||||
const auto div_result = the_one / div;
|
||||
const auto div_result = the_one / div;
|
||||
|
||||
// from ps3 hardware testing: Inf => NaN and NaN => Zero
|
||||
const auto result_and = bitcast<u32[4]>(div_result) & 0x7fffffffu;
|
||||
const auto result_cmp_inf = sext<s32[4]>(result_and == splat<u32[4]>(0x7F800000u));
|
||||
const auto result_cmp_nan = sext<s32[4]>(result_and <= splat<u32[4]>(0x7F800000u));
|
||||
return vfixupimmps(bitcast<f32[4]>(splat<u32[4]>(0xFFFFFFFFu)), div_result, splat<u32[4]>(0x11001188u), 0, 0xff);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
register_intrinsic("spu_re_acc", [&](llvm::CallInst* ci)
|
||||
{
|
||||
const auto div = value<f32[4]>(ci->getOperand(0));
|
||||
const auto the_one = value<f32[4]>(ci->getOperand(1));
|
||||
|
||||
const auto and_mask = bitcast<u32[4]>(result_cmp_nan) & splat<u32[4]>(0xFFFFFFFFu);
|
||||
const auto or_mask = bitcast<u32[4]>(result_cmp_inf) & splat<u32[4]>(0xFFFFFFFu);
|
||||
const auto div_result = the_one / div;
|
||||
|
||||
return bitcast<f32[4]>((bitcast<u32[4]>(div_result) & and_mask) | or_mask);
|
||||
});
|
||||
// from ps3 hardware testing: Inf => NaN and NaN => Zero
|
||||
const auto result_and = bitcast<u32[4]>(div_result) & 0x7fffffffu;
|
||||
const auto result_cmp_inf = sext<s32[4]>(result_and == splat<u32[4]>(0x7F800000u));
|
||||
const auto result_cmp_nan = sext<s32[4]>(result_and <= splat<u32[4]>(0x7F800000u));
|
||||
|
||||
const auto and_mask = bitcast<u32[4]>(result_cmp_nan) & splat<u32[4]>(0xFFFFFFFFu);
|
||||
const auto or_mask = bitcast<u32[4]>(result_cmp_inf) & splat<u32[4]>(0xFFFFFFFu);
|
||||
return bitcast<f32[4]>((bitcast<u32[4]>(div_result) & and_mask) | or_mask);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
const auto [a, b, c] = get_vrs<f32[4]>(op.ra, op.rb, op.rc);
|
||||
static const auto MT = match<f32[4]>();
|
||||
|
||||
@ -7004,20 +7016,23 @@ public:
|
||||
{
|
||||
const auto a = bitcast<u32[4]>(value<f32[4]>(ci->getOperand(0)));
|
||||
const auto a_fraction = (a >> splat<u32[4]>(18)) & splat<u32[4]>(0x1F);
|
||||
const auto a_exponent = (a >> splat<u32[4]>(23)) & splat<u32[4]>(0xFF);
|
||||
const auto a_exponent = (a & splat<u32[4]>(0x7F800000u));
|
||||
const auto r_exponent = sub_sat(build<u16[8]>(0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80, 0000, 0x7E80), bitcast<u16[8]>(a_exponent));
|
||||
const auto fix_exponent = select((a_exponent > 0), bitcast<u32[4]>(r_exponent), splat<u32[4]>(0x7F800000u));
|
||||
const auto a_sign = (a & splat<u32[4]>(0x80000000));
|
||||
value_t<u32[4]> b = eval(splat<u32[4]>(0));
|
||||
|
||||
for (u32 i = 0; i < 4; i++)
|
||||
{
|
||||
const auto eval_fraction = eval(extract(a_fraction, i));
|
||||
const auto eval_exponent = eval(extract(a_exponent, i));
|
||||
const auto eval_sign = eval(extract(a_sign, i));
|
||||
|
||||
value_t<u32> r_fraction = load_const<u32>(m_spu_frest_fraction_lut, eval_fraction);
|
||||
value_t<u32> r_exponent = load_const<u32>(m_spu_frest_exponent_lut, eval_exponent);
|
||||
b = eval(insert(b, i, eval(r_fraction | eval_sign | r_exponent)));
|
||||
|
||||
b = eval(insert(b, i, r_fraction));
|
||||
}
|
||||
|
||||
b = eval(b | fix_exponent | a_sign);
|
||||
|
||||
const auto base = (b & 0x007ffc00u) << 9; // Base fraction
|
||||
const auto ymul = (b & 0x3ff) * (a & 0x7ffff); // Step fraction * Y fraction (fixed point at 2^-32)
|
||||
const auto comparison = (ymul > base); // Should exponent be adjusted?
|
||||
|
||||
Loading…
Reference in New Issue
Block a user