uboot: (firmwareOdroidC2/C4) don't invoke patch tool, use patches = [] instead

https://github.com/NixOS/nixpkgs/blob/master/pkgs/stdenv/generic/setup.sh#L948
this can do it nicely.

Signed-off-by: Anton Arapov <anton@deadbeef.mx>
This commit is contained in:
Anton Arapov 2021-04-03 12:58:10 +02:00 committed by Alan Daniels
commit 56de2bcd43
30691 changed files with 3076956 additions and 0 deletions

View file

@ -0,0 +1,35 @@
Source: https://github.com/marzent/dxvk/commit/65247afe2de5dd6b555b8fdd46dddcdc6325e1d6
---
src/d3d11/d3d11_device.cpp | 12 +-
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/src/d3d11/d3d11_device.cpp b/src/d3d11/d3d11_device.cpp
index 21f0d1b4a..5b1d05335 100644
--- a/src/d3d11/d3d11_device.cpp
+++ b/src/d3d11/d3d11_device.cpp
@@ -799,8 +799,12 @@ namespace dxvk {
InitReturnPtr(ppGeometryShader);
D3D11CommonShader module;
- if (!m_dxvkDevice->features().extTransformFeedback.transformFeedback)
- return DXGI_ERROR_INVALID_CALL;
+ if (!m_dxvkDevice->features().extTransformFeedback.transformFeedback) {
+ Logger::err(
+ "D3D11: CreateGeometryShaderWithStreamOutput:"
+ "\n Transform feedback not supported by device");
+ return S_OK;
+ }
// Zero-init some counterss so that we can increment
// them while walking over the stream output entries
@@ -1973,8 +1977,8 @@ namespace dxvk {
enabled.core.features.logicOp = supported.core.features.logicOp;
enabled.core.features.shaderImageGatherExtended = VK_TRUE;
enabled.core.features.variableMultisampleRate = supported.core.features.variableMultisampleRate;
- enabled.extTransformFeedback.transformFeedback = VK_TRUE;
- enabled.extTransformFeedback.geometryStreams = VK_TRUE;
+ enabled.extTransformFeedback.transformFeedback = supported.extTransformFeedback.transformFeedback;
+ enabled.extTransformFeedback.geometryStreams = supported.extTransformFeedback.geometryStreams;
}
if (featureLevel >= D3D_FEATURE_LEVEL_10_1) {

View file

@ -0,0 +1,186 @@
diff --git a/src/util/thread.h b/src/util/thread.h
index 28aeca8a..db5c9913 100644
--- a/src/util/thread.h
+++ b/src/util/thread.h
@@ -149,178 +149,8 @@ namespace dxvk {
}
}
-
- /**
- * \brief SRW-based mutex implementation
- *
- * Drop-in replacement for \c std::mutex that uses Win32
- * SRW locks, which are implemented with \c futex in wine.
- */
- class mutex {
-
- public:
-
- using native_handle_type = PSRWLOCK;
-
- mutex() { }
-
- mutex(const mutex&) = delete;
- mutex& operator = (const mutex&) = delete;
-
- void lock() {
- AcquireSRWLockExclusive(&m_lock);
- }
-
- void unlock() {
- ReleaseSRWLockExclusive(&m_lock);
- }
-
- bool try_lock() {
- return TryAcquireSRWLockExclusive(&m_lock);
- }
-
- native_handle_type native_handle() {
- return &m_lock;
- }
-
- private:
-
- SRWLOCK m_lock = SRWLOCK_INIT;
-
- };
-
-
- /**
- * \brief Recursive mutex implementation
- *
- * Drop-in replacement for \c std::recursive_mutex that
- * uses Win32 critical sections.
- */
- class recursive_mutex {
-
- public:
-
- using native_handle_type = PCRITICAL_SECTION;
-
- recursive_mutex() {
- InitializeCriticalSection(&m_lock);
- }
-
- ~recursive_mutex() {
- DeleteCriticalSection(&m_lock);
- }
-
- recursive_mutex(const recursive_mutex&) = delete;
- recursive_mutex& operator = (const recursive_mutex&) = delete;
-
- void lock() {
- EnterCriticalSection(&m_lock);
- }
-
- void unlock() {
- LeaveCriticalSection(&m_lock);
- }
-
- bool try_lock() {
- return TryEnterCriticalSection(&m_lock);
- }
-
- native_handle_type native_handle() {
- return &m_lock;
- }
-
- private:
-
- CRITICAL_SECTION m_lock;
-
- };
-
-
- /**
- * \brief SRW-based condition variable implementation
- *
- * Drop-in replacement for \c std::condition_variable that
- * uses Win32 condition variables on SRW locks.
- */
- class condition_variable {
-
- public:
-
- using native_handle_type = PCONDITION_VARIABLE;
-
- condition_variable() {
- InitializeConditionVariable(&m_cond);
- }
-
- condition_variable(condition_variable&) = delete;
-
- condition_variable& operator = (condition_variable&) = delete;
-
- void notify_one() {
- WakeConditionVariable(&m_cond);
- }
-
- void notify_all() {
- WakeAllConditionVariable(&m_cond);
- }
-
- void wait(std::unique_lock<dxvk::mutex>& lock) {
- auto srw = lock.mutex()->native_handle();
- SleepConditionVariableSRW(&m_cond, srw, INFINITE, 0);
- }
-
- template<typename Predicate>
- void wait(std::unique_lock<dxvk::mutex>& lock, Predicate pred) {
- while (!pred())
- wait(lock);
- }
-
- template<typename Clock, typename Duration>
- std::cv_status wait_until(std::unique_lock<dxvk::mutex>& lock, const std::chrono::time_point<Clock, Duration>& time) {
- auto now = Clock::now();
-
- return (now < time)
- ? wait_for(lock, now - time)
- : std::cv_status::timeout;
- }
-
- template<typename Clock, typename Duration, typename Predicate>
- bool wait_until(std::unique_lock<dxvk::mutex>& lock, const std::chrono::time_point<Clock, Duration>& time, Predicate pred) {
- if (pred())
- return true;
-
- auto now = Clock::now();
- return now < time && wait_for(lock, now - time, pred);
- }
-
- template<typename Rep, typename Period>
- std::cv_status wait_for(std::unique_lock<dxvk::mutex>& lock, const std::chrono::duration<Rep, Period>& timeout) {
- auto ms = std::chrono::duration_cast<std::chrono::milliseconds>(timeout);
- auto srw = lock.mutex()->native_handle();
-
- return SleepConditionVariableSRW(&m_cond, srw, ms.count(), 0)
- ? std::cv_status::no_timeout
- : std::cv_status::timeout;
- }
-
- template<typename Rep, typename Period, typename Predicate>
- bool wait_for(std::unique_lock<dxvk::mutex>& lock, const std::chrono::duration<Rep, Period>& timeout, Predicate pred) {
- bool result = pred();
-
- if (!result && wait_for(lock, timeout) == std::cv_status::no_timeout)
- result = pred();
-
- return result;
- }
-
- native_handle_type native_handle() {
- return &m_cond;
- }
-
- private:
-
- CONDITION_VARIABLE m_cond;
-
- };
+ using mutex = std::mutex;
+ using recursive_mutex = std::recursive_mutex;
+ using condition_variable = std::condition_variable;
}

