# spirv: overhaul constant lowering · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/80b84355692606ac840584baa62aaafdd8ecd425)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: 80b84355692606ac840584baa62aaafdd8ecd425

Requested commit: 80b84355692606ac840584baa62aaafdd8ecd425

Commit: 80b84355692606ac840584baa62aaafdd8ecd425

Tree: cdd9ef56bddb4c7d40e841d9b7accfa67e9f4bc9

Author: Robin Voetter

Committer: Robin Voetter

## Message

```
spirv: overhaul constant lowering

Lowering constants is currently not really compatible with unions. In
this commit, constant lowering is drastically overhauled: instead of
playing nice and generating SPIR-V constant representations for everything
directly, we're just going to treat globals as an untyped bag of bytes (
or rather, SPIR-V 32-bit words), which we cast to the desired type at
usage. This is similar to how Rust generates constants in its LLVm backend.

```

## Parents

- [764f19034d9aa74ce2220937d090c60f8f8bf919](https://git.cafe/gitcafe/zig/commit/764f19034d9aa74ce2220937d090c60f8f8bf919?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/80b84355692606ac840584baa62aaafdd8ecd425?format=markdown)
