mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-10-14 09:57:53 +00:00
[cmake] enable clang-cl and WoA builds (#348)
Compilation and CMake fixes for both Windows on ARM and clang-cl, meaning Windows can now be built on both MSVC and clang on both amd64 and aarch64. Compiling on clang is *dramatically* faster so this should be useful for CI. Co-authored-by: crueter <crueter@eden-emu.dev> Co-authored-by: crueter <crueter@crueter.xyz> Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/348 Reviewed-by: CamilleLaVey <camillelavey99@gmail.com> Reviewed-by: crueter <crueter@eden-emu.dev> Co-authored-by: lizzie <lizzie@eden-emu.dev> Co-committed-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
428f136a75
commit
9d2681ecc9
276 changed files with 973 additions and 1010 deletions
|
@ -45,7 +45,7 @@ u32 AudioDevice::ListAudioDeviceName(std::span<AudioDeviceName> out_buffer) cons
|
|||
names = device_names;
|
||||
}
|
||||
|
||||
const u32 out_count{static_cast<u32>(std::min(out_buffer.size(), names.size()))};
|
||||
const u32 out_count{static_cast<u32>((std::min)(out_buffer.size(), names.size()))};
|
||||
for (u32 i = 0; i < out_count; i++) {
|
||||
out_buffer[i] = names[i];
|
||||
}
|
||||
|
@ -53,7 +53,7 @@ u32 AudioDevice::ListAudioDeviceName(std::span<AudioDeviceName> out_buffer) cons
|
|||
}
|
||||
|
||||
u32 AudioDevice::ListAudioOutputDeviceName(std::span<AudioDeviceName> out_buffer) const {
|
||||
const u32 out_count{static_cast<u32>(std::min(out_buffer.size(), output_device_names.size()))};
|
||||
const u32 out_count{static_cast<u32>((std::min)(out_buffer.size(), output_device_names.size()))};
|
||||
|
||||
for (u32 i = 0; i < out_count; i++) {
|
||||
out_buffer[i] = output_device_names[i];
|
||||
|
|
|
@ -43,7 +43,7 @@ void BehaviorInfo::AppendError(const ErrorInfo& error) {
|
|||
}
|
||||
|
||||
void BehaviorInfo::CopyErrorInfo(std::span<ErrorInfo> out_errors, u32& out_count) const {
|
||||
out_count = std::min(error_count, MaxErrors);
|
||||
out_count = (std::min)(error_count, MaxErrors);
|
||||
|
||||
for (size_t i = 0; i < MaxErrors; i++) {
|
||||
if (i < out_count) {
|
||||
|
|
|
@ -464,7 +464,7 @@ void CommandBuffer::GenerateDeviceSinkCommand(const s32 node_id, const s16 buffe
|
|||
s16 max_input{0};
|
||||
for (u32 i = 0; i < parameter.input_count; i++) {
|
||||
cmd.inputs[i] = buffer_offset + parameter.inputs[i];
|
||||
max_input = std::max(max_input, cmd.inputs[i]);
|
||||
max_input = (std::max)(max_input, cmd.inputs[i]);
|
||||
}
|
||||
|
||||
if (state.upsampler_info != nullptr) {
|
||||
|
|
|
@ -56,11 +56,11 @@ public:
|
|||
// Voices
|
||||
u64 voice_size{0};
|
||||
if (behavior.IsWaveBufferVer2Supported()) {
|
||||
voice_size = std::max(std::max(sizeof(AdpcmDataSourceVersion2Command),
|
||||
voice_size = (std::max)((std::max)(sizeof(AdpcmDataSourceVersion2Command),
|
||||
sizeof(PcmInt16DataSourceVersion2Command)),
|
||||
sizeof(PcmFloatDataSourceVersion2Command));
|
||||
} else {
|
||||
voice_size = std::max(std::max(sizeof(AdpcmDataSourceVersion1Command),
|
||||
voice_size = (std::max)((std::max)(sizeof(AdpcmDataSourceVersion1Command),
|
||||
sizeof(PcmInt16DataSourceVersion1Command)),
|
||||
sizeof(PcmFloatDataSourceVersion1Command));
|
||||
}
|
||||
|
@ -82,7 +82,7 @@ public:
|
|||
|
||||
// Sinks
|
||||
size +=
|
||||
params.sinks * std::max(sizeof(DeviceSinkCommand), sizeof(CircularBufferSinkCommand));
|
||||
params.sinks * (std::max)(sizeof(DeviceSinkCommand), sizeof(CircularBufferSinkCommand));
|
||||
|
||||
// Performance
|
||||
size += (params.effects + params.voices + params.sinks + params.sub_mixes + 1 +
|
||||
|
|
|
@ -29,8 +29,8 @@ constexpr std::array<u8, 3> PitchBySrcQuality = {4, 8, 4};
|
|||
template <typename T>
|
||||
static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
||||
const DecodeArg& req) {
|
||||
constexpr s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr s32 max{std::numeric_limits<s16>::max()};
|
||||
constexpr s32 min{(std::numeric_limits<s16>::min)()};
|
||||
constexpr s32 max{(std::numeric_limits<s16>::max)()};
|
||||
|
||||
if (req.buffer == 0 || req.buffer_size == 0) {
|
||||
return 0;
|
||||
|
@ -41,7 +41,7 @@ static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
|||
}
|
||||
|
||||
auto samples_to_decode{
|
||||
std::min(req.samples_to_read, req.end_offset - req.start_offset - req.offset)};
|
||||
(std::min)(req.samples_to_read, req.end_offset - req.start_offset - req.offset)};
|
||||
u32 channel_count{static_cast<u32>(req.channel_count)};
|
||||
|
||||
switch (req.channel_count) {
|
||||
|
@ -55,7 +55,7 @@ static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
|||
if constexpr (std::is_floating_point_v<T>) {
|
||||
for (u32 i = 0; i < samples_to_decode; i++) {
|
||||
auto sample{static_cast<s32>(samples[i * channel_count + req.target_channel] *
|
||||
std::numeric_limits<s16>::max())};
|
||||
(std::numeric_limits<s16>::max)())};
|
||||
out_buffer[i] = static_cast<s16>(std::clamp(sample, min, max));
|
||||
}
|
||||
} else {
|
||||
|
@ -79,7 +79,7 @@ static u32 DecodePcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
|||
if constexpr (std::is_floating_point_v<T>) {
|
||||
for (u32 i = 0; i < samples_to_decode; i++) {
|
||||
auto sample{static_cast<s32>(samples[i * channel_count + req.target_channel] *
|
||||
std::numeric_limits<s16>::max())};
|
||||
(std::numeric_limits<s16>::max)())};
|
||||
out_buffer[i] = static_cast<s16>(std::clamp(sample, min, max));
|
||||
}
|
||||
} else {
|
||||
|
@ -125,7 +125,7 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
|||
}
|
||||
|
||||
auto start_pos{req.start_offset + req.offset};
|
||||
auto samples_to_process{std::min(req.end_offset - start_pos, req.samples_to_read)};
|
||||
auto samples_to_process{(std::min)(req.end_offset - start_pos, req.samples_to_read)};
|
||||
if (samples_to_process == 0) {
|
||||
return 0;
|
||||
}
|
||||
|
@ -139,7 +139,7 @@ static u32 DecodeAdpcm(Core::Memory::Memory& memory, std::span<s16> out_buffer,
|
|||
position_in_frame += 2;
|
||||
}
|
||||
|
||||
const auto size{std::max((samples_to_process / 8U) * SamplesPerFrame, 8U)};
|
||||
const auto size{(std::max)((samples_to_process / 8U) * SamplesPerFrame, 8U)};
|
||||
Core::Memory::CpuGuestMemory<u8, Core::Memory::GuestMemoryFlags::UnsafeRead> wavebuffer(
|
||||
memory, req.buffer + position_in_frame / 2, size);
|
||||
|
||||
|
@ -260,7 +260,7 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf
|
|||
auto max_remaining_sample_count{
|
||||
((Common::FixedPoint<17, 15>(TempBufferSize) - fraction) / sample_rate_ratio)
|
||||
.to_uint_floor()};
|
||||
max_remaining_sample_count = std::min(max_remaining_sample_count, remaining_sample_count);
|
||||
max_remaining_sample_count = (std::min)(max_remaining_sample_count, remaining_sample_count);
|
||||
|
||||
auto wavebuffers_consumed{voice_state.wave_buffers_consumed};
|
||||
auto wavebuffer_index{voice_state.wave_buffer_index};
|
||||
|
@ -273,7 +273,7 @@ void DecodeFromWaveBuffers(Core::Memory::Memory& memory, const DecodeFromWaveBuf
|
|||
std::array<s16, TempBufferSize> temp_buffer{};
|
||||
|
||||
while (remaining_sample_count > 0) {
|
||||
const auto samples_to_write{std::min(remaining_sample_count, max_remaining_sample_count)};
|
||||
const auto samples_to_write{(std::min)(remaining_sample_count, max_remaining_sample_count)};
|
||||
const auto samples_to_read{
|
||||
(fraction + samples_to_write * sample_rate_ratio).to_uint_floor()};
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr send_info_,
|
|||
u32 write_count{write_count_};
|
||||
u32 read_pos{0};
|
||||
while (write_count > 0) {
|
||||
u32 to_write{std::min(count_max - target_write_offset, write_count)};
|
||||
u32 to_write{(std::min)(count_max - target_write_offset, write_count)};
|
||||
if (to_write > 0) {
|
||||
const auto write_addr = send_buffer + target_write_offset * sizeof(s32);
|
||||
memory.WriteBlockUnsafe(write_addr, &input[read_pos], to_write * sizeof(s32));
|
||||
|
@ -157,7 +157,7 @@ static u32 ReadAuxBufferDsp(Core::Memory::Memory& memory, CpuAddr return_info_,
|
|||
u32 read_count{read_count_};
|
||||
u32 write_pos{0};
|
||||
while (read_count > 0) {
|
||||
u32 to_read{std::min(count_max - target_read_offset, read_count)};
|
||||
u32 to_read{(std::min)(count_max - target_read_offset, read_count)};
|
||||
if (to_read > 0) {
|
||||
const auto read_addr = return_buffer + target_read_offset * sizeof(s32);
|
||||
memory.ReadBlockUnsafe(read_addr, &output[write_pos], to_read * sizeof(s32));
|
||||
|
|
|
@ -20,8 +20,8 @@ namespace AudioCore::Renderer {
|
|||
void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input,
|
||||
std::array<s16, 3>& b_, std::array<s16, 2>& a_,
|
||||
VoiceState::BiquadFilterState& state, const u32 sample_count) {
|
||||
constexpr f64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr f64 max{std::numeric_limits<s32>::max()};
|
||||
constexpr f64 min{(std::numeric_limits<s32>::min)()};
|
||||
constexpr f64 max{(std::numeric_limits<s32>::max)()};
|
||||
std::array<f64, 3> b{Common::FixedPoint<50, 14>::from_base(b_[0]).to_double(),
|
||||
Common::FixedPoint<50, 14>::from_base(b_[1]).to_double(),
|
||||
Common::FixedPoint<50, 14>::from_base(b_[2]).to_double()};
|
||||
|
@ -61,8 +61,8 @@ void ApplyBiquadFilterFloat(std::span<s32> output, std::span<const s32> input,
|
|||
static void ApplyBiquadFilterInt(std::span<s32> output, std::span<const s32> input,
|
||||
std::array<s16, 3>& b, std::array<s16, 2>& a,
|
||||
VoiceState::BiquadFilterState& state, const u32 sample_count) {
|
||||
constexpr s64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr s64 max{std::numeric_limits<s32>::max()};
|
||||
constexpr s64 min{(std::numeric_limits<s32>::min)()};
|
||||
constexpr s64 max{(std::numeric_limits<s32>::max)()};
|
||||
|
||||
for (u32 i = 0; i < sample_count; i++) {
|
||||
const s64 in_sample{input[i]};
|
||||
|
|
|
@ -79,7 +79,7 @@ static u32 WriteAuxBufferDsp(Core::Memory::Memory& memory, const CpuAddr send_in
|
|||
u32 write_count{write_count_};
|
||||
u32 write_pos{0};
|
||||
while (write_count > 0) {
|
||||
u32 to_write{std::min(count_max - target_write_offset, write_count)};
|
||||
u32 to_write{(std::min)(count_max - target_write_offset, write_count)};
|
||||
|
||||
if (to_write > 0) {
|
||||
memory.WriteBlockUnsafe(send_buffer + target_write_offset * sizeof(s32),
|
||||
|
|
|
@ -76,9 +76,9 @@ static void UpdateI3dl2ReverbEffectParameter(const I3dl2ReverbInfo::ParameterVer
|
|||
|
||||
state.dry_gain = params.dry_gain;
|
||||
Common::FixedPoint<50, 14> early_gain{
|
||||
std::min(params.room_gain + params.reflection_gain, 5000.0f) / 2000.0f};
|
||||
(std::min)(params.room_gain + params.reflection_gain, 5000.0f) / 2000.0f};
|
||||
state.early_gain = pow_10(early_gain.to_float());
|
||||
Common::FixedPoint<50, 14> late_gain{std::min(params.room_gain + params.reverb_gain, 5000.0f) /
|
||||
Common::FixedPoint<50, 14> late_gain{(std::min)(params.room_gain + params.reverb_gain, 5000.0f) /
|
||||
2000.0f};
|
||||
state.late_gain = pow_10(late_gain.to_float());
|
||||
|
||||
|
@ -94,7 +94,7 @@ static void UpdateI3dl2ReverbEffectParameter(const I3dl2ReverbInfo::ParameterVer
|
|||
const Common::FixedPoint<50, 14> c{
|
||||
std::sqrt(std::pow(b.to_float(), 2.0f) + (std::pow(a.to_float(), 2.0f) * -4.0f))};
|
||||
|
||||
state.lowpass_1 = std::min(((b - c) / (a * 2.0f)).to_float(), 0.99723f);
|
||||
state.lowpass_1 = (std::min)(((b - c) / (a * 2.0f)).to_float(), 0.99723f);
|
||||
state.lowpass_2 = 1.0f - state.lowpass_1;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,8 +50,8 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p
|
|||
std::span<std::span<const s32>> inputs,
|
||||
std::span<std::span<s32>> outputs, const u32 sample_count,
|
||||
LightLimiterInfo::StatisticsInternal* statistics) {
|
||||
constexpr s64 min{std::numeric_limits<s32>::min()};
|
||||
constexpr s64 max{std::numeric_limits<s32>::max()};
|
||||
constexpr s64 min{(std::numeric_limits<s32>::min)()};
|
||||
constexpr s64 max{(std::numeric_limits<s32>::max)()};
|
||||
|
||||
const auto recip_estimate = [](f64 a) -> f64 {
|
||||
s32 q, s;
|
||||
|
@ -117,9 +117,9 @@ static void ApplyLightLimiterEffect(const LightLimiterInfo::ParameterVersion2& p
|
|||
|
||||
if (statistics) {
|
||||
statistics->channel_max_sample[channel] =
|
||||
std::max(statistics->channel_max_sample[channel], abs_sample.to_float());
|
||||
(std::max)(statistics->channel_max_sample[channel], abs_sample.to_float());
|
||||
statistics->channel_compression_gain_min[channel] =
|
||||
std::min(statistics->channel_compression_gain_min[channel],
|
||||
(std::min)(statistics->channel_compression_gain_min[channel],
|
||||
state.compression_gain[channel].to_float());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ static void UpdateReverbEffectParameter(const ReverbInfo::ParameterVersion2& par
|
|||
for (u32 i = 0; i < ReverbInfo::MaxDelayTaps; i++) {
|
||||
auto early_delay{
|
||||
((pre_delay_time + EarlyDelayTimes[params.early_mode][i]) * sample_rate).to_int()};
|
||||
early_delay = std::min(early_delay, state.pre_delay_line.sample_count_max);
|
||||
early_delay = (std::min)(early_delay, state.pre_delay_line.sample_count_max);
|
||||
state.early_delay_times[i] = early_delay + 1;
|
||||
state.early_gains[i] = Common::FixedPoint<50, 14>::from_base(params.early_gain) *
|
||||
EarlyDelayGains[params.early_mode][i];
|
||||
|
@ -107,7 +107,7 @@ static void UpdateReverbEffectParameter(const ReverbInfo::ParameterVersion2& par
|
|||
|
||||
auto pre_time{
|
||||
((pre_delay_time + EarlyDelayTimes[params.early_mode][10]) * sample_rate).to_int()};
|
||||
state.pre_delay_time = std::min(pre_time, state.pre_delay_line.sample_count_max);
|
||||
state.pre_delay_time = (std::min)(pre_time, state.pre_delay_line.sample_count_max);
|
||||
|
||||
if (!unk_initialized) {
|
||||
unk_value = cos((1280.0f / sample_rate).to_float());
|
||||
|
@ -117,13 +117,13 @@ static void UpdateReverbEffectParameter(const ReverbInfo::ParameterVersion2& par
|
|||
for (u32 i = 0; i < ReverbInfo::MaxDelayLines; i++) {
|
||||
const auto fdn_delay{(FdnDelayTimes[params.late_mode][i] * sample_rate).to_int()};
|
||||
state.fdn_delay_lines[i].sample_count =
|
||||
std::min(fdn_delay, state.fdn_delay_lines[i].sample_count_max);
|
||||
(std::min)(fdn_delay, state.fdn_delay_lines[i].sample_count_max);
|
||||
state.fdn_delay_lines[i].buffer_end =
|
||||
&state.fdn_delay_lines[i].buffer[state.fdn_delay_lines[i].sample_count - 1];
|
||||
|
||||
const auto decay_delay{(DecayDelayTimes[params.late_mode][i] * sample_rate).to_int()};
|
||||
state.decay_delay_lines[i].sample_count =
|
||||
std::min(decay_delay, state.decay_delay_lines[i].sample_count_max);
|
||||
(std::min)(decay_delay, state.decay_delay_lines[i].sample_count_max);
|
||||
state.decay_delay_lines[i].buffer_end =
|
||||
&state.decay_delay_lines[i].buffer[state.decay_delay_lines[i].sample_count - 1];
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ void DepopForMixBuffersCommand::Dump(
|
|||
}
|
||||
|
||||
void DepopForMixBuffersCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
|
||||
auto end_index{std::min(processor.buffer_count, input + count)};
|
||||
auto end_index{(std::min)(processor.buffer_count, input + count)};
|
||||
std::span<s32> depop_buff{reinterpret_cast<s32*>(depop_buffer), end_index};
|
||||
|
||||
for (u32 index = input; index < end_index; index++) {
|
||||
|
|
|
@ -215,7 +215,7 @@ auto UpsampleCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListProc
|
|||
|
||||
void UpsampleCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
|
||||
const auto info{reinterpret_cast<UpsamplerInfo*>(upsampler_info)};
|
||||
const auto input_count{std::min(info->input_count, buffer_count)};
|
||||
const auto input_count{(std::min)(info->input_count, buffer_count)};
|
||||
const std::span<const s16> inputs_{reinterpret_cast<const s16*>(inputs), input_count};
|
||||
|
||||
for (u32 i = 0; i < input_count; i++) {
|
||||
|
|
|
@ -21,8 +21,8 @@ void CircularBufferSinkCommand::Dump(
|
|||
}
|
||||
|
||||
void CircularBufferSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
|
||||
constexpr s32 min{std::numeric_limits<s16>::min()};
|
||||
constexpr s32 max{std::numeric_limits<s16>::max()};
|
||||
constexpr s32 min{(std::numeric_limits<s16>::min)()};
|
||||
constexpr s32 max{(std::numeric_limits<s16>::max)()};
|
||||
|
||||
std::array<s16, TargetSampleCount * MaxChannels> output{};
|
||||
for (u32 channel = 0; channel < input_count; channel++) {
|
||||
|
|
|
@ -20,8 +20,8 @@ void DeviceSinkCommand::Dump([[maybe_unused]] const AudioRenderer::CommandListPr
|
|||
}
|
||||
|
||||
void DeviceSinkCommand::Process(const AudioRenderer::CommandListProcessor& processor) {
|
||||
constexpr s32 min = std::numeric_limits<s16>::min();
|
||||
constexpr s32 max = std::numeric_limits<s16>::max();
|
||||
constexpr s32 min = (std::numeric_limits<s16>::min)();
|
||||
constexpr s32 max = (std::numeric_limits<s16>::max)();
|
||||
|
||||
auto stream{processor.GetOutputSinkStream()};
|
||||
stream->SetSystemChannels(input_count);
|
||||
|
|
|
@ -126,7 +126,7 @@ bool MixContext::TSortInfo(const SplitterContext& splitter_context) {
|
|||
}
|
||||
|
||||
auto sorted_results{node_states.GetSortedResuls()};
|
||||
const auto result_size{std::min(count, static_cast<s32>(sorted_results.second))};
|
||||
const auto result_size{(std::min)(count, static_cast<s32>(sorted_results.second))};
|
||||
for (s32 i = 0; i < result_size; i++) {
|
||||
sorted_mix_infos[i] = &mix_infos[sorted_results.first[i]];
|
||||
}
|
||||
|
|
|
@ -168,9 +168,9 @@ protected:
|
|||
/// Node id for this sink
|
||||
u32 node_id{};
|
||||
/// State buffer for this sink
|
||||
std::array<u8, std::max(sizeof(DeviceState), sizeof(CircularBufferState))> state{};
|
||||
std::array<u8, (std::max)(sizeof(DeviceState), sizeof(CircularBufferState))> state{};
|
||||
/// Parameter buffer for this sink
|
||||
std::array<u8, std::max(sizeof(DeviceInParameter), sizeof(CircularBufferInParameter))>
|
||||
std::array<u8, (std::max)(sizeof(DeviceInParameter), sizeof(CircularBufferInParameter))>
|
||||
parameter{};
|
||||
};
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ void SplitterContext::RecomposeDestination(SplitterInfo& out_info,
|
|||
|
||||
auto dest_count{info_header->destination_count};
|
||||
if (!splitter_bug_fixed) {
|
||||
dest_count = std::min(dest_count, GetDestCountPerInfoForCompat());
|
||||
dest_count = (std::min)(dest_count, GetDestCountPerInfoForCompat());
|
||||
}
|
||||
|
||||
if (dest_count == 0) {
|
||||
|
|
|
@ -718,7 +718,7 @@ u64 System::GenerateCommand(std::span<u8> in_command_buffer,
|
|||
|
||||
const auto estimated_time{start_estimated_time - end_estimated_time};
|
||||
|
||||
const auto time_limit{static_cast<u32>(std::max(dsp_time_limit + estimated_time, 0.0f))};
|
||||
const auto time_limit{static_cast<u32>((std::max)(dsp_time_limit + estimated_time, 0.0f))};
|
||||
num_voices_dropped =
|
||||
DropVoices(command_buffer, static_cast<u32>(start_estimated_time), time_limit);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue