aboutsummaryrefslogtreecommitdiff
path: root/external/egl_setup/egl_setup.h
blob: bdc43f04cec82c36cb76ef2eb54b9906f2ff4474 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//----------------------------------------------------------------------------------
// File:        common/egl_setup/include/egl_setup.h
// SDK Version: v1.0 
// Site:        http://developer.nvidia.com/
//
// Copyright (C) 2013 NVIDIA CORPORATION.  All Rights Reserved.
// 
// NVIDIA CORPORATION and its licensors retain all intellectual property
// and proprietary rights in and to this software, related documentation
// and any modifications thereto.  Any use, reproduction, disclosure or
// distribution of this software and related documentation is governed by 
// the NVIDIA Pre-Release License Agreement between NVIDIA CORPORATION and
// the licensee. All other uses are strictly forbidden.
//
//----------------------------------------------------------------------------------
#ifndef __EGL_SETUP_H
#define __EGL_SETUP_H

// File including this must include the desired EGL implementation before this file
#include <android/native_window.h>

class EGLCapabilities {
public:
    friend class EGLInfo;
    static const EGLCapabilities* create();
    ~EGLCapabilities();

    bool isESCapable() const { return m_esConfig > 0; }
    bool isGLCapable() const { return m_glConfig > 0; }

protected:
    EGLCapabilities();
    EGLConfig m_esConfig;
    EGLConfig m_glConfig;
};

class EGLInfo {
public:
    enum {
        API_ES,
        API_GL
    };

    static EGLInfo* create(const EGLCapabilities& caps, unsigned int api, unsigned int minAPIVersion);
    ~EGLInfo();

    bool createWindowSurface(ANativeWindow* window);

    EGLDisplay getDisplay() const { return m_display; }
    EGLContext getContext() const { return m_context; }
    EGLConfig getConfig() const { return m_config; }
    EGLSurface getSurface() const { return m_surface; }
    unsigned int getAPI() { return m_api; }
    int getAPIVersion() { return m_apiVersion; }

protected:
    EGLInfo();

    EGLDisplay m_display;
    EGLSurface m_surface;
    EGLContext m_context;
	EGLConfig m_config;
    unsigned int m_api;
    int m_apiVersion;
};

#endif