Open spnda opened 2 months ago
Got a fix for the Flat propagation.
For the composites with override, there are many bugs. One of them is that OpLoad is too naive and only looks at the raw OpVariable.
auto &expr_type = expression_type(ptr);
// If the expression has more vector components than the result type, insert
// a swizzle. This shouldn't happen normally on valid SPIR-V, but it might
// happen with e.g. the MSL backend replacing the type of an input variable.
if (expr_type.vecsize > type.vecsize)
expr = enclose_expression(expr + vector_swizzle(type.vecsize, 0));
Need to rewrite all this junk ...
I found this during investigation of Vulkan CTS failures related KhronosGroup/MoltenVK#2116. For the following fragment inputs shader input overrides are not applied at all. Setting breakpoints on all usages of
inputs_by_location
shows that none of those codepaths are taken.This generates the following MSL, regardless whether
--msl-shader-input 1 any32 4
(which should widen the firstint3
toint4
) was specified. Also, theflat
specifier is not being propagated properly.Note that this is a more complicated example, as this uses a struct within an array within a block, but as soon as any fragment inputs are within a block the shader inputs are ignored and not applied. Same happens with structs and arrays.
Shader outputs for the vertex shader using the same setup but for stage outputs are generated correctly.
I've attached a sample fragment shader that uses the above input setup: 17782185548125675323.spv.zip This is the simplest example using just a block as shown above which also fails: 215374844162041042.spv.zip And the tessellation shader with the same setup, where the shader outputs work correctly, if useful for debugging: 15478294089967604931.spv.zip