Re: [Mesa-dev] [PATCH] mesa: add GL_OES_gpu_shader5 and GL_EXT_gpu_shader5 support

2016-02-26 Thread Samuel Iglesias Gonsálvez

On 2016-02-26 15:32, Ilia Mirkin wrote:

On Fri, Feb 26, 2016 at 6:55 AM, Samuel Iglesias Gonsálvez
 wrote:

On Fri, Feb 19, 2016 at 07:10:24PM -0500, Ilia Mirkin wrote:
The two extensions are identical, and are largely taking bits of 
already

existing desktop functionality. We continue to do a poor job of
supporting the 'precise' keyword, just like we do on desktop.

This passes the relevant dEQP tests that I could find.

Signed-off-by: Ilia Mirkin 
---
 docs/GL3.txt |  2 +-
 src/compiler/glsl/ast_array_index.cpp| 20 +--
 src/compiler/glsl/builtin_functions.cpp  | 99 
+++-

 src/compiler/glsl/glcpp/glcpp-parse.y|  4 ++
 src/compiler/glsl/glsl_lexer.ll  |  2 +-
 src/compiler/glsl/glsl_parser_extras.cpp |  2 +
 src/compiler/glsl/glsl_parser_extras.h   |  4 ++
 src/mesa/main/extensions_table.h |  2 +
 8 files changed, 88 insertions(+), 47 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 2e528d4..e7d40de 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -245,7 +245,7 @@ GLES3.2, GLSL ES 3.2
   GL_OES_draw_buffers_indexed  not started
   GL_OES_draw_elements_base_vertex DONE (all 
drivers)
   GL_OES_geometry_shader   started 
(Marta)
-  GL_OES_gpu_shader5   not started 
(based on parts of GL_ARB_gpu_shader5, which is done for some 
drivers)
+  GL_OES_gpu_shader5   DONE (all 
drivers that support GL_ARB_gpu_shader5)

   GL_OES_primitive_bounding boxnot started
   GL_OES_sample_shadingDONE (nvc0, 
r600, radeonsi)
   GL_OES_sample_variables  DONE (nvc0, 
r600, radeonsi)
diff --git a/src/compiler/glsl/ast_array_index.cpp 
b/src/compiler/glsl/ast_array_index.cpp

index f5baeb9..af5e89e 100644
--- a/src/compiler/glsl/ast_array_index.cpp
+++ b/src/compiler/glsl/ast_array_index.cpp
@@ -236,13 +236,22 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
 _mesa_glsl_error(, state, "unsized array index must 
be constant");

  }
   } else if (array->type->without_array()->is_interface()
- && (array->variable_referenced()->data.mode == 
ir_var_uniform ||
- array->variable_referenced()->data.mode == 
ir_var_shader_storage)
- && !state->is_version(400, 0) && 
!state->ARB_gpu_shader5_enable) {
+ && ((array->variable_referenced()->data.mode == 
ir_var_uniform

+  && !state->is_version(400, 320)
+  && !state->ARB_gpu_shader5_enable
+  && !state->EXT_gpu_shader5_enable
+  && !state->OES_gpu_shader5_enable) ||
+ (array->variable_referenced()->data.mode == 
ir_var_shader_storage

+  && !state->is_version(400, 0)
+  && !state->ARB_gpu_shader5_enable))) {
   /* Page 50 in section 4.3.9 of the OpenGL ES 3.10 spec says:
*
* "All indices used to index a uniform or shader storage 
block

* array must be constant integral expressions."
+  *
+  * But OES_gpu_shader5 (and ESSL 3.20) relax this to allow 
indexing

+  * on uniform blocks but not shader storage blocks.
+  *


Indention here.


This file is a sad mix of tabs and spaces. Should I use tabs instead
like the other lines do? Fix the other lines?



I prefer to fix the other lines of the comment.

Thanks!

Sam



Other than that,

Reviewed-by: Samuel Iglesias Gonsálvez 


Thanks!

  -ilia

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


Re: [Mesa-dev] [PATCH] mesa: add GL_OES_gpu_shader5 and GL_EXT_gpu_shader5 support

2016-02-26 Thread Ilia Mirkin
On Fri, Feb 26, 2016 at 6:55 AM, Samuel Iglesias Gonsálvez
 wrote:
> On Fri, Feb 19, 2016 at 07:10:24PM -0500, Ilia Mirkin wrote:
>> The two extensions are identical, and are largely taking bits of already
>> existing desktop functionality. We continue to do a poor job of
>> supporting the 'precise' keyword, just like we do on desktop.
>>
>> This passes the relevant dEQP tests that I could find.
>>
>> Signed-off-by: Ilia Mirkin 
>> ---
>>  docs/GL3.txt |  2 +-
>>  src/compiler/glsl/ast_array_index.cpp| 20 +--
>>  src/compiler/glsl/builtin_functions.cpp  | 99 
>> +++-
>>  src/compiler/glsl/glcpp/glcpp-parse.y|  4 ++
>>  src/compiler/glsl/glsl_lexer.ll  |  2 +-
>>  src/compiler/glsl/glsl_parser_extras.cpp |  2 +
>>  src/compiler/glsl/glsl_parser_extras.h   |  4 ++
>>  src/mesa/main/extensions_table.h |  2 +
>>  8 files changed, 88 insertions(+), 47 deletions(-)
>>
>> diff --git a/docs/GL3.txt b/docs/GL3.txt
>> index 2e528d4..e7d40de 100644
>> --- a/docs/GL3.txt
>> +++ b/docs/GL3.txt
>> @@ -245,7 +245,7 @@ GLES3.2, GLSL ES 3.2
>>GL_OES_draw_buffers_indexed  not started
>>GL_OES_draw_elements_base_vertex DONE (all drivers)
>>GL_OES_geometry_shader   started (Marta)
>> -  GL_OES_gpu_shader5   not started (based 
>> on parts of GL_ARB_gpu_shader5, which is done for some drivers)
>> +  GL_OES_gpu_shader5   DONE (all drivers 
>> that support GL_ARB_gpu_shader5)
>>GL_OES_primitive_bounding boxnot started
>>GL_OES_sample_shadingDONE (nvc0, r600, 
>> radeonsi)
>>GL_OES_sample_variables  DONE (nvc0, r600, 
>> radeonsi)
>> diff --git a/src/compiler/glsl/ast_array_index.cpp 
>> b/src/compiler/glsl/ast_array_index.cpp
>> index f5baeb9..af5e89e 100644
>> --- a/src/compiler/glsl/ast_array_index.cpp
>> +++ b/src/compiler/glsl/ast_array_index.cpp
>> @@ -236,13 +236,22 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
>>  _mesa_glsl_error(, state, "unsized array index must be 
>> constant");
>>   }
>>} else if (array->type->without_array()->is_interface()
>> - && (array->variable_referenced()->data.mode == 
>> ir_var_uniform ||
>> - array->variable_referenced()->data.mode == 
>> ir_var_shader_storage)
>> - && !state->is_version(400, 0) && 
>> !state->ARB_gpu_shader5_enable) {
>> + && ((array->variable_referenced()->data.mode == 
>> ir_var_uniform
>> +  && !state->is_version(400, 320)
>> +  && !state->ARB_gpu_shader5_enable
>> +  && !state->EXT_gpu_shader5_enable
>> +  && !state->OES_gpu_shader5_enable) ||
>> + (array->variable_referenced()->data.mode == 
>> ir_var_shader_storage
>> +  && !state->is_version(400, 0)
>> +  && !state->ARB_gpu_shader5_enable))) {
>>/* Page 50 in section 4.3.9 of the OpenGL ES 3.10 spec says:
>> *
>> * "All indices used to index a uniform or shader storage block
>> * array must be constant integral expressions."
>> +  *
>> +  * But OES_gpu_shader5 (and ESSL 3.20) relax this to allow indexing
>> +  * on uniform blocks but not shader storage blocks.
>> +  *
>
> Indention here.

This file is a sad mix of tabs and spaces. Should I use tabs instead
like the other lines do? Fix the other lines?

>
> Other than that,
>
> Reviewed-by: Samuel Iglesias Gonsálvez 

Thanks!

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


Re: [Mesa-dev] [PATCH] mesa: add GL_OES_gpu_shader5 and GL_EXT_gpu_shader5 support

2016-02-26 Thread Samuel Iglesias Gonsálvez
On Fri, Feb 19, 2016 at 07:10:24PM -0500, Ilia Mirkin wrote:
> The two extensions are identical, and are largely taking bits of already
> existing desktop functionality. We continue to do a poor job of
> supporting the 'precise' keyword, just like we do on desktop.
> 
> This passes the relevant dEQP tests that I could find.
> 
> Signed-off-by: Ilia Mirkin 
> ---
>  docs/GL3.txt |  2 +-
>  src/compiler/glsl/ast_array_index.cpp| 20 +--
>  src/compiler/glsl/builtin_functions.cpp  | 99 
> +++-
>  src/compiler/glsl/glcpp/glcpp-parse.y|  4 ++
>  src/compiler/glsl/glsl_lexer.ll  |  2 +-
>  src/compiler/glsl/glsl_parser_extras.cpp |  2 +
>  src/compiler/glsl/glsl_parser_extras.h   |  4 ++
>  src/mesa/main/extensions_table.h |  2 +
>  8 files changed, 88 insertions(+), 47 deletions(-)
> 
> diff --git a/docs/GL3.txt b/docs/GL3.txt
> index 2e528d4..e7d40de 100644
> --- a/docs/GL3.txt
> +++ b/docs/GL3.txt
> @@ -245,7 +245,7 @@ GLES3.2, GLSL ES 3.2
>GL_OES_draw_buffers_indexed  not started
>GL_OES_draw_elements_base_vertex DONE (all drivers)
>GL_OES_geometry_shader   started (Marta)
> -  GL_OES_gpu_shader5   not started (based on 
> parts of GL_ARB_gpu_shader5, which is done for some drivers)
> +  GL_OES_gpu_shader5   DONE (all drivers 
> that support GL_ARB_gpu_shader5)
>GL_OES_primitive_bounding boxnot started
>GL_OES_sample_shadingDONE (nvc0, r600, 
> radeonsi)
>GL_OES_sample_variables  DONE (nvc0, r600, 
> radeonsi)
> diff --git a/src/compiler/glsl/ast_array_index.cpp 
> b/src/compiler/glsl/ast_array_index.cpp
> index f5baeb9..af5e89e 100644
> --- a/src/compiler/glsl/ast_array_index.cpp
> +++ b/src/compiler/glsl/ast_array_index.cpp
> @@ -236,13 +236,22 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
>  _mesa_glsl_error(, state, "unsized array index must be 
> constant");
>   }
>} else if (array->type->without_array()->is_interface()
> - && (array->variable_referenced()->data.mode == 
> ir_var_uniform ||
> - array->variable_referenced()->data.mode == 
> ir_var_shader_storage)
> - && !state->is_version(400, 0) && 
> !state->ARB_gpu_shader5_enable) {
> + && ((array->variable_referenced()->data.mode == 
> ir_var_uniform
> +  && !state->is_version(400, 320)
> +  && !state->ARB_gpu_shader5_enable
> +  && !state->EXT_gpu_shader5_enable
> +  && !state->OES_gpu_shader5_enable) ||
> + (array->variable_referenced()->data.mode == 
> ir_var_shader_storage
> +  && !state->is_version(400, 0)
> +  && !state->ARB_gpu_shader5_enable))) {
>/* Page 50 in section 4.3.9 of the OpenGL ES 3.10 spec says:
> *
> * "All indices used to index a uniform or shader storage block
> * array must be constant integral expressions."
> +  *
> +  * But OES_gpu_shader5 (and ESSL 3.20) relax this to allow indexing
> +  * on uniform blocks but not shader storage blocks.
> +  *

Indention here.

Other than that,

Reviewed-by: Samuel Iglesias Gonsálvez 

Sam

> */
>_mesa_glsl_error(, state, "%s block array index must be constant",
>array->variable_referenced()->data.mode
> @@ -279,7 +288,10 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
> * dynamically uniform expression is undefined.
> */
>if (array->type->without_array()->is_sampler()) {
> - if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) {
> + if (!state->is_version(400, 320) &&
> + !state->ARB_gpu_shader5_enable &&
> + !state->EXT_gpu_shader5_enable &&
> + !state->OES_gpu_shader5_enable) {
>  if (state->is_version(130, 300))
> _mesa_glsl_error(, state,
>  "sampler arrays indexed with non-constant "
> diff --git a/src/compiler/glsl/builtin_functions.cpp 
> b/src/compiler/glsl/builtin_functions.cpp
> index 6576650..b862da0 100644
> --- a/src/compiler/glsl/builtin_functions.cpp
> +++ b/src/compiler/glsl/builtin_functions.cpp
> @@ -240,6 +240,21 @@ gpu_shader5(const _mesa_glsl_parse_state *state)
>  }
>  
>  static bool
> +gpu_shader5_es(const _mesa_glsl_parse_state *state)
> +{
> +   return state->is_version(400, 320) ||
> +  state->ARB_gpu_shader5_enable ||
> +  state->EXT_gpu_shader5_enable ||
> +  state->OES_gpu_shader5_enable;
> +}
> +
> +static bool
> +es31_not_gs5(const _mesa_glsl_parse_state *state)
> +{
> +   

[Mesa-dev] [PATCH] mesa: add GL_OES_gpu_shader5 and GL_EXT_gpu_shader5 support

2016-02-19 Thread Ilia Mirkin
The two extensions are identical, and are largely taking bits of already
existing desktop functionality. We continue to do a poor job of
supporting the 'precise' keyword, just like we do on desktop.

This passes the relevant dEQP tests that I could find.

Signed-off-by: Ilia Mirkin 
---
 docs/GL3.txt |  2 +-
 src/compiler/glsl/ast_array_index.cpp| 20 +--
 src/compiler/glsl/builtin_functions.cpp  | 99 +++-
 src/compiler/glsl/glcpp/glcpp-parse.y|  4 ++
 src/compiler/glsl/glsl_lexer.ll  |  2 +-
 src/compiler/glsl/glsl_parser_extras.cpp |  2 +
 src/compiler/glsl/glsl_parser_extras.h   |  4 ++
 src/mesa/main/extensions_table.h |  2 +
 8 files changed, 88 insertions(+), 47 deletions(-)

diff --git a/docs/GL3.txt b/docs/GL3.txt
index 2e528d4..e7d40de 100644
--- a/docs/GL3.txt
+++ b/docs/GL3.txt
@@ -245,7 +245,7 @@ GLES3.2, GLSL ES 3.2
   GL_OES_draw_buffers_indexed  not started
   GL_OES_draw_elements_base_vertex DONE (all drivers)
   GL_OES_geometry_shader   started (Marta)
-  GL_OES_gpu_shader5   not started (based on 
parts of GL_ARB_gpu_shader5, which is done for some drivers)
+  GL_OES_gpu_shader5   DONE (all drivers that 
support GL_ARB_gpu_shader5)
   GL_OES_primitive_bounding boxnot started
   GL_OES_sample_shadingDONE (nvc0, r600, 
radeonsi)
   GL_OES_sample_variables  DONE (nvc0, r600, 
radeonsi)
diff --git a/src/compiler/glsl/ast_array_index.cpp 
b/src/compiler/glsl/ast_array_index.cpp
index f5baeb9..af5e89e 100644
--- a/src/compiler/glsl/ast_array_index.cpp
+++ b/src/compiler/glsl/ast_array_index.cpp
@@ -236,13 +236,22 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
 _mesa_glsl_error(, state, "unsized array index must be 
constant");
  }
   } else if (array->type->without_array()->is_interface()
- && (array->variable_referenced()->data.mode == ir_var_uniform 
||
- array->variable_referenced()->data.mode == 
ir_var_shader_storage)
- && !state->is_version(400, 0) && 
!state->ARB_gpu_shader5_enable) {
+ && ((array->variable_referenced()->data.mode == ir_var_uniform
+  && !state->is_version(400, 320)
+  && !state->ARB_gpu_shader5_enable
+  && !state->EXT_gpu_shader5_enable
+  && !state->OES_gpu_shader5_enable) ||
+ (array->variable_referenced()->data.mode == 
ir_var_shader_storage
+  && !state->is_version(400, 0)
+  && !state->ARB_gpu_shader5_enable))) {
 /* Page 50 in section 4.3.9 of the OpenGL ES 3.10 spec says:
  *
  * "All indices used to index a uniform or shader storage block
  * array must be constant integral expressions."
+  *
+  * But OES_gpu_shader5 (and ESSL 3.20) relax this to allow indexing
+  * on uniform blocks but not shader storage blocks.
+  *
  */
 _mesa_glsl_error(, state, "%s block array index must be constant",
   array->variable_referenced()->data.mode
@@ -279,7 +288,10 @@ _mesa_ast_array_index_to_hir(void *mem_ctx,
* dynamically uniform expression is undefined.
*/
   if (array->type->without_array()->is_sampler()) {
- if (!state->is_version(400, 0) && !state->ARB_gpu_shader5_enable) {
+ if (!state->is_version(400, 320) &&
+ !state->ARB_gpu_shader5_enable &&
+ !state->EXT_gpu_shader5_enable &&
+ !state->OES_gpu_shader5_enable) {
 if (state->is_version(130, 300))
_mesa_glsl_error(, state,
 "sampler arrays indexed with non-constant "
diff --git a/src/compiler/glsl/builtin_functions.cpp 
b/src/compiler/glsl/builtin_functions.cpp
index 6576650..b862da0 100644
--- a/src/compiler/glsl/builtin_functions.cpp
+++ b/src/compiler/glsl/builtin_functions.cpp
@@ -240,6 +240,21 @@ gpu_shader5(const _mesa_glsl_parse_state *state)
 }
 
 static bool
+gpu_shader5_es(const _mesa_glsl_parse_state *state)
+{
+   return state->is_version(400, 320) ||
+  state->ARB_gpu_shader5_enable ||
+  state->EXT_gpu_shader5_enable ||
+  state->OES_gpu_shader5_enable;
+}
+
+static bool
+es31_not_gs5(const _mesa_glsl_parse_state *state)
+{
+   return state->is_version(0, 310) && !gpu_shader5_es(state);
+}
+
+static bool
 gpu_shader5_or_es31(const _mesa_glsl_parse_state *state)
 {
return state->is_version(400, 310) || state->ARB_gpu_shader5_enable;
@@ -361,8 +376,10 @@ texture_gather_or_es31(const _mesa_glsl_parse_state *state)
 static bool
 texture_gather_only_or_es31(const _mesa_glsl_parse_state *state)