Merge branch 'main' into loadaudio

This commit is contained in:
goeiecool9999 2024-04-03 18:32:25 +02:00
commit 09f32d0936
24 changed files with 1887 additions and 1410 deletions

View file

@ -0,0 +1,15 @@
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt
index 8cde1ffe0..d4d09f223 100644
--- a/tools/CMakeLists.txt
+++ b/tools/CMakeLists.txt
@@ -91,7 +91,9 @@ endif()
add_executable(dbus-launch ${dbus_launch_SOURCES})
target_link_libraries(dbus-launch ${DBUS_LIBRARIES})
if(DBUS_BUILD_X11)
- target_link_libraries(dbus-launch ${X11_LIBRARIES} )
+ find_package(Threads REQUIRED)
+ target_link_libraries(dbus-launch ${X11_LIBRARIES} ${X11_xcb_LIB} ${X11_Xau_LIB} ${X11_Xdmcp_LIB} Threads::Threads)
+ target_include_directories(dbus-launch PRIVATE ${X11_INCLUDE_DIR})
endif()
install(TARGETS dbus-launch ${INSTALL_TARGETS_DEFAULT_ARGS})

View file

@ -0,0 +1,26 @@
diff --git a/cmake/ConfigureChecks.cmake b/cmake/ConfigureChecks.cmake
index b7f3702..e2336ba 100644
--- a/cmake/ConfigureChecks.cmake
+++ b/cmake/ConfigureChecks.cmake
@@ -51,6 +51,7 @@ check_symbol_exists(closefrom "unistd.h" HAVE_CLOSEFROM) #
check_symbol_exists(environ "unistd.h" HAVE_DECL_ENVIRON)
check_symbol_exists(fstatfs "sys/vfs.h" HAVE_FSTATFS)
check_symbol_exists(getgrouplist "grp.h" HAVE_GETGROUPLIST) # dbus-sysdeps.c
+check_symbol_exists(getpeereid "sys/types.h;unistd.h" HAVE_GETPEEREID) # dbus-sysdeps.c,
check_symbol_exists(getpeerucred "ucred.h" HAVE_GETPEERUCRED) # dbus-sysdeps.c, dbus-sysdeps-win.c
check_symbol_exists(getpwnam_r "errno.h;pwd.h" HAVE_GETPWNAM_R) # dbus-sysdeps-util-unix.c
check_symbol_exists(getrandom "sys/random.h" HAVE_GETRANDOM)
diff --git a/cmake/config.h.cmake b/cmake/config.h.cmake
index 77fc19c..2f25643 100644
--- a/cmake/config.h.cmake
+++ b/cmake/config.h.cmake
@@ -140,6 +140,9 @@
/* Define to 1 if you have getgrouplist */
#cmakedefine HAVE_GETGROUPLIST 1
+/* Define to 1 if you have getpeereid */
+#cmakedefine HAVE_GETPEEREID 1
+
/* Define to 1 if you have getpeerucred */
#cmakedefine HAVE_GETPEERUCRED 1

View file

@ -0,0 +1,15 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d3ec71b..932066a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,6 +141,10 @@ if(DBUS_LINUX)
if(ENABLE_SYSTEMD AND SYSTEMD_FOUND)
set(DBUS_BUS_ENABLE_SYSTEMD ON)
set(HAVE_SYSTEMD ${SYSTEMD_FOUND})
+ pkg_check_modules(SYSTEMD libsystemd IMPORTED_TARGET)
+ set(SYSTEMD_LIBRARIES PkgConfig::SYSTEMD CACHE INTERNAL "")
+ else()
+ set(SYSTEMD_LIBRARIES "" CACHE INTERNAL "")
endif()
option(ENABLE_USER_SESSION "enable user-session semantics for session bus under systemd" OFF)
set(DBUS_ENABLE_USER_SESSION ${ENABLE_USER_SESSION})

View file

