Merge pull request #36187 from Chaosus/shader_forbid_out_samplers

Prevent usage 'out' modifier on opaque shader types (textures currently)
This commit is contained in:
Yuri Roubinsky 2020-02-13 23:19:59 +03:00 committed by GitHub
commit 234d355081
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6273,6 +6273,13 @@ Error ShaderLanguage::_parse_shader(const Map<StringName, FunctionInfo> &p_funct
return ERR_PARSE_ERROR;
}
if (qualifier == ARGUMENT_QUALIFIER_OUT || qualifier == ARGUMENT_QUALIFIER_INOUT) {
if (is_sampler_type(get_token_datatype(tk.type))) {
_set_error("Opaque types cannot be output parameters.");
return ERR_PARSE_ERROR;
}
}
if (is_struct) {
ptype = TYPE_STRUCT;
} else {