It turns out there's already a glslang bug for this and it was closed in March:
https://github.com/KhronosGroup/glslang/issues/809 Unfortunately, there are applications shipping with these shaders so failure isn't really an option. --Jason On Thu, Dec 14, 2017 at 7:56 PM, Jason Ekstrand <[email protected]> wrote: > The Talos Principle contains shaders with an OpSelect between two > vectors where the condition is a scalar boolean. This is technically > against the spec bout nir_builder gracefully handles it by splatting > out the condition to all the channels. So long as the condition is a > boolean, just emit a warning instead of failing. > > Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=104246 > --- > src/compiler/spirv/spirv_to_nir.c | 18 ++++++++++++++---- > 1 file changed, 14 insertions(+), 4 deletions(-) > > diff --git a/src/compiler/spirv/spirv_to_nir.c > b/src/compiler/spirv/spirv_to_nir.c > index 0493dd3..f0476b2 100644 > --- a/src/compiler/spirv/spirv_to_nir.c > +++ b/src/compiler/spirv/spirv_to_nir.c > @@ -3511,10 +3511,20 @@ vtn_handle_body_instruction(struct vtn_builder > *b, SpvOp opcode, > vtn_fail("Result type of OpSelect must be a scalar, vector, or > pointer"); > } > > - vtn_fail_if(sel_val->type->type != sel_type, > - "Condition type of OpSelect must be a scalar or vector > of " > - "Boolean type. It must have the same number of > components " > - "as Result Type"); > + if (unlikely(sel_val->type->type != sel_type)) { > + if (sel_val->type->type == glsl_bool_type()) { > + /* This case is illegal but some versions of GLSLang produce > it. > + * That's fine, nir_builder will just splat the condition out > + * which is most likely what the client wanted anyway. > + */ > + vtn_warn("Condition type of OpSelect must have the same > number " > + "of components as Result Type"); > + } else { > + vtn_fail("Condition type of OpSelect must be a scalar or > vector " > + "of Boolean type. It must have the same number of " > + "components as Result Type"); > + } > + } > > vtn_fail_if(obj1_val->type != res_val->type || > obj2_val->type != res_val->type, > -- > 2.5.0.400.gff86faf > >
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
