4 #include "caffe2/core/common.h" 9 static std::unique_ptr<GLContext> _glcontext;
10 std::function<const GLTexture*(const int width, const int height)> foreignTextureAllocator =
14 bool half_float_supported =
true;
17 virtual void set_context() = 0;
18 virtual void reset_context() = 0;
19 virtual void flush_context() = 0;
22 static void initGLContext();
24 static void deleteGLContext();
26 static bool GL_EXT_texture_border_clamp_defined();
28 inline bool halfFloatTextureSupported() {
return half_float_supported; }
30 void setTextureAllocator(
31 std::function<
const GLTexture*(
const int width,
const int height)> textureAllocator) {
32 foreignTextureAllocator = textureAllocator;
35 std::function<const GLTexture*(const int width, const int height)> getTextureAllocator() {
36 return foreignTextureAllocator;
40 bool supportOpenGLES3(
bool* hfs =
nullptr);
42 bool isSupportedDevice();