#ifndef GL_HPP__ #define GL_HPP__ #define GL_GLEXT_PROTOTYPES #if defined(GLES) #include #include #else #include #include #endif #include #include #include "libretro.h" #ifdef __GNUC__ #define decltype(type) typeof(type) #endif #define SYM(sym) (::GL::symbol(#sym)) namespace GL { // If true, GL context has been reset and all // objects are invalid. Do not free their resources // in destructors. extern bool dead_state; typedef std::map SymMap; SymMap& symbol_map(); void init_symbol_map(); // Discover and cache GL symbols on-the-fly. // Avoids things like GLEW, and avoids typing out a billion symbol declarations. void set_function_cb(retro_hw_get_proc_address_t); retro_proc_address_t get_symbol(const std::string& str); template inline Func symbol(const std::string& sym) { std::map& map = symbol_map(); retro_proc_address_t func = map[sym]; if (!func) { func = get_symbol(sym); if (!func) std::cerr << "Didn't find GL symbol: " << sym << std::endl; } return reinterpret_cast(func); } } #endif