CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!
Path: blob/master/android/jni/AndroidJavaGLContext.cpp
Views: 1401
#include "AndroidJavaGLContext.h"1#include "Common/System/Display.h"2#include "Common/GPU/OpenGL/GLFeatures.h"3#include "Common/Log.h"4#include "Core/Config.h"5#include "Core/ConfigValues.h"6#include "Core/System.h"78AndroidJavaEGLGraphicsContext::AndroidJavaEGLGraphicsContext() {9SetGPUBackend(GPUBackend::OPENGL);10}1112bool AndroidJavaEGLGraphicsContext::InitFromRenderThread(ANativeWindow *wnd, int desiredBackbufferSizeX, int desiredBackbufferSizeY, int backbufferFormat, int androidVersion) {13INFO_LOG(Log::G3D, "AndroidJavaEGLGraphicsContext::InitFromRenderThread");14if (!CheckGLExtensions()) {15ERROR_LOG(Log::G3D, "CheckGLExtensions failed - not gonna attempt starting up.");16state_ = GraphicsContextState::FAILED_INIT;17return false;18}1920// OpenGL handles rotated rendering in the driver.21g_display.rotation = DisplayRotation::ROTATE_0;22g_display.rot_matrix.setIdentity();2324draw_ = Draw::T3DCreateGLContext(false); // Can't fail25renderManager_ = (GLRenderManager *)draw_->GetNativeObject(Draw::NativeObject::RENDER_MANAGER);26renderManager_->SetInflightFrames(g_Config.iInflightFrames);2728if (!draw_->CreatePresets()) {29// This can't really happen now that compilation is async - they're only really queued for compile here.30_assert_msg_(false, "Failed to compile preset shaders");31state_ = GraphicsContextState::FAILED_INIT;32return false;33}34state_ = GraphicsContextState::INITIALIZED;35return true;36}3738void AndroidJavaEGLGraphicsContext::ShutdownFromRenderThread() {39INFO_LOG(Log::G3D, "AndroidJavaEGLGraphicsContext::Shutdown");40renderManager_ = nullptr; // owned by draw_.41delete draw_;42draw_ = nullptr;43state_ = GraphicsContextState::SHUTDOWN;44}454647