Skip to content

Run Windows games on Apple Silicon — free, open source, with an open compatibility database that tells you what actually works.

MoltenVK: the fixes from DiAvisoo's MoltenVK-Detroit for Detroit: Become Human (highball#125), as two patches for the Wine 11 set

Gauthier Piarrette6d12171c6edf
diff --git a/.github/workflows/build-moltenvk.yml b/.github/workflows/build-moltenvk.yml
index 07ff32f..b406b91 100644
--- a/.github/workflows/build-moltenvk.yml
+++ b/.github/workflows/build-moltenvk.yml
@@ -16,7 +16,7 @@ on:
default: "v1.4.2"
patches:
description: "MVK_PATCHES, in the order they apply"
- default: "shadow-import linear-fallback shadow-readback device-memory-cap"
+ default: "shadow-import linear-fallback shadow-readback device-memory-cap cache-drawid-present lenient-interfaces"
publish:
description: "Upload the archive to the engine-components release"
type: boolean
@@ -39,7 +39,7 @@ jobs:
xcodebuild -version
- name: build
env:
- MVK_PATCHES: ${{ inputs.patches || 'shadow-import linear-fallback shadow-readback device-memory-cap' }}
+ MVK_PATCHES: ${{ inputs.patches || 'shadow-import linear-fallback shadow-readback device-memory-cap cache-drawid-present lenient-interfaces' }}
run: Scripts/build-moltenvk.sh "${{ inputs.tag || 'v1.4.2' }}" "$RUNNER_TEMP/out"
- name: sdk and markers
run: |
diff --git a/Scripts/build-moltenvk.sh b/Scripts/build-moltenvk.sh
index 8c9279f..dc2d316 100755
--- a/Scripts/build-moltenvk.sh
+++ b/Scripts/build-moltenvk.sh
@@ -33,9 +33,19 @@ fi
# shadowed memory back to the game's pages when a submission completes, so a 32-bit game's readbacks stop being
# stale; MVK_PATCHES="shadow-import shadow-readback" built moltenvk-1.4.1-shadow-import-1-shadow-readback-1, published
# in the engine-components release and not yet referenced by any engine manifest.
-# device-memory-cap (2026-10-27, highball#398) goes last: HB_MVK_DEVICE_MEMORY_PERCENT caps the device-local heap
+# device-memory-cap (2026-10-27, highball#398) comes next: HB_MVK_DEVICE_MEMORY_PERCENT caps the device-local heap
# and its budget at that share of the Mac's memory, so a game that sizes its streaming from them stops growing
-# into swap. Inert unless the variable is set. The .github/workflows/build-moltenvk.yml job runs this script.
+# into swap. Inert unless the variable is set.
+# cache-drawid-present and lenient-interfaces (2026-10-29, highball#125) go last, ported from DiAvisoo's
+# MoltenVK-Detroit (alexdremov's and squidbus's work in KhronosGroup/MoltenVK#2054) for Detroit: Become Human.
+# cache-drawid-present fixes three bugs any game can hit, so it is always on: vkGetPipelineCacheData() wrote
+# nothing when the cache size was not known yet, the draw ID of a direct draw was written at the wrong place, and
+# a finished present read its swapchain after letting go of the image. lenient-interfaces is inert unless
+# HB_MVK_LENIENT_INTERFACES=1: then a vertex attribute the pipeline does not describe gets a placeholder, and a
+# color attachment whose float or integer kind differs from the fragment output takes the output's kind. Both
+# apply on bare 1.4.2 too. The Wine 11 set, in order: shadow-import linear-fallback shadow-readback
+# device-memory-cap cache-drawid-present lenient-interfaces. The .github/workflows/build-moltenvk.yml job runs
+# this script with that set.
read -r -a PATCH_NAMES <<< "${MVK_PATCHES:-shadow-import linear-fallback}"
for NAME_ in "${PATCH_NAMES[@]}"; do
PATCH="$PATCHES/moltenvk-$NAME_.patch"
diff --git a/spike/patches/moltenvk-cache-drawid-present.patch b/spike/patches/moltenvk-cache-drawid-present.patch
new file mode 100644
index 0000000..aca6f83
--- /dev/null
+++ b/spike/patches/moltenvk-cache-drawid-present.patch
@@ -0,0 +1,92 @@
+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/spike/patches/moltenvk-lenient-interfaces.patch b/spike/patches/moltenvk-lenient-interfaces.patch
new file mode 100644
index 0000000..02c2e56
--- /dev/null
+++ b/spike/patches/moltenvk-lenient-interfaces.patch
@@ -0,0 +1,238 @@
+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;