Re: [Mesa-dev] [PATCH 6/7] mesa: add a GLES3.2 enums section, and expose new MS line width params

2016-08-31 Thread Ian Romanick
On 08/29/2016 11:24 AM, Ilia Mirkin wrote:
> On Sun, Aug 28, 2016 at 10:10 PM, Ilia Mirkin  wrote:
>> This also exposes them for ARB_ES3_2_compatibility.
>>
>> Signed-off-by: Ilia Mirkin 
>> ---
>>  src/mesa/main/context.h | 10 ++
>>  src/mesa/main/get.c | 26 --
>>  src/mesa/main/get_hash_generator.py | 12 
>>  src/mesa/main/get_hash_params.py|  5 +
>>  4 files changed, 43 insertions(+), 10 deletions(-)
>>
>> diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
>> index 4cd149d..520b3bb 100644
>> --- a/src/mesa/main/context.h
>> +++ b/src/mesa/main/context.h
>> @@ -318,6 +318,16 @@ _mesa_is_gles31(const struct gl_context *ctx)
>>
>>
>>  /**
>> + * Checks if the context is for GLES 3.2 or later
>> + */
>> +static inline bool
>> +_mesa_is_gles32(const struct gl_context *ctx)
>> +{
>> +   return ctx->API == API_OPENGLES2 && ctx->Version >= 32;
>> +}
>> +
>> +
>> +/**
>>   * Checks if the context supports geometry shaders.
>>   */
>>  static inline bool
>> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
>> index 810ccb9..3cabb2b 100644
>> --- a/src/mesa/main/get.c
>> +++ b/src/mesa/main/get.c
>> @@ -142,6 +142,7 @@ enum value_extra {
>> EXTRA_API_ES2,
>> EXTRA_API_ES3,
>> EXTRA_API_ES31,
>> +   EXTRA_API_ES32,
>> EXTRA_NEW_BUFFERS,
>> EXTRA_NEW_FRAG_CLAMP,
>> EXTRA_VALID_DRAW_BUFFER,
>> @@ -416,6 +417,12 @@ static const int 
>> extra_ARB_gpu_shader5_or_OES_sample_variables[] = {
>> EXTRA_END
>>  };
>>
>> +static const int extra_ES32[] = {
>> +   EXT(ARB_ES3_2_compatibility),
>> +   EXTRA_API_ES32,
>> +   EXTRA_END
>> +};
>> +
>>  EXTRA_EXT(ARB_texture_cube_map);
>>  EXTRA_EXT(EXT_texture_array);
>>  EXTRA_EXT(NV_fog_distance);
>> @@ -1164,6 +1171,11 @@ check_extra(struct gl_context *ctx, const char *func, 
>> const struct value_desc *d
>>   if (_mesa_is_gles31(ctx))
>>  api_found = GL_TRUE;
>>  break;
>> +  case EXTRA_API_ES32:
>> + api_check = GL_TRUE;
>> + if (_mesa_is_gles32(ctx))
>> +api_found = GL_TRUE;
>> +break;
>>case EXTRA_API_GL:
>>   api_check = GL_TRUE;
>>   if (_mesa_is_desktop_gl(ctx))
>> @@ -1312,12 +1324,14 @@ find_value(const char *func, GLenum pname, void **p, 
>> union value *v)
>>  * value since it's compatible with GLES2 its entry in table_set[] is at 
>> the
>>  * end.
>>  */
>> -   STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 3);
>> -   if (_mesa_is_gles3(ctx)) {
>> -  api = API_OPENGL_LAST + 1;
>> -   }
>> -   if (_mesa_is_gles31(ctx)) {
>> -  api = API_OPENGL_LAST + 2;
>> +   STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 4);
>> +   if (ctx->API == API_OPENGLES2) {
>> +  if (ctx->Version >= 32)
>> + api = API_OPENGL_LAST + 3;
>> +  else if (ctx->Version >= 31)
>> + api = API_OPENGL_LAST + 2;
>> +  else if (ctx->Version >= 30)
>> + api = API_OPENGL_LAST + 1;
>> }
>> mask = ARRAY_SIZE(table(api)) - 1;
>> hash = (pname * prime_factor);
>> diff --git a/src/mesa/main/get_hash_generator.py 
>> b/src/mesa/main/get_hash_generator.py
>> index c777b78..a8b4647 100644
>> --- a/src/mesa/main/get_hash_generator.py
>> +++ b/src/mesa/main/get_hash_generator.py
>> @@ -44,7 +44,7 @@ prime_factor = 89
>>  prime_step = 281
>>  hash_table_size = 1024
>>
>> -gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3", "GLES31"])
>> +gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3", "GLES31", "GLES32"])
>>
>>  def print_header():
>> print "typedef const unsigned short table_t[%d];\n" % (hash_table_size)
>> @@ -69,6 +69,7 @@ api_enum = [
>> 'GL_CORE',
>> 'GLES3', # Not in gl_api enum in mtypes.h
>> 'GLES31', # Not in gl_api enum in mtypes.h
>> +   'GLES32', # Not in gl_api enum in mtypes.h
>>  ]
>>
>>  def api_index(api):
>> @@ -168,13 +169,15 @@ def generate_hash_tables(enum_list, enabled_apis, 
>> param_descriptors):
>>
>>   for api in valid_apis:
>>  add_to_hash_table(tables[api], hash_val, len(params))
>> -# Also add GLES2 items to the GLES3 and GLES31 hash table
>> +# Also add GLES2 items to the GLES3+ hash tables
>>  if api == "GLES2":
>> add_to_hash_table(tables["GLES3"], hash_val, len(params))
>> add_to_hash_table(tables["GLES31"], hash_val, len(params))
>> -# Also add GLES3 items to the GLES31 hash table
>> +   add_to_hash_table(tables["GLES32"], hash_val, len(params))
>> +# Also add GLES3 items to the GLES31+ hash tables
>>  if api == "GLES3":
>> add_to_hash_table(tables["GLES31"], hash_val, len(params))
>> +   add_to_hash_table(tables["GLES32"], hash_val, len(params))
> 
> This is missing:
> 
> +if api == "GLES31":
> +   

Re: [Mesa-dev] [PATCH 6/7] mesa: add a GLES3.2 enums section, and expose new MS line width params

2016-08-29 Thread Ilia Mirkin
On Sun, Aug 28, 2016 at 10:10 PM, Ilia Mirkin  wrote:
> This also exposes them for ARB_ES3_2_compatibility.
>
> Signed-off-by: Ilia Mirkin 
> ---
>  src/mesa/main/context.h | 10 ++
>  src/mesa/main/get.c | 26 --
>  src/mesa/main/get_hash_generator.py | 12 
>  src/mesa/main/get_hash_params.py|  5 +
>  4 files changed, 43 insertions(+), 10 deletions(-)
>
> diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
> index 4cd149d..520b3bb 100644
> --- a/src/mesa/main/context.h
> +++ b/src/mesa/main/context.h
> @@ -318,6 +318,16 @@ _mesa_is_gles31(const struct gl_context *ctx)
>
>
>  /**
> + * Checks if the context is for GLES 3.2 or later
> + */
> +static inline bool
> +_mesa_is_gles32(const struct gl_context *ctx)
> +{
> +   return ctx->API == API_OPENGLES2 && ctx->Version >= 32;
> +}
> +
> +
> +/**
>   * Checks if the context supports geometry shaders.
>   */
>  static inline bool
> diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
> index 810ccb9..3cabb2b 100644
> --- a/src/mesa/main/get.c
> +++ b/src/mesa/main/get.c
> @@ -142,6 +142,7 @@ enum value_extra {
> EXTRA_API_ES2,
> EXTRA_API_ES3,
> EXTRA_API_ES31,
> +   EXTRA_API_ES32,
> EXTRA_NEW_BUFFERS,
> EXTRA_NEW_FRAG_CLAMP,
> EXTRA_VALID_DRAW_BUFFER,
> @@ -416,6 +417,12 @@ static const int 
> extra_ARB_gpu_shader5_or_OES_sample_variables[] = {
> EXTRA_END
>  };
>
> +static const int extra_ES32[] = {
> +   EXT(ARB_ES3_2_compatibility),
> +   EXTRA_API_ES32,
> +   EXTRA_END
> +};
> +
>  EXTRA_EXT(ARB_texture_cube_map);
>  EXTRA_EXT(EXT_texture_array);
>  EXTRA_EXT(NV_fog_distance);
> @@ -1164,6 +1171,11 @@ check_extra(struct gl_context *ctx, const char *func, 
> const struct value_desc *d
>   if (_mesa_is_gles31(ctx))
>  api_found = GL_TRUE;
>  break;
> +  case EXTRA_API_ES32:
> + api_check = GL_TRUE;
> + if (_mesa_is_gles32(ctx))
> +api_found = GL_TRUE;
> +break;
>case EXTRA_API_GL:
>   api_check = GL_TRUE;
>   if (_mesa_is_desktop_gl(ctx))
> @@ -1312,12 +1324,14 @@ find_value(const char *func, GLenum pname, void **p, 
> union value *v)
>  * value since it's compatible with GLES2 its entry in table_set[] is at 
> the
>  * end.
>  */
> -   STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 3);
> -   if (_mesa_is_gles3(ctx)) {
> -  api = API_OPENGL_LAST + 1;
> -   }
> -   if (_mesa_is_gles31(ctx)) {
> -  api = API_OPENGL_LAST + 2;
> +   STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 4);
> +   if (ctx->API == API_OPENGLES2) {
> +  if (ctx->Version >= 32)
> + api = API_OPENGL_LAST + 3;
> +  else if (ctx->Version >= 31)
> + api = API_OPENGL_LAST + 2;
> +  else if (ctx->Version >= 30)
> + api = API_OPENGL_LAST + 1;
> }
> mask = ARRAY_SIZE(table(api)) - 1;
> hash = (pname * prime_factor);
> diff --git a/src/mesa/main/get_hash_generator.py 
> b/src/mesa/main/get_hash_generator.py
> index c777b78..a8b4647 100644
> --- a/src/mesa/main/get_hash_generator.py
> +++ b/src/mesa/main/get_hash_generator.py
> @@ -44,7 +44,7 @@ prime_factor = 89
>  prime_step = 281
>  hash_table_size = 1024
>
> -gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3", "GLES31"])
> +gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3", "GLES31", "GLES32"])
>
>  def print_header():
> print "typedef const unsigned short table_t[%d];\n" % (hash_table_size)
> @@ -69,6 +69,7 @@ api_enum = [
> 'GL_CORE',
> 'GLES3', # Not in gl_api enum in mtypes.h
> 'GLES31', # Not in gl_api enum in mtypes.h
> +   'GLES32', # Not in gl_api enum in mtypes.h
>  ]
>
>  def api_index(api):
> @@ -168,13 +169,15 @@ def generate_hash_tables(enum_list, enabled_apis, 
> param_descriptors):
>
>   for api in valid_apis:
>  add_to_hash_table(tables[api], hash_val, len(params))
> -# Also add GLES2 items to the GLES3 and GLES31 hash table
> +# Also add GLES2 items to the GLES3+ hash tables
>  if api == "GLES2":
> add_to_hash_table(tables["GLES3"], hash_val, len(params))
> add_to_hash_table(tables["GLES31"], hash_val, len(params))
> -# Also add GLES3 items to the GLES31 hash table
> +   add_to_hash_table(tables["GLES32"], hash_val, len(params))
> +# Also add GLES3 items to the GLES31+ hash tables
>  if api == "GLES3":
> add_to_hash_table(tables["GLES31"], hash_val, len(params))
> +   add_to_hash_table(tables["GLES32"], hash_val, len(params))

This is missing:

+if api == "GLES31":
+   add_to_hash_table(tables["GLES32"], hash_val, len(params))

Oops.

>   params.append(["GL_" + enum_name, param[1]])
>
> sorted_tables={}
> @@ -210,7 +213,8 @@ if __name__ == '__main__':
>

[Mesa-dev] [PATCH 6/7] mesa: add a GLES3.2 enums section, and expose new MS line width params

2016-08-28 Thread Ilia Mirkin
This also exposes them for ARB_ES3_2_compatibility.

Signed-off-by: Ilia Mirkin 
---
 src/mesa/main/context.h | 10 ++
 src/mesa/main/get.c | 26 --
 src/mesa/main/get_hash_generator.py | 12 
 src/mesa/main/get_hash_params.py|  5 +
 4 files changed, 43 insertions(+), 10 deletions(-)

diff --git a/src/mesa/main/context.h b/src/mesa/main/context.h
index 4cd149d..520b3bb 100644
--- a/src/mesa/main/context.h
+++ b/src/mesa/main/context.h
@@ -318,6 +318,16 @@ _mesa_is_gles31(const struct gl_context *ctx)
 
 
 /**
+ * Checks if the context is for GLES 3.2 or later
+ */
+static inline bool
+_mesa_is_gles32(const struct gl_context *ctx)
+{
+   return ctx->API == API_OPENGLES2 && ctx->Version >= 32;
+}
+
+
+/**
  * Checks if the context supports geometry shaders.
  */
 static inline bool
diff --git a/src/mesa/main/get.c b/src/mesa/main/get.c
index 810ccb9..3cabb2b 100644
--- a/src/mesa/main/get.c
+++ b/src/mesa/main/get.c
@@ -142,6 +142,7 @@ enum value_extra {
EXTRA_API_ES2,
EXTRA_API_ES3,
EXTRA_API_ES31,
+   EXTRA_API_ES32,
EXTRA_NEW_BUFFERS, 
EXTRA_NEW_FRAG_CLAMP,
EXTRA_VALID_DRAW_BUFFER,
@@ -416,6 +417,12 @@ static const int 
extra_ARB_gpu_shader5_or_OES_sample_variables[] = {
EXTRA_END
 };
 
+static const int extra_ES32[] = {
+   EXT(ARB_ES3_2_compatibility),
+   EXTRA_API_ES32,
+   EXTRA_END
+};
+
 EXTRA_EXT(ARB_texture_cube_map);
 EXTRA_EXT(EXT_texture_array);
 EXTRA_EXT(NV_fog_distance);
@@ -1164,6 +1171,11 @@ check_extra(struct gl_context *ctx, const char *func, 
const struct value_desc *d
  if (_mesa_is_gles31(ctx))
 api_found = GL_TRUE;
 break;
+  case EXTRA_API_ES32:
+ api_check = GL_TRUE;
+ if (_mesa_is_gles32(ctx))
+api_found = GL_TRUE;
+break;
   case EXTRA_API_GL:
  api_check = GL_TRUE;
  if (_mesa_is_desktop_gl(ctx))
@@ -1312,12 +1324,14 @@ find_value(const char *func, GLenum pname, void **p, 
union value *v)
 * value since it's compatible with GLES2 its entry in table_set[] is at the
 * end.
 */
-   STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 3);
-   if (_mesa_is_gles3(ctx)) {
-  api = API_OPENGL_LAST + 1;
-   }
-   if (_mesa_is_gles31(ctx)) {
-  api = API_OPENGL_LAST + 2;
+   STATIC_ASSERT(ARRAY_SIZE(table_set) == API_OPENGL_LAST + 4);
+   if (ctx->API == API_OPENGLES2) {
+  if (ctx->Version >= 32)
+ api = API_OPENGL_LAST + 3;
+  else if (ctx->Version >= 31)
+ api = API_OPENGL_LAST + 2;
+  else if (ctx->Version >= 30)
+ api = API_OPENGL_LAST + 1;
}
mask = ARRAY_SIZE(table(api)) - 1;
hash = (pname * prime_factor);
diff --git a/src/mesa/main/get_hash_generator.py 
b/src/mesa/main/get_hash_generator.py
index c777b78..a8b4647 100644
--- a/src/mesa/main/get_hash_generator.py
+++ b/src/mesa/main/get_hash_generator.py
@@ -44,7 +44,7 @@ prime_factor = 89
 prime_step = 281
 hash_table_size = 1024
 
-gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3", "GLES31"])
+gl_apis=set(["GL", "GL_CORE", "GLES", "GLES2", "GLES3", "GLES31", "GLES32"])
 
 def print_header():
print "typedef const unsigned short table_t[%d];\n" % (hash_table_size)
@@ -69,6 +69,7 @@ api_enum = [
'GL_CORE',
'GLES3', # Not in gl_api enum in mtypes.h
'GLES31', # Not in gl_api enum in mtypes.h
+   'GLES32', # Not in gl_api enum in mtypes.h
 ]
 
 def api_index(api):
@@ -168,13 +169,15 @@ def generate_hash_tables(enum_list, enabled_apis, 
param_descriptors):
 
  for api in valid_apis:
 add_to_hash_table(tables[api], hash_val, len(params))
-# Also add GLES2 items to the GLES3 and GLES31 hash table
+# Also add GLES2 items to the GLES3+ hash tables
 if api == "GLES2":
add_to_hash_table(tables["GLES3"], hash_val, len(params))
add_to_hash_table(tables["GLES31"], hash_val, len(params))
-# Also add GLES3 items to the GLES31 hash table
+   add_to_hash_table(tables["GLES32"], hash_val, len(params))
+# Also add GLES3 items to the GLES31+ hash tables
 if api == "GLES3":
add_to_hash_table(tables["GLES31"], hash_val, len(params))
+   add_to_hash_table(tables["GLES32"], hash_val, len(params))
  params.append(["GL_" + enum_name, param[1]])
 
sorted_tables={}
@@ -210,7 +213,8 @@ if __name__ == '__main__':
   die("missing descriptor file (-f)\n")
 
# generate the code for all APIs
-   enabled_apis = set(["GLES", "GLES2", "GLES3", "GLES31", "GL", "GL_CORE"])
+   enabled_apis = set(["GLES", "GLES2", "GLES3", "GLES31", "GLES32",
+   "GL", "GL_CORE"])
 
try:
   api_desc = gl_XML.parse_GL_API(api_desc_file)
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index a206c85..0ff2af9 100644
---