mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2026-08-23 07:56:52 +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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user