Commit e70413c7 by Geoff Lang Committed by Commit Bot

Roll EGL headers.

Update CGL backend to use new EGL types. BUG=angleproject:1707 Change-Id: I165e81a758cad0a8036aef68c44a57bcc61e982d Reviewed-on: https://chromium-review.googlesource.com/428292Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent fd8b469e
......@@ -6,7 +6,7 @@ extern "C" {
#endif
/*
** Copyright (c) 2013-2015 The Khronos Group Inc.
** Copyright (c) 2013-2017 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
......@@ -31,14 +31,14 @@ extern "C" {
** This header is generated from the Khronos OpenGL / OpenGL ES XML
** API Registry. The current version of the Registry, generator scripts
** used to make the header, and the header can be found at
** http://www.opengl.org/registry/
** http://www.opengl.org/registry/egl
**
** Khronos $Revision: 31566 $ on $Date: 2015-06-23 08:48:48 -0700 (Tue, 23 Jun 2015) $
** Khronos $Revision$ on $Date$
*/
#include <EGL/eglplatform.h>
/* Generated on date 20150623 */
/* Generated on date 20161230 */
/* Generated C header for:
* API: egl
......@@ -78,7 +78,7 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void);
#define EGL_CONFIG_ID 0x3028
#define EGL_CORE_NATIVE_ENGINE 0x305B
#define EGL_DEPTH_SIZE 0x3025
#define EGL_DONT_CARE ((EGLint)-1)
#define EGL_DONT_CARE EGL_CAST(EGLint,-1)
#define EGL_DRAW 0x3059
#define EGL_EXTENSIONS 0x3055
#define EGL_FALSE 0
......@@ -95,9 +95,9 @@ typedef void (*__eglMustCastToProperFunctionPointerType)(void);
#define EGL_NONE 0x3038
#define EGL_NON_CONFORMANT_CONFIG 0x3051
#define EGL_NOT_INITIALIZED 0x3001
#define EGL_NO_CONTEXT ((EGLContext)0)
#define EGL_NO_DISPLAY ((EGLDisplay)0)
#define EGL_NO_SURFACE ((EGLSurface)0)
#define EGL_NO_CONTEXT EGL_CAST(EGLContext,0)
#define EGL_NO_DISPLAY EGL_CAST(EGLDisplay,0)
#define EGL_NO_SURFACE EGL_CAST(EGLSurface,0)
#define EGL_PBUFFER_BIT 0x0001
#define EGL_PIXMAP_BIT 0x0002
#define EGL_READ 0x305A
......@@ -197,7 +197,7 @@ typedef void *EGLClientBuffer;
#define EGL_RGB_BUFFER 0x308E
#define EGL_SINGLE_BUFFER 0x3085
#define EGL_SWAP_BEHAVIOR 0x3093
#define EGL_UNKNOWN ((EGLint)-1)
#define EGL_UNKNOWN EGL_CAST(EGLint,-1)
#define EGL_VERTICAL_RESOLUTION 0x3091
EGLAPI EGLBoolean EGLAPIENTRY eglBindAPI (EGLenum api);
EGLAPI EGLenum EGLAPIENTRY eglQueryAPI (void);
......@@ -224,7 +224,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglWaitClient (void);
#ifndef EGL_VERSION_1_4
#define EGL_VERSION_1_4 1
#define EGL_DEFAULT_DISPLAY ((EGLNativeDisplayType)0)
#define EGL_DEFAULT_DISPLAY EGL_CAST(EGLNativeDisplayType,0)
#define EGL_MULTISAMPLE_RESOLVE_BOX_BIT 0x0200
#define EGL_MULTISAMPLE_RESOLVE 0x3099
#define EGL_MULTISAMPLE_RESOLVE_DEFAULT 0x309A
......@@ -266,7 +266,7 @@ typedef void *EGLImage;
#define EGL_FOREVER 0xFFFFFFFFFFFFFFFFull
#define EGL_TIMEOUT_EXPIRED 0x30F5
#define EGL_CONDITION_SATISFIED 0x30F6
#define EGL_NO_SYNC ((EGLSync)0)
#define EGL_NO_SYNC EGL_CAST(EGLSync,0)
#define EGL_SYNC_FENCE 0x30F9
#define EGL_GL_COLORSPACE 0x309D
#define EGL_GL_COLORSPACE_SRGB 0x3089
......@@ -283,7 +283,7 @@ typedef void *EGLImage;
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x30B7
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x30B8
#define EGL_IMAGE_PRESERVED 0x30D2
#define EGL_NO_IMAGE ((EGLImage)0)
#define EGL_NO_IMAGE EGL_CAST(EGLImage,0)
EGLAPI EGLSync EGLAPIENTRY eglCreateSync (EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySync (EGLDisplay dpy, EGLSync sync);
EGLAPI EGLint EGLAPIENTRY eglClientWaitSync (EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout);
......
......@@ -2,7 +2,7 @@
#define __eglplatform_h_
/*
** Copyright (c) 2007-2013 The Khronos Group Inc.
** Copyright (c) 2007-2016 The Khronos Group Inc.
**
** Permission is hereby granted, free of charge, to any person obtaining a
** copy of this software and/or associated documentation files (the
......@@ -83,7 +83,7 @@ typedef HWND EGLNativeWindowType;
typedef IInspectable* EGLNativeWindowType;
#endif
#elif defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
#elif defined(__APPLE__) || defined(__WINSCW__) || defined(__SYMBIAN32__) /* Symbian */
typedef int EGLNativeDisplayType;
typedef void *EGLNativeWindowType;
......@@ -115,18 +115,6 @@ typedef Display *EGLNativeDisplayType;
typedef Pixmap EGLNativePixmapType;
typedef Window EGLNativeWindowType;
#elif defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) || defined(__MACOS_CLASSIC__) )
#if defined(__OBJC__)
@class CALayer;
#else
class CALayer;
#endif
typedef void *EGLNativeDisplayType;
typedef void *EGLNativePixmapType;
typedef CALayer *EGLNativeWindowType;
#else
#error "Platform not recognized"
#endif
......@@ -146,4 +134,12 @@ typedef EGLNativeWindowType NativeWindowType;
*/
typedef khronos_int32_t EGLint;
/* C++ / C typecast macros for special EGL handle values */
#if defined(__cplusplus)
#define EGL_CAST(type, value) (static_cast<type>(value))
#else
#define EGL_CAST(type, value) ((type) (value))
#endif
#endif /* __eglplatform_h */
......@@ -26,7 +26,7 @@
/* Khronos platform-specific types and definitions.
*
* $Revision: 23298 $ on $Date: 2013-09-30 17:07:13 -0700 (Mon, 30 Sep 2013) $
* $Revision: 32517 $ on $Date: 2016-03-11 02:41:19 -0800 (Fri, 11 Mar 2016) $
*
* Adopters may modify this file to suit their platform. Adopters are
* encouraged to submit platform specific modifications to the Khronos
......@@ -101,6 +101,9 @@
# define KHRONOS_APICALL __declspec(dllimport)
#elif defined (__SYMBIAN32__)
# define KHRONOS_APICALL IMPORT_C
#elif defined(__ANDROID__)
# include <sys/cdefs.h>
# define KHRONOS_APICALL __attribute__((visibility("default"))) __NDK_FPABI__
#else
# define KHRONOS_APICALL
#endif
......@@ -223,7 +226,7 @@ typedef signed short int khronos_int16_t;
typedef unsigned short int khronos_uint16_t;
/*
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* Types that differ between LLP64 and LP64 architectures - in LLP64,
* pointers are 64 bits, but 'long' is still 32 bits. Win64 appears
* to be the only LLP64 architecture in current use.
*/
......@@ -279,4 +282,4 @@ typedef enum {
KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM
} khronos_boolean_enum_t;
#endif /* __khrplatform_h_ */
#endif /* __khrplatform_h_ */
\ No newline at end of file
......@@ -273,17 +273,16 @@ rx::DisplayImpl *CreateDisplayFromAttribs(const AttributeMap &attribMap, const D
} // anonymous namespace
Display *Display::GetDisplayFromAttribs(void *native_display, const AttributeMap &attribMap)
Display *Display::GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay,
const AttributeMap &attribMap)
{
// Initialize the global platform if not already
InitDefaultPlatformImpl();
Display *display = nullptr;
EGLNativeDisplayType displayId = reinterpret_cast<EGLNativeDisplayType>(native_display);
ANGLEPlatformDisplayMap *displays = GetANGLEPlatformDisplayMap();
ANGLEPlatformDisplayMap::const_iterator iter = displays->find(displayId);
ANGLEPlatformDisplayMap::const_iterator iter = displays->find(nativeDisplay);
if (iter != displays->end())
{
display = iter->second;
......@@ -292,13 +291,13 @@ Display *Display::GetDisplayFromAttribs(void *native_display, const AttributeMap
if (display == nullptr)
{
// Validate the native display
if (!Display::isValidNativeDisplay(displayId))
if (!Display::isValidNativeDisplay(nativeDisplay))
{
return NULL;
}
display = new Display(EGL_PLATFORM_ANGLE_ANGLE, displayId, nullptr);
displays->insert(std::make_pair(displayId, display));
display = new Display(EGL_PLATFORM_ANGLE_ANGLE, nativeDisplay, nullptr);
displays->insert(std::make_pair(nativeDisplay, display));
}
// Apply new attributes if the display is not initialized yet.
......@@ -317,15 +316,14 @@ Display *Display::GetDisplayFromAttribs(void *native_display, const AttributeMap
return display;
}
Display *Display::GetDisplayFromDevice(void *native_display)
Display *Display::GetDisplayFromDevice(Device *device)
{
// Initialize the global platform if not already
InitDefaultPlatformImpl();
Display *display = nullptr;
Device *eglDevice = reinterpret_cast<Device *>(native_display);
ASSERT(Device::IsValidDevice(eglDevice));
ASSERT(Device::IsValidDevice(device));
ANGLEPlatformDisplayMap *anglePlatformDisplays = GetANGLEPlatformDisplayMap();
DevicePlatformDisplayMap *devicePlatformDisplays = GetDevicePlatformDisplayMap();
......@@ -334,7 +332,7 @@ Display *Display::GetDisplayFromDevice(void *native_display)
for (auto &displayMapEntry : *anglePlatformDisplays)
{
egl::Display *iterDisplay = displayMapEntry.second;
if (iterDisplay->getDevice() == eglDevice)
if (iterDisplay->getDevice() == device)
{
display = iterDisplay;
}
......@@ -343,7 +341,7 @@ Display *Display::GetDisplayFromDevice(void *native_display)
if (display == nullptr)
{
// See if the eglDevice is in use by a Display created using the DEVICE platform
DevicePlatformDisplayMap::const_iterator iter = devicePlatformDisplays->find(eglDevice);
DevicePlatformDisplayMap::const_iterator iter = devicePlatformDisplays->find(device);
if (iter != devicePlatformDisplays->end())
{
display = iter->second;
......@@ -353,14 +351,14 @@ Display *Display::GetDisplayFromDevice(void *native_display)
if (display == nullptr)
{
// Otherwise create a new Display
display = new Display(EGL_PLATFORM_DEVICE_EXT, 0, eglDevice);
devicePlatformDisplays->insert(std::make_pair(eglDevice, display));
display = new Display(EGL_PLATFORM_DEVICE_EXT, 0, device);
devicePlatformDisplays->insert(std::make_pair(device, display));
}
// Apply new attributes if the display is not initialized yet.
if (!display->isInitialized())
{
rx::DisplayImpl *impl = CreateDisplayFromDevice(eglDevice, display->getState());
rx::DisplayImpl *impl = CreateDisplayFromDevice(device, display->getState());
display->setAttributes(impl, egl::AttributeMap());
}
......
......@@ -52,8 +52,9 @@ class Display final : angle::NonCopyable
Error initialize();
void terminate();
static egl::Display *GetDisplayFromDevice(void *native_display);
static egl::Display *GetDisplayFromAttribs(void *native_display, const AttributeMap &attribMap);
static egl::Display *GetDisplayFromDevice(Device *device);
static egl::Display *GetDisplayFromNativeDisplay(EGLNativeDisplayType nativeDisplay,
const AttributeMap &attribMap);
static const ClientExtensions &getClientExtensions();
static const std::string &getClientExtensionString();
......
......@@ -226,8 +226,8 @@ egl::Error DisplayCGL::restoreLostDevice()
bool DisplayCGL::isValidNativeWindow(EGLNativeWindowType window) const
{
// TODO(cwallez) investigate implementing this
return true;
NSObject *layer = reinterpret_cast<NSObject *>(window);
return [layer isKindOfClass:[CALayer class]];
}
std::string DisplayCGL::getVendorString() const
......
......@@ -56,7 +56,7 @@ class WindowSurfaceCGL : public SurfaceGL
public:
WindowSurfaceCGL(const egl::SurfaceState &state,
RendererGL *renderer,
CALayer *layer,
EGLNativeWindowType layer,
const FunctionsGL *functions,
CGLContextObj context);
~WindowSurfaceCGL() override;
......
......@@ -144,13 +144,13 @@
WindowSurfaceCGL::WindowSurfaceCGL(const egl::SurfaceState &state,
RendererGL *renderer,
CALayer *layer,
EGLNativeWindowType layer,
const FunctionsGL *functions,
CGLContextObj context)
: SurfaceGL(state, renderer),
mSwapLayer(nil),
mCurrentSwapId(0),
mLayer(layer),
mLayer(reinterpret_cast<CALayer *>(layer)),
mContext(context),
mFunctions(functions),
mStateManager(renderer->getStateManager()),
......
......@@ -46,7 +46,7 @@ EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id)
{
EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id);
return Display::GetDisplayFromAttribs(reinterpret_cast<void *>(display_id), AttributeMap());
return Display::GetDisplayFromNativeDisplay(display_id, AttributeMap());
}
EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
......
......@@ -349,8 +349,9 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
}
thread->setError(Error(EGL_SUCCESS));
return Display::GetDisplayFromAttribs(native_display,
AttributeMap::CreateFromIntArray(attrib_list));
return Display::GetDisplayFromNativeDisplay(
gl::bitCast<EGLNativeDisplayType>(native_display),
AttributeMap::CreateFromIntArray(attrib_list));
}
else if (platform == EGL_PLATFORM_DEVICE_EXT)
{
......@@ -364,7 +365,7 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_disp
}
thread->setError(Error(EGL_SUCCESS));
return Display::GetDisplayFromDevice(native_display);
return Display::GetDisplayFromDevice(eglDevice);
}
else
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment