Play Windows games on Apple Silicon Macs. Free, open-source app that installs the official Battle.net, Steam, Epic and GOG launchers and lists your games in one library.
HTML apple-siliconbattle-netcrossover-alternatived3dmetaldiablo-ii-resurrecteddxmtea-appepic-gamesgame-porting-toolkitgogmac-gamingmacosmacos-gamingrockstar-gamessteamubisoft-connectwhisky-alternativewindows-gameswinewine-wrapper
Steam: Soju's own MoltenVK patch for Detroit: Become Human (Steam support v6) (#137)
Mikek4106dec3f628
diff --git a/NOTICE b/NOTICEindex 1162543063c..95b362f10f1 100644--- a/NOTICE+++ b/NOTICE@@ -15,9 +15,7 @@ Built or downloaded by the scripts (open-source component releases include corre- DXMT pinned notpop fork: MIT, Copyright (c) 2023 Feifan He(built from the notpop fork of github.com/3Shain/dxmt)- MoltenVK v1.4.2 in the Steam support package (libMoltenVK.dylib): Apache-2.0, built by- scripts/build-moltenvk.sh with patches/moltenvk/*.patch. Those two patches come from Highball- (github.com/gauthierpiarrette/highball, GPL-3.0-or-later), ported there from DiAvisoo's MoltenVK-Detroit- (work by alexdremov and squidbus in KhronosGroup/MoltenVK#2054).+ scripts/build-moltenvk.sh with patches/moltenvk/zero-missing-vertex-attributes.patch (Soju's, Apache-2.0).- wine-mono: MIT (dotnet parts MIT/BSD-like); MoltenVK: Apache-2.0; gnutls: LGPL-2.1+;freetype: FTL/GPL-2.0 dual- Apple Game Porting Toolkit payload (libd3dshared/D3DMetal): Apple proprietary,diff --git a/README.ko.md b/README.ko.mdindex 0c5b06d4386..730603f24c1 100644--- a/README.ko.md+++ b/README.ko.md@@ -47,7 +47,7 @@ soju install| 디아블로 4 | Battle.net | ✅ 인게임 (무료 체험판) | 캐릭터 생성, 첫 지역 진입까지 확인. 소리와 프레임은 미확인. 고해상도 에셋 제외 97GB. [가이드](https://didimlabs.com/guides/ko/diablo-4-mac.html) || Hogwarts Legacy | Epic | ✅ 인게임 | 시작할 때 뜨는 "AMD 드라이버" 경고는 무시해도 됩니다. 입력 소스는 영어로 || StarCraft: Remastered | Battle.net | ✅ 인게임 | 컴퓨터 상대 대전까지 확인, 멀티플레이는 미확인, [가이드](https://didimlabs.com/guides/ko/starcraft-mac.html) |-| 디트로이트: 비컴 휴먼 (데모) | Steam | ✅ 인게임 | 맥 미니 M4 Pro, macOS 26.5. Steam 지원 v5의 MoltenVK로 Vulkan을 그립니다. 처음 실행할 때 셰이더 준비에 몇 분 걸립니다. "그래픽카드가 공식 지원되지 않는다" 경고는 OK를 누르면 됩니다 |+| 디트로이트: 비컴 휴먼 (데모) | Steam | ✅ 인게임 | 맥 미니 M4 Pro, macOS 26.5. Steam 지원 v6의 MoltenVK로 Vulkan을 그립니다. 처음 실행할 때 셰이더 준비에 몇 분 걸립니다. "그래픽카드가 공식 지원되지 않는다" 경고는 OK를 누르면 됩니다 || 오버워치 2 | Steam | ✅ 메인 메뉴, 온라인 | Platforms > Steam > **Overwatch and Diablo II mode**를 켭니다(`soju steam-gptk on`). 처음 한 번 배틀넷 계정 연결을 묻습니다. [가이드](https://didimlabs.com/guides/ko/overwatch-2-mac.html) || The Elder Scrolls V: Skyrim Special Edition | Steam | ✅ 인게임 (사용자 제보) | M5 Pro, macOS 27.2, Soju 1.14.8. 대사와 서라운드 소리 확인 ([#95](https://github.com/BCD1210/soju/issues/95)) || Guilt Free (Unity Direct3D 11 게임) | Steam | ✅ 인게임, 창 모드 | [docs/STEAM-GAMES.md](docs/STEAM-GAMES.md) |diff --git a/README.md b/README.mdindex 1ee9c2c6c43..fd97e70adb2 100644--- a/README.md+++ b/README.md@@ -49,7 +49,7 @@ Tested by us on an M4 Pro with macOS 26.5, unless a row says it is a player's re| Diablo IV | Battle.net | ✅ in-game (free trial) | character created and in the first area; sound and frame rate not checked; 97 GB without High-Resolution Assets; [guide](https://didimlabs.com/guides/diablo-4-apple-silicon.html) || Hogwarts Legacy | Epic | ✅ in-game | the "AMD driver" warning at start is harmless || StarCraft: Remastered | Battle.net | ✅ in-game | a match against the computer; multiplayer not tried; [guide](https://didimlabs.com/guides/starcraft-remastered-apple-silicon.html) |-| Detroit: Become Human (demo) | Steam | ✅ in-game | Mac mini M4 Pro, macOS 26.5. Draws with Vulkan through the MoltenVK in Steam support v5; the first start compiles shaders for a few minutes. Press OK on the "graphics card is not officially supported" warning |+| Detroit: Become Human (demo) | Steam | ✅ in-game | Mac mini M4 Pro, macOS 26.5. Draws with Vulkan through the MoltenVK in Steam support v6; the first start compiles shaders for a few minutes. Press OK on the "graphics card is not officially supported" warning || Overwatch 2 | Steam | ✅ main menu, online | turn on Platforms > Steam > **Overwatch and Diablo II mode** (`soju steam-gptk on`); the game asks once to connect a Battle.net account; [guide](https://didimlabs.com/guides/overwatch-2-apple-silicon.html) || The Elder Scrolls V: Skyrim Special Edition | Steam | ✅ in-game (player's report) | M5 Pro, macOS 27.2, Soju 1.14.8; dialogue and surround sound confirmed ([#95](https://github.com/BCD1210/soju/issues/95)) || Guilt Free (a Unity Direct3D 11 game) | Steam | ✅ in-game, windowed | see [docs/STEAM-GAMES.md](docs/STEAM-GAMES.md) |diff --git a/README.zh.md b/README.zh.mdindex 2c96309844e..59699092041 100644--- a/README.zh.md+++ b/README.zh.md@@ -47,7 +47,7 @@ soju install| Diablo IV | Battle.net | ✅ 进入游戏(免费试玩) | 已创建角色并进入第一个区域;声音和帧率未测试;不含高清素材约 97 GB;[指南](https://didimlabs.com/guides/diablo-4-apple-silicon.html) || Hogwarts Legacy | Epic | ✅ 进入游戏 | 启动时的“AMD 驱动”警告可以忽略 || StarCraft: Remastered | Battle.net | ✅ 进入游戏 | 已确认与电脑对战;多人未测试 |-| Detroit: Become Human(试玩版) | Steam | ✅ 游戏内 | Mac mini M4 Pro,macOS 26.5。通过 Steam 支持包 v5 中的 MoltenVK 用 Vulkan 绘制;首次启动需要几分钟编译着色器。出现“显卡未受官方支持”提示时按 OK |+| Detroit: Become Human(试玩版) | Steam | ✅ 游戏内 | Mac mini M4 Pro,macOS 26.5。通过 Steam 支持包 v6 中的 MoltenVK 用 Vulkan 绘制;首次启动需要几分钟编译着色器。出现“显卡未受官方支持”提示时按 OK || 守望先锋 2 | Steam | ✅ 主菜单,在线 | 打开 Platforms > Steam > **Overwatch and Diablo II mode**(`soju steam-gptk on`);首次会要求连接一次 Battle.net 账号 || The Elder Scrolls V: Skyrim Special Edition | Steam | ✅ 进入游戏(玩家反馈) | M5 Pro,macOS 27.2,Soju 1.14.8;对白和环绕声已确认([#95](https://github.com/BCD1210/soju/issues/95)) || Guilt Free(Unity Direct3D 11 游戏) | Steam | ✅ 进入游戏,窗口模式 | 见 [docs/STEAM-GAMES.md](docs/STEAM-GAMES.md) |diff --git a/docs/STEAM-PREBUILTS.md b/docs/STEAM-PREBUILTS.mdindex 4f700313c72..c448c703bbb 100644--- a/docs/STEAM-PREBUILTS.md+++ b/docs/STEAM-PREBUILTS.md@@ -1,4 +1,4 @@-# Steam support release v5+# Steam support release v6The package contains only these open-source components:@@ -19,15 +19,16 @@ The package contains only these open-source components:(LGPL-2.1-or-later).- Steam webhelper wrapper: vendored notpop source (MIT).- MoltenVK v1.4.2: `db66022459ffb663aa2b50f6b018bc2e124f5edf` (Apache-2.0), x86_64, with- `patches/moltenvk/cache-drawid-present.patch` and `patches/moltenvk/lenient-interfaces.patch` from Highball- (GPL-3.0-or-later), built by `scripts/build-moltenvk.sh`. It replaces the Steam runtime's MoltenVK 1.4.1, which- could not compile Detroit: Become Human's pipelines (`DrawIndex is not supported in MSL`). Steam starts with- `HB_MVK_LENIENT_INTERFACES=1`, `MVK_CONFIG_SHOULD_MAXIMIZE_CONCURRENT_COMPILATION=1` and- `MVK_CONFIG_SHADER_COMPRESSION_ALGORITHM=1`, Highball's settings for that game.+ `patches/moltenvk/zero-missing-vertex-attributes.patch`, built by `scripts/build-moltenvk.sh`. It replaces the+ Steam runtime's MoltenVK 1.4.1, which could not compile Detroit: Become Human's shaders+ (`DrawIndex is not supported in MSL`, fixed in 1.4.2). The patch lets a pipeline build when its vertex shader+ reads a location the vertex input state does not describe (Vulkan allows it, Metal refuses the pipeline):+ those inputs read zero. Steam starts with `MVK_CONFIG_SHOULD_MAXIMIZE_CONCURRENT_COMPILATION=1` and+ `MVK_CONFIG_SHADER_COMPRESSION_ALGORITHM=1`.- LLVM 15.0.7: `8dfdcc7b7bf66834a761bd8de445840ef68e4d1a`(Apache-2.0 with LLVM exceptions), statically linked into the renderer.-[Binary and corresponding source release](https://github.com/BCD1210/soju/releases/tag/steam-support-v5)+[Binary and corresponding source release](https://github.com/BCD1210/soju/releases/tag/steam-support-v6)([v4](https://github.com/BCD1210/soju/releases/tag/steam-support-v4) is the same without MoltenVK; [v3](https://github.com/BCD1210/soju/releases/tag/steam-support-v3) is the same without the audio components;[v2](https://github.com/BCD1210/soju/releases/tag/steam-support-v2) is the same without the pure virtualbackport; [v1](https://github.com/BCD1210/soju/releases/tag/steam-support-v1) also lacks the tessellation backport.)diff --git a/patches/moltenvk/cache-drawid-present.patch b/patches/moltenvk/cache-drawid-present.patchdeleted file mode 100644index 164bd5668f6..00000000000--- a/patches/moltenvk/cache-drawid-present.patch+++ /dev/null@@ -1,96 +0,0 @@-From Highball (github.com/gauthierpiarrette/highball, spike/patches/moltenvk-cache-drawid-present.patch, GPL-3.0-or-later),-ported there from DiAvisoo's MoltenVK-Detroit (alexdremov's and squidbus's work in KhronosGroup/MoltenVK#2054).-Applied by scripts/build-moltenvk.sh on MoltenVK v1.4.2 for Detroit: Become Human.--diff --git a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm-index 664276b..f7b99b5 100644---- a/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm-+++ b/MoltenVK/MoltenVK/Commands/MVKCmdDraw.mm-@@ -209,7 +209,10 @@- tempDrawIDBuff = cmdEncoder->getTempMTLBuffer(sizeof(uint32_t));-- // We don't currently support non-indirect multi-draw commands, so just 0.-- memset([tempDrawIDBuff->_mtlBuffer contents], 0, sizeof(uint32_t));-+ // HIGHBALL cache-drawid-present: at this allocation's offset, where the shader reads it. The memset-+ // wrote the start of the shared temporary MTLBuffer, over another allocation, and left the draw ID-+ // unset (alexdremov in MoltenVK-Detroit, highball#125; upstream fixed it after 1.4.2 in bc0d5bf7).-+ *(uint32_t*)tempDrawIDBuff->getContents() = 0;- }- for (uint32_t s : stages) {- auto stage = MVKGraphicsStage(s);-@@ -492,7 +495,10 @@- tempDrawIDBuff = cmdEncoder->getTempMTLBuffer(sizeof(uint32_t));-- // We don't currently support non-indirect multi-draw commands, so just 0.-- memset([tempDrawIDBuff->_mtlBuffer contents], 0, sizeof(uint32_t));-+ // HIGHBALL cache-drawid-present: at this allocation's offset, where the shader reads it. The memset-+ // wrote the start of the shared temporary MTLBuffer, over another allocation, and left the draw ID-+ // unset (alexdremov in MoltenVK-Detroit, highball#125; upstream fixed it after 1.4.2 in bc0d5bf7).-+ *(uint32_t*)tempDrawIDBuff->getContents() = 0;- }- for (uint32_t s : stages) {- auto stage = MVKGraphicsStage(s);-diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm-index 28eb255..804a8fb 100644---- a/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm-+++ b/MoltenVK/MoltenVK/GPUObjects/MVKImage.mm-@@ -1684,9 +1684,16 @@ static void signalAndUntrack(const MVKSwapchainSignaler& signaler) {- [mtlCmdBuff addCompletedHandler: ^(id<MTLCommandBuffer> mcb) {- signal(fence);- if (fence) { fence->release(); }-+ // HIGHBALL cache-drawid-present: tell the swapchain before letting go of this image. When the swapchain-+ // was destroyed meanwhile (a window, fullscreen or resolution change), release() can free this image,-+ // and _swapchain was then read from freed memory. The detachment lock keeps the swapchain from being-+ // detached and freed during the call (DiAvisoo in MoltenVK-Detroit, highball#125).-+ {-+ lock_guard<mutex> lock(_detachmentLock);-+ if (_swapchain) { _swapchain->notifyPresentComplete(presentInfo); }-+ }- [mtlDrwbl release];- release();-- if (_swapchain) { _swapchain->notifyPresentComplete(presentInfo); }- }];-- signal(signaler.semaphore, signaler.semaphoreSignalToken, mtlCmdBuff);-diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm-index 7eae64c..9019727 100644---- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm-+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm-@@ -2656,6 +2656,24 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura-- if ( !pDataSize ) { return VK_SUCCESS; }--+ // HIGHBALL cache-drawid-present: the size is known only after a size query, and any pipeline added-+ // since then resets it to zero. A call that passed a buffer in that state serialized into zero bytes,-+ // threw, and returned VK_INCOMPLETE with nothing written, so a game that saves its pipeline cache while-+ // other threads still compile, or without asking the size first (both valid Vulkan), saved nothing.-+ // Compute the size first for both forms of the call (alexdremov's fix in DiAvisoo's MoltenVK-Detroit,-+ // highball#125).-+ if (_dataSize == 0) {-+ mvk::countbuf cb;-+ ostream outStream(&cb);-+ writeData(outStream, true);-+ _dataSize = cb.buffSize;-+ static bool reported = false;-+ if (pData && !reported) {-+ reported = true;-+ reportMessage(MVK_CONFIG_LOG_LEVEL_INFO, "HIGHBALL cache-drawid-present: vkGetPipelineCacheData() got a buffer while the cache size was unknown; the size was computed first (reported once).");-+ }-+ }-+- if (pData) {- if (*pDataSize >= _dataSize) {- mvk::membuf mb((char*)pData, _dataSize);-@@ -2668,12 +2686,6 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura- return VK_INCOMPLETE;- }- } else {-- if (_dataSize == 0) {-- mvk::countbuf cb;-- ostream outStream(&cb);-- writeData(outStream, true);-- _dataSize = cb.buffSize;-- }- *pDataSize = _dataSize;- return VK_SUCCESS;- }diff --git a/patches/moltenvk/lenient-interfaces.patch b/patches/moltenvk/lenient-interfaces.patchdeleted file mode 100644index 7ee76599968..00000000000--- a/patches/moltenvk/lenient-interfaces.patch+++ /dev/null@@ -1,242 +0,0 @@-From Highball (github.com/gauthierpiarrette/highball, spike/patches/moltenvk-lenient-interfaces.patch, GPL-3.0-or-later),-ported there from DiAvisoo's MoltenVK-Detroit (alexdremov's and squidbus's work in KhronosGroup/MoltenVK#2054).-Applied by scripts/build-moltenvk.sh on MoltenVK v1.4.2 for Detroit: Become Human.--diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm-index ca05b5e..4bbc2e5 100644---- a/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm-+++ b/MoltenVK/MoltenVK/GPUObjects/MVKDevice.mm-@@ -3276,6 +3276,11 @@ static uint32_t mvkGetEntryProperty(io_registry_entry_t entry, CFStringRef prope- // might affect the contents of the pipeline cache (mostly MSL content).- uint32_t mtlFeatures = 0;- mtlFeatures |= _isUsingMetalArgumentBuffers << 0;-+ // HIGHBALL lenient-interfaces: HB_MVK_LENIENT_INTERFACES=1 changes what a cached vertex shader library-+ // records (MVKPipeline.mm), so cache data saved with and without it must not be mixed: a game's cache from-+ // before the switch would otherwise serve libraries without the placeholders and keep failing pipelines.-+ const char* hbLenient = getenv("HB_MVK_LENIENT_INTERFACES");-+ mtlFeatures |= (uint32_t)(hbLenient && hbLenient[0] == '1') << 31;- *(uint32_t*)&_properties.pipelineCacheUUID[uuidComponentOffset] = NSSwapHostIntToBig(mtlFeatures);- uuidComponentOffset += sizeof(mtlFeatures);- }-diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h-index e385e9b..f0a6de2 100644---- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h-+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h-@@ -358,7 +358,7 @@ protected:- bool addVertexInputToPipeline(T* inputDesc, const VkPipelineVertexInputStateCreateInfo* pVI, const mvk::SPIRVToMSLConversionConfiguration& shaderConfig);- void adjustVertexInputForMultiview(MTLVertexDescriptor* inputDesc, const VkPipelineVertexInputStateCreateInfo* pVI, uint32_t viewCount, uint32_t oldViewCount = 1);- void addTessellationToPipeline(MTLRenderPipelineDescriptor* plDesc, const mvk::SPIRVTessReflectionData& reflectData, const VkPipelineTessellationStateCreateInfo* pTS);-- void addFragmentOutputToPipeline(MTLRenderPipelineDescriptor* plDesc, const VkGraphicsPipelineCreateInfo* pCreateInfo);-+ void addFragmentOutputToPipeline(MTLRenderPipelineDescriptor* plDesc, const VkGraphicsPipelineCreateInfo* pCreateInfo, const SPIRVShaderOutputs* pFragOutputs = nullptr);- bool isRenderingPoints();- bool isRasterizationDisabled(const VkGraphicsPipelineCreateInfo* pCreateInfo);- bool isDepthClipNegativeOneToOne(const VkGraphicsPipelineCreateInfo* pCreateInfo);-diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm-index 9019727..3804f9c 100644---- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm-+++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm-@@ -43,6 +43,56 @@- using namespace mvk;- using namespace SPIRV_CROSS_NAMESPACE;--+// HIGHBALL lenient-interfaces: some games build pipelines whose stages disagree in ways Metal refuses and PC-+// drivers tolerate. Detroit: Become Human's vertex shaders read attributes the pipeline never describes-+// ("Vertex attribute in_vfMsBindPosePosition(12) is missing from the vertex descriptor"), and some of its-+// fragment shaders write float4 into an R32Uint color attachment. MoltenVK then fails the pipeline and the-+// game stops at the end of its shader preparation or crashes in a scene (highball#125). With-+// HB_MVK_LENIENT_INTERFACES=1, an attribute the shader reads but the pipeline does not describe reads four bytes-+// from the start of a vertex buffer the pipeline already uses, and a color attachment whose integer or float-+// kind differs from the fragment output takes a format of the output's kind and the same size. This is the code-+// squidbus and alexdremov wrote in KhronosGroup/MoltenVK#2054 and DiAvisoo shipped in MoltenVK-Detroit, with-+// which players finished the game. It is invalid Vulkan made to work, so it stays off unless a game's recipe-+// sets the variable; unset, nothing changes.-+static bool mvkHighballLenientInterfaces() {-+ static const bool enabled = [] {-+ const char* val = getenv("HB_MVK_LENIENT_INTERFACES");-+ bool on = val && val[0] == '1';-+ if (on) {-+ MVKBaseObject::reportMessage(nullptr, MVK_CONFIG_LOG_LEVEL_WARNING,-+ "HIGHBALL lenient-interfaces: undescribed vertex attributes and color attachments of another kind than the fragment output are allowed (HB_MVK_LENIENT_INTERFACES=1).");-+ }-+ return on;-+ }();-+ return enabled;-+}-+-+// HIGHBALL lenient-interfaces: adds each vertex input location the shader declares and the pipeline does not-+// describe, before the conversion, which then reports whether the MSL reads it, so addVertexInputToPipeline()-+// can give it a placeholder. Added before the conversion, the entries are part of the shader library's cache-+// key, so a later pipeline with the same shader and attributes still finds the converted library.-+static void mvkHighballAddUndescribedVertexInputs(SPIRVToMSLConversionConfiguration& shaderConfig,-+ MVKShaderModule* vtxModule,-+ const VkPipelineShaderStageCreateInfo* pVertexSS) {-+ if ( !mvkHighballLenientInterfaces() || !vtxModule || !pVertexSS ) { return; }-+ MVKSmallVector<SPIRVShaderInterfaceVariable, 32> vtxInputs;-+ std::string errorLog;-+ if ( !getShaderInputs(vtxModule->getSPIRV(), spv::ExecutionModelVertex, pVertexSS->pName, vtxInputs, errorLog) ) { return; }-+ for (auto& vi : vtxInputs) {-+ if (vi.builtin != spv::BuiltInMax || vi.location >= kMVKMaxBufferCount) { continue; }-+ bool isDescribed = false;-+ for (auto& si : shaderConfig.shaderInputs) {-+ if (si.shaderVar.builtin == spv::BuiltInMax && si.shaderVar.location == vi.location) { isDescribed = true; break; }-+ }-+ if ( !isDescribed ) {-+ mvk::MSLShaderInput si;-+ si.shaderVar.location = vi.location;-+ si.binding = 0;-+ shaderConfig.shaderInputs.push_back(si);-+ }-+ }-+}-+-- #pragma mark - MVKPipelineLayout--@@ -1196,7 +1246,11 @@ static bool usesConstantColor(MVKRenderStateFlags dynamic, const VkPipelineColor- if (!addFragmentShaderToPipeline(plDesc, pCreateInfo, shaderConfig, vtxOutputs, pFragmentSS, pFragmentFB)) { return nil; }-- // Output-- addFragmentOutputToPipeline(plDesc, pCreateInfo);-+ SPIRVShaderOutputs fragOutputs; // HIGHBALL lenient-interfaces-+ if (mvkHighballLenientInterfaces() && pFragmentSS && _fragmentModule) {-+ getShaderOutputs(_fragmentModule->getSPIRV(), spv::ExecutionModelFragment, pFragmentSS->pName, fragOutputs, errorLog);-+ }-+ addFragmentOutputToPipeline(plDesc, pCreateInfo, &fragOutputs);-- // Metal does not allow the name of the pipeline to be changed after it has been created,- // and we need to create the Metal pipeline immediately to provide error feedback to app.-@@ -1430,7 +1484,11 @@ static MTLVertexFormat mvkAdjustFormatVectorToSize(MTLVertexFormat format, uint3- addTessellationToPipeline(plDesc, reflectData, pCreateInfo->pTessellationState);-- // Output-- addFragmentOutputToPipeline(plDesc, pCreateInfo);-+ SPIRVShaderOutputs fragOutputs; // HIGHBALL lenient-interfaces-+ if (mvkHighballLenientInterfaces() && pFragmentSS && _fragmentModule) {-+ getShaderOutputs(_fragmentModule->getSPIRV(), spv::ExecutionModelFragment, pFragmentSS->pName, fragOutputs, errorLog);-+ }-+ addFragmentOutputToPipeline(plDesc, pCreateInfo, &fragOutputs);-- return plDesc;- }-@@ -1507,6 +1565,7 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura- shaderConfig.options.mslOptions.disable_rasterization = !_isRasterizing;- setEmulatedReversedDepthViewportConfig(shaderConfig, implicit, getPhysicalDevice()->shouldEmulateReversedDepthViewport());- addVertexInputToShaderConversionConfig(shaderConfig, pCreateInfo);-+ mvkHighballAddUndescribedVertexInputs(shaderConfig, _vertexModule, pVertexSS); // HIGHBALL lenient-interfaces-- MVKMTLFunction func = getMTLFunction(shaderConfig, pVertexSS, pVertexFB, _vertexModule, "Vertex");- id<MTLFunction> mtlFunc = func.getMTLFunction();-@@ -1545,6 +1604,7 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura- shaderConfig.options.mslOptions.disable_rasterization = true;- setEmulatedReversedDepthViewportConfig(shaderConfig, implicit, false);- addVertexInputToShaderConversionConfig(shaderConfig, pCreateInfo);-+ mvkHighballAddUndescribedVertexInputs(shaderConfig, _vertexModule, pVertexSS); // HIGHBALL lenient-interfaces- addNextStageInputToShaderConversionConfig(shaderConfig, tcInputs);-- // We need to compile this function three times, with no indexing, 16-bit indices, and 32-bit indices.-@@ -1774,10 +1834,12 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura- }-- // Vertex attributes-+ std::vector<uint32_t> boundLocations; // HIGHBALL lenient-interfaces- uint32_t vaCnt = pVI->vertexAttributeDescriptionCount;- for (uint32_t i = 0; i < vaCnt; i++) {- const VkVertexInputAttributeDescription* pVKVA = &pVI->pVertexAttributeDescriptions[i];- if (shaderConfig.isShaderInputLocationUsed(pVKVA->location)) {-+ boundLocations.push_back(pVKVA->location);- uint32_t vaBinding = pVKVA->binding;- uint32_t vaOffset = pVKVA->offset;- auto vaDesc = inputDesc.attributes[pVKVA->location];-@@ -1834,6 +1896,41 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura- }- }--+ // HIGHBALL lenient-interfaces: Metal requires every attribute the vertex shader reads to be in the vertex-+ // descriptor. Describe each one the app left out as four bytes at offset 0 of the first vertex buffer-+ // the pipeline uses, or of a constant one-byte-stride layout when it uses none.-+ if (mvkHighballLenientInterfaces()) {-+ uint32_t dummyBufferIndex = 0;-+ bool foundUsedBuffer = false;-+ for (uint32_t i = 0; i < kMVKMaxBufferCount; i++) {-+ if (_mtlVertexBuffers.get(i)) {-+ dummyBufferIndex = i;-+ foundUsedBuffer = true;-+ break;-+ }-+ }-+ bool addedDummy = false;-+ for (auto& ctxSI : shaderConfig.shaderInputs) {-+ if (ctxSI.outIsUsedByShader && ctxSI.shaderVar.builtin == spv::BuiltInMax &&-+ ctxSI.shaderVar.location < kMVKMaxBufferCount &&-+ std::find(boundLocations.begin(), boundLocations.end(), ctxSI.shaderVar.location) == boundLocations.end()) {-+ auto vaDesc = inputDesc.attributes[ctxSI.shaderVar.location];-+ if ((uint32_t)vaDesc.format == 0) {-+ vaDesc.format = (decltype(vaDesc.format))MTLVertexFormatUChar4;-+ vaDesc.bufferIndex = dummyBufferIndex;-+ vaDesc.offset = 0;-+ addedDummy = true;-+ }-+ }-+ }-+ if (addedDummy && !foundUsedBuffer) {-+ auto vbDesc = inputDesc.layouts[dummyBufferIndex];-+ vbDesc.stride = 1; // Metal requires a non-zero stride-+ vbDesc.stepFunction = (decltype(vbDesc.stepFunction))MTLStepFunctionConstant;-+ vbDesc.stepRate = 0;-+ }-+ }-+- // Run through the vertex bindings. Add a new Metal vertex layout for each translated binding,- // identical to the original layout. The translated binding will index into the same MTLBuffer,- // but at an offset that is one or more strides away from the original.-@@ -1940,7 +2037,8 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura- }-- void MVKGraphicsPipeline::addFragmentOutputToPipeline(MTLRenderPipelineDescriptor* plDesc,-- const VkGraphicsPipelineCreateInfo* pCreateInfo) {-+ const VkGraphicsPipelineCreateInfo* pCreateInfo,-+ const SPIRVShaderOutputs* pFragOutputs) {- // Topology- if (pCreateInfo->pInputAssemblyState)- plDesc.inputPrimitiveTopology = getPrimitiveTopologyClass();-@@ -1957,6 +2055,40 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura-- VkFormat attachFmt = pRendInfo->pColorAttachmentFormats[caIdx];- MTLPixelFormat mtlPixFmt = getPixelFormats()->getMTLPixelFormat(attachFmt);-+-+ // HIGHBALL lenient-interfaces: Metal refuses a pipeline whose fragment output is float and whose-+ // color attachment is an unsigned integer format, or the reverse ("output of type float4 is not-+ // compatible with a MTLPixelFormatR32Uint color attachment"). Take a format of the output's kind-+ // with the same bytes per pixel. pFragOutputs is filled only under HB_MVK_LENIENT_INTERFACES=1.-+ if (pFragOutputs && mtlPixFmt) {-+ for (const auto& so : *pFragOutputs) {-+ if (so.builtin != spv::BuiltInMax || so.location != caLoc) { continue; }-+ MVKFormatType fmtType = getPixelFormats()->getFormatType(mtlPixFmt);-+ bool isFloatFmt = (fmtType == kMVKFormatColorHalf || fmtType == kMVKFormatColorFloat);-+ bool isUIntFmt = (fmtType == kMVKFormatColorUInt8 || fmtType == kMVKFormatColorUInt16 || fmtType == kMVKFormatColorUInt32);-+ MTLPixelFormat subFmt = MTLPixelFormatInvalid;-+ if (so.baseType == SPIRV_CROSS_NAMESPACE::SPIRType::Float && isUIntFmt) {-+ switch (getPixelFormats()->getBytesPerBlock(attachFmt)) {-+ case 4: subFmt = MTLPixelFormatR32Float; break;-+ case 8: subFmt = MTLPixelFormatRG32Float; break;-+ case 16: subFmt = MTLPixelFormatRGBA32Float; break;-+ }-+ } else if (so.baseType == SPIRV_CROSS_NAMESPACE::SPIRType::UInt && isFloatFmt) {-+ switch (getPixelFormats()->getBytesPerBlock(attachFmt)) {-+ case 4: subFmt = MTLPixelFormatR32Uint; break;-+ case 8: subFmt = MTLPixelFormatRG32Uint; break;-+ case 16: subFmt = MTLPixelFormatRGBA32Uint; break;-+ }-+ }-+ if (subFmt != MTLPixelFormatInvalid) {-+ reportWarning(VK_ERROR_VALIDATION_FAILED, "HIGHBALL lenient-interfaces: fragment output %u does not match the kind of color attachment format %s; using %s.",-+ caLoc, getPixelFormats()->getName(attachFmt), getPixelFormats()->getName(subFmt));-+ mtlPixFmt = subFmt;-+ }-+ break;-+ }-+ }-+- bool supportsBlend = getPixelFormats()->getCapabilities(mtlPixFmt) & kMVKMTLFmtCapsBlend;- MTLRenderPipelineColorAttachmentDescriptor* colorDesc = plDesc.colorAttachments[caLoc];- colorDesc.pixelFormat = mtlPixFmt;diff --git a/patches/moltenvk/zero-missing-vertex-attributes.patch b/patches/moltenvk/zero-missing-vertex-attributes.patchnew file mode 100644index 00000000000..e572e3c0c70--- /dev/null+++ b/patches/moltenvk/zero-missing-vertex-attributes.patch@@ -0,0 +1,122 @@+Soju: let a pipeline build when its vertex shader reads a location the vertex input state does not describe.+Vulkan allows it (the value is undefined); Metal refuses the pipeline ("Vertex attribute ... is missing from+the vertex descriptor"). Such inputs get an attribute in a constant buffer the encoder fills with zeros.+Applies to MoltenVK v1.4.2. Apache-2.0, like MoltenVK.++diff --git a/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm b/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm+index 7d16b94..1f98fbd 100644+--- a/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm++++ b/MoltenVK/MoltenVK/Commands/MVKCommandEncoderState.mm+@@ -1446,6 +1446,13 @@ static bool shouldEmulateReversedDepthViewport(const MVKPhysicalDevice* physical+ } else {+ bindVulkanGraphicsToMetalGraphics(encoder, mvkEncoder, vk, vkShared, *this, pipeline, kMVKShaderStageVertex, MVKMetalGraphicsStage::Vertex);+ bindVertexBuffers(encoder, vk, _exists.vertex(), _bindings.vertex(), MVKVertexBufferBinder::Vertex());++ // SOJU zero-missing-vertex-attributes: the zero-filled buffer behind undescribed vertex shader inputs.++ uint32_t zeroIdx = pipeline->getZeroVertexAttributeBufferIndex();++ if (zeroIdx != kMVKUndefinedLargeUInt32) {++ static const uint32_t zeros[4] = {};++ [encoder setVertexBytes:zeros length:sizeof(zeros) atIndex:zeroIdx];++ _bindings.vertex().buffers[zeroIdx] = MVKStageResourceBindings::InvalidBuffer();++ }+ }+ bindVulkanGraphicsToMetalGraphics(encoder, mvkEncoder, vk, vkShared, *this, pipeline, kMVKShaderStageFragment, MVKMetalGraphicsStage::Fragment);+ mvkEncoder.getState().mtlShared()._useResource.bindAndResetGraphics(encoder);+diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h+index e385e9b..f86bd1c 100644+--- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h++++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.h+@@ -316,6 +316,9 @@ public:+ const MVKStaticBitSet<kMVKMaxBufferCount>& getVkVertexBuffers() const { return _vkVertexBuffers; }+ /** Returns a list of the vertex buffers used by this pipeline by Metal buffer ID */+ const MVKStaticBitSet<kMVKMaxBufferCount>& getMtlVertexBuffers() const { return _mtlVertexBuffers; }++++ /** Metal vertex buffer index of the zero-filled buffer for shader inputs the pipeline does not describe, or kMVKUndefinedLargeUInt32. */++ uint32_t getZeroVertexAttributeBufferIndex() const { return _zeroVertexAttributeBufferIndex; }+ const VkViewport* getViewports() const { return _viewports; }+ const VkRect2D* getScissors() const { return _scissors; }+ const MTLSamplePosition* getSampleLocations() const { return _sampleLocations; }+@@ -364,6 +367,7 @@ protected:+ bool isDepthClipNegativeOneToOne(const VkGraphicsPipelineCreateInfo* pCreateInfo);+ bool verifyImplicitBuffers(MVKShaderStage stage);+ uint32_t getTranslatedVertexBinding(uint32_t binding, uint32_t translationOffset, uint32_t maxBinding);++ void addZeroVertexAttributes(MTLVertexDescriptor* inputDesc, const VkPipelineVertexInputStateCreateInfo* pVI, const SPIRVShaderInputs& vtxInputs);+ uint32_t getImplicitBufferIndex(MVKShaderStage stage, uint32_t bufferIndexOffset);+ MVKMTLFunction getMTLFunction(mvk::SPIRVToMSLConversionConfiguration& shaderConfig,+ const VkPipelineShaderStageCreateInfo* pShaderStage,+@@ -386,6 +390,7 @@ protected:+ std::unordered_map<uint32_t, id<MTLRenderPipelineState>> _multiviewMTLPipelineStates;+ MVKStaticBitSet<kMVKMaxBufferCount> _vkVertexBuffers;+ MVKStaticBitSet<kMVKMaxBufferCount> _mtlVertexBuffers;++ uint32_t _zeroVertexAttributeBufferIndex = kMVKUndefinedLargeUInt32;+ MVKPipelineStageResourceInfo _stageResources[kMVKShaderStageFragment + 1] = {};++ id<MTLComputePipelineState> _mtlTessVertexStageState = nil;+diff --git a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm+index 7eae64c..30473fb 100644+--- a/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm++++ b/MoltenVK/MoltenVK/GPUObjects/MVKPipeline.mm+@@ -1192,6 +1192,16 @@ static bool usesConstantColor(MVKRenderStateFlags dynamic, const VkPipelineColor+ // This needs to happen before compiling the fragment shader, or we'll lose information on vertex attributes.+ if (!addVertexInputToPipeline(plDesc.vertexDescriptor, pCreateInfo->pVertexInputState, shaderConfig)) { return nil; }+++ // SOJU zero-missing-vertex-attributes: Vulkan lets a vertex shader read a location the pipeline's++ // vertex input state does not describe (the value is undefined), but Metal refuses to build such a++ // pipeline ("Vertex attribute ... is missing from the vertex descriptor"). Read those as zero instead.++ if (pCreateInfo->pVertexInputState) {++ SPIRVShaderInputs vtxInputs;++ if (getShaderInputs(_vertexModule->getSPIRV(), spv::ExecutionModelVertex, pVertexSS->pName, vtxInputs, errorLog)) {++ addZeroVertexAttributes(plDesc.vertexDescriptor, pCreateInfo->pVertexInputState, vtxInputs);++ }++ }+++ // Fragment shader - only add if rasterization is enabled+ if (!addFragmentShaderToPipeline(plDesc, pCreateInfo, shaderConfig, vtxOutputs, pFragmentSS, pFragmentFB)) { return nil; }++@@ -1891,6 +1901,47 @@ static void setEmulatedReversedDepthViewportConfig(SPIRVToMSLConversionConfigura+ }++ // Returns a translated binding for the existing binding and translation offset, creating it if needed.++// SOJU zero-missing-vertex-attributes: give every used, undescribed vertex shader input an attribute++// in a dedicated constant-step buffer that the encoder fills with zeros at draw time.++void MVKGraphicsPipeline::addZeroVertexAttributes(MTLVertexDescriptor* inputDesc,++ const VkPipelineVertexInputStateCreateInfo* pVI,++ const SPIRVShaderInputs& vtxInputs) {++ uint32_t zeroIdx = kMVKUndefinedLargeUInt32;++ for (auto& input : vtxInputs) {++ // Every declared input that has no Metal attribute yet. MoltenVK leaves out locations it judges unused,++ // even when the Vulkan pipeline describes them, but Metal still checks the shader's declared inputs.++ if (input.builtin != spv::BuiltInMax || input.location >= 31 || inputDesc.attributes[input.location].format != MTLVertexFormatInvalid) { continue; }++ if (zeroIdx == kMVKUndefinedLargeUInt32) {++ // The first Vulkan binding number above every binding this pipeline uses, including translated ones.++ for (uint32_t b = 0; b < kMVKMaxBufferCount; b++) {++ uint32_t idx = getMetalBufferIndexForVertexAttributeBinding(b);++ bool taken = _mtlVertexBuffers.get(idx) || inputDesc.layouts[idx].stride != 0;++ for (uint32_t j = 0; j < pVI->vertexBindingDescriptionCount; j++) {++ if (pVI->pVertexBindingDescriptions[j].binding >= b) { taken = true; }++ }++ if (!taken) { zeroIdx = idx; break; }++ }++ if (zeroIdx == kMVKUndefinedLargeUInt32) { return; }++ inputDesc.layouts[zeroIdx].stride = 16; // Metal wants a stride even for a constant step; 16 bytes covers a 4-component input.++ inputDesc.layouts[zeroIdx].stepFunction = MTLVertexStepFunctionConstant;++ inputDesc.layouts[zeroIdx].stepRate = 0;++ }++ uint32_t width = std::max(1u, std::min(input.vecWidth, 4u)) - 1;++ static const MTLVertexFormat floats[] = { MTLVertexFormatFloat, MTLVertexFormatFloat2, MTLVertexFormatFloat3, MTLVertexFormatFloat4 };++ static const MTLVertexFormat ints[] = { MTLVertexFormatInt, MTLVertexFormatInt2, MTLVertexFormatInt3, MTLVertexFormatInt4 };++ static const MTLVertexFormat uints[] = { MTLVertexFormatUInt, MTLVertexFormatUInt2, MTLVertexFormatUInt3, MTLVertexFormatUInt4 };++ MTLVertexFormat format = floats[width];++ if (input.baseType == SPIRV_CROSS_NAMESPACE::SPIRType::Int) { format = ints[width]; }++ if (input.baseType == SPIRV_CROSS_NAMESPACE::SPIRType::UInt) { format = uints[width]; }++ auto vaDesc = inputDesc.attributes[input.location];++ vaDesc.format = format;++ vaDesc.bufferIndex = zeroIdx;++ vaDesc.offset = 0;++ reportMessage(MVK_CONFIG_LOG_LEVEL_INFO, "Vertex shader input at location %u is not in the vertex input state; it reads zero.", input.location);++ }++ _zeroVertexAttributeBufferIndex = zeroIdx;++}+++ uint32_t MVKGraphicsPipeline::getTranslatedVertexBinding(uint32_t binding, uint32_t translationOffset, uint32_t maxBinding) {+ // See if a translated binding already exists (for example if more than one VA needs the same translation).+ for (auto& xltdBind : _translatedVertexBindings) {diff --git a/resources/steam-support.json b/resources/steam-support.jsonindex f802dcbe7d2..5e8b1a4e6ad 100644--- a/resources/steam-support.json+++ b/resources/steam-support.json@@ -1,18 +1,18 @@{- "version": "steam-support-v5",+ "version": "steam-support-v6","wine_version": "wine-11.0","minimum_macos": "26.0",- "url": "https://github.com/BCD1210/soju/releases/download/steam-support-v5/soju-steam-support-v5.tar.gz",- "sha256": "95560be419621b72ad5e10d47c3cff08363369a209ba1db913ff5b0dc356b8bf",- "source_url": "https://github.com/BCD1210/soju/releases/download/steam-support-v5/soju-steam-support-v5-sources.tar.gz",+ "url": "https://github.com/BCD1210/soju/releases/download/steam-support-v6/soju-steam-support-v6.tar.gz",+ "sha256": "a4f813e7457fcbca54752b7ccbd4695e4db1be481dc94318c1ca29817d2a39e0",+ "source_url": "https://github.com/BCD1210/soju/releases/download/steam-support-v6/soju-steam-support-v6-sources.tar.gz","files": {- "SOURCES.txt": "a961bc3a62478ccdd27ddf70f2b59ea4e66209a3a4557421aa2c01e28aed9d15",+ "SOURCES.txt": "3db8046ece46432c8acc3009a806086757b3a4ed8c0394d10379d9a11343cf17","dxmt-x64/d3d10core.dll": "53bc695d1408abd9067cf219a70e11c2f00d0c9c4c1065516de0fcfc81b95186","dxmt-x64/d3d11.dll": "5c3056229d1cbcca67fdad1f89755f45e77c3adfd216905b265589ffba1400ce","dxmt-x64/dxgi.dll": "ec286d4323c2ac18fc405067526c93b07a9f5f1cef719ab15829e48b8bed79b9","dxmt-x64/winemetal.dll": "799b0a094e6b0b9d1d967956ea8bff67792abdf24741a7a7035bf3e08febf7c5","dxmt-x64/winemetal.so": "6ae39285534a645ce4f33e55c07bcdc111847231bf42b005d260b1b2ae6913dc",- "libMoltenVK.dylib": "335fea790c1a1d599f6ad6f0f399d25839b9ff866c5b363d2b07895a43e9e680",+ "libMoltenVK.dylib": "247cee0d147187348b91e3de300fb750a88a0128ffe1eba76f94e86592c0c7cf","licenses/DXMT-MIT.txt": "6b928413c6308c106f3e0080bd94b6427b56d587d400fd40e6cbfbab7d9c4ae1","licenses/DirectX-headers.txt": "f38e6194bd3bfa1b654f118e5acefe0aead437bbe669eee43957ccc65a7127f1","licenses/LLVM.txt": "8d85c1057d742e597985c7d4e6320b015a9139385cff4cbae06ffc0ebe89afee",diff --git a/scripts/build-moltenvk.sh b/scripts/build-moltenvk.shindex 0de33eb6ce1..92d46607b09 100755--- a/scripts/build-moltenvk.sh+++ b/scripts/build-moltenvk.sh@@ -2,11 +2,10 @@# Build the MoltenVK in the Steam support package (libMoltenVK.dylib): upstream v1.4.2 plus# patches/moltenvk/*.patch, x86_64 only (the Steam runtime's Wine runs under Rosetta).# bash scripts/build-moltenvk.sh [out-dir]-# Needs Xcode. The patches come from Highball (GPL-3.0-or-later): cache-drawid-present fixes the-# draw ID of direct draws, an empty pipeline cache read and a present that read a released image;-# lenient-interfaces (only with HB_MVK_LENIENT_INTERFACES=1) gives a vertex attribute the pipeline-# does not describe a placeholder and lets a color attachment take the fragment output's kind.-# Together they let Detroit: Become Human compile its pipelines (DrawIndex) and draw.+# Needs Xcode. 1.4.2 converts the DrawIndex shader input that 1.4.1 refused. Soju's patch,+# zero-missing-vertex-attributes, lets a pipeline build when its vertex shader reads a location the+# vertex input state does not describe: Vulkan allows that, Metal refuses the pipeline. Such inputs+# get an attribute in a constant zero buffer. Detroit: Become Human needs both.set -euo pipefailROOT="$(cd "$(dirname "$0")/.." && pwd)"TAG=v1.4.2@@ -16,15 +15,13 @@ WORK="$(mktemp -d)"trap 'rm -rf "$WORK"' EXITgit clone -q --depth 1 --branch "$TAG" https://github.com/KhronosGroup/MoltenVK.git "$WORK/src"[ "$(git -C "$WORK/src" rev-parse HEAD)" = "$COMMIT" ] || { echo "MoltenVK $TAG is not $COMMIT" >&2; exit 1; }-for p in cache-drawid-present lenient-interfaces; do git -C "$WORK/src" apply "$ROOT/patches/moltenvk/$p.patch"; done+for p in "$ROOT"/patches/moltenvk/*.patch; do git -C "$WORK/src" apply "$p"; done(cd "$WORK/src" && ./fetchDependencies --macos)(cd "$WORK/src" && xcodebuild build -project MoltenVKPackaging.xcodeproj -scheme "MoltenVK Package (macOS only)" \-destination "generic/platform=macOS" -configuration Release ARCHS=x86_64 ONLY_ACTIVE_ARCH=NO -quiet)DYLIB="$WORK/src/Package/Release/MoltenVK/dynamic/dylib/macOS/libMoltenVK.dylib"-MARKS="$(strings -a "$DYLIB")"-for p in cache-drawid-present lenient-interfaces; do- grep -q "HIGHBALL $p" <<< "$MARKS" || { echo "patch missing from build: $p" >&2; exit 1; }-done+strings -a "$DYLIB" > "$WORK/strings.txt"+grep -q "is not in the vertex input state; it reads zero" "$WORK/strings.txt" || { echo "patch missing from build" >&2; exit 1; }mkdir -p "$OUT"cp "$DYLIB" "$OUT/libMoltenVK.dylib"cp "$WORK/src/LICENSE" "$OUT/MoltenVK-Apache.txt"diff --git a/scripts/play.sh b/scripts/play.shindex d17ba29a7e3..ad31a549753 100755--- a/scripts/play.sh+++ b/scripts/play.sh@@ -340,7 +340,10 @@ case "$MODE" in[[ -f "$ST" ]] || { echo "Steam not found, run scripts/create-steam-bottle.sh first"; exit 1; }# A newer Steam support package (resources/steam-support.json) is set up before Steam# starts, so an app update brings its components without Update components.- if [ -f "$STEAM_WINE_ROOT/.soju-runtime" ] && ! pgrep -f "$WINESTABLE_SERVER" >/dev/null 2>&1; then+ # steam-session.py idle looks at running wineservers themselves (the reaper's command line names the+ # server path too, so pgrep -f on it is never empty while the reaper runs).+ if [ -f "$STEAM_WINE_ROOT/.soju-runtime" ] && \+ python3 "$(dirname "${BASH_SOURCE[0]}")/steam-session.py" idle "$STEAM_WINE_ROOT" >/dev/null 2>&1; thenwant=$(python3 -c 'import json,sys; print(json.load(open(sys.argv[1]))["version"])' \"$(dirname "${BASH_SOURCE[0]}")/../resources/steam-support.json" 2>/dev/null || true)if [ -n "$want" ] && [ "$(cat "$STEAM_WINE_ROOT/.soju-runtime")" != "$want" ]; then@@ -348,11 +351,9 @@ case "$MODE" inbash "$(dirname "${BASH_SOURCE[0]}")/setup-steam-games.sh" || echo "soju: Steam component update failed; Steam starts with the previous ones" >&2fifi- # Vulkan games through MoltenVK (Detroit: Become Human, Highball's settings): compile shaders- # on every core, keep their source compressed, and let pipelines whose vertex inputs or color- # outputs do not match exactly still build (the patched MoltenVK in the support package).+ # Vulkan games through MoltenVK: compile shaders on every core and keep their source compressed+ # (Detroit: Become Human prepares thousands of pipelines on its first start).export MVK_CONFIG_SHOULD_MAXIMIZE_CONCURRENT_COMPILATION=1 MVK_CONFIG_SHADER_COMPRESSION_ALGORITHM=1- export HB_MVK_LENIENT_INTERFACES=1# Repair a bootstrap-only installation before deploying the CEF wrapper.python3 "$(dirname "${BASH_SOURCE[0]}")/bootstrap-steam.py" "$WINESTABLE"# Known DXVK games (resources/steam-profiles.json) get DXVK once, before Steamdiff --git a/scripts/setup-steam-games.sh b/scripts/setup-steam-games.shindex b51ab359915..c6279026ed8 100755--- a/scripts/setup-steam-games.sh+++ b/scripts/setup-steam-games.sh@@ -100,7 +100,7 @@ if [ -f "$SUP/winecoreaudio-patched.so" ]; thencp -f "$SUP/winecoreaudio-patched.so" "$WLIB/x86_64-unix/winecoreaudio.so"cp -f "$SUP/mmdevapi-x64.dll" "$WLIB/x86_64-windows/mmdevapi.dll"fi-# MoltenVK 1.4.2 with Highball's Detroit: Become Human patches (scripts/build-moltenvk.sh), for+# MoltenVK 1.4.2 with Soju's patch for undescribed vertex inputs (scripts/build-moltenvk.sh), for# games that draw with Vulkan and for DXVK. Older support packages have none: the runtime's stays.if [ -f "$SUP/libMoltenVK.dylib" ]; then[ -f "$WAPP/lib/libMoltenVK.dylib.vanilla" ] || cp -f "$WAPP/lib/libMoltenVK.dylib" "$WAPP/lib/libMoltenVK.dylib.vanilla"