-
Notifications
You must be signed in to change notification settings - Fork 632
Open
Description
Reproduction
https://godbolt.org/z/96E5qqG3r
Description of issue
A compute shader that reads from an HLSL cbuffer containing nested structs (including a derived struct Y : X and arrays like Z { X xs[2]; Y y; } and Z zs[2]) triggers MoltenVK’s SPIR-V→MSL path to attempt struct repacking, but it aborts when the repacked struct is itself a member of another struct. This results in SPIR-V to MSL conversion error: Cannot perform any repacking for structs when it is used as a member of another struct and pipeline creation fails with VK_ERROR_INITIALIZATION_FAILED.
HLSL Source
dxc-3.7 -spirv -fspv-target-env=vulkan1.3 -fvk-use-dx-layout -T cs_6_5 source.hlsl > structs.test.spv
struct X {
int a1;
};
struct Y : X {
int2 a2;
};
struct Z {
X xs[2];
Y y;
};
cbuffer CBStructs : register(b0) {
X x1;
X x2;
Y y;
Z zs[2];
};
struct S {
int x1a1;
int x2a1;
int ya1;
int2 ya2;
int z1x1a1;
int z1x2a1;
int z1ya1;
int2 z1ya2;
int z2x1a1;
int z2x2a1;
int z2ya1;
int2 z2ya2;
};
RWStructuredBuffer<S> Out : register(u1);
[numthreads(1,1,1)]
void main() {
Out[0].x1a1 = x1.a1;
Out[0].x2a1 = x2.a1;
Out[0].ya1 = y.a1;
Out[0].ya2 = y.a2;
Out[0].z1x1a1 = zs[0].xs[0].a1;
Out[0].z1x2a1 = zs[0].xs[1].a1;
Out[0].z1ya1 = zs[0].y.a1;
Out[0].z1ya2 = zs[0].y.a2;
Out[0].z2x1a1 = zs[1].xs[0].a1;
Out[0].z2x2a1 = zs[1].xs[1].a1;
Out[0].z2ya1 = zs[1].y.a1;
Out[0].z2ya2 = zs[1].y.a2;
}Errors
[mvk-error] SPIR-V to MSL conversion error: Cannot perform any repacking for structs when it is used as a member of another struct.
[mvk-error] VK_ERROR_INITIALIZATION_FAILED: Compute shader function could not be compiled into pipeline. See previous logged error.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels