From 5571743e27a99024a74b224985d0a32881679946 Mon Sep 17 00:00:00 2001 From: ZEROx Date: Wed, 13 Nov 2024 10:51:09 +0300 Subject: [PATCH] build: Set march to IvyBridge for supported platforms build: Enable specific instructions (AVX / SSE4.2) instead of using march --- build.sh | 7 +++++-- hw/xbox/nv2a/pgraph/vk/shaders.c | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/build.sh b/build.sh index fc797467894..4853c655d41 100755 --- a/build.sh +++ b/build.sh @@ -195,6 +195,9 @@ case "$platform" in # Adjust compilation options based on platform sys_cflags='-Wno-error=redundant-decls' opts="$opts --disable-werror" postbuild='package_linux' + if [ "$target_arch" == "x86_64" ]; then + sys_cflags="$sys_cflags -msse4.2 -mavx" + fi ;; Darwin) echo "Compiling for MacOS for $target_arch..." @@ -233,7 +236,7 @@ case "$platform" in # Adjust compilation options based on platform ;; CYGWIN*|MINGW*|MSYS*) echo 'Compiling for Windows...' - sys_cflags='-Wno-error' + sys_cflags='-Wno-error -msse4.2 -mavx' CFLAGS="${CFLAGS} -lIphlpapi -lCrypt32" # workaround for linking libs on mingw opts="$opts --disable-fortify-source" postbuild='package_windows' # set the above function to be called after build @@ -242,7 +245,7 @@ case "$platform" in # Adjust compilation options based on platform win64-cross) echo 'Cross-compiling for Windows...' export AR=${AR:-$CROSSAR} - sys_cflags='-Wno-error' + sys_cflags='-Wno-error -msse4.2 -mavx' opts="$opts --cross-prefix=$CROSSPREFIX --static --disable-fortify-source" postbuild='package_wincross' # set the above function to be called after build target="qemu-system-i386w.exe" diff --git a/hw/xbox/nv2a/pgraph/vk/shaders.c b/hw/xbox/nv2a/pgraph/vk/shaders.c index 7a89a1f81b1..0b886f032db 100644 --- a/hw/xbox/nv2a/pgraph/vk/shaders.c +++ b/hw/xbox/nv2a/pgraph/vk/shaders.c @@ -646,8 +646,8 @@ static void shader_update_constants(PGRAPHState *pg, ShaderBinding *binding, uint32_t v[2]; v[0] = pgraph_reg_r(pg, NV_PGRAPH_ZCLIPMIN); v[1] = pgraph_reg_r(pg, NV_PGRAPH_ZCLIPMAX); - float zclip_min = *(float *)&v[0] / zmax * 2.0 - 1.0; - float zclip_max = *(float *)&v[1] / zmax * 2.0 - 1.0; + float zclip_min = *(float *)&v[0]; // zmax * 2.0 - 1.0; + float zclip_max = *(float *)&v[1]; // zmax * 2.0 - 1.0; if (binding->clip_range_loc != -1) { uniform4f(&binding->vertex->uniforms, binding->clip_range_loc, 0,