Vulkan-Samples: error on macOS 10.14.6 in terrain tessellation example

I’m encountering the following errors when running the terrain tessellation example (all of the other API examples I’ve tried have worked without issue.

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

program_source:101:85: error: as_type cast from 'half' to 'float' is not allowed
                spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(mix(as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]), 0.5));
                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:101:157: error: as_type cast from 'half' to 'float' is not allowed
                spvTessLevel[gl_PrimitiveID].insideTessellationFactor[0] = half(mix(as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[0]), as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[3]), 0.5));
                                                                                                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:102:85: error: as_type cast from 'half' to 'float' is not allowed
                spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(mix(as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), 0.5));
                                                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
program_source:102:157: error: as_type cast from 'half' to 'float' is not allowed
                spvTessLevel[gl_PrimitiveID].insideTessellationFactor[1] = half(mix(as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[2]), as_type<float>(spvTessLevel[gl_PrimitiveID].edgeTessellationFactor[1]), 0.5));
                                                                                                                                                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.
[mvk-error] VK_ERROR_INVALID_SHADER_NV: Tessellation control shader function could not be compiled into pipeline. See previous logged error.
[error] [samples/api/terrain_tessellation/terrain_tessellation.cpp:639] Detected Vulkan error: ERROR_INVALID_SHADER_NV

Commenting out lines 111 & 112 of the terrain.tesc causes the error to disappear -

gl_TessLevelInner[0] = mix(gl_TessLevelOuter[0], gl_TessLevelOuter[3], 0.5);
gl_TessLevelInner[1] = mix(gl_TessLevelOuter[2], gl_TessLevelOuter[1], 0.5);

however I’m not sure what the actual fix is.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16

Most upvoted comments

I know I fixed this. I used the exact source from the sample to make the test case.

What revision of MoltenVK? Did you update ExternalRevisions/SPIRV-Cross_repo_revision? The version of SPIRV-Cross that MoltenVK builds against was recently updated; if you didn’t use a recent MoltenVK master, try updating.