KhronosGroup / KhronosGroup/SPIRV-Cross

Vertex shader function could not be compiled into pipeline

Open
#1,840 8 comments 0 reactions 0 assignees View on GitHub
enhancement workaround
Dominant language
GLSL
Stars
2.5k
Forks
713
Avg merge
2d 18h
Merged PRs (30d)
16

Description

When trying to run Mortal Kombat XL on MacOS running Wineskin/crossover/MoltenVK I get the following errors.

```
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (Error code 3):
Compilation failed:

program_source:473:9: error: no member named 'gl_CullDistance' in 'main0_out'
out.gl_CullDistance[0] = out.o5;
~~~ ^
.
[mvk-error] VK_ERROR_INVALID_SHADER_NV: Vertex shader function could not be compiled into pipeline. See previous logged error.
err: DxvkGraphicsPipeline: Failed to compile pipeline
err: vs : VS_48c64a754f51018d85d9719a2c5751764481a5d6
err: fs : FS_bae6d9d5b407ddd219b7dcaeb457942a161fc78e
[mvk-info] Converting SPIR-V:
```

and

```
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Shader library compile failed (Error code 3):
Compilation failed:

program_source:686:9: error: no member named 'gl_CullDistance' in 'main0_out'; did you mean 'gl_ClipDistance'?
out.gl_CullDistance[0] = out.o0.z;
^~~~~~~~~~~~~~~
gl_ClipDistance
program_source:114:11: note: 'gl_ClipDistance' declared here
float gl_ClipDistance [[clip_distance]] [2];
^
```

I read that gl_CullDistance is not supported in Metal. https://github.com/KhronosGroup/SPIRV-Cross/issues/1403. @billhollings [here](https://github.com/KhronosGroup/MoltenVK/issues/1484) has suggested it might make sense to modify SPIRV-Cross to at least support compilation and setting an output value, even if it can't be used as an MSL built-in, and will have no actual affect on the rendering behavior.

My original downstream issue which contains more logging output is [here](https://github.com/Gcenx/WineskinServer/issues/184)

Many thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

No repository file or test is named in the report. Start by reproducing the logged SPIR-V-to-MSL conversion and tracing how gl_CullDistance is handled in SPIRV-Cross. Done means the reported shader compiles without the missing-member error and the requested output behavior is covered by a regression check.

Written by the indexing model from the issue text.

Assessment

Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.