@ -0,0 +1,21 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index caef738..b878f42 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -724,11 +724,11 @@ add_custom_target(help-options
#
if(DBUS_ENABLE_PKGCONFIG)
set(PLATFORM_LIBS pthread ${LIBRT})
- if(PKG_CONFIG_FOUND)
- # convert lists of link libraries into -lstdc++ -lm etc..
- foreach(LIB ${CMAKE_C_IMPLICIT_LINK_LIBRARIES} ${PLATFORM_LIBS})
- set(LIBDBUS_LIBS "${LIBDBUS_LIBS} -l${LIB}")
- endforeach()
+ if(1)
+ set(LIBDBUS_LIBS "${CMAKE_THREAD_LIBS_INIT}")
+ if(LIBRT)
+ string(APPEND LIBDBUS_LIBS " -lrt")
+ endif()
set(original_prefix "${CMAKE_INSTALL_PREFIX}")
if(DBUS_RELOCATABLE)
set(pkgconfig_prefix "\${pcfiledir}/../..")

View file

@ -0,0 +1,88 @@
vcpkg_check_linkage(ONLY_DYNAMIC_LIBRARY)
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.freedesktop.org/
OUT_SOURCE_PATH SOURCE_PATH
REPO dbus/dbus
REF "dbus-${VERSION}"
SHA512 8e476b408514e6540c36beb84e8025827c22cda8958b6eb74d22b99c64765eb3cd5a6502aea546e3e5f0534039857b37edee89c659acef40e7cab0939947d4af
HEAD_REF master
PATCHES
cmake.dep.patch
pkgconfig.patch
getpeereid.patch # missing check from configure.ac
libsystemd.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS options
FEATURES
systemd ENABLE_SYSTEMD
x11 DBUS_BUILD_X11
x11 CMAKE_REQUIRE_FIND_PACKAGE_X11
)
unset(ENV{DBUSDIR})
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
-DDBUS_BUILD_TESTS=OFF
-DDBUS_ENABLE_DOXYGEN_DOCS=OFF
-DDBUS_ENABLE_XML_DOCS=OFF
-DDBUS_INSTALL_SYSTEM_LIBS=OFF
#-DDBUS_SERVICE=ON
-DDBUS_WITH_GLIB=OFF
-DTHREADS_PREFER_PTHREAD_FLAG=ON
-DXSLTPROC_EXECUTABLE=FALSE
"-DCMAKE_INSTALL_SYSCONFDIR=${CURRENT_PACKAGES_DIR}/etc/${PORT}"
"-DWITH_SYSTEMD_SYSTEMUNITDIR=lib/systemd/system"
"-DWITH_SYSTEMD_USERUNITDIR=lib/systemd/user"
${options}
OPTIONS_RELEASE
-DDBUS_DISABLE_ASSERT=OFF
-DDBUS_ENABLE_STATS=OFF
-DDBUS_ENABLE_VERBOSE_MODE=OFF
MAYBE_UNUSED_VARIABLES
DBUS_BUILD_X11
DBUS_WITH_GLIB
ENABLE_SYSTEMD
THREADS_PREFER_PTHREAD_FLAG
WITH_SYSTEMD_SYSTEMUNITDIR
WITH_SYSTEMD_USERUNITDIR
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(PACKAGE_NAME "DBus1" CONFIG_PATH "lib/cmake/DBus1")
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
"${CURRENT_PACKAGES_DIR}/debug/var/"
"${CURRENT_PACKAGES_DIR}/etc"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/services"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/session.d"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system-services"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.d"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf"
"${CURRENT_PACKAGES_DIR}/share/dbus-1/system.conf"
"${CURRENT_PACKAGES_DIR}/share/doc"
"${CURRENT_PACKAGES_DIR}/var"
)
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "<include ignore_missing=\"yes\">${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session.conf</include>" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "<includedir>${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session.d</includedir>" "")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/dbus-1/session.conf" "<include ignore_missing=\"yes\">${CURRENT_PACKAGES_DIR}/etc/dbus/dbus-1/session-local.conf</include>" "")
set(TOOLS daemon launch monitor run-session send test-tool update-activation-environment)
if(VCPKG_TARGET_IS_WINDOWS)
file(MAKE_DIRECTORY "${CURRENT_PACKAGES_DIR}/tools/${PORT}")
file(RENAME "${CURRENT_PACKAGES_DIR}/bin/dbus-env.bat" "${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/tools/${PORT}/dbus-env.bat" "${CURRENT_PACKAGES_DIR}" "%~dp0/../..")
else()
list(APPEND TOOLS cleanup-sockets uuidgen)
endif()
list(TRANSFORM TOOLS PREPEND "dbus-" )
vcpkg_copy_tools(TOOL_NAMES ${TOOLS} AUTO_CLEAN)
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View file

@ -0,0 +1,30 @@
{
"name": "dbus",
"version": "1.15.8",
"port-version": 2,
"description": "D-Bus specification and reference implementation, including libdbus and dbus-daemon",
"homepage": "https://gitlab.freedesktop.org/dbus/dbus",
"license": "AFL-2.1 OR GPL-2.0-or-later",
"supports": "!uwp & !staticcrt",
"dependencies": [
"expat",
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
],
"features": {
"x11": {
"description": "Build with X11 autolaunch support",
"dependencies": [
"libx11"
]
}
}
}

View file

@ -0,0 +1,13 @@
diff --git a/cmake/FindCMath.cmake b/cmake/FindCMath.cmake
index ad92218..dd42aba 100644
--- a/cmake/FindCMath.cmake
+++ b/cmake/FindCMath.cmake
@@ -31,7 +31,7 @@ include(CheckSymbolExists)
include(CheckLibraryExists)
check_symbol_exists(pow "math.h" CMath_HAVE_LIBC_POW)
-find_library(CMath_LIBRARY NAMES m)
+find_library(CMath_LIBRARY NAMES m PATHS ${CMAKE_C_IMPLICIT_LINK_DIRECTORIES})
if(NOT CMath_HAVE_LIBC_POW)
set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})

View file

@ -0,0 +1,86 @@
vcpkg_from_gitlab(
GITLAB_URL https://gitlab.com
OUT_SOURCE_PATH SOURCE_PATH
REPO libtiff/libtiff
REF "v${VERSION}"
SHA512 ef2f1d424219d9e245069b7d23e78f5e817cf6ee516d46694915ab6c8909522166f84997513d20a702f4e52c3f18467813935b328fafa34bea5156dee00f66fa
HEAD_REF master
PATCHES
FindCMath.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
cxx cxx
jpeg jpeg
jpeg CMAKE_REQUIRE_FIND_PACKAGE_JPEG
libdeflate libdeflate
libdeflate CMAKE_REQUIRE_FIND_PACKAGE_Deflate
lzma lzma
lzma CMAKE_REQUIRE_FIND_PACKAGE_liblzma
tools tiff-tools
webp webp
webp CMAKE_REQUIRE_FIND_PACKAGE_WebP
zip zlib
zip CMAKE_REQUIRE_FIND_PACKAGE_ZLIB
zstd zstd
zstd CMAKE_REQUIRE_FIND_PACKAGE_ZSTD
)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS
${FEATURE_OPTIONS}
-DCMAKE_FIND_PACKAGE_PREFER_CONFIG=ON
-Dtiff-docs=OFF
-Dtiff-contrib=OFF
-Dtiff-tests=OFF
-Djbig=OFF # This is disabled by default due to GPL/Proprietary licensing.
-Djpeg12=OFF
-Dlerc=OFF
-DCMAKE_DISABLE_FIND_PACKAGE_OpenGL=ON
-DCMAKE_DISABLE_FIND_PACKAGE_GLUT=ON
-DZSTD_HAVE_DECOMPRESS_STREAM=ON
-DHAVE_JPEGTURBO_DUAL_MODE_8_12=OFF
OPTIONS_DEBUG
-DCMAKE_DEBUG_POSTFIX=d # tiff sets "d" for MSVC only.
MAYBE_UNUSED_VARIABLES
CMAKE_DISABLE_FIND_PACKAGE_GLUT
CMAKE_DISABLE_FIND_PACKAGE_OpenGL
ZSTD_HAVE_DECOMPRESS_STREAM
)
vcpkg_cmake_install()
# CMake config wasn't packaged in the past and is not yet usable now,
# cf. https://gitlab.com/libtiff/libtiff/-/merge_requests/496
# vcpkg_cmake_config_fixup(CONFIG_PATH "lib/cmake/tiff")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/lib/cmake" "${CURRENT_PACKAGES_DIR}/debug/lib/cmake")
set(_file "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/libtiff-4.pc")
if(EXISTS "${_file}")
vcpkg_replace_string("${_file}" "-ltiff" "-ltiffd")
endif()
vcpkg_fixup_pkgconfig()
file(REMOVE_RECURSE
"${CURRENT_PACKAGES_DIR}/debug/include"
"${CURRENT_PACKAGES_DIR}/debug/share"
)
configure_file("${CMAKE_CURRENT_LIST_DIR}/vcpkg-cmake-wrapper.cmake.in" "${CURRENT_PACKAGES_DIR}/share/${PORT}/vcpkg-cmake-wrapper.cmake" @ONLY)
if ("tools" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES
tiffcp
tiffdump
tiffinfo
tiffset
tiffsplit
AUTO_CLEAN
)
endif()
vcpkg_copy_pdbs()
file(COPY "${CURRENT_PORT_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE.md")

View file

@ -0,0 +1,9 @@
tiff is compatible with built-in CMake targets:
find_package(TIFF REQUIRED)
target_link_libraries(main PRIVATE TIFF::TIFF)
tiff provides pkg-config modules:
# Tag Image File Format (TIFF) library.
libtiff-4

View file

