Skip to content

[spirv][glspirv] Const Arrays #35

Open
@kg

Description

@kg

Just a note for posterity that, like in every other backend before it, the spir-v backend seems to have a partially or completely broken implementation for local const arrays. static const arrays might also be broken but i haven't tested them.

Example problem code snippet:

#define DEFINE_QuadCorners const float2 QuadCorners[] = { \
    {0, 0}, \
    {1, 0}, \
    {1, 1}, \
    {0, 1} \
};

inline float2 ComputeCorner (
    in int2 cornerIndex : BLENDINDICES0,
    in float2 regionSize
) {
    DEFINE_QuadCorners
    float2 corner = QuadCorners[cornerIndex.x];
    return corner * regionSize;
}

in original XNA along with FNA3D d3d11 and FNA3D glsl, QuadCorners[1] will be {1, 0} but in spir-v right now, it seems to always be 0.

I'm just going to learn my lesson and never use arrays again but maybe someone else will run into this problem in the future.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions