mesa: #include "util/glheader.h" instead GL/gl.h in shared code
authorYonggang Luo <luoyonggang@gmail.com>
Wed, 2 Nov 2022 19:11:38 +0000 (03:11 +0800)
committerMarge Bot <emma+marge@anholt.net>
Thu, 3 Nov 2022 16:07:31 +0000 (16:07 +0000)
Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Acked-by: Brian Paul brianp@vmware.com
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19472>

20 files changed:
src/compiler/glsl/gl_nir_link_atomics.c
src/compiler/glsl/gl_nir_linker.c
src/compiler/glsl/linker_util.h
src/compiler/glsl_types.h
src/compiler/nir_gl_types.h
src/gallium/auxiliary/tgsi/tgsi_ureg.c
src/gallium/frontends/wgl/stw_ext_interop.c
src/gallium/frontends/wgl/stw_image.c
src/gallium/include/frontend/winsys_handle.h
src/mesa/main/condrender.c
src/mesa/main/dd.h
src/mesa/main/formats.h
src/mesa/main/glformats.h
src/mesa/main/glthread.h
src/mesa/main/tests/enum_strings.cpp
src/mesa/main/tests/program_state_string.cpp
src/mesa/main/tests/stubs.cpp
src/mesa/main/texcompress_s3tc_tmp.h
src/mesa/program/program_parser.h
src/mesa/vbo/vbo_save.h

index aedcacd6f1bf3a908ff4628fef7133b2fb131b18..f8101d5296be5101fa9d629ca21b45f08b4f2838 100644 (file)
  */
 
 #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,
index ef3d64b300a20c6a3a98f37c53c329390ff41eaa..998ca74f0cb79b5202280bb0a6cacb11d210735d 100644 (file)
@@ -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
index dcd8a5af2d9af57d5c420ef230f101dc7ef66f0f..2d7b6cb866288a69d12c2873b58edca083c51ee6 100644 (file)
@@ -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;
index 627b06528651b9083d8ad75a3fc0fad1e7c1e519..ecd2fb88def4fddb8ab05e5a4844a676f00a28b1 100644 (file)
@@ -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;
index 161d5a2306beee6a03b058aeac89fa461ff873c9..14bf4d8be28c8d25dd4868da772dd84b78e65164 100644 (file)
@@ -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" {
index 398d59b957b3ba398ed99e1d763a4048bf282695..a0e9bb8ddbe54a7344bda087f5dcde4917e51dc8 100644 (file)
 #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 {
index 27d0ba277aca3f758ec830aa50706190912d23e0..b58ab71b4e13a7aafe6595f80db3a594f7450004 100644 (file)
 * 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)
index 64e01043b6a4ba3bbfa3330a59ebe67d94231a66..203a7c23a2c2de9227cf4ea41ff6b8089633eb09 100644 (file)
@@ -21,7 +21,6 @@
  * IN THE SOFTWARE.
  */
 
-#include "stw_image.h"
 #include <pipe/p_state.h>
 #include <util/u_inlines.h>
 #include <frontend/api.h>
@@ -31,6 +30,8 @@
 #include <state_tracker/st_context.h>
 #include <state_tracker/st_texture.h>
 
+#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)
index e3a94c8782cbcae2773fb97eb54a3d6ba4846823..98d383cffa0379a3d28108d6368223f73b5045d5 100644 (file)
@@ -3,7 +3,7 @@
 #define _WINSYS_HANDLE_H_
 
 #ifdef _WIN32
-#include <windows.h>
+typedef void *HANDLE;
 #endif
 
 #ifdef __cplusplus
index 97fc4cc6207e9c1ace6f1a64bf132319b8b95d6b..cfabfe8cb5a4695d1f913f3870633e6bd4c621a2 100644 (file)
@@ -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);
index 59626bde596c86cf7f3a37e9a4430a0422396788..5322a77ed81e66d110abbb236a9d074455a75f6c 100644 (file)
 #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 <windows.h> here"
 #endif
 
 struct gl_buffer_object;
index aee6217621d6bb28d85fee102060d44eed897201..ff313141b142a7b10268b629df53a10401be5331 100644 (file)
 #define FORMATS_H
 
 
-#include <GL/gl.h>
 #include <stdbool.h>
 #include <stdint.h>
+
+#include "util/glheader.h"
 #include "gallium/include/pipe/p_format.h"
 #include "util/u_endian.h"
 
index 98987a15f4e727276f6ec2d4528eba7ae145d5cb..cfca451ab1f6cda353dfe7ad910881ad76e0135d 100644 (file)
@@ -30,8 +30,8 @@
 
 #include <stdbool.h>
 #include <stdint.h>
-#include <GL/gl.h>
 
+#include "util/glheader.h"
 
 #ifdef __cplusplus
 extern "C" {
index 283e4a50b21f4a45837b5185251be9060a8d552d..f536865cb446110b0f901b0921f8c44ac881d20e 100644 (file)
@@ -49,7 +49,6 @@
 #include <inttypes.h>
 #include <stdbool.h>
 #include "util/u_queue.h"
-#include "GL/gl.h"
 #include "compiler/shader_enums.h"
 #include "main/config.h"
 #include "util/glheader.h"
index 1395ac8fb33b81e24e5abbbc43005db5522e17e9..17509c5f0737799357852190b4c4970819e7a3df 100644 (file)
@@ -22,7 +22,6 @@
  */
 
 #include <gtest/gtest.h>
-#include <GL/gl.h>
 
 #include "main/enums.h"
 
index 38805f92c77b25dc96f5d5c15c070c4d635bc5da..e606194e55af37e804a0afb7920722adc7c5b35c 100644 (file)
@@ -23,9 +23,6 @@
 
 #include <gtest/gtest.h>
 
-#include "GL/gl.h"
-#include "GL/glext.h"
-
 #include "program/prog_statevars.h"
 
 TEST(program_state_string, depth_range)
index c24df53a561594a079046d4134f2c2eebf26875e..0d1f463b65fe2726a0e6fb82a134b9d9b3ee6093 100644 (file)
@@ -20,7 +20,6 @@
  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  * DEALINGS IN THE SOFTWARE.
  */
-#include <GL/gl.h>
 #include "main/errors.h"
 
 extern "C" {
index 5c2c0ef7fc4fde6b5565b9c4a3ac2d06afe55cfc..79e1e55fd599c9094746586e37024f0a0bed0468 100644 (file)
 #ifndef TEXCOMPRESS_S3TC_TMP_H
 #define TEXCOMPRESS_S3TC_TMP_H
 
-#ifdef __APPLE__
-#include <OpenGL/gl.h>
-#else
-#include <GL/gl.h>
-#endif
+#include "util/glheader.h"
 
 typedef GLubyte GLchan;
 #define UBYTE_TO_CHAN(b)  (b)
index 4d31d99772482f41101387bb84043df74974d127..08229038986caf8ab29ab7eef8a9ef301340a3e0 100644 (file)
@@ -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;
index 78a6340c1969b3f863001da31c595942f3fb4aed..7782129a7ec64d1fb159d5b80ab87ca395b77436 100644 (file)
@@ -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"