This is only ever used to retrieve a raw view of the given UID data
structure, however it's already valid C++ to retrieve a char/unsigned
char view of an object for bytewise inspection.
u8 maps to unsigned char on all platforms we support, so we can just do
this directly with a reinterpret cast, simplifying the overall
interface.
Zero-initialization zeroes out all members and padding bits, so this is
safe to do. While we're at it, also add static assertions that enforce
the necessary requirements of a UID type explicitly within the ShaderUid
class.
This way, we can remove several memset calls around the shader
generation code that makes sure the underlying UID data is zeroed out.
Now our ShaderUid class enforces this for us, so we don't need to care about
it at the usage sites.
Now that we utilize C++17, we can simply return an optional containing
the code instead of using an out variable and a boolean result,
essentially combining them into one.
This provides a much more straightforward interface.
Greatly simplifies the overall interface when it comes to compiling
shaders. Also allows getting rid of a std::string overload of the same
name. Now std::string and const char* both go through the same function.
Makes VertexLoader_Normal completely stateless, eliminating the need for
an Init() function, and by extension, also gets rid of the need for the
FifoAnalyzer to have an Init() function.
Many of the arrays defined within this file weren't declared as
immutable, which can inhibit the strings being put into the read-only
segment. We can declare them constexpr to make them immutable.
While we're at it, we can use std::array, to allow bounds conditional
bounds checking with standard libraries. The declarations can also be
shortened in the future when all platform toolchain versions we use
support std::array deduction guides. Currently macOS and FreeBSD
builders fail on them.
The vector is only ever queryied and it's contents aren't modified, so
there's no reason to take the vector by value. We can take a constant
reference to it to avoid unnecessary allocating.
In these cases, the given string is only ever compared against other
string, so std::string can be turned into a std::string_view to allow
non-allocating inputs.
If opening the adapter fails, report the libusb error message in the GUI
instead of “No Adapter Detected”.
The error condition is removed when the adapter is unplugged.
The CMakeLists file for the static zlib checks for presence of
unistd.h, but it doesn't properly define HAVE_UNISTD_H if it's found.
This change adds the necessary preprocessor definition if unistd.h is
found.
Upstream zlib handles this with by configuring zconf.h with CMake:
cacf7f1d4e/zconf.h.cmakein (L11)
Dolphin's static version of zlib doesn't do this, which is why setting
Z_HAVE_UNISTD_H in zlib's CMakeLists.txt isn't enough.
This probably wasn't noticed since because most *nix systems will use
the shared zlib. Force use of the static zlib (comment out
find_package(ZLIB) in the root CMakeLists.txt) and you'll see implicit
function declaration warnings during its compilation.
Ensures that the destruction logic is kept local to the translation unit
(making it nicer when it comes to forward declaring non-trivial types).
It also doesn't really do much to define it in the header.