stride3d/stride · error · Exception
{cross.CompilerGetCombinedImageSamplers(compiler…
Error message
{cross.CompilerGetCombinedImageSamplers(compiler, &combinedImageSamplers, ref numSamplers)} What it means
Translate throws this when CompilerGetCombinedImageSamplers fails to retrieve the list of combined image samplers after the combination pass ran for GLSL. The returned pointer and count are unavailable, so the subsequent renaming loop cannot run and translation aborts. The message is the raw call result.
Solutions
- Ensure the native spirv-cross binary version matches the Silk.NET.SPIRV.Cross bindings
- Check the spirv-cross error-callback log lines before the throw
- Re-run with a known-good GLSL shader to isolate environment vs shader cause
- Update the native library to the latest release
- Verify CompilerBuildCombinedImageSamplers succeeded immediately before (it should have, or 2086 would have thrown first)
Example fix
// before
var glsl = translator.Translate(Backend.Glsl, entryPoint);
// after
try { var glsl = translator.Translate(Backend.Glsl, entryPoint); }
catch (Exception ex) when (ex.Message.Contains("CompilerGetCombinedImageSamplers"))
{ Log.Error($"Combined sampler query failed (check spirv-cross native/binding version match): {ex.Message}"); throw; } Defensive patterns
Strategy: try-catch
Validate before calling
// Check native/binding version alignment at startup: // typeof(Silk.NET.SPIRV.Cross.Cross).Assembly.GetName().Version vs native spirv-cross build
Try / catch
try { var glsl = translator.Translate(Backend.Glsl, entryPoint); } catch (Exception ex) when (ex.Message.Contains("CompilerGetCombinedImageSamplers")) { Log.Error($"Combined-sampler query failed — check native library/binding ABI match: {ex.Message}"); throw; } Prevention
- Upgrade Silk.NET bindings and the native binary together
- Smoke-test one GLSL shader at startup to catch ABI mismatches early
- Check error-callback logs for native-side detail
- Run shader translation tests on every supported platform
When it happens
Trigger: Calling Translate(Backend.Glsl, ...) when the query returns non-success — internal spirv-cross error, compiler state invalid after BuildCombinedImageSamplers, or binding/ABI mismatch between the Silk.NET bindings and the loaded native library.
Common situations: Mismatched Silk.NET.SPIRV.Cross binding vs native spirv-cross version (struct ABI changes); spirv-cross built with combined-sampler support disabled; rare native memory failures.
Understand the failure class
Background: "API request failed": what wrapped HTTP errors from external APIs mean and how to find the real cause — this error's family across 29 libraries.
Related errors
- : could not create compiler
- : could not create shader resources
- : Could not enable combined image samplers
- : could not compile code
- Could not translate code
AI-assisted analysis of stride3d/stride@96fad776d2 (2026-09-14).
Data as JSON: /api/errors/398517cd47e87516.
Report an issue: GitHub.
Appendix: source
Thrown at sources/shaders/Stride.Shaders.Compilers/SpirvTranslator.cs:162
vertexInputRemap[vertexInputRemapCount].Location = cross.CompilerGetDecoration(compiler, resourcesList[i].Id, Decoration.Location);
vertexInputRemap[vertexInputRemapCount].Semantic = cross.CompilerGetDecorationString(compiler, resourcesList[i].Id, Decoration.UserSemantic);
vertexInputRemapCount++;
}
}
cross.CompilerHlslAddVertexAttributeRemap(compiler, vertexInputRemap, (nuint)vertexInputRemapCount);
cross.CompilerHlslSetResourceBindingFlags(compiler, 0);
}
if (backend == Backend.Glsl)
{
if (cross.CompilerBuildCombinedImageSamplers(compiler) != Result.Success)
throw new Exception($"{cross.CompilerBuildCombinedImageSamplers(compiler)} : Could not enable combined image samplers");
nuint numSamplers = 0;
CombinedImageSampler* combinedImageSamplers = null;
if (cross.CompilerGetCombinedImageSamplers(compiler, &combinedImageSamplers, ref numSamplers) != Result.Success)
throw new Exception($"{cross.CompilerGetCombinedImageSamplers(compiler, &combinedImageSamplers, ref numSamplers)}");
for (uint i = 0; i < numSamplers; ++i)
{
var textureName = cross.CompilerGetNameS(compiler, combinedImageSamplers[i].ImageId);
var samplerName = cross.CompilerGetNameS(compiler, combinedImageSamplers[i].SamplerId);
cross.CompilerSetName(compiler, combinedImageSamplers[i].CombinedId, $"SPIRV_Cross_Combined{textureName}{samplerName}");
}
}
if (cross.CompilerCompile(compiler, &translated) != Result.Success)
throw new Exception($"{cross.CompilerCompile(compiler, &translated)} : could not compile code");
translatedCode = SilkMarshal.PtrToString((nint)translated);
cross.ContextReleaseAllocations(context);
cross.ContextDestroy(context);
return translatedCode ?? throw new Exception("Could not translate code");
}
}View on GitHub (pinned to 96fad776d2)