From b89a48e00d0713563aec852caed564affd486098 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Fri, 4 Aug 2023 06:02:57 -0500 Subject: [PATCH] Revert "mesa, compiler: Move gl_texture_index to glsl_types.h" 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: --- src/compiler/glsl/glsl_parser_extras.h | 2 -- src/compiler/glsl_types.h | 5 +++++ src/compiler/shader_enums.h | 26 -------------------------- src/mesa/main/config.h | 3 +++ src/mesa/main/menums.h | 22 ++++++++++++++++++++++ 5 files changed, 30 insertions(+), 28 deletions(-) diff --git a/src/compiler/glsl/glsl_parser_extras.h b/src/compiler/glsl/glsl_parser_extras.h index 90d4017..c9277be 100644 --- a/src/compiler/glsl/glsl_parser_extras.h +++ b/src/compiler/glsl/glsl_parser_extras.h @@ -32,8 +32,6 @@ #include #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. diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index 10b94a9..70c8e6e 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -36,6 +36,11 @@ #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 diff --git a/src/compiler/shader_enums.h b/src/compiler/shader_enums.h index 3eaaf2f..10358f9 100644 --- a/src/compiler/shader_enums.h +++ b/src/compiler/shader_enums.h @@ -32,10 +32,6 @@ /* 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, diff --git a/src/mesa/main/config.h b/src/mesa/main/config.h index 859add7..753d847 100644 --- a/src/mesa/main/config.h +++ b/src/mesa/main/config.h @@ -168,6 +168,8 @@ #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) @@ -251,6 +253,7 @@ #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 */ diff --git a/src/mesa/main/menums.h b/src/mesa/main/menums.h index ff8d310..2a711ff 100644 --- a/src/mesa/main/menums.h +++ b/src/mesa/main/menums.h @@ -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 -- 2.7.4