Commit 9dac86c9 by George Burgess IV Committed by Commit Bot

gen_proc_table: generate `const` tables

We never mutate these tables; marking them const allows the loader to shuffle them to a place that makes them readonly after they're init'ed. This isn't intended to be a functional change. Bug: chromium:1084580 Change-Id: If3356f6082945ef1109bf08aab94f7bfb606b951 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2216295 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org>
parent 05f11a3b
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"scripts/egl_angle_ext.xml": "scripts/egl_angle_ext.xml":
"854e99785af19f8f4eea4f73005a0451", "854e99785af19f8f4eea4f73005a0451",
"scripts/gen_proc_table.py": "scripts/gen_proc_table.py":
"24dbcc78fd3f000f58ca98237ccc0da4", "7f52dba9bba75fffba11f427af205d6a",
"scripts/gl.xml": "scripts/gl.xml":
"e74a595068cbdd6064300be1e71b7cc9", "e74a595068cbdd6064300be1e71b7cc9",
"scripts/gl_angle_ext.xml": "scripts/gl_angle_ext.xml":
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
"scripts/wgl.xml": "scripts/wgl.xml":
"aa96419c582af2f6673430e2847693f4", "aa96419c582af2f6673430e2847693f4",
"src/libGL/proc_table_wgl_autogen.cpp": "src/libGL/proc_table_wgl_autogen.cpp":
"03c05f20c57c1de822b0ddaf6d4f9607", "b2ea218380642a9f426a131b77762ce9",
"src/libGLESv2/proc_table_egl_autogen.cpp": "src/libGLESv2/proc_table_egl_autogen.cpp":
"0154d2734e6d89520d3697890df2164e" "ebf1d019dd3a474485549bd052e7cd87"
} }
\ No newline at end of file
...@@ -37,11 +37,11 @@ template_cpp = """// GENERATED FILE - DO NOT EDIT. ...@@ -37,11 +37,11 @@ template_cpp = """// GENERATED FILE - DO NOT EDIT.
namespace {namespace} namespace {namespace}
{{ {{
ProcEntry g_procTable[] = {{ const ProcEntry g_procTable[] = {{
{proc_data} {proc_data}
}}; }};
size_t g_numProcs = {num_procs}; const size_t g_numProcs = {num_procs};
}} // namespace {namespace} }} // namespace {namespace}
""" """
......
...@@ -225,7 +225,7 @@ PROC GL_APIENTRY wglGetProcAddress(LPCSTR lpszProc) ...@@ -225,7 +225,7 @@ PROC GL_APIENTRY wglGetProcAddress(LPCSTR lpszProc)
FUNC_EVENT("const char *procname = \"%s\"", lpszProc); FUNC_EVENT("const char *procname = \"%s\"", lpszProc);
egl::Thread *thread = egl::GetCurrentThread(); egl::Thread *thread = egl::GetCurrentThread();
ProcEntry *entry = const ProcEntry *entry =
std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], lpszProc, CompareProc); std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], lpszProc, CompareProc);
thread->setSuccess(); thread->setSuccess();
......
...@@ -30,8 +30,8 @@ namespace wgl ...@@ -30,8 +30,8 @@ namespace wgl
{ {
using ProcEntry = std::pair<const char *, PROC>; using ProcEntry = std::pair<const char *, PROC>;
extern wgl::ProcEntry g_procTable[]; extern const wgl::ProcEntry g_procTable[];
extern size_t g_numProcs; extern const size_t g_numProcs;
} // namespace wgl } // namespace wgl
#endif // LIBGL_PROC_TABLE_H_ #endif // LIBGL_PROC_TABLE_H_
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
namespace wgl namespace wgl
{ {
ProcEntry g_procTable[] = { const ProcEntry g_procTable[] = {
{"glAccum", P(gl::Accum)}, {"glAccum", P(gl::Accum)},
{"glActiveShaderProgram", P(gl::ActiveShaderProgram)}, {"glActiveShaderProgram", P(gl::ActiveShaderProgram)},
{"glActiveTexture", P(gl::ActiveTexture)}, {"glActiveTexture", P(gl::ActiveTexture)},
...@@ -1114,5 +1114,5 @@ ProcEntry g_procTable[] = { ...@@ -1114,5 +1114,5 @@ ProcEntry g_procTable[] = {
{"wglUseFontOutlinesA", P(wglUseFontOutlinesA)}, {"wglUseFontOutlinesA", P(wglUseFontOutlinesA)},
{"wglUseFontOutlinesW", P(wglUseFontOutlinesW)}}; {"wglUseFontOutlinesW", P(wglUseFontOutlinesW)}};
size_t g_numProcs = 1074; const size_t g_numProcs = 1074;
} // namespace wgl } // namespace wgl
...@@ -1085,7 +1085,7 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const ch ...@@ -1085,7 +1085,7 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY EGL_GetProcAddress(const ch
FUNC_EVENT("const char *procname = \"%s\"", procname); FUNC_EVENT("const char *procname = \"%s\"", procname);
Thread *thread = egl::GetCurrentThread(); Thread *thread = egl::GetCurrentThread();
ProcEntry *entry = const ProcEntry *entry =
std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], procname, CompareProc); std::lower_bound(&g_procTable[0], &g_procTable[g_numProcs], procname, CompareProc);
thread->setSuccess(); thread->setSuccess();
......
...@@ -18,8 +18,8 @@ namespace egl ...@@ -18,8 +18,8 @@ namespace egl
{ {
using ProcEntry = std::pair<const char *, __eglMustCastToProperFunctionPointerType>; using ProcEntry = std::pair<const char *, __eglMustCastToProperFunctionPointerType>;
extern ProcEntry g_procTable[]; extern const ProcEntry g_procTable[];
extern size_t g_numProcs; extern const size_t g_numProcs;
} // namespace egl } // namespace egl
#endif // LIBGLESV2_PROC_TABLE_H_ #endif // LIBGLESV2_PROC_TABLE_H_
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
namespace egl namespace egl
{ {
ProcEntry g_procTable[] = { const ProcEntry g_procTable[] = {
{"ANGLEGetDisplayPlatform", P(ANGLEGetDisplayPlatform)}, {"ANGLEGetDisplayPlatform", P(ANGLEGetDisplayPlatform)},
{"ANGLEResetDisplayPlatform", P(ANGLEResetDisplayPlatform)}, {"ANGLEResetDisplayPlatform", P(ANGLEResetDisplayPlatform)},
{"eglBindAPI", P(EGL_BindAPI)}, {"eglBindAPI", P(EGL_BindAPI)},
...@@ -1518,5 +1518,5 @@ ProcEntry g_procTable[] = { ...@@ -1518,5 +1518,5 @@ ProcEntry g_procTable[] = {
{"glWeightPointerOES", P(gl::WeightPointerOES)}, {"glWeightPointerOES", P(gl::WeightPointerOES)},
{"glWeightPointerOESContextANGLE", P(gl::WeightPointerOESContextANGLE)}}; {"glWeightPointerOESContextANGLE", P(gl::WeightPointerOESContextANGLE)}};
size_t g_numProcs = 1424; const size_t g_numProcs = 1424;
} // namespace egl } // namespace egl
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment