-
Notifications
You must be signed in to change notification settings - Fork 439
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bye bye std::string in the GL library #499
Commits on Jan 1, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c6e627d - Browse repository at this point
Copy the full SHA c6e627dView commit details -
Configuration menu - View commit details
-
Copy full SHA for 4f5fc0a - Browse repository at this point
Copy the full SHA 4f5fc0aView commit details -
GL: deduplicate & simplify DebugOutput::setCallback() internals.
The previous callback pointer was needed just to disambiguate, so it can be a bool; the user pointer can be set from the caller already instead of being done in each variant again.
Configuration menu - View commit details
-
Copy full SHA for 475a748 - Browse repository at this point
Copy the full SHA 475a748View commit details -
Those are reserved for temporary TODOs and debugging, not meant to stay there forever.
Configuration menu - View commit details
-
Copy full SHA for 569e494 - Browse repository at this point
Copy the full SHA 569e494View commit details -
Configuration menu - View commit details
-
Copy full SHA for 527a4d8 - Browse repository at this point
Copy the full SHA 527a4d8View commit details -
GL: properly test failed AbstractShaderProgram::validate().
So far everything everywhere was just testing the success case, without checking that the message is properly retrieved and returned. Sigh.
Configuration menu - View commit details
-
Copy full SHA for f3de392 - Browse repository at this point
Copy the full SHA f3de392View commit details -
GL: trim whitespace from AbstractShaderProgram::validate().
The test added in previous commit passed on Mesa, but not on SwiftShader.
Configuration menu - View commit details
-
Copy full SHA for e35a52e - Browse repository at this point
Copy the full SHA e35a52eView commit details -
Configuration menu - View commit details
-
Copy full SHA for e933849 - Browse repository at this point
Copy the full SHA e933849View commit details -
GL: port Debug{Output,Group,Message} away from std::string.
Most of these are just inputs, so a compatibility StringStl.h include will do, the only exception is the callback for which there needs to stay a deprecated overload (which is internally delegated from the StringView one). Also explicitly testing with non-null-terminated strings -- the APIs take an explicit size so it shouldn't be a problem, but it's always good to have this verified independently. Drivers are crap, you know. One consequence of no longer using an impossible-to-forward-declare std::string is that I had to deinline the DebugGroup constructor because it no longer worked with just a forward-declared StringView.
Configuration menu - View commit details
-
Copy full SHA for d89b882 - Browse repository at this point
Copy the full SHA d89b882View commit details -
Shaders: ditch the insane Phong light initializer setup.
Do it the same as for the skinning stuff, format() and string multiplication. No need to get this crazy.
Configuration menu - View commit details
-
Copy full SHA for 2f57162 - Browse repository at this point
Copy the full SHA 2f57162View commit details -
GL: port Shader and ShaderProgram away from std::string.
Same as in the previous commit, most cases are inputs so a StringStl.h compatibility include will do, the only breaking change is GL::Shader::sources() which now returns a StringIterable instead of a std::vector<std::string> (ew). Awesome about this whole thing is that The Shader API now allows creating a shader from sources coming either from string view literals or Utility::Resource completely without having to allocate any strings internally, because all those can be just non-owning references wrapped with String::nullTerminatedGlobalView(). The only parts which aren't references are the #line markers, but (especially on 64bit) those can easily fit into the 22-byte (or 10-byte on 32bit) SSO storage. Also, various Shader constructors and assignment operators had to be deinlined in order to avoid having to include the String header, which would be needed for Array destruction during a move. Co-authored-by: Hugo Amiard <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for db2cb49 - Browse repository at this point
Copy the full SHA db2cb49View commit details -
Configuration menu - View commit details
-
Copy full SHA for 18f0b31 - Browse repository at this point
Copy the full SHA 18f0b31View commit details -
Configuration menu - View commit details
-
Copy full SHA for b2f72c9 - Browse repository at this point
Copy the full SHA b2f72c9View commit details -
GL: drop std::pair from AbstractShaderProgram::validate() as well.
Given that I made a breaking change by returning Containers::String instead of a std::string, I can take it further and replace also std::pair with Containers::Pair -- it won't bring any more pain to the users, they have to change their code anyway. Co-authored-by: Hugo Amiard <[email protected]>
Configuration menu - View commit details
-
Copy full SHA for d0e18e1 - Browse repository at this point
Copy the full SHA d0e18e1View commit details -
GL: drop std::pair from texture state tracker internals.
Apparently even `= {}` was broken for std::pair once, not to mention the unnecessary extra overhead with this type not being trivially copyable. Good riddance.
Configuration menu - View commit details
-
Copy full SHA for e0210a1 - Browse repository at this point
Copy the full SHA e0210a1View commit details -
GL: drop another std::pair occurence from the internals.
Hm, and here I used the "capability" of std::pair that allowed it to store references. I don't even want to know what all was involved to support that, Containers::Reference is much easier to reason about.
Configuration menu - View commit details
-
Copy full SHA for 2620eca - Browse repository at this point
Copy the full SHA 2620ecaView commit details -
GL: don't use std::pair in Context internals.
And this, this change allows the growable Array to use malloc() instead of new, and thus also realloc(), saving unnecessary reallocations if the memory can be grown in-place. All because Containers::Pair is trivially copyable while std::pair wasn't. There isn't any good reason to use the STL anymore.
Configuration menu - View commit details
-
Copy full SHA for 468d68e - Browse repository at this point
Copy the full SHA 468d68eView commit details -
DebugTools: port screenshot() away from std::string.
Simple & easy, for a change.
Configuration menu - View commit details
-
Copy full SHA for 19ba079 - Browse repository at this point
Copy the full SHA 19ba079View commit details -
DebugTools: port FrameProfiler away from std::string.
One of the last remaining leftovers.
Configuration menu - View commit details
-
Copy full SHA for cec3c21 - Browse repository at this point
Copy the full SHA cec3c21View commit details -
Configuration menu - View commit details
-
Copy full SHA for e4f6625 - Browse repository at this point
Copy the full SHA e4f6625View commit details -
Configuration menu - View commit details
-
Copy full SHA for 6a2d7a4 - Browse repository at this point
Copy the full SHA 6a2d7a4View commit details -
Remove random unneeded <string> and StringStl.h includes.
Or document why is it still needed.
Configuration menu - View commit details
-
Copy full SHA for 5d0454c - Browse repository at this point
Copy the full SHA 5d0454cView commit details -
doc: remove std::string usage from doc image generators.
From some, at least. The easings need to wait for a growable String.
Configuration menu - View commit details
-
Copy full SHA for 31b77f0 - Browse repository at this point
Copy the full SHA 31b77f0View commit details -
Configuration menu - View commit details
-
Copy full SHA for b8cec8d - Browse repository at this point
Copy the full SHA b8cec8dView commit details -
DebugTools,Shaders,TextureTools: use string view literals everywhere.
Mainly important for Shader::addSource() to prevent it from creating a needless copy, but doesn't hurt to do the same also for uniformLocation(), bindAttributeLocation() etc. -- it'll avoid a runtime strlen() in that case at least.
Configuration menu - View commit details
-
Copy full SHA for 3e7298f - Browse repository at this point
Copy the full SHA 3e7298fView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b4a813 - Browse repository at this point
Copy the full SHA 9b4a813View commit details -
package/archlinux: include also RelWithDebInfo in the dev PKGBUILD.
Not built by default, but handy for profiling.
Configuration menu - View commit details
-
Copy full SHA for ac03515 - Browse repository at this point
Copy the full SHA ac03515View commit details