101
pkgs/misc/dxvk/default.nix Normal file
View file

@ -0,0 +1,101 @@
{ lib
, pkgs
, hostPlatform
, stdenvNoCC
, fetchFromGitHub
, pkgsCross
}:
let
inherit (hostPlatform.uname) system;
# DXVK needs to be a separate derivation because its actually a set of DLLs for Windows that
# needs to be built with a cross-compiler.
dxvk32 = pkgsCross.mingw32.callPackage ./dxvk.nix { inherit (self) src version dxvkPatches; };
dxvk64 = pkgsCross.mingwW64.callPackage ./dxvk.nix { inherit (self) src version dxvkPatches; };
# Split out by platform to make maintenance easy in case supported versions on Darwin and other
# platforms diverge (due to the need for Darwin-specific patches that would fail to apply).
# Should that happen, set `darwin` to the last working `rev` and `hash`.
srcs = rec {
darwin = { inherit (default) rev hash version; };
default = {
rev = "v${self.version}";
hash = "sha256-+6PkrkamSvhCaGj2tq+RXri/yQ7vs0cAqgdRAFtU8UA=";
version = "1.10.1";
};
};
# Use the self pattern to support overriding `src` and `version` via `overrideAttrs`. A recursive
# attrset wouldnt work.
self = stdenvNoCC.mkDerivation {
name = "dxvk";
inherit (srcs."${system}" or srcs.default) version;
src = fetchFromGitHub {
owner = "doitsujin";
repo = "dxvk";
inherit (srcs."${system}" or srcs.default) rev hash;
};
# Override this to patch DXVK itself (rather than the setup script).
dxvkPatches = lib.optionals stdenvNoCC.isDarwin [
# Patch DXVK to work with MoltenVK even though it doesnt support some required features.
# Some games work poorly (particularly Unreal Engine 4 games), but others work pretty well.
./darwin-dxvk-compat.patch
# Use synchronization primitives from the C++ standard library to avoid deadlocks on Darwin.
# See: https://www.reddit.com/r/macgaming/comments/t8liua/comment/hzsuce9/
./darwin-thread-primitives.patch
];
outputs = [ "out" "bin" "lib" ];
# Also copy `mcfgthread-12.dll` due to DXVKs being built in a MinGW cross environment.
patches = [ ./mcfgthread.patch ];
dontConfigure = true;
dontBuild = true;
installPhase = ''
mkdir -p $out/bin $bin $lib
substitute setup_dxvk.sh $out/bin/setup_dxvk.sh \
--subst-var-by mcfgthreads32 "${pkgsCross.mingw32.windows.mcfgthreads}" \
--subst-var-by mcfgthreads64 "${pkgsCross.mingwW64.windows.mcfgthreads}" \
--replace 'basedir=$(dirname "$(readlink -f $0)")' "basedir=$bin"
chmod a+x $out/bin/setup_dxvk.sh
declare -A dxvks=( [x32]=${dxvk32} [x64]=${dxvk64} )
for arch in "''${!dxvks[@]}"; do
ln -s "''${dxvks[$arch]}/bin" $bin/$arch
ln -s "''${dxvks[$arch]}/lib" $lib/$arch
done
'';
# DXVK with MoltenVK requires a patched MoltenVK in addition to its own patches. Provide a
# convenience function to handle the necessary patching.
#
# Usage:
# let
# patchedMoltenVK = dxvk.patchMoltenVK darwin.moltenvk;
# in
# wine64Packages.full.override { moltenvk = patchedMoltenVK; vkd3dSupport = false; }
passthru.patchMoltenVK = moltenvk:
moltenvk.overrideAttrs (old: {
patches = old.patches or [ ] ++ [
# Apply MoltenVKs DXVK compatability patch. This is needed to fake support for certain
# extensions. There is no package for a patched MoltenVK to avoid any confusion by users
# whether they should use it. Except with DXVK, the answer is always no.
old.passthru.dxvkPatch
];
});
meta = {
description = "A Vulkan-based translation layer for Direct3D 9/10/11";
homepage = "https://github.com/doitsujin/dxvk";
changelog = "https://github.com/doitsujin/dxvk/releases";
maintainers = [ lib.maintainers.reckenrode ];
license = lib.licenses.zlib;
platforms = lib.platforms.unix;
};
};
in
self

