EglPlatformContext.h#
↰ Parent directory (EGL)
Contains the declaration of the PlatformContext class, the main wrapper for the Platform specific part of a Graphics context.
Includes#
- PVRCore/math/Rectangle.h
- PVRCore/stream/Stream.h
- PVRCore/strings/StringFunctions.h
- PVRUtils/EGL/EglPlatformHandles.h
- map
Included By#
Namespaces#
Classes#
Functions#
Typedefs#
Source Code#
#pragma once
#include "PVRCore/stream/Stream.h"
#include "PVRCore/math/Rectangle.h"
#include "PVRCore/strings/StringFunctions.h"
#if TARGET_OS_IPHONE
#include "PVRUtils/EAGL/EaglPlatformHandles.h"
#else
#include "PVRUtils/EGL/EglPlatformHandles.h"
#endif
#include <map>
namespace pvr {
namespace platform {
class EglContext_
{
public:
    EglContext_()
        : _platformContextHandles(), _swapInterval(-2), _initialized(false), _preInitialized(false), _apiType(Api::Unspecified), _maxApiVersion(Api::Unspecified), _attributes(0),
          _isDiscardSupported(false), _parentContext(0)
    {}
    virtual ~EglContext_() { release(); }
    void release();
    Api getMaxApiVersion();
    bool isApiSupported(Api api);
    void swapBuffers();
    void makeCurrent();
    const NativePlatformHandles_& getNativePlatformHandles() const { return *_platformContextHandles; }
    NativePlatformHandles_& getNativePlatformHandles() { return *_platformContextHandles; }
    std::string getInfo();
    bool isInitialized() const { return (_platformContextHandles.get() != 0) && _initialized; }
    Api getApiVersion();
    void init(OSWindow window, OSDisplay display, DisplayAttributes& attributes, Api minVersion = Api::Unspecified, Api maxVersion = Api::Unspecified);
    uint32_t getOnScreenFbo();
    std::unique_ptr<EglContext_> createSharedContextFromEGLContext();
private:
    EglContext_(const EglContext_& rhs); // deleted
    NativePlatformHandles _platformContextHandles;
    NativeDisplayHandle _displayHandle;
    int8_t _swapInterval;
    bool _initialized;
    bool _preInitialized;
    Api _apiType;
    Api _maxApiVersion;
    DisplayAttributes* _attributes;
    bool _isDiscardSupported;
    platform::EglContext_* _parentContext;
    // Must be called after the context has been active in order to query the driver for resource limitations.
    void populateMaxApiVersion();
};
} // namespace platform
} // namespace pvr
namespace pvr {
typedef std::unique_ptr<platform::EglContext_> EglContext;
std::unique_ptr<platform::EglContext_> createEglContext();
} // namespace pvr
 
          