[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:
lizzie 2025-09-09 20:47:49 +02:00 committed by crueter
parent 428f136a75
commit 9d2681ecc9
No known key found for this signature in database
GPG key ID: 425ACD2D4830EBC6
276 changed files with 973 additions and 1010 deletions

View file

@ -45,8 +45,8 @@ void BlitImageHelper::BlitColor(GLuint dst_framebuffer, GLuint src_image_view, G
static_cast<float>(src_region.start.x) / static_cast<float>(src_size.width),
static_cast<float>(src_region.start.y) /
static_cast<float>(src_size.height));
glViewport(std::min(dst_region.start.x, dst_region.end.x),
std::min(dst_region.start.y, dst_region.end.y),
glViewport((std::min)(dst_region.start.x, dst_region.end.x),
(std::min)(dst_region.start.y, dst_region.end.y),
std::abs(dst_region.end.x - dst_region.start.x),
std::abs(dst_region.end.y - dst_region.start.y));
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, dst_framebuffer);

View file

@ -248,7 +248,7 @@ void BufferCacheRuntime::BindVertexBuffers(VideoCommon::HostBindings<Buffer>& bi
std::ranges::transform(bindings.strides, buffer_strides.begin(),
[](u64 stride) { return static_cast<GLsizei>(stride); });
const u32 count =
std::min(static_cast<u32>(bindings.buffers.size()), max_attributes - bindings.min_index);
(std::min)(static_cast<u32>(bindings.buffers.size()), max_attributes - bindings.min_index);
if (has_unified_vertex_buffers) {
for (u32 index = 0; index < count; ++index) {
Buffer& buffer = *bindings.buffers[index];

View file

@ -59,7 +59,7 @@ class BufferCacheRuntime {
friend Buffer;
public:
static constexpr u8 INVALID_BINDING = std::numeric_limits<u8>::max();
static constexpr u8 INVALID_BINDING = (std::numeric_limits<u8>::max)();
explicit BufferCacheRuntime(const Device& device_, StagingBufferPool& staging_buffer_pool_);

View file

@ -1266,7 +1266,7 @@ void RasterizerOpenGL::SyncPointState() {
oglEnable(GL_PROGRAM_POINT_SIZE, maxwell3d->regs.point_size_attribute.enabled);
const bool is_rescaling{texture_cache.IsRescaling()};
const float scale = is_rescaling ? Settings::values.resolution_info.up_factor : 1.0f;
glPointSize(std::max(1.0f, maxwell3d->regs.point_size * scale));
glPointSize((std::max)(1.0f, maxwell3d->regs.point_size * scale));
}
void RasterizerOpenGL::SyncLineState() {

View file

@ -617,7 +617,7 @@ std::unique_ptr<ComputePipeline> ShaderCache::CreateComputePipeline(
}
std::unique_ptr<ShaderWorker> ShaderCache::CreateWorkers() const {
return std::make_unique<ShaderWorker>(std::max(std::thread::hardware_concurrency(), 2U) - 1,
return std::make_unique<ShaderWorker>((std::max)(std::thread::hardware_concurrency(), 2U) - 1,
"GlShaderBuilder",
[this] { return Context{emu_window}; });
}

View file

@ -68,7 +68,7 @@ size_t StagingBuffers::RequestBuffer(size_t requested_size) {
std::optional<size_t> StagingBuffers::FindBuffer(size_t requested_size) {
size_t known_unsignaled_index = current_sync_index + 1;
size_t smallest_buffer = std::numeric_limits<size_t>::max();
size_t smallest_buffer = (std::numeric_limits<size_t>::max)();
std::optional<size_t> found;
const size_t num_buffers = allocs.size();
for (size_t index = 0; index < num_buffers; ++index) {
@ -88,7 +88,7 @@ std::optional<size_t> StagingBuffers::FindBuffer(size_t requested_size) {
if (!alloc.sync.IsSignaled()) {
// Since this fence hasn't been signaled, it's safe to assume all later
// fences haven't been signaled either
known_unsignaled_index = std::min(known_unsignaled_index, alloc.sync_index);
known_unsignaled_index = (std::min)(known_unsignaled_index, alloc.sync_index);
continue;
}
alloc.sync.Release();
@ -120,7 +120,7 @@ std::pair<std::span<u8>, size_t> StreamBuffer::Request(size_t size) noexcept {
used_iterator = iterator;
for (size_t region = Region(free_iterator) + 1,
region_end = std::min(Region(iterator + size) + 1, NUM_SYNCS);
region_end = (std::min)(Region(iterator + size) + 1, NUM_SYNCS);
region < region_end; ++region) {
glClientWaitSync(fences[region].handle, 0, GL_TIMEOUT_IGNORED);
fences[region].Release();

View file

@ -79,7 +79,7 @@ enum : u8 {
Last
};
static_assert(Last <= std::numeric_limits<u8>::max());
static_assert(Last <= (std::numeric_limits<u8>::max)());
} // namespace Dirty

View file

@ -717,7 +717,7 @@ Image::Image(TextureCacheRuntime& runtime_, const VideoCommon::ImageInfo& info_,
gl_type = tuple.type;
}
const int max_host_mip_levels = std::bit_width(info.size.width);
gl_num_levels = std::min(info.resources.levels, max_host_mip_levels);
gl_num_levels = (std::min)(info.resources.levels, max_host_mip_levels);
texture = MakeImage(info, gl_internal_format, gl_num_levels);
current_texture = texture.handle;
if (runtime->device.HasDebuggingToolAttached()) {
@ -742,8 +742,8 @@ void Image::UploadMemory(GLuint buffer_handle, size_t buffer_offset,
glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
u32 current_row_length = std::numeric_limits<u32>::max();
u32 current_image_height = std::numeric_limits<u32>::max();
u32 current_row_length = (std::numeric_limits<u32>::max)();
u32 current_image_height = (std::numeric_limits<u32>::max)();
for (const VideoCommon::BufferImageCopy& copy : copies) {
if (copy.image_subresource.base_level >= gl_num_levels) {
@ -788,8 +788,8 @@ void Image::DownloadMemory(std::span<GLuint> buffer_handles, std::span<size_t> b
glBindBuffer(GL_PIXEL_PACK_BUFFER, buffer_handle);
glPixelStorei(GL_PACK_ALIGNMENT, 1);
u32 current_row_length = std::numeric_limits<u32>::max();
u32 current_image_height = std::numeric_limits<u32>::max();
u32 current_row_length = (std::numeric_limits<u32>::max)();
u32 current_image_height = (std::numeric_limits<u32>::max)();
for (const VideoCommon::BufferImageCopy& copy : copies) {
if (copy.image_subresource.base_level >= gl_num_levels) {
@ -1033,10 +1033,10 @@ void Image::Scale(bool up_scale) {
const GLuint draw_fbo = runtime->rescale_draw_fbos[fbo_index].handle;
for (s32 layer = 0; layer < info.resources.layers; ++layer) {
for (s32 level = 0; level < info.resources.levels; ++level) {
const u32 src_level_width = std::max(1u, src_width >> level);
const u32 src_level_height = std::max(1u, src_height >> level);
const u32 dst_level_width = std::max(1u, dst_width >> level);
const u32 dst_level_height = std::max(1u, dst_height >> level);
const u32 src_level_width = (std::max)(1u, src_width >> level);
const u32 src_level_height = (std::max)(1u, src_height >> level);
const u32 dst_level_width = (std::max)(1u, dst_width >> level);
const u32 dst_level_height = (std::max)(1u, dst_height >> level);
glNamedFramebufferTextureLayer(read_fbo, attachment, src_handle, level, layer);
glNamedFramebufferTextureLayer(draw_fbo, attachment, dst_handle, level, layer);