mapi: #include "util/glheader.h" instead of #include "GL/gl.h"
Also add macro to guard windows.h won't be included 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>
This commit is contained in:
@@ -84,4 +84,8 @@ entry_patch(mapi_func entry, int slot)
|
||||
|
||||
#endif /* MAPI_MODE_BRIDGE */
|
||||
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
#endif /* asm */
|
||||
|
@@ -47,7 +47,7 @@ class PrintCode(gl_XML.gl_print_base):
|
||||
#ifndef API_EXEC_DECL_H
|
||||
#define API_EXEC_DECL_H
|
||||
|
||||
#include "GL/gl.h"
|
||||
#include "util/glheader.h"
|
||||
|
||||
#define GL_API GLAPI
|
||||
#define GL_APIENTRY GLAPIENTRY
|
||||
|
@@ -46,7 +46,7 @@ class PrintCode(gl_XML.gl_print_base):
|
||||
#ifndef API_SAVE_H
|
||||
#define API_SAVE_H
|
||||
|
||||
#include "GL/gl.h"
|
||||
#include "util/glheader.h"
|
||||
"""))
|
||||
|
||||
for f in api.functionIterateAll():
|
||||
|
@@ -164,7 +164,7 @@ class PrintGlxProtoStubs(glX_proto_common.glx_print_proto):
|
||||
|
||||
def printRealHeader(self):
|
||||
print('')
|
||||
print('#include <GL/gl.h>')
|
||||
print('#include "util/glheader.h"')
|
||||
print('#include "indirect.h"')
|
||||
print('#include "glxclient.h"')
|
||||
print('#include "indirect_size.h"')
|
||||
|
@@ -313,7 +313,7 @@ class PrintGlxSizeStubs_c(PrintGlxSizeStubs_common):
|
||||
def printRealHeader(self):
|
||||
print('')
|
||||
print('#include <X11/Xfuncproto.h>')
|
||||
print('#include <GL/gl.h>')
|
||||
print('#include "util/glheader.h"')
|
||||
if self.emit_get:
|
||||
print('#include "indirect_size_get.h"')
|
||||
print('#include "glxserver.h"')
|
||||
@@ -440,7 +440,7 @@ class PrintGlxReqSize_c(PrintGlxReqSize_common):
|
||||
|
||||
def printRealHeader(self):
|
||||
print('')
|
||||
print('#include <GL/gl.h>')
|
||||
print('#include "util/glheader.h"')
|
||||
print('#include "glxserver.h"')
|
||||
print('#include "glxbyteorder.h"')
|
||||
print('#include "indirect_size.h"')
|
||||
|
@@ -164,8 +164,8 @@ class PrintGlOffsets(gl_XML.gl_print_base):
|
||||
#error RETURN_DISPATCH must be defined
|
||||
#endif
|
||||
|
||||
#ifdef MemoryBarrier
|
||||
#undef MemoryBarrier
|
||||
#if defined(_WIN32) && defined(_WINDOWS_)
|
||||
#error "Should not include <windows.h> here"
|
||||
#endif
|
||||
|
||||
""")
|
||||
|
@@ -52,7 +52,7 @@ class PrintCode(gl_XML.gl_print_base):
|
||||
print(footer)
|
||||
|
||||
def printBody(self, api):
|
||||
print('#include "GL/gl.h"')
|
||||
print('#include "util/glheader.h"')
|
||||
print('')
|
||||
print('enum marshal_dispatch_cmd_id')
|
||||
print('{')
|
||||
|
@@ -55,8 +55,8 @@ class PrintGlTable(gl_XML.gl_print_base):
|
||||
print('extern "C" {')
|
||||
print('#endif')
|
||||
print('')
|
||||
print('#ifdef MemoryBarrier')
|
||||
print('#undef MemoryBarrier')
|
||||
print('#if defined(_WIN32) && defined(_WINDOWS_)')
|
||||
print('#error "Should not include <windows.h> here"')
|
||||
print('#endif')
|
||||
print('')
|
||||
print('struct _glapi_table')
|
||||
|
@@ -479,8 +479,8 @@ class ABIPrinter(object):
|
||||
print('#ifdef MAPI_TMP_DEFINES')
|
||||
print(self.c_public_includes())
|
||||
print()
|
||||
print('#ifdef MemoryBarrier')
|
||||
print('#undef MemoryBarrier')
|
||||
print('#if defined(_WIN32) && defined(_WINDOWS_)')
|
||||
print('#error "Should not include <windows.h> here"')
|
||||
print('#endif')
|
||||
print()
|
||||
print(self.c_public_declarations(self.prefix_lib))
|
||||
@@ -578,10 +578,10 @@ class GLAPIPrinter(ABIPrinter):
|
||||
self._override_for_api(ent)
|
||||
super(GLAPIPrinter, self).__init__(entries)
|
||||
|
||||
self.api_defines = ['GL_GLEXT_PROTOTYPES']
|
||||
self.api_headers = ['"GL/gl.h"', '"GL/glext.h"']
|
||||
self.api_defines = []
|
||||
self.api_headers = []
|
||||
self.api_call = 'GLAPI'
|
||||
self.api_entry = 'APIENTRY'
|
||||
self.api_entry = 'GLAPIENTRY'
|
||||
self.api_attrs = ''
|
||||
|
||||
self.lib_need_table_size = False
|
||||
@@ -608,7 +608,7 @@ class GLAPIPrinter(ABIPrinter):
|
||||
#define GLAPI_PREFIX(func) gl##func
|
||||
#define GLAPI_PREFIX_STR(func) "gl"#func
|
||||
|
||||
typedef int GLclampx;
|
||||
#include "util/glheader.h"
|
||||
#endif /* _GLAPI_TMP_H_ */"""
|
||||
|
||||
return header
|
||||
@@ -635,7 +635,7 @@ class SharedGLAPIPrinter(GLAPIPrinter):
|
||||
def _get_c_header(self):
|
||||
header = """#ifndef _GLAPI_TMP_H_
|
||||
#define _GLAPI_TMP_H_
|
||||
typedef int GLclampx;
|
||||
#include "util/glheader.h"
|
||||
#endif /* _GLAPI_TMP_H_ */"""
|
||||
|
||||
return header
|
||||
|
@@ -57,7 +57,6 @@ def _main():
|
||||
|
||||
#ifndef _GLAPI_TMP_H_
|
||||
#define _GLAPI_TMP_H_
|
||||
typedef int GLclampx;
|
||||
#endif /* _GLAPI_TMP_H_ */
|
||||
""".lstrip("\n"))
|
||||
|
||||
@@ -75,13 +74,11 @@ typedef int GLclampx;
|
||||
def generate_defines(functions):
|
||||
text = r"""
|
||||
#ifdef MAPI_TMP_DEFINES
|
||||
#define GL_GLEXT_PROTOTYPES
|
||||
#include "GL/gl.h"
|
||||
#include "GL/glext.h"
|
||||
#include "util/glheader.h"
|
||||
|
||||
""".lstrip("\n")
|
||||
for func in functions:
|
||||
text += "GLAPI {f.rt} APIENTRY {f.name}({f.decArgs});\n".format(f=func)
|
||||
text += "GLAPI {f.rt} GLAPIENTRY {f.name}({f.decArgs});\n".format(f=func)
|
||||
text += "#undef MAPI_TMP_DEFINES\n"
|
||||
text += "#endif /* MAPI_TMP_DEFINES */\n"
|
||||
return text
|
||||
@@ -99,7 +96,7 @@ def generate_noop_array(functions):
|
||||
text += "#ifdef DEBUG\n\n"
|
||||
|
||||
for func in functions:
|
||||
text += "static {f.rt} APIENTRY noop{f.basename}({f.decArgs})\n".format(f=func)
|
||||
text += "static {f.rt} GLAPIENTRY noop{f.basename}({f.decArgs})\n".format(f=func)
|
||||
text += "{\n"
|
||||
if (len(func.args) > 0):
|
||||
text += " "
|
||||
@@ -147,11 +144,11 @@ def generate_public_entries(functions):
|
||||
for func in functions:
|
||||
retStr = ("return " if func.hasReturn() else "")
|
||||
text += r"""
|
||||
GLAPI {f.rt} APIENTRY {f.name}({f.decArgs})
|
||||
GLAPI {f.rt} GLAPIENTRY {f.name}({f.decArgs})
|
||||
{{
|
||||
const struct _glapi_table *_tbl = entry_current_get();
|
||||
mapi_func _func = ((const mapi_func *) _tbl)[{f.slot}];
|
||||
{retStr}(({f.rt} (APIENTRY *)({f.decArgs})) _func)({f.callArgs});
|
||||
{retStr}(({f.rt} (GLAPIENTRY *)({f.decArgs})) _func)({f.callArgs});
|
||||
}}
|
||||
|
||||
""".lstrip("\n").format(f=func, retStr=retStr)
|
||||
|
Reference in New Issue
Block a user