[icc] fix intel c++ compiler errors

This commit is contained in:
lizzie 2025-07-28 19:39:31 +01:00
parent 18942b7ee0
commit 0e58324f71
Signed by untrusted user: Lizzie
GPG key ID: D9E134A23AD395CE
9 changed files with 109 additions and 114 deletions

31
docs/build/Linux.md vendored
View file

@ -33,13 +33,12 @@ Dependencies are listed here as commands that can be copied/pasted. Of course, t
- Proper wayland support requires `qt6-wayland` - Proper wayland support requires `qt6-wayland`
- GCC 11 or later is required. - GCC 11 or later is required.
- Ubuntu / Linux Mint / Debian: - Ubuntu / Linux Mint / Debian:
- `sudo apt-get install autoconf cmake g++-11 gcc-11 git glslang-tools libasound2 libboost-context-dev libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qtbase6-dev qtbase6-private-dev qtwebengine6-dev qtmultimedia6-dev libmbedtls-dev catch2 libfmt-dev liblz4-dev nlohmann-json3-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev` - `sudo apt-get install autoconf cmake g++ gcc git glslang-tools libasound2 libboost-context-dev libglu1-mesa-dev libhidapi-dev libpulse-dev libtool libudev-dev libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-render-util0 libxcb-xinerama0 libxcb-xkb1 libxext-dev libxkbcommon-x11-0 mesa-common-dev nasm ninja-build qtbase6-dev libmbedtls-dev catch2 libfmt-dev liblz4-dev nlohmann-json3-dev libzstd-dev libssl-dev libavfilter-dev libavcodec-dev libswscale-dev pkg-config zlib1g-dev`
- Ubuntu 22.04, Linux Mint 20, or Debian 12 or later is required. - Ubuntu 22.04, Linux Mint 20, or Debian 12 or later is required.
- Users need to manually specify building with QT Web Engine enabled. This is done using the parameter `-DYUZU_USE_QT_WEB_ENGINE=ON` when running CMake. - Users need to manually specify building with QT Web Engine enabled. This is done using the parameter `-DYUZU_USE_QT_WEB_ENGINE=ON` when running CMake.
- Users need to manually specify building with GCC 11. This can be done by adding the parameters `-DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11` when running CMake. i.e.
- Users need to manually disable building SDL2 from externals if they intend to use the version provided by their system by adding the parameters `-DYUZU_USE_EXTERNAL_SDL2=OFF` - Users need to manually disable building SDL2 from externals if they intend to use the version provided by their system by adding the parameters `-DYUZU_USE_EXTERNAL_SDL2=OFF`
``` ```sh
git submodule update --init --recursive git submodule update --init --recursive
cmake .. -GNinja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11 cmake .. -GNinja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
``` ```
@ -57,10 +56,10 @@ cmake .. -GNinja -DCMAKE_C_COMPILER=gcc-11 -DCMAKE_CXX_COMPILER=g++-11
**Master:** **Master:**
```bash ```bash
git clone --recursive https://git.eden-emu.dev/eden-emu/eden git clone --recursive https://git.eden-emu.dev/eden-emu/eden
cd eden cd eden
``` ```
The `--recursive` option automatically clones the required Git submodules. The `--recursive` option automatically clones the required Git submodules.
@ -124,12 +123,12 @@ After building, an AppImage can be packaged via `.ci/linux/package.sh`. This scr
After building, the binaries `eden` and `eden-cmd` (depending on your build options) will end up in `build/bin/`. After building, the binaries `eden` and `eden-cmd` (depending on your build options) will end up in `build/bin/`.
```bash ```bash
# SDL # SDL
cd build/bin/ cd build/bin/
./eden-cmd ./eden-cmd
# Qt # Qt
cd build/bin/ cd build/bin/
./eden ./eden
``` ```

View file

