Any matrix, array or struct member in a uniform/buffer block requires
offset and stride annotations. These seem to be calculated correctly
(tricky due to qfcc's internal size system, which I should probably
adjust based on target (I think type_size() and type_align() should help
here). Now I've got fun with incompatible structs that are the same type
in the source (thus pass type checks), but different in the target (due
to concrete vs abstract addressing).
Fixes an ICE when compiling simplex.r (thus its addition to qfcc's
tests). It still fails due to having lost the points parameter, but yet
another automated test :)
It both seems to be a bit of a hack (since it probably doesn't conform
with the GLSL spec, but I've given up on worrying too much about that),
and the most sensible thing to do.
Shadow swizzling can return a single component but OpVectorShuffle
doesn't support returning a scalar. This is essentially duplicating the
vector logic in proc_field.
The whole point of prototypes is to ensure arguments are of the correct
type. Fixes some ints getting into places where floats were expected
(eg, mix, smoothstep, etc).
The function queue needs to be cleared before figuring out the interface
symbols otherwise the variables referenced only by called functions will
not get into the list of interface symbols.
This fixes the constant type reference ICE for subpassLoad. The problem
was stale symbols recorded in the expressions thus gsubpassInput
referred to the allowed types for the generic function rather than the
type specific to the call.
`address_expr()` wasn't enough because it returns pointers instead of
references (quite correct) which messes with checks for references
elsewhere (also quite correct). It seems I've finally got reference
parameters working.
Generic function parameters can now use references (currently via
`@reference()`) for generic types. And seem to work. There's still a
problem with chains: `atomicExchange(__imageTexel(...))` is
dereferencing __imageTexel's return value.
It seems it should return an Image storage class pointer. Validation
still fails because of the ptr local var (not allowed by default) and so
needs to be an SSA temp, but I'm having a little trouble with *that*.
It turned out error checking on type functions was broken by generic
functions because type_function wasn't being called. The rest of the
changes were for error recovery.
The default value is 1, and the assumption in target_spirv is that if
the first one is set, all are set, but the source code doesn't need to
set any explicitly.
Doing <= when I wanted != caused some very strange behavior with
valgrind and bsearch. Also, going with negative logic rather than
positive logic is probably the cause of the brainfart.
This means that `layout(triangles)` etc now work, though there are
issues with frag shaders missing functions (since getting function calls
working) and compute shaders silently failing.
But only for non-extension. I'm not sure it's quite right (as I don't
know if all void intrinsics should not have res type/id (all extension
instructions *do*)).