Resync mt_opengl_loader.cpp with BindingGenerator.lua

also add a warning that you can't edit it by hand
This commit is contained in:
sfan5
2023-12-17 18:00:19 +01:00
parent 4e52d547b2
commit 0110826ce9
3 changed files with 73 additions and 15 deletions

View File

@ -410,6 +410,9 @@ f:close();
-- Write loader implementation
f = io.open( sourceTreePath .. "/source/Irrlicht/mt_opengl_loader.cpp", "wb" );
f:write[[
// This code was generated by scripts/BindingGenerator.lua
// Do not modify it, modify and run the generator instead.
#include "mt_opengl.h"
#include <string>
#include <sstream>
@ -423,9 +426,21 @@ void OpenGLProcedures::LoadAllProcedures(irr::video::IContextManager *cmgr)
f:write( loader:Concat() );
f:write[[
// OpenGL 3 way to enumerate extensions
int ext_count = 0;
GetIntegerv(NUM_EXTENSIONS, &ext_count);
extensions.reserve(ext_count);
for (int k = 0; k < ext_count; k++)
extensions.emplace((char *)GetStringi(EXTENSIONS, k));
if (ext_count)
return;
// OpenGL 2 / ES 2 way to enumerate extensions
auto ext_str = GetString(EXTENSIONS);
if (!ext_str)
return;
// get the extension string, chop it up
std::string ext_string = std::string((char*)GetString(EXTENSIONS));
std::stringstream ext_ss(ext_string);
std::stringstream ext_ss((char*)ext_str);
std::string tmp;
while (std::getline(ext_ss, tmp, ' '))
extensions.emplace(tmp);