renderdoc: unfuck on i686, ppc, atomic8-less platforms, etc
This commit is contained in:
parent
87c50098f6
commit
21ee99ab0a
6 changed files with 254 additions and 3 deletions
56
srcpkgs/renderdoc/patches/add-x86-family.patch
Normal file
56
srcpkgs/renderdoc/patches/add-x86-family.patch
Normal file
|
@ -0,0 +1,56 @@
|
|||
From: Jordan Justen <jordan.l.justen@intel.com>
|
||||
Date: Wed, 29 Jul 2020 02:01:24 -0700
|
||||
Subject: Add RENDERDOC_X86_PROC_FAMILY CMake and RDOC_X86_FAMILY C switches
|
||||
|
||||
This can build useful when trying to build renderdoc on unsupported
|
||||
platforms. For example, if trying to build renderdoc on ARM, but
|
||||
without targeting ANDROID, the compressonator code will fail to
|
||||
compile. Instead of depending on the BUILD_ANDROID flag, we can use
|
||||
the RENDERDOC_X86 flag.
|
||||
|
||||
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
|
||||
---
|
||||
CMakeLists.txt | 8 ++++++++
|
||||
renderdoc/common/globalconfig.h | 10 ++++++++++
|
||||
2 files changed, 18 insertions(+)
|
||||
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index 7ee30d4..d2edf3d 100644
|
||||
--- CMakeLists.txt
|
||||
+++ CMakeLists.txt
|
||||
@@ -89,6 +89,14 @@ set(RENDERDOC_APK_PATH "" CACHE STRING "Path to RenderDoc .apk files after insta
|
||||
set(LIB_SUFFIX "" CACHE STRING "Suffix for 'lib' folder in target directory structure. E.g. set to '64' to use /usr/local/lib64 instead of /usr/local/lib.")
|
||||
set(LIB_SUBFOLDER "" CACHE STRING "Subfolder under the 'lib' folder in target directory structure. E.g. set to 'renderdoc' to use /usr/local/lib/renderdoc instead of /usr/local/lib.")
|
||||
|
||||
+if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64" OR
|
||||
+ CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
|
||||
+set(RENDERDOC_X86_PROC_FAMILY TRUE)
|
||||
+add_definitions(-DRENDERDOC_X86_PROC_FAMILY=1)
|
||||
+else()
|
||||
+set(RENDERDOC_X86_PROC_FAMILY FALSE)
|
||||
+endif()
|
||||
+
|
||||
if(NOT LIB_SUFFIX STREQUAL "")
|
||||
add_definitions(-DRENDERDOC_LIB_SUFFIX=${LIB_SUFFIX})
|
||||
endif()
|
||||
diff --git a/renderdoc/common/globalconfig.h b/renderdoc/common/globalconfig.h
|
||||
index d266166..d21da15 100644
|
||||
--- renderdoc/common/globalconfig.h
|
||||
+++ renderdoc/common/globalconfig.h
|
||||
@@ -125,6 +125,16 @@
|
||||
|
||||
#endif
|
||||
|
||||
+#if defined(RENDERDOC_X86_PROC_FAMILY)
|
||||
+
|
||||
+#define RDOC_X86_FAMILY OPTION_ON
|
||||
+
|
||||
+#else
|
||||
+
|
||||
+#define RDOC_X86_FAMILY OPTION_OFF
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
// is size_t a real separate type, not just typedef'd to uint32_t or uint64_t (or equivalent)?
|
||||
#if defined(RENDERDOC_PLATFORM_APPLE)
|
||||
#define RDOC_SIZET_SEP_TYPE OPTION_ON
|
56
srcpkgs/renderdoc/patches/atomic.patch
Normal file
56
srcpkgs/renderdoc/patches/atomic.patch
Normal file
|
@ -0,0 +1,56 @@
|
|||
@q66: replace old __sync stuff with equivalent modern ones,
|
||||
so we can use libatomic on targets without atomic8 support
|
||||
|
||||
--- renderdoc/CMakeLists.txt
|
||||
+++ renderdoc/CMakeLists.txt
|
||||
@@ -55,6 +55,8 @@ elseif(UNIX)
|
||||
PRIVATE -ldl
|
||||
PRIVATE -lrt)
|
||||
|
||||
+#libatomic list(APPEND RDOC_LIBRARIES PRIVATE -latomic)
|
||||
+
|
||||
if(ENABLE_XLIB)
|
||||
find_package(X11 REQUIRED)
|
||||
|
||||
--- renderdoc/os/posix/posix_threading.cpp
|
||||
+++ renderdoc/os/posix/posix_threading.cpp
|
||||
@@ -43,32 +43,33 @@ namespace Atomic
|
||||
{
|
||||
int32_t Inc32(int32_t *i)
|
||||
{
|
||||
- return __sync_add_and_fetch(i, int32_t(1));
|
||||
+ return __atomic_add_fetch(i, int32_t(1), __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
int32_t Dec32(int32_t *i)
|
||||
{
|
||||
- return __sync_add_and_fetch(i, int32_t(-1));
|
||||
+ return __atomic_sub_fetch(i, int32_t(1), __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
int64_t Inc64(int64_t *i)
|
||||
{
|
||||
- return __sync_add_and_fetch(i, int64_t(1));
|
||||
+ return __atomic_add_fetch(i, int64_t(1), __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
int64_t Dec64(int64_t *i)
|
||||
{
|
||||
- return __sync_add_and_fetch(i, int64_t(-1));
|
||||
+ return __atomic_sub_fetch(i, int64_t(1), __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
int64_t ExchAdd64(int64_t *i, int64_t a)
|
||||
{
|
||||
- return __sync_add_and_fetch(i, int64_t(a));
|
||||
+ return __atomic_add_fetch(i, a, __ATOMIC_SEQ_CST);
|
||||
}
|
||||
|
||||
int32_t CmpExch32(int32_t *dest, int32_t oldVal, int32_t newVal)
|
||||
{
|
||||
- return __sync_val_compare_and_swap(dest, oldVal, newVal);
|
||||
+ __atomic_compare_exchange_n(dest, &oldVal, newVal, 0, __ATOMIC_SEQ_CST, __ATOMIC_SEQ_CST);
|
||||
+ return oldVal;
|
||||
}
|
||||
};
|
||||
|
38
srcpkgs/renderdoc/patches/compressonator-only-x86.patch
Normal file
38
srcpkgs/renderdoc/patches/compressonator-only-x86.patch
Normal file
|
@ -0,0 +1,38 @@
|
|||
From: Jordan Justen <jordan.l.justen@intel.com>
|
||||
Date: Wed, 29 Jul 2020 02:26:27 -0700
|
||||
Subject: replay: Only support compressonator on x86
|
||||
|
||||
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
|
||||
---
|
||||
renderdoc/CMakeLists.txt | 2 +-
|
||||
renderdoc/replay/replay_driver.cpp | 4 ++--
|
||||
2 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/renderdoc/CMakeLists.txt b/renderdoc/CMakeLists.txt
|
||||
index e3e8c28..59c8937 100644
|
||||
--- renderdoc/CMakeLists.txt
|
||||
+++ renderdoc/CMakeLists.txt
|
||||
@@ -342,7 +342,7 @@ elseif(UNIX)
|
||||
os/posix/posix_specific.h)
|
||||
endif()
|
||||
|
||||
-if(NOT ANDROID)
|
||||
+if(RENDERDOC_X86_PROC_FAMILY)
|
||||
list(APPEND sources
|
||||
3rdparty/compressonator/BC1_Encode_kernel.cpp
|
||||
3rdparty/compressonator/BC2_Encode_kernel.cpp
|
||||
diff --git a/renderdoc/replay/replay_driver.cpp b/renderdoc/replay/replay_driver.cpp
|
||||
index a704726..7f3387f 100644
|
||||
--- renderdoc/replay/replay_driver.cpp
|
||||
+++ renderdoc/replay/replay_driver.cpp
|
||||
@@ -1430,8 +1430,8 @@ bytebuf GetDiscardPattern(DiscardType type, const ResourceFormat &fmt, uint32_t
|
||||
fmt.type == ResourceFormatType::BC5 || fmt.type == ResourceFormatType::BC6 ||
|
||||
fmt.type == ResourceFormatType::BC7)
|
||||
{
|
||||
-#if ENABLED(RDOC_ANDROID)
|
||||
- RDCERR("Format %s not supported on android", fmt.Name().c_str());
|
||||
+#if DISABLED(RDOC_X86_FAMILY)
|
||||
+ RDCERR("Format %s is only supported on x86", fmt.Name().c_str());
|
||||
#else
|
||||
const uint16_t whalf = ConvertToHalf(1000.0f);
|
||||
|
33
srcpkgs/renderdoc/patches/dostringise.patch
Normal file
33
srcpkgs/renderdoc/patches/dostringise.patch
Normal file
|
@ -0,0 +1,33 @@
|
|||
From: Jordan Justen <jordan.l.justen@intel.com>
|
||||
Date: Fri, 24 Jul 2020 15:36:34 -0700
|
||||
Subject: renderdoc/serialise: Add DoStringise(const long &el) for 32-bit x86
|
||||
on GCC
|
||||
|
||||
linux_process.cpp was generating linker errors:
|
||||
|
||||
undefined reference to `rdcstr DoStringise<long>(long const&)
|
||||
|
||||
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
|
||||
---
|
||||
renderdoc/serialise/serialiser.cpp | 8 ++++++++
|
||||
1 file changed, 8 insertions(+)
|
||||
|
||||
diff --git a/renderdoc/serialise/serialiser.cpp b/renderdoc/serialise/serialiser.cpp
|
||||
index 460a310..9e53fb1 100644
|
||||
--- renderdoc/serialise/serialiser.cpp
|
||||
+++ renderdoc/serialise/serialiser.cpp
|
||||
@@ -937,6 +937,14 @@ rdcstr DoStringise(const int16_t &el)
|
||||
return StringFormat::Fmt("%hd", el);
|
||||
}
|
||||
|
||||
+#if ENABLED(RDOC_LINUX) && ENABLED(RDOC_X86_FAMILY) && DISABLED(RDOC_X64)
|
||||
+template <>
|
||||
+rdcstr DoStringise(const long &el)
|
||||
+{
|
||||
+ return StringFormat::Fmt("%l", el);
|
||||
+}
|
||||
+#endif
|
||||
+
|
||||
template <>
|
||||
rdcstr DoStringise(const float &el)
|
||||
{
|
62
srcpkgs/renderdoc/patches/ptrace-only-x86.patch
Normal file
62
srcpkgs/renderdoc/patches/ptrace-only-x86.patch
Normal file
|
@ -0,0 +1,62 @@
|
|||
Note @q66: the ptrace code has x86-isms in it, which would need to
|
||||
be patched out anyway.
|
||||
|
||||
From: Jordan Justen <jordan.l.justen@intel.com>
|
||||
Date: Tue, 28 Jul 2020 17:12:12 -0700
|
||||
Subject: linux_process: Only use ptrace for x86 family processors
|
||||
|
||||
Although ptrace should be usable for other processor families, for now
|
||||
simply skipping the paths seems to work. I tested this by skipping the
|
||||
ptrace paths on x86.
|
||||
|
||||
Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
|
||||
---
|
||||
renderdoc/os/posix/linux/linux_process.cpp | 21 +++++++++++++++++++++
|
||||
1 file changed, 21 insertions(+)
|
||||
|
||||
diff --git a/renderdoc/os/posix/linux/linux_process.cpp b/renderdoc/os/posix/linux/linux_process.cpp
|
||||
index 7db273f..491268d 100644
|
||||
--- renderdoc/os/posix/linux/linux_process.cpp
|
||||
+++ renderdoc/os/posix/linux/linux_process.cpp
|
||||
@@ -50,6 +50,8 @@ extern char **environ;
|
||||
#define INITIAL_WAIT_TIME 1
|
||||
#define MAX_WAIT_TIME 0xfffff
|
||||
|
||||
+#define USE_PTRACE (ENABLED(RDOC_X86_FAMILY))
|
||||
+
|
||||
char **GetCurrentEnvironment()
|
||||
{
|
||||
return environ;
|
||||
@@ -150,6 +152,8 @@ int GetIdentPort(pid_t childPid)
|
||||
return ret;
|
||||
}
|
||||
|
||||
+#if USE_PTRACE
|
||||
+
|
||||
static bool ptrace_scope_ok()
|
||||
{
|
||||
if(!Linux_PtraceChildProcesses())
|
||||
@@ -577,6 +581,23 @@ void ResumeProcess(pid_t childPid, uint32_t delaySeconds)
|
||||
}
|
||||
}
|
||||
|
||||
+#else // #if USE_PTRACE
|
||||
+
|
||||
+bool StopChildAtMain(pid_t childPid)
|
||||
+{
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+void StopAtMainInChild()
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+void ResumeProcess(pid_t childPid, uint32_t delaySeconds)
|
||||
+{
|
||||
+}
|
||||
+
|
||||
+#endif
|
||||
+
|
||||
// because OSUtility::DebuggerPresent is called often we want it to be
|
||||
// cheap. Opening and parsing a file would cause high overhead on each
|
||||
// call, so instead we just cache it at startup. This fails in the case
|
|
@ -20,17 +20,23 @@ if [ "$XBPS_TARGET_LIBC" = musl ]; then
|
|||
makedepends+=" libexecinfo-devel"
|
||||
LDLIBS="-lexecinfo"
|
||||
fi
|
||||
|
||||
if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
|
||||
makedepends+=" libatomic-devel"
|
||||
fi
|
||||
|
||||
case "$XBPS_TARGET_MACHINE" in
|
||||
*-musl) broken="uses RTLD_DL_LINKMAP, RTLD_DEEPBIND, _r_debug" ;;
|
||||
ppc64*) ;;
|
||||
ppc*) broken="undefined reference to '__sync_add_and_fetch_8'" ;;
|
||||
i686) broken="undefined reference to 'rdcstr DoStringise<long>(long const&)'" ;;
|
||||
esac
|
||||
|
||||
if [ "$CROSS_BUILD" ]; then
|
||||
broken="Cross-compilation can't find python3 interpreter"
|
||||
fi
|
||||
|
||||
post_patch() {
|
||||
[ -z "$XBPS_TARGET_NO_ATOMIC8" ] && return 0
|
||||
vsed -i 's,#libatomic , ,' renderdoc/CMakeLists.txt
|
||||
}
|
||||
|
||||
post_install() {
|
||||
vlicense LICENSE.md
|
||||
|
|
Loading…
Reference in a new issue