Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument Buffer Array Padding incorrect by unused image arrays in 1.3.296 #2368

Open
andreasschultes opened this issue Oct 8, 2024 · 0 comments

Comments

@andreasschultes
Copy link

andreasschultes commented Oct 8, 2024

The padding for an unused binding is incorrect created with array size of 1 instead of the right array size

Defintion in fragment shader:

layout(binding = 1,set = 0) uniform sampler ASampler;  // unused or comment out, used in vertex shader
layout(binding = 2,set = 0) uniform sampler BSampler;
layout(binding = 3,set = 0) uniform utexture2D A_Array[128]; // unused or comment out, used in vertex shader
layout(binding = 4,set = 0) uniform texture2D B_Array[128];

Generated output extracted from XCode capture

struct spvDescriptorSetBuffer0
{
    constant void* _m0_pad [[id(0)]];
    constant void* _m1_pad [[id(1)]];
    sampler _m2_pad [[id(2)]];
    sampler BSampler [[id(3)]];
    array<texture2d<float>, 1> _m4_pad [[id(4)]]; // type maybe uint here
    array<texture2d<float>, 128> B_Array [[id(132)]];
};

XCODE View of the fragment buffer, shows the content _m4_pad[0] = A_Array [0], B_Array[0] = A_Array[1], ..., B_Array[127] = B_Array[0]
Next line starts probably with _m0_pad = B_Array[1] address

Accessing A_Array in shader changes the structure spvDescriptorSetBuffer0 to the right array size and everything is correct.

struct spvDescriptorSetBuffer0
{
    constant void* _m0_pad [[id(0)]];
    constant void* _m1_pad [[id(1)]];
    sampler ASampler [[id(2)]];
    sampler BSampler [[id(3)]];
    array<texture2d<uint>, 128> A_Array [[id(4)]]; 
    array<texture2d<float>, 128> B_Array [[id(132)]];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant