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#ifndef DEVICEINFO_H
17704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#define DEVICEINFO_H
18704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
19704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#include "Extensions.h"
20704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#include "utils/Macros.h"
21704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
22704bed0da7cc75d0c517d425445de70ceb58060bJohn Recknamespace android {
23704bed0da7cc75d0c517d425445de70ceb58060bJohn Recknamespace uirenderer {
24704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
25704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckclass DeviceInfo {
26704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    PREVENT_COPY_AND_ASSIGN(DeviceInfo);
27704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckpublic:
28704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    // returns nullptr if DeviceInfo is not initialized yet
29704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    // Note this does not have a memory fence so it's up to the caller
30704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    // to use one if required. Normally this should not be necessary
31704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    static const DeviceInfo* get();
32704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
33704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    // only call this after GL has been initialized, or at any point if compiled
34704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    // with HWUI_NULL_GPU
35704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    static void initialize();
36704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
37704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    const Extensions& extensions() const { return mExtensions; }
38704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
39704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    int maxTextureSize() const { return mMaxTextureSize; }
40704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
41704bed0da7cc75d0c517d425445de70ceb58060bJohn Reckprivate:
42704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    DeviceInfo() {}
43704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    ~DeviceInfo() {}
44704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
45704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    void load();
46704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
47704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    Extensions mExtensions;
48704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck    int mMaxTextureSize;
49704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck};
50704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
51704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck} /* namespace uirenderer */
52704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck} /* namespace android */
53704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck
54704bed0da7cc75d0c517d425445de70ceb58060bJohn Reck#endif /* DEVICEINFO_H */
55