From 72097404180f566ffe685ecfe938b1888483b794 Mon Sep 17 00:00:00 2001 From: wheremyfoodat <44909372+wheremyfoodat@users.noreply.github.com> Date: Mon, 29 Jul 2024 01:03:41 +0300 Subject: [PATCH] Fix shader caching being broken --- include/PICA/pica_vert_config.hpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/include/PICA/pica_vert_config.hpp b/include/PICA/pica_vert_config.hpp index ba66426d..4300e454 100644 --- a/include/PICA/pica_vert_config.hpp +++ b/include/PICA/pica_vert_config.hpp @@ -1,5 +1,6 @@ #pragma once #include +#include #include #include #include @@ -23,6 +24,10 @@ namespace PICA { u8 outputCount; bool usingUbershader; + // Pad to 56 bytes so that the compiler won't insert unnecessary padding, which in turn will affect our unordered_map lookup + // As the padding will get hashed and memcmp'd... + u32 pad{}; + bool operator==(const VertConfig& config) const { // Hash function and equality operator required by std::unordered_map return std::memcmp(this, &config, sizeof(VertConfig)) == 0; @@ -43,6 +48,8 @@ namespace PICA { }; } // namespace PICA +static_assert(sizeof(PICA::VertConfig) == 56); + // Override std::hash for our vertex config class template <> struct std::hash {