Commit graph

3 commits

Author SHA1 Message Date
Bill Currie
a5272d2e05 [qfcc] Hook spir-v operand kinds into intrinsic scopes
The operand kinds form namespaces for their enumerants (only BitEnum and
ValueEnum operand kinds are supported for this). Now `Lod` and `Bias`
use `ImageOperands.Lod` and `ImageOperands.Bias`, which is probably a
big improvement in the long run.

Finally, all of QF's shaders *compile*, though the spir-v is generally
incorrect (capabilities etc), and the code gen may still be full of
bugs.
2025-01-18 13:15:05 +09:00
Bill Currie
041216182e [qfcc] Implement spirv instruction lookup
Yay, no more magic numbers for intrinsics :)
2025-01-13 21:38:35 +09:00
Bill Currie
99b1859aac [qfcc] Parse the spirv grammar json files
I really don't like the way they're included (I'm really looking forward
to #embed, but gotta wait for gcc 15), and I'm a tad grumpy that the
documentation for them
(https://registry.khronos.org/SPIR-V/specs/unified1/MachineReadableGrammar.html)
is wrong (missing fields), but I think I like the result.

The grammars (core and glsl.std.450) are parsed into structs that should
be fairly easy to interpret: the instructions, kinds, and enumerant
values are sorted by name for search with bsearch. Having the data
parsed in means source code can refer to the items by name rather than
magic numbers, which will be very nice for intrinsics and image types
(and probably a few other things).
2025-01-07 03:26:12 +09:00