From c86b9d42423b5a83ccba40f828b7ad9dafe3e317 Mon Sep 17 00:00:00 2001 From: bunnei Date: Mon, 5 Oct 2015 22:33:47 -0400 Subject: renderer_opengl: Refactor shader generation/caching to be more organized + various cleanups. --- src/common/common_funcs.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'src/common/common_funcs.h') diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index ed20c3629..7a8dd39a0 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -4,6 +4,9 @@ #pragma once +#include +#include + #include "common_types.h" #define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0])) @@ -95,3 +98,18 @@ inline u64 _rotr64(u64 x, unsigned int shift){ // This function might change the error code. // Defined in Misc.cpp. const char* GetLastErrorMsg(); + +template +inline std::size_t hash(const T& o) { + return std::hash()(o); +} + +template +inline std::size_t combine_hash(const T& o) { + return hash(o); +} + +template +inline std::size_t combine_hash(const T& o, const Args&... args) { + return hash(o) * 3 + combine_hash(args...); +} -- cgit v1.2.3