1704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck/* 2704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * Copyright (C) 2015 The Android Open Source Project 3704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * 4704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * Licensed under the Apache License, Version 2.0 (the "License"); 5704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * you may not use this file except in compliance with the License. 6704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * You may obtain a copy of the License at 7704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * 8704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * http://www.apache.org/licenses/LICENSE-2.0 9704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * 10704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * Unless required by applicable law or agreed to in writing, software 11704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * distributed under the License is distributed on an "AS IS" BASIS, 12704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * See the License for the specific language governing permissions and 14704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck * limitations under the License. 15704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck */ 16704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#include <DeviceInfo.h> 17704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 18704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#include "Extensions.h" 19704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 20704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#include <GLES2/gl2.h> 218ecf41c61a5185207a21d64681e8ebc2502b7b2aChris Craik#include <log/log.h> 22704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 23704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#include <thread> 24704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#include <mutex> 25704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 26704bed0da7cc75d0c517d425445de70ceb58060bJohn Recknamespace android { 27704bed0da7cc75d0c517d425445de70ceb58060bJohn Recknamespace uirenderer { 28704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 29704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckstatic DeviceInfo* sDeviceInfo = nullptr; 30704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckstatic std::once_flag sInitializedFlag; 31704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 32704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckconst DeviceInfo* DeviceInfo::get() { 338ecf41c61a5185207a21d64681e8ebc2502b7b2aChris Craik LOG_ALWAYS_FATAL_IF(!sDeviceInfo, "DeviceInfo not yet initialized."); 34704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck return sDeviceInfo; 35704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck} 36704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 37704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckvoid DeviceInfo::initialize() { 38704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck std::call_once(sInitializedFlag, []() { 39704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck sDeviceInfo = new DeviceInfo(); 40704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck sDeviceInfo->load(); 41704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck }); 42704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck} 43704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 44704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckvoid DeviceInfo::load() { 45704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); 46704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck} 47704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck 48704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck} /* namespace uirenderer */ 49704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck} /* namespace android */ 50