Re: [Mesa-dev] [PATCH] glsl: subroutine types cannot be compared

2016-07-22 Thread Andres Gomez
On Fri, 2016-07-22 at 06:07 +1000, Dave Airlie wrote:
> > 
> > On Mon, 2016-07-18 at 16:39 +0300, Andres Gomez wrote:
> > > subroutine variables are to be used just in the way functions are
> > > called. Although the spec doesn't say it explicitely, this means that
> > > these variables are not to be used in any other way than those left
> > > for function calls. Therefore, a comparison between 2 subroutine
> > > variables should also cause a compilation error.
> > > 
> > > From The OpenGL® Shading Language 4.40, page 117:
> > > 
> > >   "  To use subroutines, a subroutine type is declared, one or more
> > >  functions are associated with that subroutine type, and a
> > >  subroutine variable of that type is declared. The function
> > >  currently assigned to the variable function is then called by
> > >  using function calling syntax replacing a function name with the
> > >  name of the subroutine variable. Subroutine variables are
> > >  uniforms, and are assigned to specific functions only through
> > >  commands (UniformSubroutinesuiv) in the OpenGL API."
> > > 
> > > From The OpenGL® Shading Language 4.40, page 118:
> > > 
> > >   "  Subroutine uniform variables are called the same way functions
> > >  are called. When a subroutine variable (or an element of a
> > >  subroutine variable array) is associated with a particular
> > >  function, all function calls through that variable will call that
> > >  particular function."
> > > 
> > > Fixes 
> > > GL44-CTS.shader_subroutine.subroutines_cannot_be_assigned_float_int_values_or_be_compared
> > > 
> > > Signed-off-by: Andres Gomez 
> 
> I prefer this one, please push it with Ian's r-b, and consider my one 
> withdrawn.
> 
> Reviewed-by: Dave Airlie 

Thanks, Dave.

Already pushed!
-- 

Br,

Andres
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: subroutine types cannot be compared

2016-07-21 Thread Dave Airlie
> On Mon, 2016-07-18 at 16:39 +0300, Andres Gomez wrote:
>> subroutine variables are to be used just in the way functions are
>> called. Although the spec doesn't say it explicitely, this means that
>> these variables are not to be used in any other way than those left
>> for function calls. Therefore, a comparison between 2 subroutine
>> variables should also cause a compilation error.
>>
>> From The OpenGL® Shading Language 4.40, page 117:
>>
>>   "  To use subroutines, a subroutine type is declared, one or more
>>  functions are associated with that subroutine type, and a
>>  subroutine variable of that type is declared. The function
>>  currently assigned to the variable function is then called by
>>  using function calling syntax replacing a function name with the
>>  name of the subroutine variable. Subroutine variables are
>>  uniforms, and are assigned to specific functions only through
>>  commands (UniformSubroutinesuiv) in the OpenGL API."
>>
>> From The OpenGL® Shading Language 4.40, page 118:
>>
>>   "  Subroutine uniform variables are called the same way functions
>>  are called. When a subroutine variable (or an element of a
>>  subroutine variable array) is associated with a particular
>>  function, all function calls through that variable will call that
>>  particular function."
>>
>> Fixes 
>> GL44-CTS.shader_subroutine.subroutines_cannot_be_assigned_float_int_values_or_be_compared
>>
>> Signed-off-by: Andres Gomez 

I prefer this one, please push it with Ian's r-b, and consider my one withdrawn.

Reviewed-by: Dave Airlie 

Dave.
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: subroutine types cannot be compared

2016-07-19 Thread Andres Gomez
Dropping this patch. It seems I overlooked:
https://lists.freedesktop.org/archives/mesa-dev/2016-June/119616.html

On Mon, 2016-07-18 at 16:39 +0300, Andres Gomez wrote:
> subroutine variables are to be used just in the way functions are
> called. Although the spec doesn't say it explicitely, this means that
> these variables are not to be used in any other way than those left
> for function calls. Therefore, a comparison between 2 subroutine
> variables should also cause a compilation error.
> 
> From The OpenGL® Shading Language 4.40, page 117:
> 
>   "  To use subroutines, a subroutine type is declared, one or more
>  functions are associated with that subroutine type, and a
>  subroutine variable of that type is declared. The function
>  currently assigned to the variable function is then called by
>  using function calling syntax replacing a function name with the
>  name of the subroutine variable. Subroutine variables are
>  uniforms, and are assigned to specific functions only through
>  commands (UniformSubroutinesuiv) in the OpenGL API."
> 
> From The OpenGL® Shading Language 4.40, page 118:
> 
>   "  Subroutine uniform variables are called the same way functions
>  are called. When a subroutine variable (or an element of a
>  subroutine variable array) is associated with a particular
>  function, all function calls through that variable will call that
>  particular function."
> 
> Fixes 
> GL44-CTS.shader_subroutine.subroutines_cannot_be_assigned_float_int_values_or_be_compared
> 
> Signed-off-by: Andres Gomez 
> ---
>  src/compiler/glsl/ast_to_hir.cpp | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp 
> b/src/compiler/glsl/ast_to_hir.cpp
> index 8ddc084..e255d63 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -1494,6 +1494,10 @@ ast_expression::do_hir(exec_list *instructions,
>   !state->check_version(120, 300, ,
> "array comparisons forbidden")) {
>   error_emitted = true;
> +  } else if ((op[0]->type->contains_subroutine() ||
> +  op[1]->type->contains_subroutine())) {
> + _mesa_glsl_error(, state, "subroutine comparisons forbidden");
> + error_emitted = true;
>} else if ((op[0]->type->contains_opaque() ||
>op[1]->type->contains_opaque())) {
>   _mesa_glsl_error(, state, "opaque type comparisons forbidden");
-- 

Br,

Andres
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


Re: [Mesa-dev] [PATCH] glsl: subroutine types cannot be compared

2016-07-18 Thread Iago Toral
Reviewed-by: Iago Toral Quiroga 


On Mon, 2016-07-18 at 16:39 +0300, Andres Gomez wrote:
> subroutine variables are to be used just in the way functions are
> called. Although the spec doesn't say it explicitely, this means that
> these variables are not to be used in any other way than those left
> for function calls. Therefore, a comparison between 2 subroutine
> variables should also cause a compilation error.
> 
> From The OpenGL® Shading Language 4.40, page 117:
> 
>   "  To use subroutines, a subroutine type is declared, one or more
>  functions are associated with that subroutine type, and a
>  subroutine variable of that type is declared. The function
>  currently assigned to the variable function is then called by
>  using function calling syntax replacing a function name with the
>  name of the subroutine variable. Subroutine variables are
>  uniforms, and are assigned to specific functions only through
>  commands (UniformSubroutinesuiv) in the OpenGL API."
> 
> From The OpenGL® Shading Language 4.40, page 118:
> 
>   "  Subroutine uniform variables are called the same way functions
>  are called. When a subroutine variable (or an element of a
>  subroutine variable array) is associated with a particular
>  function, all function calls through that variable will call
> that
>  particular function."
> 
> Fixes GL44-
> CTS.shader_subroutine.subroutines_cannot_be_assigned_float_int_values
> _or_be_compared
> 
> Signed-off-by: Andres Gomez 
> ---
>  src/compiler/glsl/ast_to_hir.cpp | 4 
>  1 file changed, 4 insertions(+)
> 
> diff --git a/src/compiler/glsl/ast_to_hir.cpp
> b/src/compiler/glsl/ast_to_hir.cpp
> index 8ddc084..e255d63 100644
> --- a/src/compiler/glsl/ast_to_hir.cpp
> +++ b/src/compiler/glsl/ast_to_hir.cpp
> @@ -1494,6 +1494,10 @@ ast_expression::do_hir(exec_list
> *instructions,
>   !state->check_version(120, 300, ,
> "array comparisons
> forbidden")) {
>   error_emitted = true;
> +  } else if ((op[0]->type->contains_subroutine() ||
> +  op[1]->type->contains_subroutine())) {
> + _mesa_glsl_error(, state, "subroutine comparisons
> forbidden");
> + error_emitted = true;
>    } else if ((op[0]->type->contains_opaque() ||
>    op[1]->type->contains_opaque())) {
>   _mesa_glsl_error(, state, "opaque type comparisons
> forbidden");
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev