mesa: Implement GL_ANGLE_pack_reverse_row_order

Identical to GL_MESA_pack_invert in effect, just need to check for a
different enum value for GLES vs GL. The spec claims that "OpenGL 1.5 or
OpenGL ES 1.0 are required", but ReadPixels isn't a thing for ES1 so we
only enable it for ES2+.

Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3156>
diff --git a/src/mapi/glapi/gen/es_EXT.xml b/src/mapi/glapi/gen/es_EXT.xml
index dd987b8..4386375 100644
--- a/src/mapi/glapi/gen/es_EXT.xml
+++ b/src/mapi/glapi/gen/es_EXT.xml
@@ -819,6 +819,11 @@
 
 <xi:include href="EXT_multisampled_render_to_texture.xml" xmlns:xi="http://www.w3.org/2001/XInclude"/>
 
+<!-- 110. GL_ANGLE_pack_reverse_row_order -->
+<category name="GL_ANGLE_pack_reverse_row_order" number="110">
+    <enum name="PACK_REVERSE_ROW_ORDER_ANGLE"           value="0x93A4"/>
+</category>
+
 <!-- 111. GL_ANGLE_texture_compression_dxt -->
 <category name="GL_ANGLE_texture_compression_dxt" number="111">
     <enum name="COMPRESSED_RGBA_S3TC_DXT3_ANGLE"        value="0x83F2"/>
diff --git a/src/mesa/main/extensions_table.h b/src/mesa/main/extensions_table.h
index f7238c1..14b0b8d 100644
--- a/src/mesa/main/extensions_table.h
+++ b/src/mesa/main/extensions_table.h
@@ -27,6 +27,7 @@
 
 EXT(ANDROID_extension_pack_es31a            , ANDROID_extension_pack_es31a           ,  x ,  x ,  x ,  31, 2014)
 
+EXT(ANGLE_pack_reverse_row_order            , dummy_true                             ,  x ,  x ,  x , ES2, 2011)
 EXT(ANGLE_texture_compression_dxt3          , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2011)
 EXT(ANGLE_texture_compression_dxt5          , ANGLE_texture_compression_dxt          , GLL, GLC, ES1, ES2, 2011)
 
diff --git a/src/mesa/main/get_hash_params.py b/src/mesa/main/get_hash_params.py
index 657a22f..d9c0984 100644
--- a/src/mesa/main/get_hash_params.py
+++ b/src/mesa/main/get_hash_params.py
@@ -262,6 +262,8 @@
 # Enums in GLES2, GLES3
 { "apis": ["GLES2", "GLES3"], "params": [
   [ "GPU_DISJOINT_EXT", "LOC_CUSTOM, TYPE_INT, 0, extra_EXT_disjoint_timer_query" ],
+# ANGLE_pack_reverse_row_order
+  [ "PACK_REVERSE_ROW_ORDER_ANGLE", "CONTEXT_BOOL(Pack.Invert), NO_EXTRA" ],
 ]},
 
 { "apis": ["GL", "GL_CORE", "GLES2"], "params": [
diff --git a/src/mesa/main/glheader.h b/src/mesa/main/glheader.h
index 59ca1cb..a7818d6 100644
--- a/src/mesa/main/glheader.h
+++ b/src/mesa/main/glheader.h
@@ -157,6 +157,10 @@
 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C
 #endif
 
+#ifndef GL_ANGLE_pack_reverse_row_order
+#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4
+#endif
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/src/mesa/main/pixelstore.c b/src/mesa/main/pixelstore.c
index d4ae7dd..a439a98 100644
--- a/src/mesa/main/pixelstore.c
+++ b/src/mesa/main/pixelstore.c
@@ -98,6 +98,11 @@
             goto invalid_enum_error;
          ctx->Pack.Invert = param;
          break;
+      case GL_PACK_REVERSE_ROW_ORDER_ANGLE:
+         if (!no_error && !_mesa_is_gles(ctx))
+            goto invalid_enum_error;
+         ctx->Pack.Invert = param;
+         break;
       case GL_PACK_COMPRESSED_BLOCK_WIDTH:
          if (!no_error && !_mesa_is_desktop_gl(ctx))
             goto invalid_enum_error;