[Mesa-dev] [PATCH 2/3] glsl: enforce fragment shader input restrictions in GLSL ES 3.10
Samuel Iglesias Gonsálvez
siglesias at igalia.com
Fri Jun 12 00:17:12 PDT 2015
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>
Sam
On 12/06/15 08:52, Timothy Arceri wrote:
> --- src/glsl/ast_to_hir.cpp | 45
> +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45
> insertions(+)
>
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp
> index d7ecc35..8236ff9 100644 --- a/src/glsl/ast_to_hir.cpp +++
> b/src/glsl/ast_to_hir.cpp @@ -3610,6 +3610,51 @@
> ast_declarator_list::hir(exec_list *instructions, }
>
> handle_geometry_shader_input_decl(state, loc, var); + }
> else if (state->stage == MESA_SHADER_FRAGMENT) { + /*
> From section 4.3.4 (Input Variables) of the GLSL ES 3.10 spec: +
> * + * It is a compile-time error to declare a
> fragment shader + * input with, or that contains,
> any of the following types: + * + * * A
> boolean type + * * An opaque type + *
> * An array of arrays + * * An array of structures +
> * * A structure containing an array + * * A
> structure containing a structure + */ + if
> (state->es_shader) { + const glsl_type *check_type =
> var->type->without_array(); + if
> (check_type->is_boolean() || +
> check_type->contains_opaque()) { +
> _mesa_glsl_error(&loc, state, +
> "fragment shader input cannot have type %s", +
> check_type->name); + } + if
> (var->type->is_array() && +
> var->type->fields.array->is_array()) { +
> _mesa_glsl_error(&loc, state, +
> "%s shader output " + "cannot
> have an array of arrays", +
> _mesa_shader_stage_to_string(state->stage)); + } +
> if (var->type->is_array() && +
> var->type->fields.array->is_record()) { +
> _mesa_glsl_error(&loc, state, +
> "fragment shader input " +
> "cannot have an array of structs"); + } +
> if (var->type->is_record()) { + for (unsigned i =
> 0; i < var->type->length; i++) { + if
> (var->type->fields.structure[i].type->is_array() || +
> var->type->fields.structure[i].type->is_record()) +
> _mesa_glsl_error(&loc, state, +
> "fragement shader input cannot have " +
> "a struct that contains an " +
> "array or struct"); + } + } +
> } } } else if (var->data.mode == ir_var_shader_out) { const
> glsl_type *check_type = var->type->without_array();
>
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQIcBAEBAgAGBQJVeod4AAoJEH/0ujLxfcNDEhgP/0iLbFCATHvJBEWEpnI1YAGl
egbGbptKCtz9cA0EkfacDrGNAcY9EF1E4yA1cAWqcdYVSVj0oE17nqovkKaCeMJe
YfXT6UUA9Ovw9imXG+xvP6qZ86u4JVGOoYfrtOMuiGEEMydkkH0CpLbvlNiGTCdN
cEfrZkAi3wBUjkxE8T8eFVpPfsI4wd9Qe+INHUgSEf+w2h3TX4VshYlLNeXQw8Kj
NilGD/lHWX7TTUslvMK9lap7bhNj8E6AuuhBHCmpMeqmKILP8HpDLhnHRqUFGagL
J3FlBpYuaWk3e6IFgUjQjvtJcU90xncRkhKSjy2r/lelpqv/SAyTsyCvuCumQCJF
/2h1OhsVuvYwr5adaR+Eqf3/2YPlhBPwbmnxppWrkDLK2Ra6Klg9cz3hjbV7/6ZL
ubsAgJLNkue74ac/ahXC8As14jwRzRWAUL4l6NaKpjbsSXDiAy9SzI2Fqe+ZWpRU
sDMYJN468iA7OI/eNYzOIzOK5Oudew0EdGxdY/lFD3NS9N/BCgh/yUsr5Oq7Rbfv
cgye2YHJIZqQddle6JtOgdKKQHY42dKLSl+v33xc9Tit5RPxcEdxSenuxuU/bQBx
6LOEFalIixjqnThSrSCK1S1dlhGV40cch2o7v52n867Vx+BZgfGqbAiP7DrxtCXM
HxdZHoulCglxEJVK2RiH
=JSlZ
-----END PGP SIGNATURE-----
More information about the mesa-dev
mailing list