@ -0,0 +1,104 @@
cmake_policy(PUSH)
cmake_policy(SET CMP0012 NEW)
cmake_policy(SET CMP0057 NEW)
set(z_vcpkg_tiff_find_options "")
if("REQUIRED" IN_LIST ARGS)
list(APPEND z_vcpkg_tiff_find_options "REQUIRED")
endif()
if("QUIET" IN_LIST ARGS)
list(APPEND z_vcpkg_tiff_find_options "QUIET")
endif()
_find_package(${ARGS})
if(TIFF_FOUND AND "@VCPKG_LIBRARY_LINKAGE@" STREQUAL "static")
include(SelectLibraryConfigurations)
set(z_vcpkg_tiff_link_libraries "")
set(z_vcpkg_tiff_libraries "")
if("@webp@")
find_package(WebP CONFIG ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:WebP::WebP>")
list(APPEND z_vcpkg_tiff_libraries ${WebP_LIBRARIES})
endif()
if("@lzma@")
find_package(LibLZMA ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:LibLZMA::LibLZMA>")
list(APPEND z_vcpkg_tiff_libraries ${LIBLZMA_LIBRARIES})
endif()
if("@jpeg@")
find_package(JPEG ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:JPEG::JPEG>")
list(APPEND z_vcpkg_tiff_libraries ${JPEG_LIBRARIES})
endif()
if("@zstd@")
find_package(zstd CONFIG ${z_vcpkg_tiff_find_options})
set(z_vcpkg_tiff_zstd_target_property "IMPORTED_LOCATION_")
if(TARGET zstd::libzstd_shared)
set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_shared>")
set(z_vcpkg_tiff_zstd_target zstd::libzstd_shared)
if(WIN32)
set(z_vcpkg_tiff_zstd_target_property "IMPORTED_IMPLIB_")
endif()
else()
set(z_vcpkg_tiff_zstd "\$<LINK_ONLY:zstd::libzstd_static>")
set(z_vcpkg_tiff_zstd_target zstd::libzstd_static)
endif()
get_target_property(z_vcpkg_tiff_zstd_configs "${z_vcpkg_tiff_zstd_target}" IMPORTED_CONFIGURATIONS)
foreach(z_vcpkg_config IN LISTS z_vcpkg_tiff_zstd_configs)
get_target_property(ZSTD_LIBRARY_${z_vcpkg_config} "${z_vcpkg_tiff_zstd_target}" "${z_vcpkg_tiff_zstd_target_property}${z_vcpkg_config}")
endforeach()
select_library_configurations(ZSTD)
if(NOT TARGET ZSTD::ZSTD)
add_library(ZSTD::ZSTD INTERFACE IMPORTED)
set_property(TARGET ZSTD::ZSTD APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_tiff_zstd})
endif()
list(APPEND z_vcpkg_tiff_link_libraries ${z_vcpkg_tiff_zstd})
list(APPEND z_vcpkg_tiff_libraries ${ZSTD_LIBRARIES})
unset(z_vcpkg_tiff_zstd)
unset(z_vcpkg_tiff_zstd_configs)
unset(z_vcpkg_config)
unset(z_vcpkg_tiff_zstd_target)
endif()
if("@libdeflate@")
find_package(libdeflate ${z_vcpkg_tiff_find_options})
set(z_vcpkg_property "IMPORTED_LOCATION_")
if(TARGET libdeflate::libdeflate_shared)
set(z_vcpkg_libdeflate_target libdeflate::libdeflate_shared)
if(WIN32)
set(z_vcpkg_property "IMPORTED_IMPLIB_")
endif()
else()
set(z_vcpkg_libdeflate_target libdeflate::libdeflate_static)
endif()
get_target_property(z_vcpkg_libdeflate_configs "${z_vcpkg_libdeflate_target}" IMPORTED_CONFIGURATIONS)
foreach(z_vcpkg_config IN LISTS z_vcpkg_libdeflate_configs)
get_target_property(Z_VCPKG_DEFLATE_LIBRARY_${z_vcpkg_config} "${z_vcpkg_libdeflate_target}" "${z_vcpkg_property}${z_vcpkg_config}")
endforeach()
select_library_configurations(Z_VCPKG_DEFLATE)
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:${z_vcpkg_libdeflate_target}>")
list(APPEND z_vcpkg_tiff_libraries ${Z_VCPKG_DEFLATE_LIBRARIES})
unset(z_vcpkg_config)
unset(z_vcpkg_libdeflate_configs)
unset(z_vcpkg_libdeflate_target)
unset(z_vcpkg_property)
unset(Z_VCPKG_DEFLATE_FOUND)
endif()
if("@zlib@")
find_package(ZLIB ${z_vcpkg_tiff_find_options})
list(APPEND z_vcpkg_tiff_link_libraries "\$<LINK_ONLY:ZLIB::ZLIB>")
list(APPEND z_vcpkg_tiff_libraries ${ZLIB_LIBRARIES})
endif()
if(UNIX)
list(APPEND z_vcpkg_tiff_link_libraries m)
list(APPEND z_vcpkg_tiff_libraries m)
endif()
if(TARGET TIFF::TIFF)
set_property(TARGET TIFF::TIFF APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${z_vcpkg_tiff_link_libraries})
endif()
list(APPEND TIFF_LIBRARIES ${z_vcpkg_tiff_libraries})
unset(z_vcpkg_tiff_link_libraries)
unset(z_vcpkg_tiff_libraries)
endif()
unset(z_vcpkg_tiff_find_options)
cmake_policy(POP)

View file

@ -0,0 +1,67 @@
{
"name": "tiff",
"version": "4.6.0",
"port-version": 2,
"description": "A library that supports the manipulation of TIFF image files",
"homepage": "https://libtiff.gitlab.io/libtiff/",
"license": "libtiff",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"default-features": [
"jpeg",
"zip"
],
"features": {
"cxx": {
"description": "Build C++ libtiffxx library"
},
"jpeg": {
"description": "Support JPEG compression in TIFF image files",
"dependencies": [
"libjpeg-turbo"
]
},
"libdeflate": {
"description": "Use libdeflate for faster ZIP support",
"dependencies": [
"libdeflate",
{
"name": "tiff",
"default-features": false,
"features": [
"zip"
]
}
]
},
"tools": {
"description": "Build tools"
},
"webp": {
"description": "Support WEBP compression in TIFF image files",
"dependencies": [
"libwebp"
]
},
"zip": {
"description": "Support ZIP/deflate compression in TIFF image files",
"dependencies": [
"zlib"
]
},
"zstd": {
"description": "Support ZSTD compression in TIFF image files",
"dependencies": [
"zstd"
]
}
}
}

View file

@ -475,18 +475,45 @@ LatteCMDPtr LatteCP_itWaitRegMem(LatteCMDPtr cmd, uint32 nWords)
{ {
uint32 fenceMemValue = _swapEndianU32(*fencePtr); uint32 fenceMemValue = _swapEndianU32(*fencePtr);
fenceMemValue &= fenceMask; fenceMemValue &= fenceMask;
if (compareOp == GPU7_WAIT_MEM_OP_GEQUAL) if (compareOp == GPU7_WAIT_MEM_OP_LESS)
{ {
// greater or equal if (fenceMemValue < fenceValue)
if (fenceMemValue >= fenceValue) break;
}
else if (compareOp == GPU7_WAIT_MEM_OP_LEQUAL)
{
if (fenceMemValue <= fenceValue)
break; break;
} }
else if (compareOp == GPU7_WAIT_MEM_OP_EQUAL) else if (compareOp == GPU7_WAIT_MEM_OP_EQUAL)
{ {
// equal
if (fenceMemValue == fenceValue) if (fenceMemValue == fenceValue)
break; break;
} }
else if (compareOp == GPU7_WAIT_MEM_OP_NOTEQUAL)
{
if (fenceMemValue != fenceValue)
break;
}
else if (compareOp == GPU7_WAIT_MEM_OP_GEQUAL)
{
if (fenceMemValue >= fenceValue)
break;
}
else if (compareOp == GPU7_WAIT_MEM_OP_GREATER)
{
if (fenceMemValue > fenceValue)
break;
}
else if (compareOp == GPU7_WAIT_MEM_OP_ALWAYS)
{
break;
}
else if (compareOp == GPU7_WAIT_MEM_OP_NEVER)
{
cemuLog_logOnce(LogType::Force, "Latte: WAIT_MEM_OP_NEVER encountered");
break;
}
else else
assert_dbg(); assert_dbg();
if (!stalls) if (!stalls)

View file

@ -340,7 +340,7 @@ uint8 LatteMRT::GetActiveColorBufferMask(const LatteDecompilerShader* pixelShade
return 0; return 0;
cemu_assert_debug(colorControlReg.get_DEGAMMA_ENABLE() == false); // not supported cemu_assert_debug(colorControlReg.get_DEGAMMA_ENABLE() == false); // not supported
// combine color buffer mask with pixel output mask from pixel shader // combine color buffer mask with pixel output mask from pixel shader
colorBufferMask &= pixelShader->pixelColorOutputMask; colorBufferMask &= (pixelShader ? pixelShader->pixelColorOutputMask : 0);
// combine color buffer mask with color channel mask from mmCB_TARGET_MASK (disable render buffer if all colors are blocked) // combine color buffer mask with color channel mask from mmCB_TARGET_MASK (disable render buffer if all colors are blocked)
uint32 channelTargetMask = lcr.CB_TARGET_MASK.get_MASK(); uint32 channelTargetMask = lcr.CB_TARGET_MASK.get_MASK();
for (uint32 i = 0; i < 8; i++) for (uint32 i = 0; i < 8; i++)

View file

@ -12,7 +12,7 @@
#define GPU7_CF_INST_VTX (0x02) // used only in GS copy program? #define GPU7_CF_INST_VTX (0x02) // used only in GS copy program?
#define GPU7_CF_INST_LOOP_END (0x05) #define GPU7_CF_INST_LOOP_END (0x05)
#define GPU7_CF_INST_LOOP_START_DX10 (0x06) #define GPU7_CF_INST_LOOP_START_DX10 (0x06)
#define GPU7_CF_INST_LOOP_START_NO_AL (0x07) // (Seen in Project Zero) #define GPU7_CF_INST_LOOP_START_NO_AL (0x07) // (Seen in Project Zero, Injustice: Gods Among Us)
#define GPU7_CF_INST_LOOP_BREAK (0x09) #define GPU7_CF_INST_LOOP_BREAK (0x09)
#define GPU7_CF_INST_JUMP (0x0A) #define GPU7_CF_INST_JUMP (0x0A)

View file

@ -101,7 +101,8 @@ bool LatteDecompiler_ParseCFInstruction(LatteDecompilerShaderContext* shaderCont
// ignored (we use ALU/IF/ELSE/PUSH/POP clauses to determine code flow) // ignored (we use ALU/IF/ELSE/PUSH/POP clauses to determine code flow)
return true; return true;
} }
else if (cf_inst23_7 == GPU7_CF_INST_LOOP_START_DX10 || cf_inst23_7 == GPU7_CF_INST_LOOP_END) else if (cf_inst23_7 == GPU7_CF_INST_LOOP_START_DX10 || cf_inst23_7 == GPU7_CF_INST_LOOP_END ||
cf_inst23_7 == GPU7_CF_INST_LOOP_START_NO_AL)
{ {
LatteDecompilerCFInstruction& cfInstruction = instructionList.emplace_back(); LatteDecompilerCFInstruction& cfInstruction = instructionList.emplace_back();
// set type and address // set type and address
@ -966,7 +967,8 @@ void LatteDecompiler_ParseClauses(LatteDecompilerShaderContext* decompilerContex
{ {
// no sub-instructions // no sub-instructions
} }
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END) else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END ||
cfInstruction.type == GPU7_CF_INST_LOOP_START_NO_AL)
{ {
// no sub-instructions // no sub-instructions
} }

View file

@ -441,7 +441,8 @@ void LatteDecompiler_analyzeSubroutine(LatteDecompilerShaderContext* shaderConte
{ {
shaderContext->analyzer.modifiesPixelActiveState = true; shaderContext->analyzer.modifiesPixelActiveState = true;
} }
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END) else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END ||
cfInstruction.type == GPU7_CF_INST_LOOP_START_NO_AL)
{ {
shaderContext->analyzer.modifiesPixelActiveState = true; shaderContext->analyzer.modifiesPixelActiveState = true;
} }
@ -685,7 +686,8 @@ void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteD
{ {
shaderContext->analyzer.modifiesPixelActiveState = true; shaderContext->analyzer.modifiesPixelActiveState = true;
} }
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END) else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END ||
cfInstruction.type == GPU7_CF_INST_LOOP_START_NO_AL)
{ {
shaderContext->analyzer.modifiesPixelActiveState = true; shaderContext->analyzer.modifiesPixelActiveState = true;
shaderContext->analyzer.hasLoops = true; shaderContext->analyzer.hasLoops = true;
@ -929,7 +931,8 @@ void LatteDecompiler_analyze(LatteDecompilerShaderContext* shaderContext, LatteD
if (cfCurrentStackDepth < 0) if (cfCurrentStackDepth < 0)
debugBreakpoint(); debugBreakpoint();
} }
else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END) else if (cfInstruction.type == GPU7_CF_INST_LOOP_START_DX10 || cfInstruction.type == GPU7_CF_INST_LOOP_END ||
cfInstruction.type == GPU7_CF_INST_LOOP_START_NO_AL)
{ {
// no effect on stack depth // no effect on stack depth
cfInstruction.activeStackDepth = cfCurrentStackDepth; cfInstruction.activeStackDepth = cfCurrentStackDepth;

View file

@ -3662,7 +3662,8 @@ void LatteDecompiler_emitClauseCode(LatteDecompilerShaderContext* shaderContext,
{ {
src->addFmt("{} = {} == true && {} == true;" _CRLF, _getActiveMaskCVarName(shaderContext, cfInstruction->activeStackDepth + 1 - cfInstruction->popCount), _getActiveMaskVarName(shaderContext, cfInstruction->activeStackDepth - cfInstruction->popCount), _getActiveMaskCVarName(shaderContext, cfInstruction->activeStackDepth - cfInstruction->popCount)); src->addFmt("{} = {} == true && {} == true;" _CRLF, _getActiveMaskCVarName(shaderContext, cfInstruction->activeStackDepth + 1 - cfInstruction->popCount), _getActiveMaskVarName(shaderContext, cfInstruction->activeStackDepth - cfInstruction->popCount), _getActiveMaskCVarName(shaderContext, cfInstruction->activeStackDepth - cfInstruction->popCount));
} }
else if( cfInstruction->type == GPU7_CF_INST_LOOP_START_DX10 ) else if( cfInstruction->type == GPU7_CF_INST_LOOP_START_DX10 ||
cfInstruction->type == GPU7_CF_INST_LOOP_START_NO_AL)
{ {
// start of loop // start of loop
// if pixel is disabled, then skip loop // if pixel is disabled, then skip loop

View file

@ -1285,9 +1285,9 @@ void VulkanRenderer::draw_beginSequence()
// update shader state // update shader state
LatteSHRC_UpdateActiveShaders(); LatteSHRC_UpdateActiveShaders();
if (m_state.drawSequenceSkip) if (LatteGPUState.activeShaderHasError)
{ {
debug_printf("Skipping drawcalls due to shader error\n"); cemuLog_logDebugOnce(LogType::Force, "Skipping drawcalls due to shader error");
m_state.drawSequenceSkip = true; m_state.drawSequenceSkip = true;
cemu_assert_debug(false); cemu_assert_debug(false);
return; return;

View file

@ -140,6 +140,17 @@ static std::tuple<Args...> cafeExportBuildArgTuple(PPCInterpreter_t* hCPU, R(fn)
return std::tuple<Args...>{ cafeExportGetParamWrapper<Args>(hCPU, gprIndex, fprIndex)... }; return std::tuple<Args...>{ cafeExportGetParamWrapper<Args>(hCPU, gprIndex, fprIndex)... };
} }
template<typename T>
T cafeExportGetFormatParamWrapper(PPCInterpreter_t* hCPU, int& gprIndex, int& fprIndex)
{
T v;
cafeExportParamWrapper::getParamWrapper(hCPU, gprIndex, fprIndex, v);
// if T is char* or const char*, return "null" instead of nullptr since newer fmtlib would throw otherwise
if constexpr (std::is_same_v<T, char*> || std::is_same_v<T, const char*>)
return v ? v : (T)"null";
return v;
}
template<typename T> template<typename T>
using _CAFE_FORMAT_ARG = std::conditional_t<std::is_pointer_v<T>, using _CAFE_FORMAT_ARG = std::conditional_t<std::is_pointer_v<T>,
std::conditional_t<std::is_same_v<T, char*> || std::is_same_v<T, const char*>, T, MEMPTR<T>>, T>; std::conditional_t<std::is_same_v<T, char*> || std::is_same_v<T, const char*>, T, MEMPTR<T>>, T>;
@ -150,7 +161,7 @@ static auto cafeExportBuildFormatTuple(PPCInterpreter_t* hCPU, R(fn)(Args...))
int gprIndex = 0; int gprIndex = 0;
int fprIndex = 0; int fprIndex = 0;
return std::tuple<_CAFE_FORMAT_ARG<Args>...>{ return std::tuple<_CAFE_FORMAT_ARG<Args>...>{
cafeExportGetParamWrapper<_CAFE_FORMAT_ARG<Args>>(hCPU, gprIndex, fprIndex)... cafeExportGetFormatParamWrapper<_CAFE_FORMAT_ARG<Args>>(hCPU, gprIndex, fprIndex)...
}; };
} }

View file

@ -3,9 +3,13 @@
#include "Cafe/HW/Espresso/PPCState.h" #include "Cafe/HW/Espresso/PPCState.h"
#include "Cafe/HW/Espresso/Interpreter/PPCInterpreterInternal.h" #include "Cafe/HW/Espresso/Interpreter/PPCInterpreterInternal.h"
#include "Cafe/HW/MMU/MMU.h" #include "Cafe/HW/MMU/MMU.h"
#include "Cafe/OS/RPL/rpl.h"
namespace coreinit namespace coreinit
{ {
static_assert(sizeof(OSCoroutine) == 0x180);
static uint32 s_PPCAddrOSSwitchCoroutineAfterOSLoadCoroutine = 0;
void coreinitExport_OSInitCoroutine(PPCInterpreter_t* hCPU) void coreinitExport_OSInitCoroutine(PPCInterpreter_t* hCPU)
{ {
@ -57,14 +61,30 @@ namespace coreinit
void coreinitExport_OSSwitchCoroutine(PPCInterpreter_t* hCPU) void coreinitExport_OSSwitchCoroutine(PPCInterpreter_t* hCPU)
{ {
OSCoroutine* coroutineCurrent = (OSCoroutine*)memory_getPointerFromVirtualOffset(hCPU->gpr[3]); // OSSwitchCoroutine is a wrapper for OSSaveCoroutine + OSLoadCoroutine but it has side effects that we need to care about:
OSCoroutine* coroutineNext = (OSCoroutine*)memory_getPointerFromVirtualOffsetAllowNull(hCPU->gpr[4]); // r31 is saved and restored via the stack in OSSwitchCoroutine
// r4 is stored in the r31 field of coroutineCurrent. Injustice: Gods Among Us reads the r31 field and expects it to match coroutineCurrent (0x027183D4 @ EU v16)
OSCoroutine* coroutineCurrent = MEMPTR<OSCoroutine>(hCPU->gpr[3]);
OSCoroutine* coroutineNext = MEMPTR<OSCoroutine>(hCPU->gpr[4]);
hCPU->gpr[1] -= 0x10;
memory_writeU32(hCPU->gpr[1]+0xC, hCPU->gpr[31]);
memory_writeU32(hCPU->gpr[1]+0x14, hCPU->spr.LR);
hCPU->spr.LR = s_PPCAddrOSSwitchCoroutineAfterOSLoadCoroutine;
hCPU->gpr[31] = hCPU->gpr[4];
coreinitCoroutine_OSSaveCoroutine(coroutineCurrent, hCPU); coreinitCoroutine_OSSaveCoroutine(coroutineCurrent, hCPU);
if (coroutineNext != NULL) hCPU->gpr[3] = hCPU->gpr[31];
{ hCPU->gpr[4] = 1;
coreinitCoroutine_OSLoadCoroutine(coroutineNext, hCPU); coreinitCoroutine_OSLoadCoroutine(coroutineNext, hCPU);
hCPU->instructionPointer = hCPU->spr.LR;
} }
osLib_returnFromFunction(hCPU, 0);
void coreinitExport_OSSwitchCoroutineAfterOSLoadCoroutine(PPCInterpreter_t* hCPU)
{
// resuming after OSSaveCoroutine
hCPU->gpr[31] = memory_readU32(hCPU->gpr[1]+0xC);
hCPU->spr.LR = memory_readU32(hCPU->gpr[1]+0x14);
hCPU->gpr[1] += 0x10;
hCPU->instructionPointer = hCPU->spr.LR;
} }
void coreinitExport_OSSwitchFiberEx(PPCInterpreter_t* hCPU) void coreinitExport_OSSwitchFiberEx(PPCInterpreter_t* hCPU)
@ -96,5 +116,7 @@ namespace coreinit
osLib_addFunction("coreinit", "OSInitCoroutine", coreinitExport_OSInitCoroutine); osLib_addFunction("coreinit", "OSInitCoroutine", coreinitExport_OSInitCoroutine);
osLib_addFunction("coreinit", "OSSwitchCoroutine", coreinitExport_OSSwitchCoroutine); osLib_addFunction("coreinit", "OSSwitchCoroutine", coreinitExport_OSSwitchCoroutine);
osLib_addFunction("coreinit", "OSSwitchFiberEx", coreinitExport_OSSwitchFiberEx); osLib_addFunction("coreinit", "OSSwitchFiberEx", coreinitExport_OSSwitchFiberEx);
s_PPCAddrOSSwitchCoroutineAfterOSLoadCoroutine = RPLLoader_MakePPCCallable(coreinitExport_OSSwitchCoroutineAfterOSLoadCoroutine);
} }
} }

File diff suppressed because it is too large Load diff

View file

@ -44,6 +44,7 @@ const std::map<LogType, std::string> g_logging_window_mapping
{LogType::CoreinitThread, "Coreinit Thread"}, {LogType::CoreinitThread, "Coreinit Thread"},
{LogType::NN_NFP, "nn::nfp"}, {LogType::NN_NFP, "nn::nfp"},
{LogType::NN_FP, "nn::fp"}, {LogType::NN_FP, "nn::fp"},
{LogType::NN_BOSS, "nn::boss"},
{LogType::GX2, "GX2"}, {LogType::GX2, "GX2"},
{LogType::SoundAPI, "Audio"}, {LogType::SoundAPI, "Audio"},
{LogType::InputAPI, "Input"}, {LogType::InputAPI, "Input"},

View file

@ -35,6 +35,7 @@ enum class LogType : sint32
NN_OLV = 23, NN_OLV = 23,
NN_NFP = 13, NN_NFP = 13,
NN_FP = 24, NN_FP = 24,
NN_BOSS = 25,
TextureReadback = 29, TextureReadback = 29,

View file

@ -2232,6 +2232,7 @@ void MainWindow::RecreateMenu()
debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::CoreinitThread), _("&Coreinit Thread API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::CoreinitThread)); debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::CoreinitThread), _("&Coreinit Thread API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::CoreinitThread));
debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::NN_NFP), _("&NN NFP"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::NN_NFP)); debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::NN_NFP), _("&NN NFP"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::NN_NFP));
debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::NN_FP), _("&NN FP"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::NN_FP)); debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::NN_FP), _("&NN FP"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::NN_FP));
debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::NN_BOSS), _("&NN BOSS"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::NN_BOSS));
debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::GX2), _("&GX2 API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::GX2)); debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::GX2), _("&GX2 API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::GX2));
debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::SoundAPI), _("&Audio API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::SoundAPI)); debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::SoundAPI), _("&Audio API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::SoundAPI));
debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::InputAPI), _("&Input API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::InputAPI)); debugLoggingMenu->AppendCheckItem(MAINFRAME_MENU_ID_DEBUG_LOGGING0 + stdx::to_underlying(LogType::InputAPI), _("&Input API"), wxEmptyString)->Check(cemuLog_isLoggingEnabled(LogType::InputAPI));