{"record":{"id":"a1ef58ace37b7820","repo":"stride3d/stride","slug":"spirv-to-dxil-pipeline-failed-spir-v-dumped-to-dumppath-diag","errorCode":null,"errorMessage":"spirv_to_dxil_pipeline failed; SPIR-V dumped to {dumpPath}\n{diag}","messagePattern":"spirv_to_dxil_pipeline failed; SPIR-V dumped to (.+?)\n(.+?)","errorType":"exception","errorClass":"InvalidOperationException","httpStatus":null,"severity":"critical","filePath":"sources/shaders/Stride.Shaders.Compilers/EffectCompiler.cs","lineNumber":627,"sourceCode":"                            {\n                                ShaderStage.Vertex => Compilers.Direct3D.ShaderStage.DXIL_SPIRV_SHADER_VERTEX,\n                                ShaderStage.Hull => Compilers.Direct3D.ShaderStage.DXIL_SPIRV_SHADER_TESS_CTRL,\n                                ShaderStage.Domain => Compilers.Direct3D.ShaderStage.DXIL_SPIRV_SHADER_TESS_EVAL,\n                                ShaderStage.Geometry => Compilers.Direct3D.ShaderStage.DXIL_SPIRV_SHADER_GEOMETRY,\n                                ShaderStage.Pixel => Compilers.Direct3D.ShaderStage.DXIL_SPIRV_SHADER_FRAGMENT,\n                                ShaderStage.Compute => Compilers.Direct3D.ShaderStage.DXIL_SPIRV_SHADER_COMPUTE,\n                                _ => throw new NotSupportedException($\"Unsupported shader stage: {entryPoints[i].Stage}\"),\n                            },\n                            entry_point_name = (byte*)nameHandles[i].AddrOfPinnedObject(),\n                        };\n                    }\n\n                    if (!Spv2DXIL.spirv_to_dxil_pipeline(stages, entryPoints.Count, ValidatorVersion.DXIL_VALIDATOR_1_4, ref runtimeConf, ref logger, outputs))\n                    {\n                        var dumpPath = System.IO.Path.Combine(System.IO.Path.GetTempPath(), $\"stride-dxil-fail-{Guid.NewGuid():N}.spv\");\n                        System.IO.File.WriteAllBytes(dumpPath, spirvBytecode.ToArray());\n                        var diag = _spvLogSink is { Length: > 0 } sb ? sb.ToString().TrimEnd() : \"(no diagnostics from spirv_to_dxil)\";\n                        throw new InvalidOperationException($\"spirv_to_dxil_pipeline failed; SPIR-V dumped to {dumpPath}\\n{diag}\");\n                    }\n\n                    for (int i = 0; i < entryPoints.Count; i++)\n                    {\n                        var dxil = outputs[i];\n                        Span<byte> dxilSpan = new(dxil.buffer, (int)dxil.size);\n                        fixed (byte* dxilSpanPtr = dxilSpan)\n                            DxilHash.ComputeHashRetail(&dxilSpanPtr[20], (uint)(dxilSpan.Length - 20), &dxilSpanPtr[4]);\n                        shaderStageBytecodes.Add(new ShaderBytecode(entryPoints[i].Stage, ObjectId.FromBytes(dxilSpan), dxilSpan.ToArray()));\n                    }\n                }\n                finally\n                {\n                    for (int i = 0; i < entryPoints.Count; i++)\n                        if (nameHandles[i].IsAllocated) nameHandles[i].Free();\n                }\n            }\n        }","sourceCodeStart":609,"sourceCodeEnd":645,"githubUrl":"https://github.com/stride3d/stride/blob/96fad776d210c221682aac1ccdf4c79dc046fc38/sources/shaders/Stride.Shaders.Compilers/EffectCompiler.cs#L609-L645","documentation":"Spv2DXIL.spirv_to_dxil_pipeline returned false: the dxil-spirv (Mesa SPIRV-to-DXIL) native converter failed to translate the SPIR-V module into DXIL for at least one stage of the pipeline. The compiler dumps the failing SPIR-V bytecode to a temp file and appends all diagnostics collected via the DXILSpirvLogger callback so the offending shader can be reproduced and analyzed.","triggerScenarios":"Calling the desktop effect compiler on a SPIR-V module that spirv_to_dxil_pipeline rejects: unsupported SPIR-V constructs/extensions, out-of-range descriptor bindings conflicting with the runtime CBV layout (runtime_data_cbv/push_constant_cbv in register space 31), 16-bit types exceeding the configured shader_model_max (SM 6.2), or validator 1.4 rejecting the produced DXIL.","commonSituations":"Shader feature (e.g. half/Float16 types, unsupported extensions, unusual cbuffer layouts) that dxil-spirv cannot lower; descriptor register/space collisions after custom cbuffer merging; a Stride/D3D12 backend bug on a specific shader; driver-independent since this happens at build/compile time on desktop.","solutions":["Read the diagnostics appended to the message; they usually name the SPIR-V instruction or feature that failed.","Locate the dumped file in %TEMP% (stride-dxil-fail-<guid>.spv), run spirv-dis on it, and identify the unsupported construct.","Fix the shader source: remove unsupported features (e.g. unusual matrix layouts, extensions) or rewrite the offending effect.","Check for descriptor/register conflicts: resources must live in space 0 since the converter reserves space 31 for runtime data and push constants.","Update Stride or the dxil-spirv native library — newer versions support more SPIR-V features and shader models.","If a shader genuinely needs SM >6.2 features, verify shader_model_max configuration is appropriate."],"exampleFix":"// before: shader uses an extension dxil-spirv can't lower\n[[vk::ext_extension(\"SPV_EXT_descriptor_indexing\")]] ...\n\n// after: rewrite using supported constructs (e.g. StructuredBuffer / standard bindings)","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { CompileDxilPipeline(spirv, entryPoints, bytecodes); }\ncatch (InvalidOperationException ex)\n{\n    // ex.Message contains the %TEMP% .spv dump path and dxil-spirv diagnostics\n    log.Error(ex.Message);\n    throw new EffectCompilationException(\"SPIR-V to DXIL conversion failed; see dumped .spv and diagnostics\", ex);\n}","preventionTips":["Avoid shader features known to be unsupported by dxil-spirv (uncommon extensions, exotic layouts).","Keep all resources in register space 0; the converter reserves space 31 for runtime data and push constants.","Pin the dxil-spirv native library and Stride versions; test shader content in CI on desktop D3D12.","Keep the dumped .spv from the temp folder when reporting — it reproduces the failure exactly."],"tags":["shader-compilation","dxil","spirv","native-interop"],"backgroundTag":"shader-compilation-failed","analyzedSha":"96fad776d210c221682aac1ccdf4c79dc046fc38","analyzedAt":"2026-09-14T02:59:31.279Z","contentChangedAt":"2026-09-14T02:59:31.279Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}