KhronosGroup / KhronosGroup/SPIRV-Cross

MSL: dynamic/runtime array conversion

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

Description

We're trying to convert a runtime array from GLSL -> SPIRV to MSL via SPIRV cross.
The conversion works on Windows, if we look at the GLSL decompiled SPIRV via RenderDoc.
On Mac, we get a statically sized array:

Here's the GLSL:

```
layout(set = 0, binding = 3, std430) readonly buffer boneMatrices
{
vec4 _boneMatrices[];
} _216;
```

Here's the converted MSL:

```
struct boneMatrices
{
float4 _boneMatrices[1];
};
```

The SPIRV looks correct as well:

```
%6 = OpTypeFloat 32
%27 = OpTypeVector %6 4
%213 = OpTypeRuntimeArray %27
%214 = OpTypeStruct %213
%215 = OpTypePointer StorageBuffer %214
%216 = OpVariable %215 StorageBuffer
```

We're using MoltenVK to do the translation, any tips would be appreciated in how we can facilitate the proper conversion.

Thanks.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the GLSL runtime-array example and the corresponding SPIR-V declarations in the issue, then investigate how SPIR-V is converted to MSL through MoltenVK. Reproduce the conversion and determine why the MSL output uses a statically sized array; done means preserving the runtime-array representation in the generated MSL.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.