[Mesa-dev] [PATCH v2 05/15] glsl parser: on desktop GL require GLSL 150 for instance names
Kenneth Graunke
kenneth at whitecape.org
Sat Mar 23 14:09:31 PDT 2013
On 03/18/2013 04:35 PM, Jordan Justen wrote:
> Interface blocks in GLSL 150 allow an instance name to be used.
>
> Signed-off-by: Jordan Justen <jordan.l.justen at intel.com>
> ---
> src/glsl/glsl_parser.yy | 15 ++++++++++-----
> 1 file changed, 10 insertions(+), 5 deletions(-)
>
> diff --git a/src/glsl/glsl_parser.yy b/src/glsl/glsl_parser.yy
> index 8e6b04d..1fd8cc2 100644
> --- a/src/glsl/glsl_parser.yy
> +++ b/src/glsl/glsl_parser.yy
> @@ -1953,11 +1953,16 @@ basic_interface_block:
> * the same language versions, we don't have to explicitly
> * version-check both things.
> */
> - if (block->instance_name != NULL
> - && !(state->language_version == 300 && state->es_shader)) {
> - _mesa_glsl_error(& @1, state,
> - "#version 300 es required for using uniform "
> - "blocks with an instance name\n");
> + if (block->instance_name != NULL) {
> + if(state->es_shader && state->language_version < 300) {
> + _mesa_glsl_error(& @1, state,
> + "#version 300 es required for using uniform "
> + "blocks with an instance name\n");
> + } else if (!state->es_shader && state->language_version < 150) {
> + _mesa_glsl_error(& @1, state,
> + "#version 150 required for using uniform "
> + "blocks with an instance name\n");
> + }
> }
>
> unsigned interface_type_mask, interface_type_flags;
This looks fine, but you could simplify it if you like:
if (block->instance_name != NULL) {
state->check_version(150, 300, & @1, "uniform blocks with "
"an instance name are not allowed");
}
which should produce the error message:
"uniform blocks with an instance name are not allowed in GLSL 1.40 (GLSL
1.50 or GLSL 3.00 ES required)."
Just a bit less code.
More information about the mesa-dev
mailing list