Revert "mesa, compiler: Move gl_texture_index to glsl_types.h"
authorFaith Ekstrand <faith.ekstrand@collabora.com>
Fri, 4 Aug 2023 11:02:57 +0000 (06:02 -0500)
committerMarge Bot <emma+marge@anholt.net>
Fri, 4 Aug 2023 13:14:35 +0000 (13:14 +0000)
This reverts commit 1b836a52ea2dcc0b77a48a2a3d1f9052321cf325.  This
patch, while claiming to decouple things, actually increases coupling
because it leaks two OpenGL state tracker limits and an OpenGL state
tracker fixed binding enum into the entire compiler.  Nothing wants to
know these outside the OpenGL state tracker and the GL-specific compiler
passes.  Put them back where they were.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24491>

src/compiler/glsl/glsl_parser_extras.h
src/compiler/glsl_types.h
src/compiler/shader_enums.h
src/mesa/main/config.h
src/mesa/main/menums.h

index 90d4017..c9277be 100644 (file)
@@ -32,8 +32,6 @@
 
 #include <stdlib.h>
 #include "glsl_symbol_table.h"
-#include "main/config.h"
-#include "main/menums.h"
 
 /* THIS is a macro defined somewhere deep in the Windows MSVC header files.
  * Undefine it here to avoid collision with the lexer's THIS token.
index 10b94a9..70c8e6e 100644 (file)
 #include "util/macros.h"
 #include "util/simple_mtx.h"
 
+#ifdef __cplusplus
+#include "mesa/main/config.h"
+#include "mesa/main/menums.h" /* for gl_texture_index, C++'s enum rules are broken */
+#endif
+
 struct glsl_type;
 
 #ifdef __cplusplus
index 3eaaf2f..10358f9 100644 (file)
 
 /* Project-wide (GL and Vulkan) maximum. */
 #define MAX_DRAW_BUFFERS 8
-/* Size of an atomic counter in bytes according to ARB_shader_atomic_counters */
-#define ATOMIC_COUNTER_SIZE 4
-/** For GL_ARB_gpu_shader5 */
-#define MAX_VERTEX_STREAMS 4
 
 #ifdef __cplusplus
 extern "C" {
@@ -1352,28 +1348,6 @@ enum ENUM_PACKED gl_subgroup_size
    SUBGROUP_SIZE_REQUIRE_128 = 128, /**< VK_EXT_subgroup_size_control */
 };
 
-/**
- * An index for each type of texture object.  These correspond to the GL
- * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.
- * Note: the order is from highest priority to lowest priority.
- */
-typedef enum
-{
-   TEXTURE_2D_MULTISAMPLE_INDEX,
-   TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX,
-   TEXTURE_CUBE_ARRAY_INDEX,
-   TEXTURE_BUFFER_INDEX,
-   TEXTURE_2D_ARRAY_INDEX,
-   TEXTURE_1D_ARRAY_INDEX,
-   TEXTURE_EXTERNAL_INDEX,
-   TEXTURE_CUBE_INDEX,
-   TEXTURE_3D_INDEX,
-   TEXTURE_RECT_INDEX,
-   TEXTURE_2D_INDEX,
-   TEXTURE_1D_INDEX,
-   NUM_TEXTURE_TARGETS
-} gl_texture_index;
-
 /* Ordered from narrower to wider scope. */
 typedef enum {
    SCOPE_NONE,
index 859add7..753d847 100644 (file)
 #define MAX_ATOMIC_COUNTERS            4096
 /* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
 #define MAX_COMBINED_ATOMIC_BUFFERS    (MAX_UNIFORM_BUFFERS * 6)
+/* Size of an atomic counter in bytes according to ARB_shader_atomic_counters */
+#define ATOMIC_COUNTER_SIZE            4
 #define MAX_IMAGE_UNIFORMS             32
 /* 6 is for vertex, hull, domain, geometry, fragment, and compute shader. */
 #define MAX_IMAGE_UNITS                (MAX_IMAGE_UNIFORMS * 6)
 #define MIN_FRAGMENT_INTERPOLATION_OFFSET   -0.5
 #define MAX_FRAGMENT_INTERPOLATION_OFFSET   0.5
 #define FRAGMENT_INTERPOLATION_OFFSET_BITS  4
+#define MAX_VERTEX_STREAMS                  4
 /*@}*/
 
 /** For GL_ARB_shader_subroutine */
index ff8d310..2a711ff 100644 (file)
@@ -64,6 +64,28 @@ _mesa_is_api_gles2(gl_api api)
 }
 
 /**
+ * An index for each type of texture object.  These correspond to the GL
+ * texture target enums, such as GL_TEXTURE_2D, GL_TEXTURE_CUBE_MAP, etc.
+ * Note: the order is from highest priority to lowest priority.
+ */
+typedef enum
+{
+   TEXTURE_2D_MULTISAMPLE_INDEX,
+   TEXTURE_2D_MULTISAMPLE_ARRAY_INDEX,
+   TEXTURE_CUBE_ARRAY_INDEX,
+   TEXTURE_BUFFER_INDEX,
+   TEXTURE_2D_ARRAY_INDEX,
+   TEXTURE_1D_ARRAY_INDEX,
+   TEXTURE_EXTERNAL_INDEX,
+   TEXTURE_CUBE_INDEX,
+   TEXTURE_3D_INDEX,
+   TEXTURE_RECT_INDEX,
+   TEXTURE_2D_INDEX,
+   TEXTURE_1D_INDEX,
+   NUM_TEXTURE_TARGETS
+} gl_texture_index;
+
+/**
  * Remapped color logical operations
  *
  * With the exception of NVIDIA hardware, which consumes the OpenGL enumerants