@ -88,26 +88,26 @@ if (MSVC)
/wd4702 # unreachable code (when used with LTO) /wd4702 # unreachable code (when used with LTO)
) )
if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS) if (USE_CCACHE OR YUZU_USE_PRECOMPILED_HEADERS)
# when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format # when caching, we need to use /Z7 to downgrade debug info to use an older but more cacheable format
# Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21 # Precompiled headers are deleted if not using /Z7. See https://github.com/nanoant/CMakePCHCompiler/issues/21
add_compile_options(/Z7) add_compile_options(/Z7)
# Avoid D9025 warning # Avoid D9025 warning
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}") string(REPLACE "/Zi" "" CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}")
else() else()
add_compile_options(/Zi) add_compile_options(/Zi)
endif() endif()
if (ARCHITECTURE_x86_64) if (ARCHITECTURE_x86_64)
add_compile_options(/QIntel-jcc-erratum) add_compile_options(/QIntel-jcc-erratum)
endif() endif()
# /GS- - No stack buffer overflow checks # /GS- - No stack buffer overflow checks
add_compile_options("$<$<CONFIG:Release>:/GS->") add_compile_options("$<$<CONFIG:Release>:/GS->")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE) set(CMAKE_EXE_LINKER_FLAGS_DEBUG "/DEBUG /MANIFEST:NO" CACHE STRING "" FORCE)
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE) set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/DEBUG /MANIFEST:NO /INCREMENTAL:NO /OPT:REF,ICF" CACHE STRING "" FORCE)
else() else()
add_compile_options( add_compile_options(
-fwrapv -fwrapv
@ -124,63 +124,63 @@ else()
-Wno-missing-field-initializers -Wno-missing-field-initializers
) )
if (CMAKE_CXX_COMPILER_ID MATCHES Clang) # Clang or AppleClang if (CMAKE_CXX_COMPILER_ID MATCHES Clang OR CMAKE_CXX_COMPILER_ID MATCHES IntelLLVM) # Clang or AppleClang
add_compile_options( add_compile_options(
-Wno-braced-scalar-init -Wno-braced-scalar-init
-Wno-unused-private-field -Wno-unused-private-field
-Wno-nullability-completeness -Wno-nullability-completeness
-Werror=shadow-uncaptured-local -Werror=shadow-uncaptured-local
-Werror=implicit-fallthrough -Werror=implicit-fallthrough
-Werror=type-limits -Werror=type-limits
) )
endif()
if (ARCHITECTURE_x86_64)
add_compile_options("-mcx16")
endif()
if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
add_compile_options("-stdlib=libc++")
endif()
# GCC bugs
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# These diagnostics would be great if they worked, but are just completely broken
# and produce bogus errors on external libraries like fmt.
add_compile_options(
-Wno-array-bounds
-Wno-stringop-overread
-Wno-stringop-overflow
)
endif()
# Set file offset size to 64 bits.
#
# On modern Unixes, this is typically already the case. The lone exception is
# glibc, which may default to 32 bits. glibc allows this to be configured
# by setting _FILE_OFFSET_BITS.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
add_definitions(-D_FILE_OFFSET_BITS=64)
endif()
if (MINGW)
add_definitions(-DMINGW_HAS_SECURE_API)
add_compile_options("-msse4.1")
if (MINGW_STATIC_BUILD)
add_definitions(-DQT_STATICPLUGIN)
add_compile_options("-static")
endif() endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW) if (ARCHITECTURE_x86_64)
# GNU ar: Create thin archive files. add_compile_options("-mcx16")
# Requires binutils-2.19 or later. endif()
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>") if (APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL Clang)
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>") add_compile_options("-stdlib=libc++")
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>") endif()
endif()
# GCC bugs
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL "11" AND CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# These diagnostics would be great if they worked, but are just completely broken
# and produce bogus errors on external libraries like fmt.
add_compile_options(
-Wno-array-bounds
-Wno-stringop-overread
-Wno-stringop-overflow
)
endif()
# Set file offset size to 64 bits.
#
# On modern Unixes, this is typically already the case. The lone exception is
# glibc, which may default to 32 bits. glibc allows this to be configured
# by setting _FILE_OFFSET_BITS.
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
add_definitions(-D_FILE_OFFSET_BITS=64)
endif()
if (MINGW)
add_definitions(-DMINGW_HAS_SECURE_API)
add_compile_options("-msse4.1")
if (MINGW_STATIC_BUILD)
add_definitions(-DQT_STATICPLUGIN)
add_compile_options("-static")
endif()
endif()
if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR MINGW)
# GNU ar: Create thin archive files.
# Requires binutils-2.19 or later.
set(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_CREATE "<CMAKE_AR> qcTP <TARGET> <LINK_FLAGS> <OBJECTS>")
set(CMAKE_CXX_ARCHIVE_APPEND "<CMAKE_AR> qTP <TARGET> <LINK_FLAGS> <OBJECTS>")
endif()
endif() endif()
add_subdirectory(common) add_subdirectory(common)

