[Mesa-dev] [PATCH 1/3] glsl: enforce output variable rules for GLSL ES 3.10

Samuel Iglesias Gonsálvez siglesias at igalia.com
Fri Jun 12 00:16:57 PDT 2015


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Reviewed-by: Samuel Iglesias Gonsálvez <siglesias at igalia.com>

Sam

On 12/06/15 08:51, Timothy Arceri wrote:
> Some rules are already applied this just adds the missing ones. 
> --- src/glsl/ast_to_hir.cpp | 49
> +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed,
> 49 insertions(+)
> 
> diff --git a/src/glsl/ast_to_hir.cpp b/src/glsl/ast_to_hir.cpp 
> index 578711a..d7ecc35 100644 --- a/src/glsl/ast_to_hir.cpp +++
> b/src/glsl/ast_to_hir.cpp @@ -3656,6 +3656,55 @@
> ast_declarator_list::hir(exec_list *instructions, "type %s",
> check_type->name); } } + +         /* From section 4.3.6 (Output
> Variables) of the GLSL ES 3.10 spec: +          * +          *
> It is a compile-time error to declare a vertex shader output +
> *     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 +
> * +          *     It is a compile-time error to declare a fragment
> shader output +          *     with, or that contains, any of the
> following types: +          * +          *     * A boolean type +
> *     * An opaque type +          *     * A matrix +          *
> * A structure +          *     * An array of array +          */ +
> if (state->es_shader) { +            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 (state->stage == MESA_SHADER_VERTEX) { +               if
> (var->type->is_array() && +
> var->type->fields.array->is_record()) { +
> _mesa_glsl_error(&loc, state, +
> "vertex shader output " +                                   "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, +
> "vertex shader output cannot have a " +
> "struct that contains an " +
> "array or struct"); +                  } +               } +
> } +         } }
> 
> /* Integer fragment inputs must be qualified with 'flat'.  In GLSL
> ES,
> 
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1

iQIcBAEBAgAGBQJVeodpAAoJEH/0ujLxfcNDpqoQANdam7PoWTfJNxNosng0rGRH
2WLiwknxtVnXhOfRa8747Ihv6nKI2Yq4yMARA4D/XcZkWju2b7nKbcNH5ndDTy6M
YZ/QH+Qox03rB3Na4Ew9bLsA+AZc8NtNUFbAlRcD8twR+oIPVAkgNeidUchCbnTP
3i+KO3XVbKHvCn6Pg/bx1Ov5PyvJcwUDDizGuzw400cLCBactaa84+HYwJKipkUF
1NpCZRGmTmfpZxIhzz/oSS4/4mzDATNyVtz+PxLNpcG71Vca6zfDUb2eGgFX0VlP
rUpsn8B+vADYeQ4wa935QwRuknAUBW8oLi3kWfW8G7GELufXcV/gCpHKNhjpYVzS
/1BuBPTGZP/2EFQpUajSjUN+DJ893fuWUTOqOoLMIX2zlGnJ+FklT2m97ldqFQsy
47MdqkmR95kBkGQabladVb/5NAMyGhmi9mW/yewjFG7jcb95vIneZkhxOHW6P0Vy
KKL4Pow/Z+Mw8eNRs9f15zSgpl53OmCCxfH4mQrrwfhDR2CPhNB2Zs60Gim9Lt6L
0BX0PMT6i8AuJ/011d95uvirONGxU17jYif1Uf2lDxiiQ06jR+20PVSPsLv0yhsm
OYAJ4b7TNUYmkd784GHUZGxZtwGqr1pVp8Rahiv6aEcFAiZNuezpslQs3waXLtIo
p0poRR77UuQue8I5Orkr
=Q0PH
-----END PGP SIGNATURE-----


More information about the mesa-dev mailing list