From bf338c3d7ffeabd099169d270df3972dd619ae27 Mon Sep 17 00:00:00 2001 From: Yonggang Luo Date: Thu, 3 Nov 2022 03:11:38 +0800 Subject: [PATCH] mesa: #include "util/glheader.h" instead GL/gl.h in shared code MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Yonggang Luo Reviewed-by: Jesse Natalie Acked-by: Brian Paul brianp@vmware.com Reviewed-by: Marek Olšák Part-of: --- src/compiler/glsl/gl_nir_link_atomics.c | 2 +- src/compiler/glsl/gl_nir_linker.c | 2 +- src/compiler/glsl/linker_util.h | 1 + src/compiler/glsl_types.h | 9 ++++++--- src/compiler/nir_gl_types.h | 2 +- src/gallium/auxiliary/tgsi/tgsi_ureg.c | 2 +- src/gallium/frontends/wgl/stw_ext_interop.c | 3 +-- src/gallium/frontends/wgl/stw_image.c | 3 ++- src/gallium/include/frontend/winsys_handle.h | 2 +- src/mesa/main/condrender.c | 4 ++-- src/mesa/main/dd.h | 8 ++------ src/mesa/main/formats.h | 3 ++- src/mesa/main/glformats.h | 2 +- src/mesa/main/glthread.h | 1 - src/mesa/main/tests/enum_strings.cpp | 1 - src/mesa/main/tests/program_state_string.cpp | 3 --- src/mesa/main/tests/stubs.cpp | 1 - src/mesa/main/texcompress_s3tc_tmp.h | 6 +----- src/mesa/program/program_parser.h | 1 + src/mesa/vbo/vbo_save.h | 2 +- 20 files changed, 25 insertions(+), 33 deletions(-) diff --git a/src/compiler/glsl/gl_nir_link_atomics.c b/src/compiler/glsl/gl_nir_link_atomics.c index aedcacd6f1b..f8101d5296b 100644 --- a/src/compiler/glsl/gl_nir_link_atomics.c +++ b/src/compiler/glsl/gl_nir_link_atomics.c @@ -22,12 +22,12 @@ */ #include "nir.h" -#include "GL/gl.h" #include "linker_util.h" #include "gl_nir_linker.h" #include "compiler/glsl/ir_uniform.h" /* for gl_uniform_storage */ #include "main/consts_exts.h" #include "main/shader_types.h" +#include "util/glheader.h" /** * This file do the common link for GLSL atomic counter uniforms, using NIR, diff --git a/src/compiler/glsl/gl_nir_linker.c b/src/compiler/glsl/gl_nir_linker.c index ef3d64b300a..998ca74f0cb 100644 --- a/src/compiler/glsl/gl_nir_linker.c +++ b/src/compiler/glsl/gl_nir_linker.c @@ -22,7 +22,6 @@ */ #include "nir.h" -#include "GL/gl.h" #include "gl_nir.h" #include "gl_nir_linker.h" #include "linker_util.h" @@ -30,6 +29,7 @@ #include "main/consts_exts.h" #include "main/shaderobj.h" #include "ir_uniform.h" /* for gl_uniform_storage */ +#include "util/glheader.h" /** * This file included general link methods, using NIR, instead of IR as diff --git a/src/compiler/glsl/linker_util.h b/src/compiler/glsl/linker_util.h index dcd8a5af2d9..2d7b6cb8662 100644 --- a/src/compiler/glsl/linker_util.h +++ b/src/compiler/glsl/linker_util.h @@ -25,6 +25,7 @@ #define GLSL_LINKER_UTIL_H #include "util/bitset.h" +#include "util/glheader.h" #include "compiler/glsl/list.h" struct gl_constants; diff --git a/src/compiler/glsl_types.h b/src/compiler/glsl_types.h index 627b0652865..ecd2fb88def 100644 --- a/src/compiler/glsl_types.h +++ b/src/compiler/glsl_types.h @@ -37,6 +37,9 @@ #ifdef __cplusplus #include "mesa/main/config.h" +#include "mesa/main/menums.h" /* for gl_texture_index, C++'s enum rules are broken */ +#include "util/glheader.h" +#include "util/ralloc.h" #endif struct glsl_type; @@ -289,10 +292,10 @@ enum { #ifdef __cplusplus } /* extern "C" */ +#endif -#include "GL/gl.h" -#include "util/ralloc.h" -#include "mesa/main/menums.h" /* for gl_texture_index, C++'s enum rules are broken */ +/* C++ struct types for glsl */ +#ifdef __cplusplus struct glsl_type { GLenum gl_type; diff --git a/src/compiler/nir_gl_types.h b/src/compiler/nir_gl_types.h index 161d5a2306b..14bf4d8be28 100644 --- a/src/compiler/nir_gl_types.h +++ b/src/compiler/nir_gl_types.h @@ -28,7 +28,7 @@ #ifndef NIR_GL_TYPES_H #define NIR_GL_TYPES_H -#include "GL/gl.h" +#include "util/glheader.h" #ifdef __cplusplus extern "C" { diff --git a/src/gallium/auxiliary/tgsi/tgsi_ureg.c b/src/gallium/auxiliary/tgsi/tgsi_ureg.c index 398d59b957b..a0e9bb8ddbe 100644 --- a/src/gallium/auxiliary/tgsi/tgsi_ureg.c +++ b/src/gallium/auxiliary/tgsi/tgsi_ureg.c @@ -35,13 +35,13 @@ #include "tgsi/tgsi_info.h" #include "tgsi/tgsi_dump.h" #include "tgsi/tgsi_sanity.h" +#include "util/glheader.h" #include "util/u_debug.h" #include "util/u_inlines.h" #include "util/u_memory.h" #include "util/u_math.h" #include "util/u_prim.h" #include "util/u_bitmask.h" -#include "GL/gl.h" #include "compiler/shader_info.h" union tgsi_any_token { diff --git a/src/gallium/frontends/wgl/stw_ext_interop.c b/src/gallium/frontends/wgl/stw_ext_interop.c index 27d0ba277ac..b58ab71b4e1 100644 --- a/src/gallium/frontends/wgl/stw_ext_interop.c +++ b/src/gallium/frontends/wgl/stw_ext_interop.c @@ -21,13 +21,12 @@ * IN THE SOFTWARE. */ +#include "state_tracker/st_interop.h" #include "stw_ext_interop.h" #include "stw_context.h" #include "stw_device.h" -#include "state_tracker/st_interop.h" - int wglMesaGLInteropQueryDeviceInfo(HDC dpy, HGLRC context, struct mesa_glinterop_device_info *out) diff --git a/src/gallium/frontends/wgl/stw_image.c b/src/gallium/frontends/wgl/stw_image.c index 64e01043b6a..203a7c23a2c 100644 --- a/src/gallium/frontends/wgl/stw_image.c +++ b/src/gallium/frontends/wgl/stw_image.c @@ -21,7 +21,6 @@ * IN THE SOFTWARE. */ -#include "stw_image.h" #include #include #include @@ -31,6 +30,8 @@ #include #include +#include "stw_image.h" + struct stw_image * stw_create_image_from_texture(struct stw_context *ctx, GLenum gl_target, GLuint texture, GLuint depth, GLint level, enum stw_image_error *error) diff --git a/src/gallium/include/frontend/winsys_handle.h b/src/gallium/include/frontend/winsys_handle.h index e3a94c8782c..98d383cffa0 100644 --- a/src/gallium/include/frontend/winsys_handle.h +++ b/src/gallium/include/frontend/winsys_handle.h @@ -3,7 +3,7 @@ #define _WINSYS_HANDLE_H_ #ifdef _WIN32 -#include +typedef void *HANDLE; #endif #ifdef __cplusplus diff --git a/src/mesa/main/condrender.c b/src/mesa/main/condrender.c index 97fc4cc6207..cfabfe8cb5a 100644 --- a/src/mesa/main/condrender.c +++ b/src/mesa/main/condrender.c @@ -206,7 +206,7 @@ end_conditional_render(struct gl_context *ctx) } -void APIENTRY +void GLAPIENTRY _mesa_EndConditionalRender_no_error(void) { GET_CURRENT_CONTEXT(ctx); @@ -214,7 +214,7 @@ _mesa_EndConditionalRender_no_error(void) } -void APIENTRY +void GLAPIENTRY _mesa_EndConditionalRender(void) { GET_CURRENT_CONTEXT(ctx); diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h index 59626bde596..5322a77ed81 100644 --- a/src/mesa/main/dd.h +++ b/src/mesa/main/dd.h @@ -36,12 +36,8 @@ #include "menums.h" #include "compiler/shader_enums.h" -/* Windows winnt.h defines MemoryBarrier as a macro on some platforms, - * including as a function-like macro in some cases. That either causes - * the table entry below to have a weird name, or fail to compile. - */ -#ifdef MemoryBarrier -#undef MemoryBarrier +#if defined(_WIN32) && defined(_WINDOWS_) +#error "Should not include here" #endif struct gl_buffer_object; diff --git a/src/mesa/main/formats.h b/src/mesa/main/formats.h index aee6217621d..ff313141b14 100644 --- a/src/mesa/main/formats.h +++ b/src/mesa/main/formats.h @@ -33,9 +33,10 @@ #define FORMATS_H -#include #include #include + +#include "util/glheader.h" #include "gallium/include/pipe/p_format.h" #include "util/u_endian.h" diff --git a/src/mesa/main/glformats.h b/src/mesa/main/glformats.h index 98987a15f4e..cfca451ab1f 100644 --- a/src/mesa/main/glformats.h +++ b/src/mesa/main/glformats.h @@ -30,8 +30,8 @@ #include #include -#include +#include "util/glheader.h" #ifdef __cplusplus extern "C" { diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h index 283e4a50b21..f536865cb44 100644 --- a/src/mesa/main/glthread.h +++ b/src/mesa/main/glthread.h @@ -49,7 +49,6 @@ #include #include #include "util/u_queue.h" -#include "GL/gl.h" #include "compiler/shader_enums.h" #include "main/config.h" #include "util/glheader.h" diff --git a/src/mesa/main/tests/enum_strings.cpp b/src/mesa/main/tests/enum_strings.cpp index 1395ac8fb33..17509c5f073 100644 --- a/src/mesa/main/tests/enum_strings.cpp +++ b/src/mesa/main/tests/enum_strings.cpp @@ -22,7 +22,6 @@ */ #include -#include #include "main/enums.h" diff --git a/src/mesa/main/tests/program_state_string.cpp b/src/mesa/main/tests/program_state_string.cpp index 38805f92c77..e606194e55a 100644 --- a/src/mesa/main/tests/program_state_string.cpp +++ b/src/mesa/main/tests/program_state_string.cpp @@ -23,9 +23,6 @@ #include -#include "GL/gl.h" -#include "GL/glext.h" - #include "program/prog_statevars.h" TEST(program_state_string, depth_range) diff --git a/src/mesa/main/tests/stubs.cpp b/src/mesa/main/tests/stubs.cpp index c24df53a561..0d1f463b65f 100644 --- a/src/mesa/main/tests/stubs.cpp +++ b/src/mesa/main/tests/stubs.cpp @@ -20,7 +20,6 @@ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. */ -#include #include "main/errors.h" extern "C" { diff --git a/src/mesa/main/texcompress_s3tc_tmp.h b/src/mesa/main/texcompress_s3tc_tmp.h index 5c2c0ef7fc4..79e1e55fd59 100644 --- a/src/mesa/main/texcompress_s3tc_tmp.h +++ b/src/mesa/main/texcompress_s3tc_tmp.h @@ -25,11 +25,7 @@ #ifndef TEXCOMPRESS_S3TC_TMP_H #define TEXCOMPRESS_S3TC_TMP_H -#ifdef __APPLE__ -#include -#else -#include -#endif +#include "util/glheader.h" typedef GLubyte GLchan; #define UBYTE_TO_CHAN(b) (b) diff --git a/src/mesa/program/program_parser.h b/src/mesa/program/program_parser.h index 4d31d997724..08229038986 100644 --- a/src/mesa/program/program_parser.h +++ b/src/mesa/program/program_parser.h @@ -25,6 +25,7 @@ #define PROGRAM_PARSER_H #include "main/config.h" +#include "program/prog_instruction.h" #include "program/prog_parameter.h" struct gl_context; diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h index 78a6340c196..7782129a7ec 100644 --- a/src/mesa/vbo/vbo_save.h +++ b/src/mesa/vbo/vbo_save.h @@ -34,7 +34,7 @@ USE OR OTHER DEALINGS IN THE SOFTWARE. #ifndef VBO_SAVE_H #define VBO_SAVE_H -#include "dlist.h" +#include "mesa/main/dlist.h" #include "vbo.h" #include "vbo_attrib.h" -- 2.34.1