View file

@ -44,7 +44,7 @@ void SinkStream::AppendBuffer(SinkBuffer& buffer, std::span<s16> samples) {
// Center = 0.596 // Center = 0.596
// LFE = 0.354 // LFE = 0.354
// Back = 0.707 // Back = 0.707
static constexpr std::array<f32, 4> down_mix_coeff{1.0, 0.596f, 0.354f, 0.707f}; static constexpr std::array<f32, 4> down_mix_coeff{1.0f, 0.596f, 0.354f, 0.707f};
for (u32 read_index = 0, write_index = 0; read_index < samples.size(); for (u32 read_index = 0, write_index = 0; read_index < samples.size();
read_index += system_channels, write_index += device_channels) { read_index += system_channels, write_index += device_channels) {

View file

@ -69,7 +69,7 @@ Result NpadVibration::GetVibrationMasterVolume(f32& out_volume) const {
Result NpadVibration::BeginPermitVibrationSession(u64 aruid) { Result NpadVibration::BeginPermitVibrationSession(u64 aruid) {
std::scoped_lock lock{mutex}; std::scoped_lock lock{mutex};
session_aruid = aruid; session_aruid = aruid;
volume = 1.0; volume = 1.0f;
return ResultSuccess; return ResultSuccess;
} }

View file

@ -110,12 +110,12 @@ public:
bool RumblePlay(const Common::Input::VibrationStatus vibration) { bool RumblePlay(const Common::Input::VibrationStatus vibration) {
constexpr u32 rumble_max_duration_ms = 2000; constexpr u32 rumble_max_duration_ms = 2000;
constexpr f32 low_start_sensitivity_limit = 140.0; constexpr f32 low_start_sensitivity_limit = 140.0f;
constexpr f32 low_width_sensitivity_limit = 400.0; constexpr f32 low_width_sensitivity_limit = 400.0f;
constexpr f32 high_start_sensitivity_limit = 200.0; constexpr f32 high_start_sensitivity_limit = 200.0f;
constexpr f32 high_width_sensitivity_limit = 700.0; constexpr f32 high_width_sensitivity_limit = 700.0f;
// Try to provide some feeling of the frequency by reducing the amplitude depending on it. // Try to provide some feeling of the frequency by reducing the amplitude depending on it.
f32 low_frequency_scale = 1.0; f32 low_frequency_scale = 1.0f;
if (vibration.low_frequency > low_start_sensitivity_limit) { if (vibration.low_frequency > low_start_sensitivity_limit) {
low_frequency_scale = low_frequency_scale =
std::max(1.0f - (vibration.low_frequency - low_start_sensitivity_limit) / std::max(1.0f - (vibration.low_frequency - low_start_sensitivity_limit) /
@ -124,7 +124,7 @@ public:
} }
f32 low_amplitude = vibration.low_amplitude * low_frequency_scale; f32 low_amplitude = vibration.low_amplitude * low_frequency_scale;
f32 high_frequency_scale = 1.0; f32 high_frequency_scale = 1.0f;
if (vibration.high_frequency > high_start_sensitivity_limit) { if (vibration.high_frequency > high_start_sensitivity_limit) {
high_frequency_scale = high_frequency_scale =
std::max(1.0f - (vibration.high_frequency - high_start_sensitivity_limit) / std::max(1.0f - (vibration.high_frequency - high_start_sensitivity_limit) /

View file

@ -249,7 +249,7 @@ void InputEngine::ResetButtonState() {
void InputEngine::ResetAnalogState() { void InputEngine::ResetAnalogState() {
for (const auto& controller : controller_list) { for (const auto& controller : controller_list) {
for (const auto& axis : controller.second.axes) { for (const auto& axis : controller.second.axes) {
SetAxis(controller.first, axis.first, 0.0); SetAxis(controller.first, axis.first, 0.0f);
} }
} }
} }

View file

@ -165,8 +165,8 @@ Id EmitFPSaturate16(EmitContext& ctx, Id value) {
} }
Id EmitFPSaturate32(EmitContext& ctx, Id value) { Id EmitFPSaturate32(EmitContext& ctx, Id value) {
const Id zero{ctx.Const(f32{0.0})}; const Id zero{ctx.Const(f32{0.0f})};
const Id one{ctx.Const(f32{1.0})}; const Id one{ctx.Const(f32{1.0f})};
return Clamp(ctx, ctx.F32[1], value, zero, one); return Clamp(ctx, ctx.F32[1], value, zero, one);
} }

View file

@ -51,7 +51,8 @@ struct InstEncoding {
MaskValue mask_value; MaskValue mask_value;
Opcode opcode; Opcode opcode;
}; };
constexpr std::array UNORDERED_ENCODINGS{ constexpr auto SortedEncodings() {
std::array<InstEncoding, 279> encodings{
#define INST(name, cute, encode) \ #define INST(name, cute, encode) \
InstEncoding{ \ InstEncoding{ \
.mask_value{MaskValueFromEncoding(encode)}, \ .mask_value{MaskValueFromEncoding(encode)}, \
@ -59,10 +60,7 @@ constexpr std::array UNORDERED_ENCODINGS{
}, },
#include "maxwell.inc" #include "maxwell.inc"
#undef INST #undef INST
}; };
constexpr auto SortedEncodings() {
std::array encodings{UNORDERED_ENCODINGS};
std::ranges::sort(encodings, [](const InstEncoding& lhs, const InstEncoding& rhs) { std::ranges::sort(encodings, [](const InstEncoding& lhs, const InstEncoding& rhs) {
return std::popcount(lhs.mask_value.mask) > std::popcount(rhs.mask_value.mask); return std::popcount(lhs.mask_value.mask) > std::popcount(rhs.mask_value.mask);
}); });

View file

@ -2,24 +2,22 @@
// SPDX-License-Identifier: GPL-2.0-or-later // SPDX-License-Identifier: GPL-2.0-or-later
#include <array> #include <array>
#include <string_view>
#include "shader_recompiler/exception.h" #include "shader_recompiler/exception.h"
#include "shader_recompiler/frontend/maxwell/opcodes.h" #include "shader_recompiler/frontend/maxwell/opcodes.h"
namespace Shader::Maxwell { namespace Shader::Maxwell {
namespace {
constexpr std::array NAME_TABLE{ const char* NameOf(Opcode opcode) {
constexpr const char* NAME_TABLE[] = {
#define INST(name, cute, encode) cute, #define INST(name, cute, encode) cute,
#include "maxwell.inc" #include "maxwell.inc"
#undef INST #undef INST
}; };
} // Anonymous namespace if (size_t(opcode) >= sizeof(NAME_TABLE) / sizeof(NAME_TABLE[0]))
throw InvalidArgument("Invalid opcode with raw value {}", int(opcode));
const char* NameOf(Opcode opcode) { return NAME_TABLE[size_t(opcode)];
if (static_cast<size_t>(opcode) >= NAME_TABLE.size()) {
throw InvalidArgument("Invalid opcode with raw value {}", static_cast<int>(opcode));
}
return NAME_TABLE[static_cast<size_t>(opcode)];
} }
} // namespace Shader::Maxwell } // namespace Shader::Maxwell