KhronosGroup / KhronosGroup/SPIRV-Cross

MSL: Unsized array of images is not supported in MSL

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

Description

We are converting HLSL to SPIR-V using DXC and then SPIR-V to MSL with SPIRV-Cross. We are getting an error msg `Unsized array of images is not supported in MSL.` Though it should be supported if SPIRV-Cross has support for Metal Argument Buffers and Bindless.

For debugging, I converted the SPIR-V to VK glsl. And it seems this line is causing the problem
`layout(set = 30, binding = 0) uniform texture2D CommonBindlessResources_textures[];`

The original HLSL line was
`Texture2D CommonBindlessResources_textures[] : register(t0 , space30 ); `

As far as I understand the MSL conversion should be something like:

```
struct CommonBindlessResources_texturesStruct
{
texture2d textures;
};

pixelShaderEntryPoint(CommonBindlessResources_texturesStruct* CommonBindlessResources_textures [[buffer(0)]])
{

}
```

We are compiling spirv to msl with following options:
```
spirv_cross::CompilerMSL::Options options;
options.platform = spirv_cross::CompilerMSL::Options::Platform::iOS;
options.msl_version = spirv_cross::CompilerMSL::Options::make_msl_version(2, 3);
options.ios_use_simdgroup_functions = true;
options.ios_support_base_vertex_instance = true;
options.enable_decoration_binding = true;
options.texture_buffer_native = true;
options.argument_buffers = true;
```

Any ideas what's wrong? Will I have to modify spirv-cross and add support for this conversion?

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the conversion with the supplied HLSL resource declaration, SPIR-V GLSL output, and CompilerMSL options, focusing on argument_buffers and MSL 2.3. Read the MSL compiler's handling of unsized image arrays and compare the generated result with the requested argument-buffer structure; done means establishing whether this case is supported and identifying the required project change or limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers, computer-graphics
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.