[clang, opengl] fix opengl build on PGO build and clang-cl on windows (#3332)

- [backported] opengl: fix PGO build error
(pulled from 34332ab81326c3f2dfae2fd11ff5b18619fedb1e@pflyly/eden-nightly)

- [clang] chore: fix std::min on windows

Signed-off-by: lizzie lizzie@eden-emu.dev
Co-authored-by: DraVee <dravee@dravee.dev>
Co-authored-by: Escary <81011361+pflyly@users.noreply.github.com>
Co-authored-by: Caio Oliveira <caiooliveirafarias0@gmail.com>
Reviewed-on: https://git.eden-emu.dev/eden-emu/eden/pulls/3332
Reviewed-by: DraVee <dravee@eden-emu.dev>
Reviewed-by: MaranBr <maranbr@eden-emu.dev>
Co-authored-by: Lizzie <lizzie@eden-emu.dev>
Co-committed-by: Lizzie <lizzie@eden-emu.dev>
This commit is contained in:
Lizzie
2026-01-18 02:35:57 +01:00
committed by crueter
parent 833a38b443
commit 6ec6ca7c37
11 changed files with 23 additions and 17 deletions

View File

@@ -462,7 +462,7 @@ void WebBrowser::WebBrowserExit(WebExitReason exit_reason, std::string last_url)
web_common_return_value.exit_reason = exit_reason;
std::memcpy(&web_common_return_value.last_url, last_url.data(),
std::min(last_url.size(), web_common_return_value.last_url.size()));
(std::min)(last_url.size(), web_common_return_value.last_url.size()));
web_common_return_value.last_url_size = last_url.size();
LOG_DEBUG(Service_AM, "WebCommonReturnValue: exit_reason={}, last_url={}, last_url_size={}",

View File

@@ -111,7 +111,7 @@ Result INewsDataService::Read(Out<u64> out_size, s64 offset,
R_SUCCEED();
}
const size_t len = std::min(out_buffer.size(), opened_payload.size() - off);
const size_t len = (std::min)(out_buffer.size(), opened_payload.size() - off);
std::memcpy(out_buffer.data(), opened_payload.data() + off, len);
*out_size = len;
R_SUCCEED();

View File

@@ -142,7 +142,7 @@ Result INewsDatabaseService::GetListV1(Out<s32> out_count,
const size_t start = static_cast<size_t>(std::max(0, offset));
const size_t max_records = out_buffer.size() / record_size;
const size_t available = start < list.size() ? list.size() - start : 0;
const size_t count = std::min(max_records, available);
const size_t count = (std::min)(max_records, available);
for (size_t i = 0; i < count; ++i) {
const auto& src = list[start + i];
@@ -182,7 +182,7 @@ Result INewsDatabaseService::GetList(Out<s32> out_count,
const size_t start = static_cast<size_t>(std::max(0, offset));
const size_t max_records = out_buffer.size() / record_size;
const size_t available = start < list.size() ? list.size() - start : 0;
const size_t count = std::min(max_records, available);
const size_t count = (std::min)(max_records, available);
if (count > 0) {
std::memcpy(out_buffer.data(), list.data() + start, count * record_size);

View File

@@ -53,7 +53,7 @@ void NewsStorage::Clear() {
void NewsStorage::CopyZ(std::span<char> dst, std::string_view src) {
std::memset(dst.data(), 0, dst.size());
std::memcpy(dst.data(), src.data(), std::min(dst.size() - 1, src.size()));
std::memcpy(dst.data(), src.data(), (std::min)(dst.size() - 1, src.size()));
}
std::string NewsStorage::MakeKey(std::string_view news_id, std::string_view user_id) {

View File

@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -41,7 +44,7 @@ NvResult WrapGeneric(F&& callable, std::span<const u8> input, std::span<const u8
if constexpr (HasFixedArg) {
// Read the fixed-size input value.
var_offset = std::min(sizeof(FixedArg), input.size());
var_offset = (std::min)(sizeof(FixedArg), input.size());
if (var_offset > 0) {
std::memcpy(&fixed, input.data(), var_offset);
}
@@ -74,14 +77,14 @@ NvResult WrapGeneric(F&& callable, std::span<const u8> input, std::span<const u8
// Copy outputs.
if constexpr (HasFixedArg) {
if (output.size() > 0) {
std::memcpy(output.data(), &fixed, std::min(output.size(), sizeof(FixedArg)));
std::memcpy(output.data(), &fixed, (std::min)(output.size(), sizeof(FixedArg)));
}
}
if constexpr (HasVarArg) {
if (num_var_args > 0 && output.size() > var_offset) {
const size_t max_var_size = output.size() - var_offset;
std::memcpy(output.data() + var_offset, var_args.data(), std::min(max_var_size, num_var_args * sizeof(VarArg)));
std::memcpy(output.data() + var_offset, var_args.data(), (std::min)(max_var_size, num_var_args * sizeof(VarArg)));
}
}

View File

@@ -1,3 +1,6 @@
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
// SPDX-License-Identifier: GPL-3.0-or-later
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
// SPDX-License-Identifier: GPL-2.0-or-later
@@ -309,7 +312,7 @@ public:
}
while (1) {
if (!cleartext_read_buf.empty()) {
*out_size = std::min(cleartext_read_buf.size(), data.size());
*out_size = (std::min)(cleartext_read_buf.size(), data.size());
std::memcpy(data.data(), cleartext_read_buf.data(), *out_size);
cleartext_read_buf.erase(cleartext_read_buf.begin(),
cleartext_read_buf.begin() + *out_size);

View File

@@ -1219,7 +1219,7 @@ GLuint ImageView::StorageView(Shader::TextureType texture_type, Shader::ImageFor
const bool is_signed = image_format == Shader::ImageFormat::R8_SINT
|| image_format == Shader::ImageFormat::R16_SINT;
if (!storage_views)
storage_views.emplace();
storage_views = {OpenGL::ImageView::StorageViews{}};
auto& type_views{is_signed ? storage_views->signeds : storage_views->unsigneds};
GLuint& view{type_views[size_t(texture_type)]};
if (view == 0)

View File

@@ -184,7 +184,7 @@ private:
QuadIndexedPass quad_index_pass;
bool limit_dynamic_storage_buffers = false;
u32 max_dynamic_storage_buffers = std::numeric_limits<u32>::max();
u32 max_dynamic_storage_buffers = (std::numeric_limits<u32>::max)();
};
struct BufferCacheParams {

View File

@@ -756,7 +756,7 @@ void BlockLinearUnswizzle3DPass::Unswizzle(
{
using namespace VideoCommon::Accelerated;
const u32 MAX_BATCH_SLICES = std::min(z_count, image.info.size.depth);
const u32 MAX_BATCH_SLICES = (std::min)(z_count, image.info.size.depth);
if (!image.has_compute_unswizzle_buffer) {
// Allocate exactly what this batch needs
@@ -772,7 +772,7 @@ void BlockLinearUnswizzle3DPass::Unswizzle(
scheduler.RequestOutsideRenderPassOperationContext();
for (u32 z_offset = 0; z_offset < z_count; z_offset += MAX_BATCH_SLICES) {
const u32 current_chunk_slices = std::min(MAX_BATCH_SLICES, z_count - z_offset);
const u32 current_chunk_slices = (std::min)(MAX_BATCH_SLICES, z_count - z_offset);
const u32 current_z_start = z_start + z_offset;
UnswizzleChunk(image, swizzled, sw, params, blocks_x, blocks_y,

View File

@@ -1632,7 +1632,7 @@ void Image::AllocateComputeUnswizzleBuffer(u32 max_slices) {
// BCn is 4x4x1 blocks
const u32 blocks_x = (info.size.width + block_width - 1) / block_width;
const u32 blocks_y = (info.size.height + block_height - 1) / block_height;
const u32 blocks_z = std::min(max_slices, info.size.depth);
const u32 blocks_z = (std::min)(max_slices, info.size.depth);
const u64 block_count =
static_cast<u64>(blocks_x) *

View File

@@ -1468,7 +1468,7 @@ void TextureCache<P>::TickAsyncUnswizzle() {
if (task.current_offset < task.total_size) {
const size_t remaining = task.total_size - task.current_offset;
size_t copy_amount = std::min(swizzle_chunk_size, remaining);
size_t copy_amount = (std::min)(swizzle_chunk_size, remaining);
if (remaining > swizzle_chunk_size) {
copy_amount = (copy_amount / task.bytes_per_slice) * task.bytes_per_slice;
@@ -1487,8 +1487,8 @@ void TextureCache<P>::TickAsyncUnswizzle() {
if (complete_slices >= swizzle_slices_per_batch || (is_final_batch && complete_slices > 0)) {
const u32 z_start = static_cast<u32>(task.last_submitted_offset / task.bytes_per_slice);
const u32 slices_to_process = std::min(complete_slices, swizzle_slices_per_batch);
const u32 z_count = std::min(slices_to_process, image.info.size.depth - z_start);
const u32 slices_to_process = (std::min)(complete_slices, swizzle_slices_per_batch);
const u32 z_count = (std::min)(slices_to_process, image.info.size.depth - z_start);
if (z_count > 0) {
const auto uploads = FullUploadSwizzles(task.info);