40
pkgs/misc/dxvk/dxvk.nix Normal file
View file

@ -0,0 +1,40 @@
{ lib
, stdenv
, fetchFromGitHub
, glslang
, meson
, ninja
, windows
, src
, version
, dxvkPatches
}:
stdenv.mkDerivation {
pname = "dxvk";
inherit src version;
nativeBuildInputs = [ glslang meson ninja ];
buildInputs = [ windows.pthreads ];
patches = dxvkPatches;
mesonFlags =
let
arch = if stdenv.is32bit then "32" else "64";
in
[
"--buildtype" "release"
"--cross-file" "build-win${arch}.txt"
"--prefix" "${placeholder "out"}"
];
meta = {
description = "A Vulkan-based translation layer for Direct3D 9/10/11";
homepage = "https://github.com/doitsujin/dxvk";
changelog = "https://github.com/doitsujin/dxvk/releases";
maintainers = [ lib.maintainers.reckenrode ];
license = lib.licenses.zlib;
platforms = lib.platforms.windows;
};
}

View file

@ -0,0 +1,34 @@
diff --git a/setup_dxvk.sh b/setup_dxvk.sh
index 3e63ecf0..87c04f23 100755
--- a/setup_dxvk.sh
+++ b/setup_dxvk.sh
@@ -133,6 +133,8 @@
rm -v "${dstfile}"
fi
$file_cmd "${srcfile}" "${dstfile}"
+ elif [ "${4}" = "--force" ]; then
+ $file_cmd "${srcfile}" "${dstfile}"
else
echo "${dstfile}: File not found in wine prefix" >&2
return 1
@@ -170,12 +172,12 @@
}
install() {
- installFile "$win64_sys_path" "$dxvk_lib64" "$1"
+ installFile "$win64_sys_path" "$dxvk_lib64" "$1" "${2-}"
inst64_ret="$?"
inst32_ret=-1
if $wow64; then
- installFile "$win32_sys_path" "$dxvk_lib32" "$1"
+ installFile "$win32_sys_path" "$dxvk_lib32" "$1" "${2-}"
inst32_ret="$?"
fi
@@ -214,3 +216,5 @@
$action d3d10core
$action d3d11
+
+basedir="" dxvk_lib32=@mcfgthreads32@/bin dxvk_lib64=@mcfgthreads64@/bin $action mcfgthread-12 --force