Skip to content

Lua and Python have counter-intuitive naming in Dim table #415

@kimiyoribaka

Description

@kimiyoribaka

I'm not sure what the standards are. It certainly seems like the keys for the tables in the Lua version of the SPIR-V main header are supposed to match the keywords in the spec and also as used in the reference front-end's assembly. If that is the case, then having the 1D, 2D and 3D dimensionality keys be appended with Dim is a pitfall that needs to be highlighted. If not, then it'd still be nice if the file's notes at the beginning mentioned that the tokens aren't meant to be used directly.

That said, mainly the reason I wanted to post about this is that, looking at the formatting and such, it really seems like whoever made that header assumed that the keys "1D", "2D" and "3D" aren't valid table keys in Lua.

They are. This is how that table should be written to maintain consistent usage:

    Dim = {
        ["1D"] = 0,
        ["2D"] = 1,
        ["3D"] = 2,
        Cube = 3,
        Rect = 4,
        Buffer = 5,
        SubpassData = 6,
        TileImageDataEXT = 4173,
    },

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions