Improvements of the context manager in order to prepare context switching.
Implement WGL context manager OGLES2 driver was not yet working again, might be a different problem, though. Andoird device was not tested. git-svn-id: svn://svn.code.sf.net/p/irrlicht/code/branches/ogl-es@4605 dfc29bdd-3216-0410-991c-e03cc46cb475master
parent
8d278705b1
commit
2d4193888e
|
@ -0,0 +1,50 @@
|
|||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __IRR_I_CONTEXT_MANAGER_H_INCLUDED__
|
||||
#define __IRR_I_CONTEXT_MANAGER_H_INCLUDED__
|
||||
|
||||
#include "SExposedVideoData.h"
|
||||
#include "SIrrCreationParameters.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
class IContextManager : public virtual IReferenceCounted
|
||||
{
|
||||
public:
|
||||
//! Initialize manager with device creation parameters and device window (passed as exposed video data)
|
||||
virtual bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data) =0;
|
||||
|
||||
//! Terminate manager, any cleanup that is left over. Manager needs a new initialize to be usable again
|
||||
virtual void terminate() =0;
|
||||
|
||||
//! Create surface based on current window set
|
||||
virtual bool generateSurface() =0;
|
||||
|
||||
//! Destroy current surface
|
||||
virtual void destroySurface() =0;
|
||||
|
||||
//! Create context based on current surface
|
||||
virtual bool generateContext() =0;
|
||||
|
||||
//! Destroy current context
|
||||
virtual void destroyContext() =0;
|
||||
|
||||
//! Get current context
|
||||
virtual const SExposedVideoData& getContext() const =0;
|
||||
|
||||
//! Change render context, disable old and activate new defined by videoData
|
||||
virtual bool activateContext(const SExposedVideoData& videoData) =0;
|
||||
|
||||
//! Swap buffers.
|
||||
virtual bool swapBuffers() =0;
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif
|
|
@ -198,11 +198,14 @@ If not defined, Windows Multimedia library is used, which offers also broad supp
|
|||
/** If you do not wish the engine to be compiled with OpenGL, comment this
|
||||
define out. */
|
||||
#if !defined(_IRR_IPHONE_PLATFORM_) && !defined(_IRR_ANDROID_PLATFORM_)
|
||||
#define _IRR_COMPILE_WITH_OPENGL_
|
||||
//#define _IRR_COMPILE_WITH_OPENGL_
|
||||
#endif
|
||||
#ifdef NO_IRR_COMPILE_WITH_OPENGL_
|
||||
#undef _IRR_COMPILE_WITH_OPENGL_
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_OPENGL_) && defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_) && !defined(NO_IRR_COMPILE_WITH_WGL_MANAGER_)
|
||||
#define _IRR_COMPILE_WITH_WGL_MANAGER_
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_OGLES1_ to compile the Irrlicht engine with OpenGL-ES 1.x.
|
||||
/** If you do not wish the engine to be compiled with OpenGL-ES 1.x, comment
|
||||
|
@ -215,6 +218,9 @@ define out. */
|
|||
#ifdef NO_IRR_COMPILE_WITH_OGLES1_
|
||||
#undef _IRR_COMPILE_WITH_OGLES1_
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_OGLES1_) && !defined(NO_IRR_COMPILE_WITH_EGL_MANAGER_)
|
||||
#define _IRR_COMPILE_WITH_EGL_MANAGER_
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_OGLES2_ to compile the Irrlicht engine with OpenGL-ES 2.x.
|
||||
/** If you do not wish the engine to be compiled with OpenGL-ES 2.x, comment
|
||||
|
@ -236,6 +242,9 @@ define out. */
|
|||
#define IRR_OGLES2_SHADER_PATH "../../media/Shaders/"
|
||||
#endif
|
||||
#endif
|
||||
#if defined(_IRR_COMPILE_WITH_OGLES2_) && !defined(NO_IRR_COMPILE_WITH_EGL_MANAGER_)
|
||||
#define _IRR_COMPILE_WITH_EGL_MANAGER_
|
||||
#endif
|
||||
|
||||
//! Define _IRR_COMPILE_WITH_SOFTWARE_ to compile the Irrlicht engine with software driver
|
||||
/** If you do not need the software driver, or want to use Burning's Video instead,
|
||||
|
|
|
@ -34,6 +34,10 @@ namespace irr
|
|||
class ISceneManager;
|
||||
} // end namespace scene
|
||||
|
||||
namespace video {
|
||||
class IContextManager;
|
||||
} // end namespace video
|
||||
|
||||
//! The Irrlicht device. You can create it with createDevice() or createDeviceEx().
|
||||
/** This is the most important class of the Irrlicht Engine. You can
|
||||
access everything in the engine if you have a pointer to an instance of
|
||||
|
@ -293,6 +297,9 @@ namespace irr
|
|||
virtual bool getGammaRamp(f32 &red, f32 &green, f32 &blue,
|
||||
f32 &brightness, f32 &contrast) =0;
|
||||
|
||||
//! Get context manager
|
||||
virtual video::IContextManager* getContextManager() =0;
|
||||
|
||||
//! Remove messages pending in the system message loop
|
||||
/** This function is usually used after messages have been buffered for a longer time, for example
|
||||
when loading a large scene. Clearing the message loop prevents that mouse- or buttonclicks which users
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "IBillboardTextSceneNode.h"
|
||||
#include "IBoneSceneNode.h"
|
||||
#include "ICameraSceneNode.h"
|
||||
#include "IContextManager.h"
|
||||
#include "ICursorControl.h"
|
||||
#include "IDummyTransformationSceneNode.h"
|
||||
#include "IDynamicMeshBuffer.h"
|
||||
|
|
|
@ -21,7 +21,7 @@ namespace irr
|
|||
namespace video
|
||||
{
|
||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||
video::SExposedVideoData& data, io::IFileSystem* io, video::IContextManager* contextManager);
|
||||
io::IFileSystem* io, video::IContextManager* contextManager);
|
||||
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
video::SExposedVideoData& data, io::IFileSystem* io, video::IContextManager* contextManager);
|
||||
|
@ -57,7 +57,7 @@ CIrrDeviceAndroid::CIrrDeviceAndroid(const SIrrlichtCreationParameters& param)
|
|||
Android->onInputEvent = handleInput;
|
||||
|
||||
// Create EGL manager.
|
||||
ContextManager = new video::CEGLManager(CreationParams, &ExposedVideoData);
|
||||
ContextManager = new video::CEGLManager();
|
||||
|
||||
os::Printer::log("Waiting for Android activity window to be created.", ELL_DEBUG);
|
||||
|
||||
|
@ -201,9 +201,10 @@ void CIrrDeviceAndroid::handleAndroidCommand(android_app* app, int32_t cmd)
|
|||
Device->CreationParams.WindowSize.Height = ANativeWindow_getHeight(app->window);
|
||||
}
|
||||
|
||||
Device->getContextManager()->initialize();
|
||||
Device->getContextManager()->createSurface();
|
||||
Device->getContextManager()->createContext();
|
||||
Device->getContextManager()->initialize(CreationParams, ExposedVideoData);
|
||||
Device->getContextManager()->generateSurface();
|
||||
Device->getContextManager()->generateContext();
|
||||
Device->getContextManager()->activateContext(Device->getContextManager()->getContext());
|
||||
|
||||
if (!Device->Initialized)
|
||||
{
|
||||
|
@ -314,7 +315,7 @@ void CIrrDeviceAndroid::createDriver()
|
|||
{
|
||||
case video::EDT_OGLES1:
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||
VideoDriver = video::createOGLES1Driver(CreationParams, ExposedVideoData, FileSystem, ContextManager);
|
||||
VideoDriver = video::createOGLES1Driver(CreationParams, FileSystem, ContextManager);
|
||||
#else
|
||||
os::Printer::log("No OpenGL ES 1.0 support compiled in.", ELL_ERROR);
|
||||
#endif
|
||||
|
|
|
@ -1,411 +1,415 @@
|
|||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "CEGLManager.h"
|
||||
|
||||
#include "irrString.h"
|
||||
#include "os.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
CEGLManager::CEGLManager(const SIrrlichtCreationParameters& params, SExposedVideoData* data) : IContextManager(), EglWindow(0), EglDisplay(EGL_NO_DISPLAY),
|
||||
EglSurface(EGL_NO_SURFACE), EglContext(EGL_NO_CONTEXT), EglConfig(0), Params(params), Data(data), MajorVersion(0), MinorVersion(0)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
HDc = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
CEGLManager::~CEGLManager()
|
||||
{
|
||||
destroyContext();
|
||||
destroySurface();
|
||||
terminate();
|
||||
}
|
||||
|
||||
bool CEGLManager::initialize()
|
||||
{
|
||||
if (EglWindow != 0 && EglDisplay != EGL_NO_DISPLAY)
|
||||
return true;
|
||||
|
||||
// Window is depend on platform.
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
EglWindow = (NativeWindowType)Data->OpenGLWin32.HWnd;
|
||||
HDc = GetDC((HWND)EglWindow);
|
||||
EglDisplay = eglGetDisplay((NativeDisplayType)HDc);
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
EglWindow = (NativeWindowType)Data->OpenGLLinux.X11Window;
|
||||
EglDisplay = eglGetDisplay((NativeDisplayType)Data->OpenGLLinux.X11Display);
|
||||
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
EglWindow = (ANativeWindow*)Data->OGLESAndroid.window;
|
||||
EglDisplay = eglGetDisplay((NativeDisplayType) EGL_DEFAULT_DISPLAY);
|
||||
#endif
|
||||
|
||||
// We must check if EGL display is valid.
|
||||
if (EglDisplay == EGL_NO_DISPLAY)
|
||||
{
|
||||
os::Printer::log("Could not get EGL display.");
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
if (HDc)
|
||||
{
|
||||
ReleaseDC((HWND)EglWindow, HDc);
|
||||
HDc = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize EGL here.
|
||||
if (!eglInitialize(EglDisplay, &MajorVersion, &MinorVersion))
|
||||
{
|
||||
os::Printer::log("Could not initialize EGL display.");
|
||||
|
||||
EglDisplay = EGL_NO_DISPLAY;
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
if (HDc)
|
||||
{
|
||||
ReleaseDC((HWND)EglWindow, HDc);
|
||||
HDc = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return false;
|
||||
}
|
||||
else
|
||||
os::Printer::log("EGL version", core::stringc(MajorVersion+(MinorVersion*0.1f)).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEGLManager::terminate()
|
||||
{
|
||||
if (EglWindow == 0 && EglDisplay == EGL_NO_DISPLAY)
|
||||
return;
|
||||
|
||||
// We should unbind current EGL context before terminate EGL.
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
eglTerminate(EglDisplay);
|
||||
EglDisplay = EGL_NO_DISPLAY;
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
if (HDc)
|
||||
{
|
||||
ReleaseDC((HWND)EglWindow, HDc);
|
||||
HDc = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
MajorVersion = 0;
|
||||
MinorVersion = 0;
|
||||
}
|
||||
|
||||
bool CEGLManager::createSurface()
|
||||
{
|
||||
if (EglDisplay == EGL_NO_DISPLAY)
|
||||
return false;
|
||||
|
||||
if (EglSurface != EGL_NO_SURFACE)
|
||||
return true;
|
||||
|
||||
// We should assign new WindowID on platforms, where WindowID may change at runtime,
|
||||
// at this time only Android support this feature.
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
EglWindow = (ANativeWindow*)Data->OGLESAndroid.window;
|
||||
#endif
|
||||
|
||||
EGLint EglOpenGLBIT = 0;
|
||||
|
||||
// We need properly OpenGL BIT.
|
||||
switch (Params.DriverType)
|
||||
{
|
||||
case EDT_OGLES1:
|
||||
EglOpenGLBIT = EGL_OPENGL_ES_BIT;
|
||||
break;
|
||||
case EDT_OGLES2:
|
||||
EglOpenGLBIT = EGL_OPENGL_ES2_BIT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
EGLint Attribs[] =
|
||||
{
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_ALPHA_SIZE, Params.WithAlphaChannel ? 1:0,
|
||||
EGL_BUFFER_SIZE, Params.Bits,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_DEPTH_SIZE, Params.ZBufferBits,
|
||||
EGL_STENCIL_SIZE, Params.Stencilbuffer,
|
||||
EGL_SAMPLE_BUFFERS, Params.AntiAlias ? 1:0,
|
||||
EGL_SAMPLES, Params.AntiAlias,
|
||||
#ifdef EGL_VERSION_1_3
|
||||
EGL_RENDERABLE_TYPE, EglOpenGLBIT,
|
||||
#endif
|
||||
EGL_NONE, 0
|
||||
};
|
||||
|
||||
EglConfig = 0;
|
||||
EGLint NumConfigs = 0;
|
||||
u32 Steps = 5;
|
||||
|
||||
// Choose the best EGL config.
|
||||
while (!eglChooseConfig(EglDisplay, Attribs, &EglConfig, 1, &NumConfigs) || !NumConfigs)
|
||||
{
|
||||
switch (Steps)
|
||||
{
|
||||
case 5: // samples
|
||||
if (Attribs[19] > 2)
|
||||
--Attribs[19];
|
||||
else
|
||||
{
|
||||
Attribs[17] = 0;
|
||||
Attribs[19] = 0;
|
||||
--Steps;
|
||||
}
|
||||
break;
|
||||
case 4: // alpha
|
||||
if (Attribs[7])
|
||||
{
|
||||
Attribs[7] = 0;
|
||||
|
||||
if (Params.AntiAlias)
|
||||
{
|
||||
Attribs[17] = 1;
|
||||
Attribs[19] = Params.AntiAlias;
|
||||
Steps = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
case 3: // stencil
|
||||
if (Attribs[15])
|
||||
{
|
||||
Attribs[15] = 0;
|
||||
|
||||
if (Params.AntiAlias)
|
||||
{
|
||||
Attribs[17] = 1;
|
||||
Attribs[19] = Params.AntiAlias;
|
||||
Steps = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
case 2: // depth size
|
||||
if (Attribs[13] > 16)
|
||||
{
|
||||
Attribs[13] -= 8;
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
case 1: // buffer size
|
||||
if (Attribs[9] > 16)
|
||||
{
|
||||
Attribs[9] -= 8;
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
default:
|
||||
os::Printer::log("Could not get config for EGL display.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Params.AntiAlias && !Attribs[17])
|
||||
os::Printer::log("No multisampling.");
|
||||
|
||||
if (Params.WithAlphaChannel && !Attribs[7])
|
||||
os::Printer::log("No alpha.");
|
||||
|
||||
if (Params.Stencilbuffer && !Attribs[15])
|
||||
os::Printer::log("No stencil buffer.");
|
||||
|
||||
if (Params.ZBufferBits > Attribs[13])
|
||||
os::Printer::log("No full depth buffer.");
|
||||
|
||||
if (Params.Bits > Attribs[9])
|
||||
os::Printer::log("No full color buffer.");
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
EGLint Format = 0;
|
||||
eglGetConfigAttrib(EglDisplay, EglConfig, EGL_NATIVE_VISUAL_ID, &Format);
|
||||
|
||||
ANativeWindow_setBuffersGeometry(EglWindow, 0, 0, Format);
|
||||
#endif
|
||||
|
||||
// Now we are able to create EGL surface.
|
||||
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, EglWindow, 0);
|
||||
|
||||
if (EGL_NO_SURFACE == EglSurface)
|
||||
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, 0, 0);
|
||||
|
||||
if (EGL_NO_SURFACE == EglSurface)
|
||||
os::Printer::log("Could not create EGL surface.");
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
if (MinorVersion > 1)
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
#endif
|
||||
|
||||
// FIX-ME
|
||||
if (Params.Vsync)
|
||||
eglSwapInterval(EglDisplay, 1);
|
||||
|
||||
// If EGL context already exist we should activate it.
|
||||
if (EglContext != EGL_NO_CONTEXT)
|
||||
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEGLManager::destroySurface()
|
||||
{
|
||||
if (EglSurface == EGL_NO_SURFACE)
|
||||
return;
|
||||
|
||||
// We should unbind current EGL context before destroy EGL surface.
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
eglDestroySurface(EglDisplay, EglSurface);
|
||||
EglSurface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
bool CEGLManager::createContext()
|
||||
{
|
||||
if (EglDisplay == EGL_NO_DISPLAY || EglSurface == EGL_NO_SURFACE)
|
||||
return false;
|
||||
|
||||
if (EglContext != EGL_NO_CONTEXT)
|
||||
return true;
|
||||
|
||||
EGLint OpenGLESVersion = 0;
|
||||
|
||||
switch (Params.DriverType)
|
||||
{
|
||||
case EDT_OGLES1:
|
||||
OpenGLESVersion = 1;
|
||||
break;
|
||||
case EDT_OGLES2:
|
||||
OpenGLESVersion = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
EGLint ContextAttrib[] =
|
||||
{
|
||||
#ifdef EGL_VERSION_1_3
|
||||
EGL_CONTEXT_CLIENT_VERSION, OpenGLESVersion,
|
||||
#endif
|
||||
EGL_NONE, 0
|
||||
};
|
||||
|
||||
EglContext = eglCreateContext(EglDisplay, EglConfig, EGL_NO_CONTEXT, ContextAttrib);
|
||||
|
||||
if (testEGLError())
|
||||
os::Printer::log("Could not create EGL context.");
|
||||
|
||||
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);
|
||||
|
||||
if (testEGLError())
|
||||
os::Printer::log("Could not make EGL context current.");
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEGLManager::destroyContext()
|
||||
{
|
||||
if (EglContext == EGL_NO_CONTEXT)
|
||||
return;
|
||||
|
||||
// We must unbind current EGL context before destroy it.
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
eglDestroyContext(EglDisplay, EglContext);
|
||||
|
||||
EglContext = EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
void CEGLManager::swapBuffers()
|
||||
{
|
||||
eglSwapBuffers(EglDisplay, EglSurface);
|
||||
}
|
||||
|
||||
bool CEGLManager::testEGLError()
|
||||
{
|
||||
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
||||
EGLint Status = eglGetError();
|
||||
|
||||
switch (Status)
|
||||
{
|
||||
case EGL_SUCCESS:
|
||||
return false;
|
||||
case EGL_NOT_INITIALIZED :
|
||||
os::Printer::log("Not Initialized", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_ACCESS:
|
||||
os::Printer::log("Bad Access", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_ALLOC:
|
||||
os::Printer::log("Bad Alloc", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_ATTRIBUTE:
|
||||
os::Printer::log("Bad Attribute", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_CONTEXT:
|
||||
os::Printer::log("Bad Context", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_CONFIG:
|
||||
os::Printer::log("Bad Config", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_CURRENT_SURFACE:
|
||||
os::Printer::log("Bad Current Surface", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_DISPLAY:
|
||||
os::Printer::log("Bad Display", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_SURFACE:
|
||||
os::Printer::log("Bad Surface", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_MATCH:
|
||||
os::Printer::log("Bad Match", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_PARAMETER:
|
||||
os::Printer::log("Bad Parameter", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_NATIVE_PIXMAP:
|
||||
os::Printer::log("Bad Native Pixmap", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_NATIVE_WINDOW:
|
||||
os::Printer::log("Bad Native Window", ELL_ERROR);
|
||||
break;
|
||||
case EGL_CONTEXT_LOST:
|
||||
os::Printer::log("Context Lost", ELL_ERROR);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "CEGLManager.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_EGL_MANAGER_
|
||||
|
||||
#include "irrString.h"
|
||||
#include "os.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
CEGLManager::CEGLManager() : IContextManager(), EglWindow(0), EglDisplay(EGL_NO_DISPLAY),
|
||||
EglSurface(EGL_NO_SURFACE), EglContext(EGL_NO_CONTEXT), EglConfig(0), MajorVersion(0), MinorVersion(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CWGLManager");
|
||||
#endif
|
||||
}
|
||||
|
||||
CEGLManager::~CEGLManager()
|
||||
{
|
||||
destroyContext();
|
||||
destroySurface();
|
||||
terminate();
|
||||
}
|
||||
|
||||
bool CEGLManager::initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data)
|
||||
{
|
||||
// store new data
|
||||
Params=params;
|
||||
Data=data;
|
||||
|
||||
if (EglWindow != 0 && EglDisplay != EGL_NO_DISPLAY)
|
||||
return true;
|
||||
|
||||
// Window is depend on platform.
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
EglWindow = (NativeWindowType)Data.OpenGLWin32.HWnd;
|
||||
Data.OpenGLWin32.HDc = GetDC((HWND)EglWindow);
|
||||
EglDisplay = eglGetDisplay((NativeDisplayType)Data.OpenGLWin32.HDc);
|
||||
#elif defined(_IRR_COMPILE_WITH_X11_DEVICE_)
|
||||
EglWindow = (NativeWindowType)Data->OpenGLLinux.X11Window;
|
||||
EglDisplay = eglGetDisplay((NativeDisplayType)Data->OpenGLLinux.X11Display);
|
||||
#elif defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
EglWindow = (ANativeWindow*)Data->OGLESAndroid.window;
|
||||
EglDisplay = eglGetDisplay((NativeDisplayType) EGL_DEFAULT_DISPLAY);
|
||||
#endif
|
||||
|
||||
// We must check if EGL display is valid.
|
||||
if (EglDisplay == EGL_NO_DISPLAY)
|
||||
{
|
||||
os::Printer::log("Could not get EGL display.");
|
||||
terminate();
|
||||
return false;
|
||||
}
|
||||
|
||||
// Initialize EGL here.
|
||||
if (!eglInitialize(EglDisplay, &MajorVersion, &MinorVersion))
|
||||
{
|
||||
os::Printer::log("Could not initialize EGL display.");
|
||||
|
||||
EglDisplay = EGL_NO_DISPLAY;
|
||||
terminate();
|
||||
return false;
|
||||
}
|
||||
else
|
||||
os::Printer::log("EGL version", core::stringc(MajorVersion+(MinorVersion*0.1f)).c_str());
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEGLManager::terminate()
|
||||
{
|
||||
if (EglWindow == 0 && EglDisplay == EGL_NO_DISPLAY)
|
||||
return;
|
||||
|
||||
if (EglDisplay != EGL_NO_DISPLAY)
|
||||
{
|
||||
// We should unbind current EGL context before terminate EGL.
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
eglTerminate(EglDisplay);
|
||||
EglDisplay = EGL_NO_DISPLAY;
|
||||
}
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_WINDOWS_DEVICE_)
|
||||
if (Data.OpenGLWin32.HDc)
|
||||
{
|
||||
ReleaseDC((HWND)EglWindow, (HDC)Data.OpenGLWin32.HDc);
|
||||
Data.OpenGLWin32.HDc = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
MajorVersion = 0;
|
||||
MinorVersion = 0;
|
||||
}
|
||||
|
||||
bool CEGLManager::generateSurface()
|
||||
{
|
||||
if (EglDisplay == EGL_NO_DISPLAY)
|
||||
return false;
|
||||
|
||||
if (EglSurface != EGL_NO_SURFACE)
|
||||
return true;
|
||||
|
||||
// We should assign new WindowID on platforms, where WindowID may change at runtime,
|
||||
// at this time only Android support this feature.
|
||||
// this needs an update method instead!
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
EglWindow = (ANativeWindow*)Data.OGLESAndroid.window;
|
||||
#endif
|
||||
|
||||
EGLint EglOpenGLBIT = 0;
|
||||
|
||||
// We need proper OpenGL BIT.
|
||||
switch (Params.DriverType)
|
||||
{
|
||||
case EDT_OGLES1:
|
||||
EglOpenGLBIT = EGL_OPENGL_ES_BIT;
|
||||
break;
|
||||
case EDT_OGLES2:
|
||||
EglOpenGLBIT = EGL_OPENGL_ES2_BIT;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
EGLint Attribs[] =
|
||||
{
|
||||
EGL_RED_SIZE, 8,
|
||||
EGL_GREEN_SIZE, 8,
|
||||
EGL_BLUE_SIZE, 8,
|
||||
EGL_ALPHA_SIZE, Params.WithAlphaChannel ? 1:0,
|
||||
EGL_BUFFER_SIZE, Params.Bits,
|
||||
EGL_SURFACE_TYPE, EGL_WINDOW_BIT,
|
||||
EGL_DEPTH_SIZE, Params.ZBufferBits,
|
||||
EGL_STENCIL_SIZE, Params.Stencilbuffer,
|
||||
EGL_SAMPLE_BUFFERS, Params.AntiAlias ? 1:0,
|
||||
EGL_SAMPLES, Params.AntiAlias,
|
||||
#ifdef EGL_VERSION_1_3
|
||||
EGL_RENDERABLE_TYPE, EglOpenGLBIT,
|
||||
#endif
|
||||
EGL_NONE, 0
|
||||
};
|
||||
|
||||
EglConfig = 0;
|
||||
EGLint NumConfigs = 0;
|
||||
u32 Steps = 5;
|
||||
|
||||
// Choose the best EGL config.
|
||||
while (!eglChooseConfig(EglDisplay, Attribs, &EglConfig, 1, &NumConfigs) || !NumConfigs)
|
||||
{
|
||||
switch (Steps)
|
||||
{
|
||||
case 5: // samples
|
||||
if (Attribs[19] > 2)
|
||||
--Attribs[19];
|
||||
else
|
||||
{
|
||||
Attribs[17] = 0;
|
||||
Attribs[19] = 0;
|
||||
--Steps;
|
||||
}
|
||||
break;
|
||||
case 4: // alpha
|
||||
if (Attribs[7])
|
||||
{
|
||||
Attribs[7] = 0;
|
||||
|
||||
if (Params.AntiAlias)
|
||||
{
|
||||
Attribs[17] = 1;
|
||||
Attribs[19] = Params.AntiAlias;
|
||||
Steps = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
case 3: // stencil
|
||||
if (Attribs[15])
|
||||
{
|
||||
Attribs[15] = 0;
|
||||
|
||||
if (Params.AntiAlias)
|
||||
{
|
||||
Attribs[17] = 1;
|
||||
Attribs[19] = Params.AntiAlias;
|
||||
Steps = 5;
|
||||
}
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
case 2: // depth size
|
||||
if (Attribs[13] > 16)
|
||||
{
|
||||
Attribs[13] -= 8;
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
case 1: // buffer size
|
||||
if (Attribs[9] > 16)
|
||||
{
|
||||
Attribs[9] -= 8;
|
||||
}
|
||||
else
|
||||
--Steps;
|
||||
break;
|
||||
default:
|
||||
os::Printer::log("Could not get config for EGL display.");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (Params.AntiAlias && !Attribs[17])
|
||||
os::Printer::log("No multisampling.");
|
||||
|
||||
if (Params.WithAlphaChannel && !Attribs[7])
|
||||
os::Printer::log("No alpha.");
|
||||
|
||||
if (Params.Stencilbuffer && !Attribs[15])
|
||||
os::Printer::log("No stencil buffer.");
|
||||
|
||||
if (Params.ZBufferBits > Attribs[13])
|
||||
os::Printer::log("No full depth buffer.");
|
||||
|
||||
if (Params.Bits > Attribs[9])
|
||||
os::Printer::log("No full color buffer.");
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
EGLint Format = 0;
|
||||
eglGetConfigAttrib(EglDisplay, EglConfig, EGL_NATIVE_VISUAL_ID, &Format);
|
||||
|
||||
ANativeWindow_setBuffersGeometry(EglWindow, 0, 0, Format);
|
||||
#endif
|
||||
|
||||
// Now we are able to create EGL surface.
|
||||
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, EglWindow, 0);
|
||||
|
||||
if (EGL_NO_SURFACE == EglSurface)
|
||||
EglSurface = eglCreateWindowSurface(EglDisplay, EglConfig, 0, 0);
|
||||
|
||||
if (EGL_NO_SURFACE == EglSurface)
|
||||
os::Printer::log("Could not create EGL surface.");
|
||||
|
||||
#ifdef EGL_VERSION_1_2
|
||||
if (MinorVersion > 1)
|
||||
eglBindAPI(EGL_OPENGL_ES_API);
|
||||
#endif
|
||||
|
||||
if (Params.Vsync)
|
||||
eglSwapInterval(EglDisplay, 1);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEGLManager::destroySurface()
|
||||
{
|
||||
if (EglSurface == EGL_NO_SURFACE)
|
||||
return;
|
||||
|
||||
// We should unbind current EGL context before destroy EGL surface.
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
|
||||
eglDestroySurface(EglDisplay, EglSurface);
|
||||
EglSurface = EGL_NO_SURFACE;
|
||||
}
|
||||
|
||||
bool CEGLManager::generateContext()
|
||||
{
|
||||
if (EglDisplay == EGL_NO_DISPLAY || EglSurface == EGL_NO_SURFACE)
|
||||
return false;
|
||||
|
||||
if (EglContext != EGL_NO_CONTEXT)
|
||||
return true;
|
||||
|
||||
EGLint OpenGLESVersion = 0;
|
||||
|
||||
switch (Params.DriverType)
|
||||
{
|
||||
case EDT_OGLES1:
|
||||
OpenGLESVersion = 1;
|
||||
break;
|
||||
case EDT_OGLES2:
|
||||
OpenGLESVersion = 2;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
EGLint ContextAttrib[] =
|
||||
{
|
||||
#ifdef EGL_VERSION_1_3
|
||||
EGL_CONTEXT_CLIENT_VERSION, OpenGLESVersion,
|
||||
#endif
|
||||
EGL_NONE, 0
|
||||
};
|
||||
|
||||
EglContext = eglCreateContext(EglDisplay, EglConfig, EGL_NO_CONTEXT, ContextAttrib);
|
||||
|
||||
if (testEGLError())
|
||||
{
|
||||
os::Printer::log("Could not create EGL context.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CEGLManager::destroyContext()
|
||||
{
|
||||
if (EglContext == EGL_NO_CONTEXT)
|
||||
return;
|
||||
|
||||
// We must unbind current EGL context before destroy it.
|
||||
eglMakeCurrent(EglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
|
||||
eglDestroyContext(EglDisplay, EglContext);
|
||||
|
||||
EglContext = EGL_NO_CONTEXT;
|
||||
}
|
||||
|
||||
bool CEGLManager::activateContext(const SExposedVideoData& videoData)
|
||||
{
|
||||
eglMakeCurrent(EglDisplay, EglSurface, EglSurface, EglContext);
|
||||
|
||||
if (testEGLError())
|
||||
{
|
||||
os::Printer::log("Could not make EGL context current.");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
const SExposedVideoData& CEGLManager::getContext() const
|
||||
{
|
||||
return Data;
|
||||
}
|
||||
|
||||
bool CEGLManager::swapBuffers()
|
||||
{
|
||||
return (eglSwapBuffers(EglDisplay, EglSurface)==EGL_TRUE);
|
||||
}
|
||||
|
||||
bool CEGLManager::testEGLError()
|
||||
{
|
||||
#if defined(EGL_VERSION_1_0) && defined(_DEBUG)
|
||||
EGLint Status = eglGetError();
|
||||
|
||||
switch (Status)
|
||||
{
|
||||
case EGL_SUCCESS:
|
||||
return false;
|
||||
case EGL_NOT_INITIALIZED :
|
||||
os::Printer::log("Not Initialized", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_ACCESS:
|
||||
os::Printer::log("Bad Access", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_ALLOC:
|
||||
os::Printer::log("Bad Alloc", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_ATTRIBUTE:
|
||||
os::Printer::log("Bad Attribute", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_CONTEXT:
|
||||
os::Printer::log("Bad Context", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_CONFIG:
|
||||
os::Printer::log("Bad Config", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_CURRENT_SURFACE:
|
||||
os::Printer::log("Bad Current Surface", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_DISPLAY:
|
||||
os::Printer::log("Bad Display", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_SURFACE:
|
||||
os::Printer::log("Bad Surface", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_MATCH:
|
||||
os::Printer::log("Bad Match", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_PARAMETER:
|
||||
os::Printer::log("Bad Parameter", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_NATIVE_PIXMAP:
|
||||
os::Printer::log("Bad Native Pixmap", ELL_ERROR);
|
||||
break;
|
||||
case EGL_BAD_NATIVE_WINDOW:
|
||||
os::Printer::log("Bad Native Window", ELL_ERROR);
|
||||
break;
|
||||
case EGL_CONTEXT_LOST:
|
||||
os::Printer::log("Context Lost", ELL_ERROR);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
};
|
||||
|
||||
return true;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,91 +1,96 @@
|
|||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_EGL_MANAGER_H_INCLUDED__
|
||||
#define __C_EGL_MANAGER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
#include <EGL/egl.h>
|
||||
#else
|
||||
#include <GLES/egl.h>
|
||||
#endif
|
||||
|
||||
#include "SIrrCreationParameters.h"
|
||||
#include "SExposedVideoData.h"
|
||||
#include "IContextManager.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
// EGL manager.
|
||||
class CEGLManager : public IContextManager
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
CEGLManager(const SIrrlichtCreationParameters& params, SExposedVideoData* data);
|
||||
|
||||
//! Destructor.
|
||||
virtual ~CEGLManager();
|
||||
|
||||
// Initialize EGL.
|
||||
/* This method initialize EGLand create EGL display, anyway surface and context
|
||||
aren't create. */
|
||||
bool initialize();
|
||||
|
||||
// Terminate EGL.
|
||||
/* Terminate EGL context. This method break both existed surface and context. */
|
||||
void terminate();
|
||||
|
||||
// Create EGL surface.
|
||||
/* This method create EGL surface. On some platforms eg. Android, we must
|
||||
recreate surface on each resume, because WindowID may change, so existed
|
||||
surface may not be valid. If EGL context already exist, this method
|
||||
automatically activates it. */
|
||||
bool createSurface();
|
||||
|
||||
// Destroy EGL surface.
|
||||
/* This method destroy EGL. On some platforms eg. Android, we should call
|
||||
this method on each pause, because after resume this surface may not be valid.
|
||||
Hovewer this method doesn'r break EGL context. */
|
||||
void destroySurface();
|
||||
|
||||
// Create EGL context.
|
||||
/* This method create and activate EGL context. */
|
||||
bool createContext();
|
||||
|
||||
// Destroy EGL context.
|
||||
/* This method destroy EGL context. */
|
||||
void destroyContext();
|
||||
|
||||
// Swap buffers.
|
||||
void swapBuffers();
|
||||
|
||||
private:
|
||||
bool testEGLError();
|
||||
|
||||
NativeWindowType EglWindow;
|
||||
EGLDisplay EglDisplay;
|
||||
EGLSurface EglSurface;
|
||||
EGLContext EglContext;
|
||||
|
||||
EGLConfig EglConfig;
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
HDC HDc;
|
||||
#endif
|
||||
|
||||
SIrrlichtCreationParameters Params;
|
||||
SExposedVideoData* Data;
|
||||
|
||||
EGLint MajorVersion;
|
||||
EGLint MinorVersion;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_EGL_MANAGER_H_INCLUDED__
|
||||
#define __C_EGL_MANAGER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_EGL_MANAGER_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
#include <EGL/egl.h>
|
||||
#else
|
||||
#include <GLES/egl.h>
|
||||
#endif
|
||||
|
||||
#include "SIrrCreationParameters.h"
|
||||
#include "SExposedVideoData.h"
|
||||
#include "IContextManager.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "libEGL.lib")
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
// EGL manager.
|
||||
class CEGLManager : public IContextManager
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
CEGLManager();
|
||||
|
||||
//! Destructor.
|
||||
virtual ~CEGLManager();
|
||||
|
||||
// Initialize EGL.
|
||||
/* This method initialize EGLand create EGL display, anyway surface and context
|
||||
aren't create. */
|
||||
bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data);
|
||||
|
||||
// Terminate EGL.
|
||||
/* Terminate EGL context. This method break both existed surface and context. */
|
||||
void terminate();
|
||||
|
||||
// Create EGL surface.
|
||||
/* This method create EGL surface. On some platforms eg. Android, we must
|
||||
recreate surface on each resume, because WindowID may change, so existed
|
||||
surface may not be valid. If EGL context already exist, this method
|
||||
automatically activates it. */
|
||||
bool generateSurface();
|
||||
|
||||
// Destroy EGL surface.
|
||||
/* This method destroy EGL. On some platforms eg. Android, we should call
|
||||
this method on each pause, because after resume this surface may not be valid.
|
||||
Hovewer this method doesn'r break EGL context. */
|
||||
void destroySurface();
|
||||
|
||||
// Create EGL context.
|
||||
/* This method create and activate EGL context. */
|
||||
bool generateContext();
|
||||
|
||||
// Destroy EGL context.
|
||||
/* This method destroy EGL context. */
|
||||
void destroyContext();
|
||||
|
||||
const SExposedVideoData& getContext() const;
|
||||
|
||||
bool activateContext(const SExposedVideoData& videoData);
|
||||
|
||||
// Swap buffers.
|
||||
bool swapBuffers();
|
||||
|
||||
private:
|
||||
bool testEGLError();
|
||||
|
||||
NativeWindowType EglWindow;
|
||||
EGLDisplay EglDisplay;
|
||||
EGLSurface EglSurface;
|
||||
EGLContext EglContext;
|
||||
|
||||
EGLConfig EglConfig;
|
||||
|
||||
SIrrlichtCreationParameters Params;
|
||||
SExposedVideoData Data;
|
||||
|
||||
EGLint MajorVersion;
|
||||
EGLint MinorVersion;
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -35,6 +35,9 @@
|
|||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
#include "CEGLManager.h"
|
||||
#endif
|
||||
#if defined(_IRR_WINDOWS_API_)
|
||||
#include "CWGLManager.h"
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -52,11 +55,11 @@ namespace irr
|
|||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
IVideoDriver* createOpenGLDriver(const irr::SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceWin32* device);
|
||||
io::IFileSystem* io, IContextManager* contextManager);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params, video::SExposedVideoData& data, io::IFileSystem* io
|
||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -66,7 +69,7 @@ namespace irr
|
|||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, video::SExposedVideoData& data, io::IFileSystem* io
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params, io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -934,8 +937,8 @@ namespace irr
|
|||
|
||||
//! constructor
|
||||
CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
||||
: CIrrDeviceStub(params), HWnd(0), ChangedToFullScreen(false), Resized(false),
|
||||
ExternalWindow(false), Win32CursorControl(0), JoyControl(0)
|
||||
: CIrrDeviceStub(params), ChangedToFullScreen(false), Resized(false),
|
||||
ExternalWindow(false), Win32CursorControl(0), JoyControl(0), HWnd(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CIrrDeviceWin32");
|
||||
|
@ -1019,9 +1022,13 @@ CIrrDeviceWin32::CIrrDeviceWin32(const SIrrlichtCreationParameters& params)
|
|||
}
|
||||
|
||||
// create window
|
||||
|
||||
HWnd = CreateWindow( ClassName, __TEXT(""), style, windowLeft, windowTop,
|
||||
realWidth, realHeight, NULL, NULL, hInstance, NULL);
|
||||
if (!HWnd)
|
||||
{
|
||||
os::Printer::log("Window could not be created.", ELL_ERROR);
|
||||
}
|
||||
|
||||
CreationParams.WindowId = HWnd;
|
||||
// CreationParams.WindowSize.Width = realWidth;
|
||||
// CreationParams.WindowSize.Height = realHeight;
|
||||
|
@ -1143,14 +1150,17 @@ void CIrrDeviceWin32::createDriver()
|
|||
break;
|
||||
|
||||
case video::EDT_OPENGL:
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
switchToFullScreen();
|
||||
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, this);
|
||||
if (!VideoDriver)
|
||||
{
|
||||
os::Printer::log("Could not create OpenGL driver.", ELL_ERROR);
|
||||
switchToFullScreen();
|
||||
|
||||
ContextManager = new video::CWGLManager();
|
||||
ContextManager->initialize(CreationParams, video::SExposedVideoData(HWnd));
|
||||
VideoDriver = video::createOpenGLDriver(CreationParams, FileSystem, ContextManager);
|
||||
if (!VideoDriver)
|
||||
{
|
||||
os::Printer::log("Could not create OpenGL driver.", ELL_ERROR);
|
||||
}
|
||||
}
|
||||
#else
|
||||
os::Printer::log("OpenGL driver was not compiled in.", ELL_ERROR);
|
||||
|
@ -1160,13 +1170,11 @@ void CIrrDeviceWin32::createDriver()
|
|||
case video::EDT_OGLES1:
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||
{
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLWin32.HWnd=HWnd;
|
||||
|
||||
ContextManager = new video::CEGLManager(CreationParams,&data);
|
||||
switchToFullScreen();
|
||||
ContextManager = new video::CEGLManager();
|
||||
ContextManager->initialize(CreationParams, video::SExposedVideoData(HWnd));
|
||||
|
||||
VideoDriver = video::createOGLES1Driver(CreationParams, data, FileSystem, ContextManager);
|
||||
VideoDriver = video::createOGLES1Driver(CreationParams, FileSystem, ContextManager);
|
||||
if (!VideoDriver)
|
||||
{
|
||||
os::Printer::log("Could not create OpenGL-ES1 driver.", ELL_ERROR);
|
||||
|
@ -1180,13 +1188,11 @@ void CIrrDeviceWin32::createDriver()
|
|||
case video::EDT_OGLES2:
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
{
|
||||
video::SExposedVideoData data;
|
||||
data.OpenGLWin32.HWnd=HWnd;
|
||||
|
||||
ContextManager = new video::CEGLManager(CreationParams,&data);
|
||||
switchToFullScreen();
|
||||
ContextManager = new video::CEGLManager();
|
||||
ContextManager->initialize(CreationParams, video::SExposedVideoData(HWnd));
|
||||
|
||||
VideoDriver = video::createOGLES2Driver(CreationParams, data, FileSystem, ContextManager);
|
||||
VideoDriver = video::createOGLES2Driver(CreationParams, FileSystem, ContextManager);
|
||||
if (!VideoDriver)
|
||||
{
|
||||
os::Printer::log("Could not create OpenGL-ES2 driver.", ELL_ERROR);
|
||||
|
@ -1855,7 +1861,7 @@ bool CIrrDeviceWin32::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright
|
|||
r = GetDeviceGammaRamp ( dc, ramp ) == TRUE;
|
||||
ReleaseDC(HWnd, dc);
|
||||
|
||||
if ( r )
|
||||
if (r)
|
||||
{
|
||||
calculateGammaFromRamp(red, ramp[0]);
|
||||
calculateGammaFromRamp(green, ramp[1]);
|
||||
|
@ -1866,7 +1872,6 @@ bool CIrrDeviceWin32::getGammaRamp( f32 &red, f32 &green, f32 &blue, f32 &bright
|
|||
contrast = 0.f;
|
||||
|
||||
return r;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -1881,7 +1886,7 @@ void CIrrDeviceWin32::handleSystemMessages()
|
|||
// deadkey handling.
|
||||
|
||||
if (ExternalWindow && msg.hwnd == HWnd)
|
||||
WndProc(HWnd, msg.message, msg.wParam, msg.lParam);
|
||||
WndProc(msg.hwnd, msg.message, msg.wParam, msg.lParam);
|
||||
else
|
||||
DispatchMessage(&msg);
|
||||
|
||||
|
|
|
@ -406,15 +406,13 @@ namespace irr
|
|||
|
||||
void resizeIfNecessary();
|
||||
|
||||
HWND HWnd;
|
||||
|
||||
bool ChangedToFullScreen;
|
||||
bool Resized;
|
||||
bool ExternalWindow;
|
||||
CCursorControl* Win32CursorControl;
|
||||
DEVMODE DesktopMode;
|
||||
|
||||
SJoystickWin32Control* JoyControl;
|
||||
DEVMODE DesktopMode;
|
||||
HWND HWnd;
|
||||
};
|
||||
|
||||
} // end namespace irr
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace video
|
|||
{
|
||||
|
||||
COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data, io::IFileSystem* io
|
||||
io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -58,7 +58,6 @@ COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
|||
setDebugName("COGLES2Driver");
|
||||
#endif
|
||||
|
||||
ExposedData = data;
|
||||
core::dimension2d<u32> WindowSize(0, 0);
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
|
@ -66,11 +65,12 @@ COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
|||
return;
|
||||
|
||||
ContextManager->grab();
|
||||
ContextManager->initialize();
|
||||
ContextManager->createSurface();
|
||||
ContextManager->createContext();
|
||||
ContextManager->generateSurface();
|
||||
ContextManager->generateContext();
|
||||
ExposedData = ContextManager->getContext();
|
||||
ContextManager->activateContext(ExposedData);
|
||||
|
||||
WindowSize = params.WindowSize;
|
||||
WindowSize = params.WindowSize;
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
glGenFramebuffers(1, &ViewFramebuffer);
|
||||
glGenRenderbuffers(1, &ViewRenderbuffer);
|
||||
|
@ -100,10 +100,10 @@ COGLES2Driver::COGLES2Driver(const SIrrlichtCreationParameters& params,
|
|||
|
||||
WindowSize = core::dimension2d<u32>(backingWidth, backingHeight);
|
||||
CNullDriver::ScreenSize = WindowSize;
|
||||
CNullDriver::ViewPort = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(WindowSize));
|
||||
CNullDriver::ViewPort = core::rect<s32>(core::position2d<s32>(0,0), core::dimension2di(WindowSize));
|
||||
#endif
|
||||
|
||||
genericDriverInit(WindowSize, params.Stencilbuffer);
|
||||
genericDriverInit(WindowSize, params.Stencilbuffer);
|
||||
}
|
||||
|
||||
COGLES2Driver::~COGLES2Driver()
|
||||
|
@ -119,6 +119,7 @@ COGLES2Driver::~COGLES2Driver()
|
|||
if (ContextManager)
|
||||
{
|
||||
ContextManager->destroyContext();
|
||||
ContextManager->destroySurface();
|
||||
ContextManager->drop();
|
||||
}
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -2872,7 +2873,7 @@ class IContextManager;
|
|||
#endif
|
||||
|
||||
IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
video::SExposedVideoData& data, io::IFileSystem* io
|
||||
io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -2881,7 +2882,7 @@ IVideoDriver* createOGLES2Driver(const SIrrlichtCreationParameters& params,
|
|||
)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
return new COGLES2Driver(params, data, io
|
||||
return new COGLES2Driver(params, io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
|
|
@ -26,23 +26,15 @@
|
|||
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES2_
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
#include <OpenGLES/ES2/gl.h>
|
||||
#include <OpenGLES/ES2/glext.h>
|
||||
#else
|
||||
#include <EGL/eglplatform.h>
|
||||
#endif
|
||||
|
||||
#include "CNullDriver.h"
|
||||
#include "IMaterialRendererServices.h"
|
||||
#include "EDriverFeatures.h"
|
||||
#include "fast_atof.h"
|
||||
|
||||
#include "COGLES2ExtensionHandler.h"
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "libEGL.lib")
|
||||
#pragma comment(lib, "libGLESv2.lib")
|
||||
#endif
|
||||
#include "COGLES2ExtensionHandler.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
|
@ -63,7 +55,7 @@ namespace video
|
|||
public:
|
||||
//! constructor
|
||||
COGLES2Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data, io::IFileSystem* io
|
||||
io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace video
|
|||
{
|
||||
|
||||
COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data, io::IFileSystem* io
|
||||
io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -45,7 +45,6 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
|||
setDebugName("COGLESDriver");
|
||||
#endif
|
||||
|
||||
ExposedData = data;
|
||||
core::dimension2d<u32> WindowSize(0, 0);
|
||||
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
|
@ -53,9 +52,10 @@ COGLES1Driver::COGLES1Driver(const SIrrlichtCreationParameters& params,
|
|||
return;
|
||||
|
||||
ContextManager->grab();
|
||||
ContextManager->initialize();
|
||||
ContextManager->createSurface();
|
||||
ContextManager->createContext();
|
||||
ContextManager->generateSurface();
|
||||
ContextManager->generateContext();
|
||||
ExposedData = ContextManager->getContext();
|
||||
ContextManager->activateContext(ExposedData);
|
||||
|
||||
WindowSize = params.WindowSize;
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -103,6 +103,7 @@ COGLES1Driver::~COGLES1Driver()
|
|||
if (ContextManager)
|
||||
{
|
||||
ContextManager->destroyContext();
|
||||
ContextManager->destroySurface();
|
||||
ContextManager->drop();
|
||||
}
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -3035,7 +3036,7 @@ class IContextManager;
|
|||
#endif
|
||||
|
||||
IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||
video::SExposedVideoData& data, io::IFileSystem* io
|
||||
io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
@ -3044,7 +3045,7 @@ IVideoDriver* createOGLES1Driver(const SIrrlichtCreationParameters& params,
|
|||
)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OGLES1_
|
||||
return new COGLES1Driver(params, data, io
|
||||
return new COGLES1Driver(params, io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include "IMaterialRendererServices.h"
|
||||
#include "EDriverFeatures.h"
|
||||
#include "fast_atof.h"
|
||||
#include "SIrrCreationParameters.h"
|
||||
#include "IContextManager.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "libgles_cm.lib")
|
||||
|
@ -32,7 +34,7 @@ namespace video
|
|||
public:
|
||||
//! constructor
|
||||
COGLES1Driver(const SIrrlichtCreationParameters& params,
|
||||
const SExposedVideoData& data, io::IFileSystem* io
|
||||
io::IFileSystem* io
|
||||
#if defined(_IRR_COMPILE_WITH_X11_DEVICE_) || defined(_IRR_WINDOWS_API_) || defined(_IRR_COMPILE_WITH_ANDROID_DEVICE_)
|
||||
, IContextManager* contextManager
|
||||
#elif defined(_IRR_COMPILE_WITH_IPHONE_DEVICE_)
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
#include "COpenGLDriver.h"
|
||||
// needed here also because of the create methods' parameters
|
||||
#include "CNullDriver.h"
|
||||
#include "IContextManager.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
|
||||
|
@ -16,6 +17,7 @@
|
|||
#include "COpenGLNormalMapRenderer.h"
|
||||
#include "COpenGLParallaxMapRenderer.h"
|
||||
#include "os.h"
|
||||
#include "IrrlichtDevice.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
#include <SDL/SDL.h>
|
||||
|
@ -41,16 +43,17 @@ const u16 COpenGLDriver::Quad2DIndices[4] = { 0, 1, 2, 3 };
|
|||
// WINDOWS CONSTRUCTOR
|
||||
// -----------------------------------------------------------------------
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
#include "CWGLManager.h"
|
||||
|
||||
//! Windows constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const irr::SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceWin32* device)
|
||||
COpenGLDriver::COpenGLDriver(const ::irr::SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, IContextManager* contextManager)
|
||||
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
|
||||
CurrentRenderMode(ERM_NONE), ResetRenderStates(true), Transformation3DChanged(true),
|
||||
AntiAlias(params.AntiAlias), RenderTargetTexture(0),
|
||||
CurrentRendertargetSize(0,0), ColorFormat(ECF_R8G8B8),
|
||||
CurrentTarget(ERT_FRAME_BUFFER), Params(params), BridgeCalls(0),
|
||||
HDc(0), Window(static_cast<HWND>(params.WindowId)), Win32Device(device),
|
||||
DeviceType(EIDT_WIN32)
|
||||
ContextManager(contextManager), DeviceType(EIDT_WIN32)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("COpenGLDriver");
|
||||
|
@ -62,408 +65,13 @@ COpenGLDriver::COpenGLDriver(const irr::SIrrlichtCreationParameters& params,
|
|||
}
|
||||
|
||||
|
||||
bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrrDeviceWin32* device)
|
||||
{
|
||||
if (videoData.OpenGLWin32.HWnd && videoData.OpenGLWin32.HDc && videoData.OpenGLWin32.HRc)
|
||||
{
|
||||
if (!wglMakeCurrent((HDC)videoData.OpenGLWin32.HDc, (HGLRC)videoData.OpenGLWin32.HRc))
|
||||
{
|
||||
os::Printer::log("Render Context switch failed.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
HDc = (HDC)videoData.OpenGLWin32.HDc;
|
||||
}
|
||||
}
|
||||
// set back to main context
|
||||
else if (HDc != ExposedData.OpenGLWin32.HDc)
|
||||
{
|
||||
if (!wglMakeCurrent((HDC)ExposedData.OpenGLWin32.HDc, (HGLRC)ExposedData.OpenGLWin32.HRc))
|
||||
{
|
||||
os::Printer::log("Render Context switch failed.");
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
HDc = (HDC)ExposedData.OpenGLWin32.HDc;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
//! inits the open gl driver
|
||||
bool COpenGLDriver::initDriver(CIrrDeviceWin32* device)
|
||||
{
|
||||
// Create a window to test antialiasing support
|
||||
const fschar_t* ClassName = __TEXT("GLCIrrDeviceWin32");
|
||||
HINSTANCE lhInstance = GetModuleHandle(0);
|
||||
|
||||
// Register Class
|
||||
WNDCLASSEX wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = (WNDPROC)DefWindowProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = lhInstance;
|
||||
wcex.hIcon = NULL;
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = 0;
|
||||
wcex.lpszClassName = ClassName;
|
||||
wcex.hIconSm = 0;
|
||||
wcex.hIcon = 0;
|
||||
RegisterClassEx(&wcex);
|
||||
|
||||
RECT clientSize;
|
||||
clientSize.top = 0;
|
||||
clientSize.left = 0;
|
||||
clientSize.right = Params.WindowSize.Width;
|
||||
clientSize.bottom = Params.WindowSize.Height;
|
||||
|
||||
DWORD style = WS_POPUP;
|
||||
if (!Params.Fullscreen)
|
||||
style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
|
||||
AdjustWindowRect(&clientSize, style, FALSE);
|
||||
|
||||
const s32 realWidth = clientSize.right - clientSize.left;
|
||||
const s32 realHeight = clientSize.bottom - clientSize.top;
|
||||
|
||||
const s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
|
||||
const s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2;
|
||||
|
||||
HWND temporary_wnd=CreateWindow(ClassName, __TEXT(""), style, windowLeft,
|
||||
windowTop, realWidth, realHeight, NULL, NULL, lhInstance, NULL);
|
||||
|
||||
if (!temporary_wnd)
|
||||
{
|
||||
os::Printer::log("Cannot create a temporary window.", ELL_ERROR);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
HDc = GetDC(temporary_wnd);
|
||||
|
||||
// Set up pixel format descriptor with desired parameters
|
||||
PIXELFORMATDESCRIPTOR pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
||||
1, // Version Number
|
||||
PFD_DRAW_TO_WINDOW | // Format Must Support Window
|
||||
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
||||
(Params.Doublebuffer?PFD_DOUBLEBUFFER:0) | // Must Support Double Buffering
|
||||
(Params.Stereobuffer?PFD_STEREO:0), // Must Support Stereo Buffer
|
||||
PFD_TYPE_RGBA, // Request An RGBA Format
|
||||
Params.Bits, // Select Our Color Depth
|
||||
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
||||
0, // No Alpha Buffer
|
||||
0, // Shift Bit Ignored
|
||||
0, // No Accumulation Buffer
|
||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||
Params.ZBufferBits, // Z-Buffer (Depth Buffer)
|
||||
BYTE(Params.Stencilbuffer ? 1 : 0), // Stencil Buffer Depth
|
||||
0, // No Auxiliary Buffer
|
||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||
0, // Reserved
|
||||
0, 0, 0 // Layer Masks Ignored
|
||||
};
|
||||
|
||||
GLuint PixelFormat;
|
||||
|
||||
for (u32 i=0; i<6; ++i)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
if (Params.Stencilbuffer)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device with stencil buffer, disabling stencil shadows.", ELL_WARNING);
|
||||
Params.Stencilbuffer = false;
|
||||
pfd.cStencilBits = 0;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 2)
|
||||
{
|
||||
pfd.cDepthBits = 24;
|
||||
}
|
||||
else
|
||||
if (i == 3)
|
||||
{
|
||||
if (Params.Bits!=16)
|
||||
pfd.cDepthBits = 16;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 4)
|
||||
{
|
||||
// try single buffer
|
||||
if (Params.Doublebuffer)
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 5)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device context", "No suitable format for temporary window.", ELL_ERROR);
|
||||
ReleaseDC(temporary_wnd, HDc);
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
// choose pixelformat
|
||||
PixelFormat = ChoosePixelFormat(HDc, &pfd);
|
||||
if (PixelFormat)
|
||||
break;
|
||||
}
|
||||
|
||||
SetPixelFormat(HDc, PixelFormat, &pfd);
|
||||
HGLRC hrc=wglCreateContext(HDc);
|
||||
if (!hrc)
|
||||
{
|
||||
os::Printer::log("Cannot create a temporary GL rendering context.", ELL_ERROR);
|
||||
ReleaseDC(temporary_wnd, HDc);
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
SExposedVideoData data;
|
||||
data.OpenGLWin32.HDc = HDc;
|
||||
data.OpenGLWin32.HRc = hrc;
|
||||
data.OpenGLWin32.HWnd = temporary_wnd;
|
||||
|
||||
|
||||
if (!changeRenderContext(data, device))
|
||||
{
|
||||
os::Printer::log("Cannot activate a temporary GL rendering context.", ELL_ERROR);
|
||||
wglDeleteContext(hrc);
|
||||
ReleaseDC(temporary_wnd, HDc);
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
core::stringc wglExtensions;
|
||||
#ifdef WGL_ARB_extensions_string
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
if (irrGetExtensionsString)
|
||||
wglExtensions = irrGetExtensionsString(HDc);
|
||||
#elif defined(WGL_EXT_extensions_string)
|
||||
PFNWGLGETEXTENSIONSSTRINGEXTPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT");
|
||||
if (irrGetExtensionsString)
|
||||
wglExtensions = irrGetExtensionsString(HDc);
|
||||
#endif
|
||||
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
|
||||
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
|
||||
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1) );
|
||||
#ifdef _DEBUG
|
||||
os::Printer::log("WGL_extensions", wglExtensions);
|
||||
#endif
|
||||
|
||||
#ifdef WGL_ARB_pixel_format
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
if (pixel_format_supported && wglChoosePixelFormat_ARB)
|
||||
{
|
||||
// This value determines the number of samples used for antialiasing
|
||||
// My experience is that 8 does not show a big
|
||||
// improvement over 4, but 4 shows a big improvement
|
||||
// over 2.
|
||||
|
||||
if(AntiAlias > 32)
|
||||
AntiAlias = 32;
|
||||
|
||||
f32 fAttributes[] = {0.0, 0.0};
|
||||
s32 iAttributes[] =
|
||||
{
|
||||
WGL_DRAW_TO_WINDOW_ARB,1,
|
||||
WGL_SUPPORT_OPENGL_ARB,1,
|
||||
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
|
||||
WGL_COLOR_BITS_ARB,(Params.Bits==32) ? 24 : 15,
|
||||
WGL_ALPHA_BITS_ARB,(Params.Bits==32) ? 8 : 1,
|
||||
WGL_DEPTH_BITS_ARB,Params.ZBufferBits, // 10,11
|
||||
WGL_STENCIL_BITS_ARB,Params.Stencilbuffer ? 1 : 0,
|
||||
WGL_DOUBLE_BUFFER_ARB,Params.Doublebuffer ? 1 : 0,
|
||||
WGL_STEREO_ARB,Params.Stereobuffer ? 1 : 0,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
#ifdef WGL_ARB_multisample
|
||||
WGL_SAMPLES_ARB,AntiAlias, // 20,21
|
||||
WGL_SAMPLE_BUFFERS_ARB, 1,
|
||||
#elif defined(WGL_EXT_multisample)
|
||||
WGL_SAMPLES_EXT,AntiAlias, // 20,21
|
||||
WGL_SAMPLE_BUFFERS_EXT, 1,
|
||||
#elif defined(WGL_3DFX_multisample)
|
||||
WGL_SAMPLES_3DFX,AntiAlias, // 20,21
|
||||
WGL_SAMPLE_BUFFERS_3DFX, 1,
|
||||
#endif
|
||||
#ifdef WGL_ARB_framebuffer_sRGB
|
||||
WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, Params.HandleSRGB ? 1:0,
|
||||
#elif defined(WGL_EXT_framebuffer_sRGB)
|
||||
WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT, Params.HandleSRGB ? 1:0,
|
||||
#endif
|
||||
// WGL_DEPTH_FLOAT_EXT, 1,
|
||||
0,0,0,0
|
||||
};
|
||||
int iAttrSize = sizeof(iAttributes)/sizeof(int);
|
||||
const bool framebuffer_srgb_supported = ((wglExtensions.find("WGL_ARB_framebuffer_sRGB") != -1) ||
|
||||
(wglExtensions.find("WGL_EXT_framebuffer_sRGB") != -1));
|
||||
if (!framebuffer_srgb_supported)
|
||||
{
|
||||
memmove(&iAttributes[24],&iAttributes[26],sizeof(int)*(iAttrSize-26));
|
||||
iAttrSize -= 2;
|
||||
}
|
||||
if (!multi_sample_supported)
|
||||
{
|
||||
memmove(&iAttributes[20],&iAttributes[24],sizeof(int)*(iAttrSize-24));
|
||||
iAttrSize -= 4;
|
||||
}
|
||||
|
||||
s32 rv=0;
|
||||
// Try to get an acceptable pixel format
|
||||
do
|
||||
{
|
||||
int pixelFormat=0;
|
||||
UINT numFormats=0;
|
||||
const BOOL valid = wglChoosePixelFormat_ARB(HDc,iAttributes,fAttributes,1,&pixelFormat,&numFormats);
|
||||
|
||||
if (valid && numFormats)
|
||||
rv = pixelFormat;
|
||||
else
|
||||
iAttributes[21] -= 1;
|
||||
}
|
||||
while(rv==0 && iAttributes[21]>1);
|
||||
if (rv)
|
||||
{
|
||||
PixelFormat=rv;
|
||||
AntiAlias=iAttributes[21];
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
AntiAlias=0;
|
||||
|
||||
wglMakeCurrent(HDc, NULL);
|
||||
wglDeleteContext(hrc);
|
||||
ReleaseDC(temporary_wnd, HDc);
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
|
||||
// get hdc
|
||||
HDc=GetDC(Window);
|
||||
if (!HDc)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device context.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// search for pixel format the simple way
|
||||
if (PixelFormat==0 || (!SetPixelFormat(HDc, PixelFormat, &pfd)))
|
||||
{
|
||||
for (u32 i=0; i<5; ++i)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
if (Params.Stencilbuffer)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device with stencil buffer, disabling stencil shadows.", ELL_WARNING);
|
||||
Params.Stencilbuffer = false;
|
||||
pfd.cStencilBits = 0;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 2)
|
||||
{
|
||||
pfd.cDepthBits = 24;
|
||||
}
|
||||
if (i == 3)
|
||||
{
|
||||
if (Params.Bits!=16)
|
||||
pfd.cDepthBits = 16;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 4)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device context", "No suitable format.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// choose pixelformat
|
||||
PixelFormat = ChoosePixelFormat(HDc, &pfd);
|
||||
if (PixelFormat)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set pixel format
|
||||
if (!SetPixelFormat(HDc, PixelFormat, &pfd))
|
||||
{
|
||||
os::Printer::log("Cannot set the pixel format.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
os::Printer::log("Pixel Format", core::stringc(PixelFormat).c_str(), ELL_DEBUG);
|
||||
|
||||
// create rendering context
|
||||
#ifdef WGL_ARB_create_context
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
if (wglCreateContextAttribs_ARB)
|
||||
{
|
||||
int iAttribs[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 3,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
0
|
||||
};
|
||||
hrc=wglCreateContextAttribs_ARB(HDc, 0, iAttribs);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
hrc=wglCreateContext(HDc);
|
||||
|
||||
if (!hrc)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL rendering context.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// set exposed data
|
||||
ExposedData.OpenGLWin32.HDc = HDc;
|
||||
ExposedData.OpenGLWin32.HRc = hrc;
|
||||
ExposedData.OpenGLWin32.HWnd = Window;
|
||||
|
||||
// activate rendering context
|
||||
|
||||
if (!changeRenderContext(ExposedData, device))
|
||||
{
|
||||
os::Printer::log("Cannot activate GL rendering context", ELL_ERROR);
|
||||
wglDeleteContext(hrc);
|
||||
return false;
|
||||
}
|
||||
|
||||
int pf = GetPixelFormat(HDc);
|
||||
DescribePixelFormat(HDc, pf, sizeof(PIXELFORMATDESCRIPTOR), &pfd);
|
||||
if (pfd.cAlphaBits != 0)
|
||||
{
|
||||
if (pfd.cRedBits == 8)
|
||||
ColorFormat = ECF_A8R8G8B8;
|
||||
else
|
||||
ColorFormat = ECF_A1R5G5B5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pfd.cRedBits == 8)
|
||||
ColorFormat = ECF_R8G8B8;
|
||||
else
|
||||
ColorFormat = ECF_R5G6B5;
|
||||
}
|
||||
ContextManager->generateSurface();
|
||||
ContextManager->generateContext();
|
||||
ExposedData=ContextManager->getContext();
|
||||
ContextManager->activateContext(ExposedData);
|
||||
|
||||
genericDriverInit();
|
||||
|
||||
|
@ -477,7 +85,6 @@ bool COpenGLDriver::initDriver(CIrrDeviceWin32* device)
|
|||
// MacOSX CONSTRUCTOR
|
||||
// -----------------------------------------------------------------------
|
||||
#ifdef _IRR_COMPILE_WITH_OSX_DEVICE_
|
||||
//! Windows constructor and init code
|
||||
COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceMacOSX *device)
|
||||
: CNullDriver(io, params.WindowSize), COpenGLExtensionHandler(),
|
||||
|
@ -524,7 +131,7 @@ COpenGLDriver::COpenGLDriver(const SIrrlichtCreationParameters& params,
|
|||
}
|
||||
|
||||
|
||||
bool COpenGLDriver::changeRenderContext(const SExposedVideoData& videoData, CIrrDeviceLinux* device)
|
||||
bool COpenGLDriver::activateContext(const SExposedVideoData& videoData, CIrrDeviceLinux* device)
|
||||
{
|
||||
if (videoData.OpenGLLinux.X11Window)
|
||||
{
|
||||
|
@ -643,23 +250,13 @@ COpenGLDriver::~COpenGLDriver()
|
|||
removeAllOcclusionQueries();
|
||||
removeAllHardwareBuffers();
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
if (DeviceType == EIDT_WIN32)
|
||||
if (ContextManager)
|
||||
{
|
||||
|
||||
if (ExposedData.OpenGLWin32.HRc)
|
||||
{
|
||||
if (!wglMakeCurrent(HDc, 0))
|
||||
os::Printer::log("Release of dc and rc failed.", ELL_WARNING);
|
||||
|
||||
if (!wglDeleteContext((HGLRC)ExposedData.OpenGLWin32.HRc))
|
||||
os::Printer::log("Release of rendering context failed.", ELL_WARNING);
|
||||
}
|
||||
|
||||
if (HDc)
|
||||
ReleaseDC(Window, HDc);
|
||||
ContextManager->destroyContext();
|
||||
ContextManager->destroySurface();
|
||||
ContextManager->terminate();
|
||||
ContextManager->drop();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------
|
||||
|
@ -668,6 +265,8 @@ COpenGLDriver::~COpenGLDriver()
|
|||
|
||||
bool COpenGLDriver::genericDriverInit()
|
||||
{
|
||||
if (ContextManager)
|
||||
ContextManager->grab();
|
||||
Name=L"OpenGL ";
|
||||
Name.append(glGetString(GL_VERSION));
|
||||
s32 pos=Name.findNext(L' ', 7);
|
||||
|
@ -849,7 +448,9 @@ bool COpenGLDriver::endScene()
|
|||
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
if (DeviceType == EIDT_WIN32)
|
||||
return SwapBuffers(HDc) == TRUE;
|
||||
{
|
||||
return ContextManager->swapBuffers();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
|
@ -921,16 +522,16 @@ bool COpenGLDriver::beginScene(bool backBuffer, bool zBuffer, SColor color,
|
|||
{
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
case EIDT_WIN32:
|
||||
changeRenderContext(videoData, Win32Device);
|
||||
ContextManager->activateContext(videoData);
|
||||
break;
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
case EIDT_X11:
|
||||
changeRenderContext(videoData, X11Device);
|
||||
activateContext(videoData, X11Device);
|
||||
break;
|
||||
#endif
|
||||
default:
|
||||
changeRenderContext(videoData, (void*)0);
|
||||
activateContext(videoData, (void*)0);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -5256,11 +4857,11 @@ namespace video
|
|||
// -----------------------------------
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
IVideoDriver* createOpenGLDriver(const SIrrlichtCreationParameters& params,
|
||||
io::IFileSystem* io, CIrrDeviceWin32* device)
|
||||
io::IFileSystem* io, IContextManager* contextManager)
|
||||
{
|
||||
#ifdef _IRR_COMPILE_WITH_OPENGL_
|
||||
COpenGLDriver* ogl = new COpenGLDriver(params, io, device);
|
||||
if (!ogl->initDriver(device))
|
||||
COpenGLDriver* ogl = new COpenGLDriver(params, io, contextManager);
|
||||
if (!ogl->initDriver((CIrrDeviceWin32*)0))
|
||||
{
|
||||
ogl->drop();
|
||||
ogl = 0;
|
||||
|
|
|
@ -23,6 +23,7 @@ namespace irr
|
|||
#include "IMaterialRendererServices.h"
|
||||
// also includes the OpenGL stuff
|
||||
#include "COpenGLExtensionHandler.h"
|
||||
#include "IContextManager.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_CG_
|
||||
#include "Cg/cg.h"
|
||||
|
@ -43,17 +44,16 @@ namespace video
|
|||
public:
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceWin32* device);
|
||||
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, IContextManager* contextManager);
|
||||
//! inits the windows specific parts of the open gl driver
|
||||
bool initDriver(CIrrDeviceWin32* device);
|
||||
bool changeRenderContext(const SExposedVideoData& videoData, CIrrDeviceWin32* device);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
COpenGLDriver(const SIrrlichtCreationParameters& params, io::IFileSystem* io, CIrrDeviceLinux* device);
|
||||
//! inits the GLX specific parts of the open gl driver
|
||||
bool initDriver(CIrrDeviceLinux* device);
|
||||
bool changeRenderContext(const SExposedVideoData& videoData, CIrrDeviceLinux* device);
|
||||
bool activateContext(const SExposedVideoData& videoData, CIrrDeviceLinux* device);
|
||||
#endif
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_SDL_DEVICE_
|
||||
|
@ -65,7 +65,7 @@ namespace video
|
|||
#endif
|
||||
|
||||
//! generic version which overloads the unimplemented versions
|
||||
bool changeRenderContext(const SExposedVideoData& videoData, void* device) {return false;}
|
||||
bool activateContext(const SExposedVideoData& videoData, void* device) {return false;}
|
||||
|
||||
//! destructor
|
||||
virtual ~COpenGLDriver();
|
||||
|
@ -604,13 +604,6 @@ namespace video
|
|||
S3DVertex Quad2DVertices[4];
|
||||
static const u16 Quad2DIndices[4];
|
||||
|
||||
#ifdef _IRR_WINDOWS_API_
|
||||
HDC HDc; // Private GDI Device Context
|
||||
HWND Window;
|
||||
#ifdef _IRR_COMPILE_WITH_WINDOWS_DEVICE_
|
||||
CIrrDeviceWin32 *Win32Device;
|
||||
#endif
|
||||
#endif
|
||||
#ifdef _IRR_COMPILE_WITH_X11_DEVICE_
|
||||
GLXDrawable Drawable;
|
||||
Display* X11Display;
|
||||
|
@ -625,6 +618,7 @@ namespace video
|
|||
#ifdef _IRR_COMPILE_WITH_CG_
|
||||
CGcontext CgContext;
|
||||
#endif
|
||||
IContextManager* ContextManager;
|
||||
|
||||
E_DEVICE_TYPE DeviceType;
|
||||
};
|
||||
|
|
|
@ -0,0 +1,480 @@
|
|||
// Copyright (C) 2013 Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#include "CWGLManager.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WGL_MANAGER_
|
||||
|
||||
#include "os.h"
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
|
||||
CWGLManager::CWGLManager()
|
||||
: PrimaryContext(SExposedVideoData(0)), PixelFormat(0)
|
||||
{
|
||||
#ifdef _DEBUG
|
||||
setDebugName("CWGLManager");
|
||||
#endif
|
||||
}
|
||||
|
||||
CWGLManager::~CWGLManager()
|
||||
{
|
||||
}
|
||||
|
||||
bool CWGLManager::initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& videodata)
|
||||
{
|
||||
// store params, videoData is set later as it would be overwritten else
|
||||
Params=params;
|
||||
|
||||
// Create a window to test antialiasing support
|
||||
const fschar_t* ClassName = __TEXT("CWGLManager");
|
||||
HINSTANCE lhInstance = GetModuleHandle(0);
|
||||
|
||||
// Register Class
|
||||
WNDCLASSEX wcex;
|
||||
wcex.cbSize = sizeof(WNDCLASSEX);
|
||||
wcex.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcex.lpfnWndProc = (WNDPROC)DefWindowProc;
|
||||
wcex.cbClsExtra = 0;
|
||||
wcex.cbWndExtra = 0;
|
||||
wcex.hInstance = lhInstance;
|
||||
wcex.hIcon = NULL;
|
||||
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
|
||||
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
|
||||
wcex.lpszMenuName = 0;
|
||||
wcex.lpszClassName = ClassName;
|
||||
wcex.hIconSm = 0;
|
||||
wcex.hIcon = 0;
|
||||
RegisterClassEx(&wcex);
|
||||
|
||||
RECT clientSize;
|
||||
clientSize.top = 0;
|
||||
clientSize.left = 0;
|
||||
clientSize.right = Params.WindowSize.Width;
|
||||
clientSize.bottom = Params.WindowSize.Height;
|
||||
|
||||
DWORD style = WS_POPUP;
|
||||
if (!Params.Fullscreen)
|
||||
style = WS_SYSMENU | WS_BORDER | WS_CAPTION | WS_CLIPCHILDREN | WS_CLIPSIBLINGS;
|
||||
|
||||
AdjustWindowRect(&clientSize, style, FALSE);
|
||||
|
||||
const s32 realWidth = clientSize.right - clientSize.left;
|
||||
const s32 realHeight = clientSize.bottom - clientSize.top;
|
||||
|
||||
const s32 windowLeft = (GetSystemMetrics(SM_CXSCREEN) - realWidth) / 2;
|
||||
const s32 windowTop = (GetSystemMetrics(SM_CYSCREEN) - realHeight) / 2;
|
||||
|
||||
HWND temporary_wnd=CreateWindow(ClassName, __TEXT(""), style, windowLeft,
|
||||
windowTop, realWidth, realHeight, NULL, NULL, lhInstance, NULL);
|
||||
|
||||
if (!temporary_wnd)
|
||||
{
|
||||
os::Printer::log("Cannot create a temporary window.", ELL_ERROR);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
HDC HDc = GetDC(temporary_wnd);
|
||||
|
||||
// Set up pixel format descriptor with desired parameters
|
||||
PIXELFORMATDESCRIPTOR tmp_pfd = {
|
||||
sizeof(PIXELFORMATDESCRIPTOR), // Size Of This Pixel Format Descriptor
|
||||
1, // Version Number
|
||||
PFD_DRAW_TO_WINDOW | // Format Must Support Window
|
||||
PFD_SUPPORT_OPENGL | // Format Must Support OpenGL
|
||||
(Params.Doublebuffer?PFD_DOUBLEBUFFER:0) | // Must Support Double Buffering
|
||||
(Params.Stereobuffer?PFD_STEREO:0), // Must Support Stereo Buffer
|
||||
PFD_TYPE_RGBA, // Request An RGBA Format
|
||||
Params.Bits, // Select Our Color Depth
|
||||
0, 0, 0, 0, 0, 0, // Color Bits Ignored
|
||||
0, // No Alpha Buffer
|
||||
0, // Shift Bit Ignored
|
||||
0, // No Accumulation Buffer
|
||||
0, 0, 0, 0, // Accumulation Bits Ignored
|
||||
Params.ZBufferBits, // Z-Buffer (Depth Buffer)
|
||||
BYTE(Params.Stencilbuffer ? 1 : 0), // Stencil Buffer Depth
|
||||
0, // No Auxiliary Buffer
|
||||
PFD_MAIN_PLANE, // Main Drawing Layer
|
||||
0, // Reserved
|
||||
0, 0, 0 // Layer Masks Ignored
|
||||
};
|
||||
pfd=tmp_pfd;
|
||||
|
||||
for (u32 i=0; i<6; ++i)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
if (Params.Stencilbuffer)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device with stencil buffer, disabling stencil shadows.", ELL_WARNING);
|
||||
Params.Stencilbuffer = false;
|
||||
pfd.cStencilBits = 0;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 2)
|
||||
{
|
||||
pfd.cDepthBits = 24;
|
||||
}
|
||||
else
|
||||
if (i == 3)
|
||||
{
|
||||
if (Params.Bits!=16)
|
||||
pfd.cDepthBits = 16;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 4)
|
||||
{
|
||||
// try single buffer
|
||||
if (Params.Doublebuffer)
|
||||
pfd.dwFlags &= ~PFD_DOUBLEBUFFER;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 5)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device context", "No suitable format for temporary window.", ELL_ERROR);
|
||||
ReleaseDC(temporary_wnd, HDc);
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
// choose pixelformat
|
||||
PixelFormat = ChoosePixelFormat(HDc, &pfd);
|
||||
if (PixelFormat)
|
||||
break;
|
||||
}
|
||||
|
||||
SetPixelFormat(HDc, PixelFormat, &pfd);
|
||||
os::Printer::log("Temporary context");
|
||||
HGLRC hrc=wglCreateContext(HDc);
|
||||
if (!hrc)
|
||||
{
|
||||
os::Printer::log("Cannot create a temporary GL rendering context.", ELL_ERROR);
|
||||
ReleaseDC(temporary_wnd, HDc);
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
CurrentContext.OpenGLWin32.HDc = HDc;
|
||||
CurrentContext.OpenGLWin32.HRc = hrc;
|
||||
CurrentContext.OpenGLWin32.HWnd = temporary_wnd;
|
||||
|
||||
if (!activateContext(CurrentContext))
|
||||
{
|
||||
os::Printer::log("Cannot activate a temporary GL rendering context.", ELL_ERROR);
|
||||
wglDeleteContext(hrc);
|
||||
ReleaseDC(temporary_wnd, HDc);
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
return false;
|
||||
}
|
||||
|
||||
core::stringc wglExtensions;
|
||||
#ifdef WGL_ARB_extensions_string
|
||||
PFNWGLGETEXTENSIONSSTRINGARBPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGARBPROC)wglGetProcAddress("wglGetExtensionsStringARB");
|
||||
if (irrGetExtensionsString)
|
||||
wglExtensions = irrGetExtensionsString(HDc);
|
||||
#elif defined(WGL_EXT_extensions_string)
|
||||
PFNWGLGETEXTENSIONSSTRINGEXTPROC irrGetExtensionsString = (PFNWGLGETEXTENSIONSSTRINGEXTPROC)wglGetProcAddress("wglGetExtensionsStringEXT");
|
||||
if (irrGetExtensionsString)
|
||||
wglExtensions = irrGetExtensionsString(HDc);
|
||||
#endif
|
||||
const bool pixel_format_supported = (wglExtensions.find("WGL_ARB_pixel_format") != -1);
|
||||
const bool multi_sample_supported = ((wglExtensions.find("WGL_ARB_multisample") != -1) ||
|
||||
(wglExtensions.find("WGL_EXT_multisample") != -1) || (wglExtensions.find("WGL_3DFX_multisample") != -1) );
|
||||
#ifdef _DEBUG
|
||||
os::Printer::log("WGL_extensions", wglExtensions);
|
||||
#endif
|
||||
|
||||
#ifdef WGL_ARB_pixel_format
|
||||
PFNWGLCHOOSEPIXELFORMATARBPROC wglChoosePixelFormat_ARB = (PFNWGLCHOOSEPIXELFORMATARBPROC)wglGetProcAddress("wglChoosePixelFormatARB");
|
||||
if (pixel_format_supported && wglChoosePixelFormat_ARB)
|
||||
{
|
||||
// This value determines the number of samples used for antialiasing
|
||||
// My experience is that 8 does not show a big
|
||||
// improvement over 4, but 4 shows a big improvement
|
||||
// over 2.
|
||||
|
||||
if (Params.AntiAlias > 32)
|
||||
Params.AntiAlias = 32;
|
||||
|
||||
f32 fAttributes[] = {0.0, 0.0};
|
||||
s32 iAttributes[] =
|
||||
{
|
||||
WGL_DRAW_TO_WINDOW_ARB,1,
|
||||
WGL_SUPPORT_OPENGL_ARB,1,
|
||||
WGL_ACCELERATION_ARB,WGL_FULL_ACCELERATION_ARB,
|
||||
WGL_COLOR_BITS_ARB,(Params.Bits==32) ? 24 : 15,
|
||||
WGL_ALPHA_BITS_ARB,(Params.Bits==32) ? 8 : 1,
|
||||
WGL_DEPTH_BITS_ARB,Params.ZBufferBits, // 10,11
|
||||
WGL_STENCIL_BITS_ARB,Params.Stencilbuffer ? 1 : 0,
|
||||
WGL_DOUBLE_BUFFER_ARB,Params.Doublebuffer ? 1 : 0,
|
||||
WGL_STEREO_ARB,Params.Stereobuffer ? 1 : 0,
|
||||
WGL_PIXEL_TYPE_ARB, WGL_TYPE_RGBA_ARB,
|
||||
#ifdef WGL_ARB_multisample
|
||||
WGL_SAMPLES_ARB,Params.AntiAlias, // 20,21
|
||||
WGL_SAMPLE_BUFFERS_ARB, 1,
|
||||
#elif defined(WGL_EXT_multisample)
|
||||
WGL_SAMPLES_EXT,AntiAlias, // 20,21
|
||||
WGL_SAMPLE_BUFFERS_EXT, 1,
|
||||
#elif defined(WGL_3DFX_multisample)
|
||||
WGL_SAMPLES_3DFX,AntiAlias, // 20,21
|
||||
WGL_SAMPLE_BUFFERS_3DFX, 1,
|
||||
#endif
|
||||
#ifdef WGL_ARB_framebuffer_sRGB
|
||||
WGL_FRAMEBUFFER_SRGB_CAPABLE_ARB, Params.HandleSRGB ? 1:0,
|
||||
#elif defined(WGL_EXT_framebuffer_sRGB)
|
||||
WGL_FRAMEBUFFER_SRGB_CAPABLE_EXT, Params.HandleSRGB ? 1:0,
|
||||
#endif
|
||||
// WGL_DEPTH_FLOAT_EXT, 1,
|
||||
0,0,0,0
|
||||
};
|
||||
int iAttrSize = sizeof(iAttributes)/sizeof(int);
|
||||
const bool framebuffer_srgb_supported = ((wglExtensions.find("WGL_ARB_framebuffer_sRGB") != -1) ||
|
||||
(wglExtensions.find("WGL_EXT_framebuffer_sRGB") != -1));
|
||||
if (!framebuffer_srgb_supported)
|
||||
{
|
||||
memmove(&iAttributes[24],&iAttributes[26],sizeof(int)*(iAttrSize-26));
|
||||
iAttrSize -= 2;
|
||||
}
|
||||
if (!multi_sample_supported)
|
||||
{
|
||||
memmove(&iAttributes[20],&iAttributes[24],sizeof(int)*(iAttrSize-24));
|
||||
iAttrSize -= 4;
|
||||
}
|
||||
|
||||
s32 rv=0;
|
||||
// Try to get an acceptable pixel format
|
||||
do
|
||||
{
|
||||
int pixelFormat=0;
|
||||
UINT numFormats=0;
|
||||
const BOOL valid = wglChoosePixelFormat_ARB(HDc,iAttributes,fAttributes,1,&pixelFormat,&numFormats);
|
||||
|
||||
if (valid && numFormats)
|
||||
rv = pixelFormat;
|
||||
else
|
||||
iAttributes[21] -= 1;
|
||||
}
|
||||
while(rv==0 && iAttributes[21]>1);
|
||||
if (rv)
|
||||
{
|
||||
PixelFormat=rv;
|
||||
Params.AntiAlias=iAttributes[21];
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif
|
||||
Params.AntiAlias=0;
|
||||
|
||||
// this only terminates the temporary HRc
|
||||
destroyContext();
|
||||
destroySurface();
|
||||
terminate();
|
||||
DestroyWindow(temporary_wnd);
|
||||
UnregisterClass(ClassName, lhInstance);
|
||||
|
||||
// now get new window
|
||||
CurrentContext.OpenGLWin32.HWnd=videodata.OpenGLWin32.HWnd;
|
||||
// get hdc
|
||||
if (!(CurrentContext.OpenGLWin32.HDc=GetDC((HWND)videodata.OpenGLWin32.HWnd)))
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device context.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
if (!PrimaryContext.OpenGLWin32.HWnd)
|
||||
{
|
||||
PrimaryContext.OpenGLWin32.HWnd=CurrentContext.OpenGLWin32.HWnd;
|
||||
PrimaryContext.OpenGLWin32.HDc=CurrentContext.OpenGLWin32.HDc;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void CWGLManager::terminate()
|
||||
{
|
||||
if (CurrentContext.OpenGLWin32.HDc)
|
||||
ReleaseDC((HWND)CurrentContext.OpenGLWin32.HWnd, (HDC)CurrentContext.OpenGLWin32.HDc);
|
||||
if (PrimaryContext.OpenGLWin32.HDc && PrimaryContext.OpenGLWin32.HDc == CurrentContext.OpenGLWin32.HDc)
|
||||
memset(&PrimaryContext, 0, sizeof(PrimaryContext));
|
||||
memset(&CurrentContext, 0, sizeof(CurrentContext));
|
||||
}
|
||||
|
||||
bool CWGLManager::generateSurface()
|
||||
{
|
||||
HDC HDc = (HDC)CurrentContext.OpenGLWin32.HDc;
|
||||
// search for pixel format the simple way
|
||||
if (PixelFormat==0 || (!SetPixelFormat(HDc, PixelFormat, &pfd)))
|
||||
{
|
||||
for (u32 i=0; i<5; ++i)
|
||||
{
|
||||
if (i == 1)
|
||||
{
|
||||
if (Params.Stencilbuffer)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device with stencil buffer, disabling stencil shadows.", ELL_WARNING);
|
||||
Params.Stencilbuffer = false;
|
||||
pfd.cStencilBits = 0;
|
||||
}
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 2)
|
||||
{
|
||||
pfd.cDepthBits = 24;
|
||||
}
|
||||
if (i == 3)
|
||||
{
|
||||
if (Params.Bits!=16)
|
||||
pfd.cDepthBits = 16;
|
||||
else
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if (i == 4)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL device context", "No suitable format.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// choose pixelformat
|
||||
PixelFormat = ChoosePixelFormat(HDc, &pfd);
|
||||
if (PixelFormat)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// set pixel format
|
||||
if (!SetPixelFormat(HDc, PixelFormat, &pfd))
|
||||
{
|
||||
os::Printer::log("Cannot set the pixel format.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (pfd.cAlphaBits != 0)
|
||||
{
|
||||
if (pfd.cRedBits == 8)
|
||||
ColorFormat = ECF_A8R8G8B8;
|
||||
else
|
||||
ColorFormat = ECF_A1R5G5B5;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (pfd.cRedBits == 8)
|
||||
ColorFormat = ECF_R8G8B8;
|
||||
else
|
||||
ColorFormat = ECF_R5G6B5;
|
||||
}
|
||||
os::Printer::log("Pixel Format", core::stringc(PixelFormat).c_str(), ELL_DEBUG);
|
||||
return true;
|
||||
}
|
||||
|
||||
void CWGLManager::destroySurface()
|
||||
{
|
||||
}
|
||||
|
||||
bool CWGLManager::generateContext()
|
||||
{
|
||||
HDC HDc=(HDC)CurrentContext.OpenGLWin32.HDc;
|
||||
HGLRC hrc;
|
||||
// create rendering context
|
||||
#ifdef WGL_ARB_create_context
|
||||
PFNWGLCREATECONTEXTATTRIBSARBPROC wglCreateContextAttribs_ARB = (PFNWGLCREATECONTEXTATTRIBSARBPROC)wglGetProcAddress("wglCreateContextAttribsARB");
|
||||
if (wglCreateContextAttribs_ARB)
|
||||
{
|
||||
// with 3.0 all available profiles should be usable, higher versions impose restrictions
|
||||
// we need at least 1.1
|
||||
const int iAttribs[] =
|
||||
{
|
||||
WGL_CONTEXT_MAJOR_VERSION_ARB, 1,
|
||||
WGL_CONTEXT_MINOR_VERSION_ARB, 1,
|
||||
0
|
||||
};
|
||||
hrc=wglCreateContextAttribs_ARB(HDc, 0, iAttribs);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
hrc=wglCreateContext(HDc);
|
||||
os::Printer::log("Irrlicht context");
|
||||
|
||||
if (!hrc)
|
||||
{
|
||||
os::Printer::log("Cannot create a GL rendering context.", ELL_ERROR);
|
||||
return false;
|
||||
}
|
||||
|
||||
// set exposed data
|
||||
CurrentContext.OpenGLWin32.HRc = hrc;
|
||||
if (!PrimaryContext.OpenGLWin32.HRc)
|
||||
PrimaryContext.OpenGLWin32.HRc=CurrentContext.OpenGLWin32.HRc;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
const SExposedVideoData& CWGLManager::getContext() const
|
||||
{
|
||||
return CurrentContext;
|
||||
}
|
||||
|
||||
bool CWGLManager::activateContext(const SExposedVideoData& videoData)
|
||||
{
|
||||
if (videoData.OpenGLWin32.HWnd && videoData.OpenGLWin32.HDc && videoData.OpenGLWin32.HRc)
|
||||
{
|
||||
if (!wglMakeCurrent((HDC)videoData.OpenGLWin32.HDc, (HGLRC)videoData.OpenGLWin32.HRc))
|
||||
{
|
||||
os::Printer::log("Render Context switch failed.");
|
||||
return false;
|
||||
}
|
||||
CurrentContext=videoData;
|
||||
}
|
||||
// set back to main context
|
||||
else if (!videoData.OpenGLWin32.HWnd && CurrentContext.OpenGLWin32.HDc != PrimaryContext.OpenGLWin32.HDc)
|
||||
{
|
||||
if (!wglMakeCurrent((HDC)PrimaryContext.OpenGLWin32.HDc, (HGLRC)PrimaryContext.OpenGLWin32.HRc))
|
||||
{
|
||||
os::Printer::log("Render Context switch failed.");
|
||||
return false;
|
||||
}
|
||||
CurrentContext=PrimaryContext;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void CWGLManager::destroyContext()
|
||||
{
|
||||
if (CurrentContext.OpenGLWin32.HRc)
|
||||
{
|
||||
if (!wglMakeCurrent((HDC)CurrentContext.OpenGLWin32.HDc, 0))
|
||||
os::Printer::log("Release of render context failed.", ELL_WARNING);
|
||||
|
||||
if (!wglDeleteContext((HGLRC)CurrentContext.OpenGLWin32.HRc))
|
||||
os::Printer::log("Deletion of render context failed.", ELL_WARNING);
|
||||
if (PrimaryContext.OpenGLWin32.HRc==CurrentContext.OpenGLWin32.HRc)
|
||||
PrimaryContext.OpenGLWin32.HRc=0;
|
||||
CurrentContext.OpenGLWin32.HRc=0;
|
||||
}
|
||||
}
|
||||
|
||||
bool CWGLManager::swapBuffers()
|
||||
{
|
||||
return SwapBuffers((HDC)CurrentContext.OpenGLWin32.HDc) == TRUE;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
|
@ -0,0 +1,81 @@
|
|||
// Copyright (C) 2013 Christian Stehno
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in Irrlicht.h
|
||||
|
||||
#ifndef __C_WGL_MANAGER_H_INCLUDED__
|
||||
#define __C_WGL_MANAGER_H_INCLUDED__
|
||||
|
||||
#include "IrrCompileConfig.h"
|
||||
|
||||
#ifdef _IRR_COMPILE_WITH_WGL_MANAGER_
|
||||
|
||||
#include "SIrrCreationParameters.h"
|
||||
#include "SExposedVideoData.h"
|
||||
#include "IContextManager.h"
|
||||
#include "SColor.h"
|
||||
|
||||
// include windows headers for HWND
|
||||
#define WIN32_LEAN_AND_MEAN
|
||||
#include <windows.h>
|
||||
#include <GL/gl.h>
|
||||
#include "wglext.h"
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma comment(lib, "OpenGL32.lib")
|
||||
#endif
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
// EGL manager.
|
||||
class CWGLManager : public IContextManager
|
||||
{
|
||||
public:
|
||||
//! Constructor.
|
||||
CWGLManager();
|
||||
|
||||
//! Destructor
|
||||
~CWGLManager();
|
||||
|
||||
// Initialize
|
||||
bool initialize(const SIrrlichtCreationParameters& params, const SExposedVideoData& data);
|
||||
|
||||
// Terminate
|
||||
void terminate();
|
||||
|
||||
// Create surface.
|
||||
bool generateSurface();
|
||||
|
||||
// Destroy surface.
|
||||
void destroySurface();
|
||||
|
||||
// Create context.
|
||||
bool generateContext();
|
||||
|
||||
// Destroy EGL context.
|
||||
void destroyContext();
|
||||
|
||||
//! Get current context
|
||||
const SExposedVideoData& getContext() const;
|
||||
|
||||
//! Change render context, disable old and activate new defined by videoData
|
||||
bool activateContext(const SExposedVideoData& videoData);
|
||||
|
||||
// Swap buffers.
|
||||
bool swapBuffers();
|
||||
|
||||
private:
|
||||
SIrrlichtCreationParameters Params;
|
||||
SExposedVideoData PrimaryContext;
|
||||
SExposedVideoData CurrentContext;
|
||||
GLuint PixelFormat;
|
||||
PIXELFORMATDESCRIPTOR pfd;
|
||||
ECOLOR_FORMAT ColorFormat;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
|
@ -1,41 +0,0 @@
|
|||
// Copyright (C) 2013 Patryk Nadrowski
|
||||
// This file is part of the "Irrlicht Engine".
|
||||
// For conditions of distribution and use, see copyright notice in irrlicht.h
|
||||
|
||||
#ifndef __IRR_I_CONTEXT_MANAGER_H_INCLUDED__
|
||||
#define __IRR_I_CONTEXT_MANAGER_H_INCLUDED__
|
||||
|
||||
namespace irr
|
||||
{
|
||||
namespace video
|
||||
{
|
||||
class IContextManager : public virtual IReferenceCounted
|
||||
{
|
||||
public:
|
||||
// Initialize manager
|
||||
virtual bool initialize() =0;
|
||||
|
||||
// Terminate manager
|
||||
virtual void terminate() =0;
|
||||
|
||||
// Create surface.
|
||||
virtual bool createSurface() =0;
|
||||
|
||||
// Destroy surface.
|
||||
virtual void destroySurface() =0;
|
||||
|
||||
// Create context.
|
||||
virtual bool createContext() =0;
|
||||
|
||||
// Destroy context.
|
||||
virtual void destroyContext() =0;
|
||||
|
||||
// Swap buffers.
|
||||
virtual void swapBuffers() =0;
|
||||
};
|
||||
|
||||
} // end namespace video
|
||||
} // end namespace irr
|
||||
|
||||
|
||||
#endif
|
|
@ -271,7 +271,7 @@
|
|||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Static lib - Release|x64'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Static lib - Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Static lib - Release|x64'" />
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Imagination Technologies\POWERVR SDK\OGLES_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES\Include;C:\Imagination Technologies\POWERVR SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\Include;$(DXSDK_DIR)include;$(IncludePath)</IncludePath>
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Imagination Technologies\POWERVR SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\Include;C:\Imagination Technologies\POWERVR SDK\OGLES_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES\Include;$(DXSDK_DIR)include;$(IncludePath)</IncludePath>
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(DXSDK_DIR)include;$(IncludePath)</IncludePath>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">obj\$(Configuration)\</IntDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">obj\$(Configuration)64\</IntDir>
|
||||
|
@ -290,7 +290,7 @@
|
|||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Static lib - Release|Win32'">$(DXSDK_DIR)include;$(IncludePath)</IncludePath>
|
||||
<IncludePath Condition="'$(Configuration)|$(Platform)'=='Static lib - Release|x64'">$(DXSDK_DIR)include;$(IncludePath)</IncludePath>
|
||||
<ExecutablePath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Imagination Technologies\POWERVR SDK\OGLES_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES\WindowsX86\Lib;C:\Imagination Technologies\POWERVR SDK\OGLES2_WINDOWS_PCEMULATION_2.07.27.0484\Builds\OGLES2\WindowsPC\Lib;$(ExecutablePath)</ExecutablePath>
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Imagination Technologies\POWERVR SDK\OGLES_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES\WindowsX86\Lib;C:\Imagination Technologies\POWERVR SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\WindowsX86\Lib;$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">C:\Imagination Technologies\POWERVR SDK\OGLES2_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES2\WindowsX86\Lib;C:\Imagination Technologies\POWERVR SDK\OGLES_WINDOWS_X86EMULATION_2.08.28.0634\Builds\OGLES\WindowsX86\Lib;$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release - Fast FPU|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath Condition="'$(Configuration)|$(Platform)'=='SDL-Debug|Win32'">$(DXSDK_DIR)Lib\x86;$(LibraryPath)</LibraryPath>
|
||||
|
@ -335,7 +335,7 @@
|
|||
</ProjectReference>
|
||||
<Link>
|
||||
<AdditionalOptions>/MACHINE:I386 %(AdditionalOptions)</AdditionalOptions>
|
||||
<AdditionalDependencies>kernel32.lib;user32.lib;gdi32.lib;libEGL.lib;libglesv2.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalDependencies>%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<OutputFile>..\..\bin\Win32-visualstudio\Irrlicht.dll</OutputFile>
|
||||
<AdditionalLibraryDirectories>%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<IgnoreSpecificDefaultLibraries>libci.lib;%(IgnoreSpecificDefaultLibraries)</IgnoreSpecificDefaultLibraries>
|
||||
|
@ -836,6 +836,7 @@
|
|||
<ClInclude Include="..\..\include\EDriverFeatures.h" />
|
||||
<ClInclude Include="..\..\include\EMaterialFlags.h" />
|
||||
<ClInclude Include="..\..\include\IAnimatedMeshMD3.h" />
|
||||
<ClInclude Include="..\..\include\IContextManager.h" />
|
||||
<ClInclude Include="..\..\include\IEventReceiver.h" />
|
||||
<ClInclude Include="..\..\include\ILogger.h" />
|
||||
<ClInclude Include="..\..\include\IOSOperator.h" />
|
||||
|
@ -1013,7 +1014,7 @@
|
|||
<ClInclude Include="COGLESMaterialRenderer.h" />
|
||||
<ClInclude Include="COGLESTexture.h" />
|
||||
<ClInclude Include="CSceneManager.h" />
|
||||
<ClInclude Include="IContextManager.h" />
|
||||
<ClInclude Include="CWGLManager.h" />
|
||||
<ClInclude Include="Octree.h" />
|
||||
<ClInclude Include="CSMFMeshFileLoader.h" />
|
||||
<ClInclude Include="C3DSMeshFileLoader.h" />
|
||||
|
@ -1301,6 +1302,7 @@
|
|||
<ClCompile Include="CQ3LevelMesh.cpp" />
|
||||
<ClCompile Include="CSkinnedMesh.cpp" />
|
||||
<ClCompile Include="CSTLMeshFileLoader.cpp" />
|
||||
<ClCompile Include="CWGLManager.cpp" />
|
||||
<ClCompile Include="CXMeshFileLoader.cpp" />
|
||||
<ClCompile Include="CAnimatedMeshSceneNode.cpp" />
|
||||
<ClCompile Include="CBillboardSceneNode.cpp" />
|
||||
|
|
|
@ -1357,7 +1357,10 @@
|
|||
<ClInclude Include="CImageLoaderPVR.h">
|
||||
<Filter>Irrlicht\video\Null\Loader</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="IContextManager.h">
|
||||
<ClInclude Include="CWGLManager.h">
|
||||
<Filter>Irrlicht\video</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\include\IContextManager.h">
|
||||
<Filter>include\video</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
|
@ -2336,6 +2339,9 @@
|
|||
<ClCompile Include="CImageLoaderPVR.cpp">
|
||||
<Filter>Irrlicht\video\Null\Loader</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="CWGLManager.cpp">
|
||||
<Filter>Irrlicht\video</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="Irrlicht.rc" />
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
#ifndef __eglext_h_
|
||||
#define __eglext_h_
|
||||
#define __eglext_h_ 1
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Copyright (c) 2007-2012 The Khronos Group Inc.
|
||||
** Copyright (c) 2013 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
|
||||
|
@ -27,186 +27,576 @@ extern "C" {
|
|||
** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
||||
** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.
|
||||
*/
|
||||
/*
|
||||
** 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/
|
||||
**
|
||||
** Khronos $Revision: 23730 $ on $Date: 2013-10-28 15:16:34 -0700 (Mon, 28 Oct 2013) $
|
||||
*/
|
||||
|
||||
#include <EGL/eglplatform.h>
|
||||
|
||||
/*************************************************************/
|
||||
#define EGL_EGLEXT_VERSION 20131028
|
||||
|
||||
/* Header file version number */
|
||||
/* Current version at http://www.khronos.org/registry/egl/ */
|
||||
/* $Revision: 19332 $ on $Date: 2012-09-28 17:56:20 -0700 (Fri, 28 Sep 2012) $ */
|
||||
#define EGL_EGLEXT_VERSION 14
|
||||
/* Generated C header for:
|
||||
* API: egl
|
||||
* Versions considered: .*
|
||||
* Versions emitted: _nomatch_^
|
||||
* Default extensions included: egl
|
||||
* Additional extensions included: _nomatch_^
|
||||
* Extensions removed: _nomatch_^
|
||||
*/
|
||||
|
||||
#ifndef EGL_KHR_cl_event
|
||||
#define EGL_KHR_cl_event 1
|
||||
#define EGL_CL_EVENT_HANDLE_KHR 0x309C
|
||||
#define EGL_SYNC_CL_EVENT_KHR 0x30FE
|
||||
#define EGL_SYNC_CL_EVENT_COMPLETE_KHR 0x30FF
|
||||
#endif /* EGL_KHR_cl_event */
|
||||
|
||||
#ifndef EGL_KHR_client_get_all_proc_addresses
|
||||
#define EGL_KHR_client_get_all_proc_addresses 1
|
||||
#endif /* EGL_KHR_client_get_all_proc_addresses */
|
||||
|
||||
#ifndef EGL_KHR_config_attribs
|
||||
#define EGL_KHR_config_attribs 1
|
||||
#define EGL_CONFORMANT_KHR 0x3042 /* EGLConfig attribute */
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040 /* EGL_SURFACE_TYPE bitfield */
|
||||
#endif
|
||||
#define EGL_CONFORMANT_KHR 0x3042
|
||||
#define EGL_VG_COLORSPACE_LINEAR_BIT_KHR 0x0020
|
||||
#define EGL_VG_ALPHA_FORMAT_PRE_BIT_KHR 0x0040
|
||||
#endif /* EGL_KHR_config_attribs */
|
||||
|
||||
#ifndef EGL_KHR_lock_surface
|
||||
#define EGL_KHR_lock_surface 1
|
||||
#define EGL_READ_SURFACE_BIT_KHR 0x0001 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
|
||||
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002 /* EGL_LOCK_USAGE_HINT_KHR bitfield */
|
||||
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100 /* EGL_SURFACE_TYPE bitfield */
|
||||
#define EGL_MATCH_FORMAT_KHR 0x3043 /* EGLConfig attribute */
|
||||
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGB_565_KHR 0x30C1 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3 /* EGL_MATCH_FORMAT_KHR value */
|
||||
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4 /* eglLockSurfaceKHR attribute */
|
||||
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5 /* eglLockSurfaceKHR attribute */
|
||||
#define EGL_BITMAP_POINTER_KHR 0x30C6 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PITCH_KHR 0x30C7 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_ORIGIN_KHR 0x30C8 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9 /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC /* eglQuerySurface attribute */
|
||||
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD /* eglQuerySurface attribute */
|
||||
#define EGL_LOWER_LEFT_KHR 0x30CE /* EGL_BITMAP_ORIGIN_KHR value */
|
||||
#define EGL_UPPER_LEFT_KHR 0x30CF /* EGL_BITMAP_ORIGIN_KHR value */
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
|
||||
#endif
|
||||
#ifndef EGL_KHR_create_context
|
||||
#define EGL_KHR_create_context 1
|
||||
#define EGL_CONTEXT_MAJOR_VERSION_KHR 0x3098
|
||||
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
|
||||
#define EGL_CONTEXT_FLAGS_KHR 0x30FC
|
||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
|
||||
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
|
||||
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
|
||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
|
||||
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
|
||||
#endif /* EGL_KHR_create_context */
|
||||
|
||||
#ifndef EGL_KHR_image
|
||||
#define EGL_KHR_image 1
|
||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0 /* eglCreateImageKHR target */
|
||||
typedef void *EGLImageKHR;
|
||||
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif
|
||||
#ifndef EGL_KHR_fence_sync
|
||||
#define EGL_KHR_fence_sync 1
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
||||
#define EGL_SYNC_CONDITION_KHR 0x30F8
|
||||
#define EGL_SYNC_FENCE_KHR 0x30F9
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_fence_sync */
|
||||
|
||||
#ifndef EGL_KHR_vg_parent_image
|
||||
#define EGL_KHR_vg_parent_image 1
|
||||
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_2D_image
|
||||
#define EGL_KHR_gl_texture_2D_image 1
|
||||
#define EGL_GL_TEXTURE_2D_KHR 0x30B1 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_cubemap_image
|
||||
#define EGL_KHR_gl_texture_cubemap_image 1
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_3D_image
|
||||
#define EGL_KHR_gl_texture_3D_image 1
|
||||
#define EGL_GL_TEXTURE_3D_KHR 0x30B2 /* eglCreateImageKHR target */
|
||||
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD /* eglCreateImageKHR attribute */
|
||||
#endif
|
||||
#ifndef EGL_KHR_get_all_proc_addresses
|
||||
#define EGL_KHR_get_all_proc_addresses 1
|
||||
#endif /* EGL_KHR_get_all_proc_addresses */
|
||||
|
||||
#ifndef EGL_KHR_gl_renderbuffer_image
|
||||
#define EGL_KHR_gl_renderbuffer_image 1
|
||||
#define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */
|
||||
#endif
|
||||
#define EGL_GL_RENDERBUFFER_KHR 0x30B9
|
||||
#endif /* EGL_KHR_gl_renderbuffer_image */
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_2D_image
|
||||
#define EGL_KHR_gl_texture_2D_image 1
|
||||
#define EGL_GL_TEXTURE_2D_KHR 0x30B1
|
||||
#define EGL_GL_TEXTURE_LEVEL_KHR 0x30BC
|
||||
#endif /* EGL_KHR_gl_texture_2D_image */
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_3D_image
|
||||
#define EGL_KHR_gl_texture_3D_image 1
|
||||
#define EGL_GL_TEXTURE_3D_KHR 0x30B2
|
||||
#define EGL_GL_TEXTURE_ZOFFSET_KHR 0x30BD
|
||||
#endif /* EGL_KHR_gl_texture_3D_image */
|
||||
|
||||
#ifndef EGL_KHR_gl_texture_cubemap_image
|
||||
#define EGL_KHR_gl_texture_cubemap_image 1
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_X_KHR 0x30B3
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_X_KHR 0x30B4
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Y_KHR 0x30B5
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_KHR 0x30B6
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z_KHR 0x30B7
|
||||
#define EGL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_KHR 0x30B8
|
||||
#endif /* EGL_KHR_gl_texture_cubemap_image */
|
||||
|
||||
#ifndef EGL_KHR_image
|
||||
#define EGL_KHR_image 1
|
||||
typedef void *EGLImageKHR;
|
||||
#define EGL_NATIVE_PIXMAP_KHR 0x30B0
|
||||
#define EGL_NO_IMAGE_KHR ((EGLImageKHR)0)
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEIMAGEKHRPROC) (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGLImageKHR image);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateImageKHR (EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyImageKHR (EGLDisplay dpy, EGLImageKHR image);
|
||||
#endif
|
||||
#endif /* EGL_KHR_image */
|
||||
|
||||
#ifndef EGL_KHR_image_base
|
||||
#define EGL_KHR_image_base 1
|
||||
#define EGL_IMAGE_PRESERVED_KHR 0x30D2
|
||||
#endif /* EGL_KHR_image_base */
|
||||
|
||||
#ifndef EGL_KHR_image_pixmap
|
||||
#define EGL_KHR_image_pixmap 1
|
||||
#endif /* EGL_KHR_image_pixmap */
|
||||
|
||||
#ifndef EGL_KHR_lock_surface
|
||||
#define EGL_KHR_lock_surface 1
|
||||
#define EGL_READ_SURFACE_BIT_KHR 0x0001
|
||||
#define EGL_WRITE_SURFACE_BIT_KHR 0x0002
|
||||
#define EGL_LOCK_SURFACE_BIT_KHR 0x0080
|
||||
#define EGL_OPTIMAL_FORMAT_BIT_KHR 0x0100
|
||||
#define EGL_MATCH_FORMAT_KHR 0x3043
|
||||
#define EGL_FORMAT_RGB_565_EXACT_KHR 0x30C0
|
||||
#define EGL_FORMAT_RGB_565_KHR 0x30C1
|
||||
#define EGL_FORMAT_RGBA_8888_EXACT_KHR 0x30C2
|
||||
#define EGL_FORMAT_RGBA_8888_KHR 0x30C3
|
||||
#define EGL_MAP_PRESERVE_PIXELS_KHR 0x30C4
|
||||
#define EGL_LOCK_USAGE_HINT_KHR 0x30C5
|
||||
#define EGL_BITMAP_POINTER_KHR 0x30C6
|
||||
#define EGL_BITMAP_PITCH_KHR 0x30C7
|
||||
#define EGL_BITMAP_ORIGIN_KHR 0x30C8
|
||||
#define EGL_BITMAP_PIXEL_RED_OFFSET_KHR 0x30C9
|
||||
#define EGL_BITMAP_PIXEL_GREEN_OFFSET_KHR 0x30CA
|
||||
#define EGL_BITMAP_PIXEL_BLUE_OFFSET_KHR 0x30CB
|
||||
#define EGL_BITMAP_PIXEL_ALPHA_OFFSET_KHR 0x30CC
|
||||
#define EGL_BITMAP_PIXEL_LUMINANCE_OFFSET_KHR 0x30CD
|
||||
#define EGL_LOWER_LEFT_KHR 0x30CE
|
||||
#define EGL_UPPER_LEFT_KHR 0x30CF
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLUNLOCKSURFACEKHRPROC) (EGLDisplay display, EGLSurface surface);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglLockSurfaceKHR (EGLDisplay display, EGLSurface surface, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglUnlockSurfaceKHR (EGLDisplay display, EGLSurface surface);
|
||||
#endif
|
||||
#endif /* EGL_KHR_lock_surface */
|
||||
|
||||
#ifndef EGL_KHR_lock_surface2
|
||||
#define EGL_KHR_lock_surface2 1
|
||||
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
|
||||
#endif /* EGL_KHR_lock_surface2 */
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_reusable_sync
|
||||
#define EGL_KHR_reusable_sync 1
|
||||
|
||||
typedef void* EGLSyncKHR;
|
||||
typedef void *EGLSyncKHR;
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeKHR;
|
||||
|
||||
#define EGL_SYNC_STATUS_KHR 0x30F1
|
||||
#define EGL_SIGNALED_KHR 0x30F2
|
||||
#define EGL_UNSIGNALED_KHR 0x30F3
|
||||
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
|
||||
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
|
||||
#define EGL_SYNC_TYPE_KHR 0x30F7
|
||||
#define EGL_SYNC_REUSABLE_KHR 0x30FA
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001 /* eglClientWaitSyncKHR <flags> bitfield */
|
||||
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR(EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_STATUS_KHR 0x30F1
|
||||
#define EGL_SIGNALED_KHR 0x30F2
|
||||
#define EGL_UNSIGNALED_KHR 0x30F3
|
||||
#define EGL_TIMEOUT_EXPIRED_KHR 0x30F5
|
||||
#define EGL_CONDITION_SATISFIED_KHR 0x30F6
|
||||
#define EGL_SYNC_TYPE_KHR 0x30F7
|
||||
#define EGL_SYNC_REUSABLE_KHR 0x30FA
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_KHR 0x0001
|
||||
#define EGL_FOREVER_KHR 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_NO_SYNC_KHR ((EGLSyncKHR)0)
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESYNCKHRPROC) (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateSyncKHR (EGLDisplay dpy, EGLenum type, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncKHR (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_reusable_sync */
|
||||
|
||||
#ifndef EGL_KHR_image_base
|
||||
#define EGL_KHR_image_base 1
|
||||
/* Most interfaces defined by EGL_KHR_image_pixmap above */
|
||||
#define EGL_IMAGE_PRESERVED_KHR 0x30D2 /* eglCreateImageKHR attribute */
|
||||
#ifndef EGL_KHR_stream
|
||||
#define EGL_KHR_stream 1
|
||||
typedef void *EGLStreamKHR;
|
||||
typedef khronos_uint64_t EGLuint64KHR;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
|
||||
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
|
||||
#define EGL_PRODUCER_FRAME_KHR 0x3212
|
||||
#define EGL_CONSUMER_FRAME_KHR 0x3213
|
||||
#define EGL_STREAM_STATE_KHR 0x3214
|
||||
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
|
||||
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
|
||||
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
|
||||
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
|
||||
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
|
||||
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
|
||||
#define EGL_BAD_STREAM_KHR 0x321B
|
||||
#define EGL_BAD_STATE_KHR 0x321C
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_KHR_stream */
|
||||
|
||||
#ifndef EGL_KHR_image_pixmap
|
||||
#define EGL_KHR_image_pixmap 1
|
||||
/* Interfaces defined by EGL_KHR_image above */
|
||||
#ifndef EGL_KHR_stream_consumer_gltexture
|
||||
#define EGL_KHR_stream_consumer_gltexture 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_consumer_gltexture */
|
||||
|
||||
#ifndef EGL_KHR_stream_cross_process_fd
|
||||
#define EGL_KHR_stream_cross_process_fd 1
|
||||
typedef int EGLNativeFileDescriptorKHR;
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
|
||||
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC) (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR (EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR (EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_cross_process_fd */
|
||||
|
||||
#ifndef EGL_KHR_stream_fifo
|
||||
#define EGL_KHR_stream_fifo 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
|
||||
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
|
||||
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
|
||||
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR (EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_fifo */
|
||||
|
||||
#ifndef EGL_KHR_stream_producer_aldatalocator
|
||||
#define EGL_KHR_stream_producer_aldatalocator 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_producer_aldatalocator */
|
||||
|
||||
#ifndef EGL_KHR_stream_producer_eglsurface
|
||||
#define EGL_KHR_stream_producer_eglsurface 1
|
||||
#ifdef EGL_KHR_stream
|
||||
#define EGL_STREAM_BIT_KHR 0x0800
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC) (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR (EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_KHR_stream */
|
||||
#endif /* EGL_KHR_stream_producer_eglsurface */
|
||||
|
||||
#ifndef EGL_KHR_surfaceless_context
|
||||
#define EGL_KHR_surfaceless_context 1
|
||||
#endif /* EGL_KHR_surfaceless_context */
|
||||
|
||||
#ifndef EGL_KHR_vg_parent_image
|
||||
#define EGL_KHR_vg_parent_image 1
|
||||
#define EGL_VG_PARENT_IMAGE_KHR 0x30BA
|
||||
#endif /* EGL_KHR_vg_parent_image */
|
||||
|
||||
#ifndef EGL_KHR_wait_sync
|
||||
#define EGL_KHR_wait_sync 1
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR (EGLDisplay dpy, EGLSyncKHR sync, EGLint flags);
|
||||
#endif
|
||||
#endif /* EGL_KHR_wait_sync */
|
||||
|
||||
#ifndef EGL_ANDROID_blob_cache
|
||||
#define EGL_ANDROID_blob_cache 1
|
||||
typedef khronos_ssize_t EGLsizeiANDROID;
|
||||
typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize);
|
||||
typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize);
|
||||
typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID (EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get);
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_blob_cache */
|
||||
|
||||
#ifndef EGL_ANDROID_framebuffer_target
|
||||
#define EGL_ANDROID_framebuffer_target 1
|
||||
#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147
|
||||
#endif /* EGL_ANDROID_framebuffer_target */
|
||||
|
||||
#ifndef EGL_ANDROID_image_native_buffer
|
||||
#define EGL_ANDROID_image_native_buffer 1
|
||||
#define EGL_NATIVE_BUFFER_ANDROID 0x3140
|
||||
#endif /* EGL_ANDROID_image_native_buffer */
|
||||
|
||||
#ifndef EGL_ANDROID_native_fence_sync
|
||||
#define EGL_ANDROID_native_fence_sync 1
|
||||
#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144
|
||||
#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145
|
||||
#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146
|
||||
#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC) (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID (EGLDisplay dpy, EGLSyncKHR sync);
|
||||
#endif
|
||||
#endif /* EGL_ANDROID_native_fence_sync */
|
||||
|
||||
#ifndef EGL_ANDROID_recordable
|
||||
#define EGL_ANDROID_recordable 1
|
||||
#define EGL_RECORDABLE_ANDROID 0x3142
|
||||
#endif /* EGL_ANDROID_recordable */
|
||||
|
||||
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
|
||||
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
|
||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
||||
#endif /* EGL_ANGLE_d3d_share_handle_client_buffer */
|
||||
|
||||
#ifndef EGL_ANGLE_query_surface_pointer
|
||||
#define EGL_ANGLE_query_surface_pointer 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#endif
|
||||
#endif /* EGL_ANGLE_query_surface_pointer */
|
||||
|
||||
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
|
||||
#endif /* EGL_ANGLE_surface_d3d_texture_2d_share_handle */
|
||||
|
||||
#ifndef EGL_ARM_pixmap_multisample_discard
|
||||
#define EGL_ARM_pixmap_multisample_discard 1
|
||||
#define EGL_DISCARD_SAMPLES_ARM 0x3286
|
||||
#endif /* EGL_ARM_pixmap_multisample_discard */
|
||||
|
||||
#ifndef EGL_EXT_buffer_age
|
||||
#define EGL_EXT_buffer_age 1
|
||||
#define EGL_BUFFER_AGE_EXT 0x313D
|
||||
#endif /* EGL_EXT_buffer_age */
|
||||
|
||||
#ifndef EGL_EXT_client_extensions
|
||||
#define EGL_EXT_client_extensions 1
|
||||
#endif /* EGL_EXT_client_extensions */
|
||||
|
||||
#ifndef EGL_EXT_create_context_robustness
|
||||
#define EGL_EXT_create_context_robustness 1
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
|
||||
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
|
||||
#endif /* EGL_EXT_create_context_robustness */
|
||||
|
||||
#ifndef EGL_EXT_image_dma_buf_import
|
||||
#define EGL_EXT_image_dma_buf_import 1
|
||||
#define EGL_LINUX_DMA_BUF_EXT 0x3270
|
||||
#define EGL_LINUX_DRM_FOURCC_EXT 0x3271
|
||||
#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272
|
||||
#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273
|
||||
#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274
|
||||
#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275
|
||||
#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276
|
||||
#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277
|
||||
#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278
|
||||
#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279
|
||||
#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A
|
||||
#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B
|
||||
#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C
|
||||
#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D
|
||||
#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E
|
||||
#define EGL_ITU_REC601_EXT 0x327F
|
||||
#define EGL_ITU_REC709_EXT 0x3280
|
||||
#define EGL_ITU_REC2020_EXT 0x3281
|
||||
#define EGL_YUV_FULL_RANGE_EXT 0x3282
|
||||
#define EGL_YUV_NARROW_RANGE_EXT 0x3283
|
||||
#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284
|
||||
#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285
|
||||
#endif /* EGL_EXT_image_dma_buf_import */
|
||||
|
||||
#ifndef EGL_EXT_multiview_window
|
||||
#define EGL_EXT_multiview_window 1
|
||||
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
|
||||
#endif /* EGL_EXT_multiview_window */
|
||||
|
||||
#ifndef EGL_EXT_platform_base
|
||||
#define EGL_EXT_platform_base 1
|
||||
typedef EGLDisplay (EGLAPIENTRYP PFNEGLGETPLATFORMDISPLAYEXTPROC) (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMWINDOWSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPLATFORMPIXMAPSURFACEEXTPROC) (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT (EGLenum platform, void *native_display, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_window, const EGLint *attrib_list);
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurfaceEXT (EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_EXT_platform_base */
|
||||
|
||||
#ifndef EGL_EXT_platform_wayland
|
||||
#define EGL_EXT_platform_wayland 1
|
||||
#define EGL_PLATFORM_WAYLAND_EXT 0x31D8
|
||||
#endif /* EGL_EXT_platform_wayland */
|
||||
|
||||
#ifndef EGL_EXT_platform_x11
|
||||
#define EGL_EXT_platform_x11 1
|
||||
#define EGL_PLATFORM_X11_EXT 0x31D5
|
||||
#define EGL_PLATFORM_X11_SCREEN_EXT 0x31D6
|
||||
#endif /* EGL_EXT_platform_x11 */
|
||||
|
||||
#ifndef EGL_EXT_swap_buffers_with_damage
|
||||
#define EGL_EXT_swap_buffers_with_damage 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEEXTPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageEXT (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects);
|
||||
#endif
|
||||
#endif /* EGL_EXT_swap_buffers_with_damage */
|
||||
|
||||
#ifndef EGL_HI_clientpixmap
|
||||
#define EGL_HI_clientpixmap 1
|
||||
struct EGLClientPixmapHI {
|
||||
void *pData;
|
||||
EGLint iWidth;
|
||||
EGLint iHeight;
|
||||
EGLint iStride;
|
||||
};
|
||||
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI *pixmap);
|
||||
#endif
|
||||
#endif /* EGL_HI_clientpixmap */
|
||||
|
||||
#ifndef EGL_HI_colorformats
|
||||
#define EGL_HI_colorformats 1
|
||||
#define EGL_COLOR_FORMAT_HI 0x8F70
|
||||
#define EGL_COLOR_RGB_HI 0x8F71
|
||||
#define EGL_COLOR_RGBA_HI 0x8F72
|
||||
#define EGL_COLOR_ARGB_HI 0x8F73
|
||||
#endif /* EGL_HI_colorformats */
|
||||
|
||||
#ifndef EGL_IMG_context_priority
|
||||
#define EGL_IMG_context_priority 1
|
||||
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
|
||||
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
|
||||
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
|
||||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
||||
#endif
|
||||
#define EGL_CONTEXT_PRIORITY_LEVEL_IMG 0x3100
|
||||
#define EGL_CONTEXT_PRIORITY_HIGH_IMG 0x3101
|
||||
#define EGL_CONTEXT_PRIORITY_MEDIUM_IMG 0x3102
|
||||
#define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103
|
||||
#endif /* EGL_IMG_context_priority */
|
||||
|
||||
#ifndef EGL_KHR_lock_surface2
|
||||
#define EGL_KHR_lock_surface2 1
|
||||
#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110
|
||||
#ifndef EGL_MESA_drm_image
|
||||
#define EGL_MESA_drm_image 1
|
||||
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0
|
||||
#define EGL_DRM_BUFFER_USE_MESA 0x31D1
|
||||
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2
|
||||
#define EGL_DRM_BUFFER_MESA 0x31D3
|
||||
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
|
||||
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001
|
||||
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif
|
||||
#endif /* EGL_MESA_drm_image */
|
||||
|
||||
#ifndef EGL_MESA_platform_gbm
|
||||
#define EGL_MESA_platform_gbm 1
|
||||
#define EGL_PLATFORM_GBM_MESA 0x31D7
|
||||
#endif /* EGL_MESA_platform_gbm */
|
||||
|
||||
#ifndef EGL_NV_3dvision_surface
|
||||
#define EGL_NV_3dvision_surface 1
|
||||
#define EGL_AUTO_STEREO_NV 0x3136
|
||||
#endif /* EGL_NV_3dvision_surface */
|
||||
|
||||
#ifndef EGL_NV_coverage_sample
|
||||
#define EGL_NV_coverage_sample 1
|
||||
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
|
||||
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
|
||||
#endif
|
||||
#define EGL_COVERAGE_BUFFERS_NV 0x30E0
|
||||
#define EGL_COVERAGE_SAMPLES_NV 0x30E1
|
||||
#endif /* EGL_NV_coverage_sample */
|
||||
|
||||
#ifndef EGL_NV_coverage_sample_resolve
|
||||
#define EGL_NV_coverage_sample_resolve 1
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
|
||||
#endif /* EGL_NV_coverage_sample_resolve */
|
||||
|
||||
#ifndef EGL_NV_depth_nonlinear
|
||||
#define EGL_NV_depth_nonlinear 1
|
||||
#define EGL_DEPTH_ENCODING_NV 0x30E2
|
||||
#define EGL_DEPTH_ENCODING_NONE_NV 0
|
||||
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
|
||||
#endif
|
||||
#define EGL_DEPTH_ENCODING_NV 0x30E2
|
||||
#define EGL_DEPTH_ENCODING_NONE_NV 0
|
||||
#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3
|
||||
#endif /* EGL_NV_depth_nonlinear */
|
||||
|
||||
#ifndef EGL_NV_native_query
|
||||
#define EGL_NV_native_query 1
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC) (EGLDisplay dpy, EGLNativeDisplayType *display_id);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC) (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV (EGLDisplay dpy, EGLNativeDisplayType *display_id);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV (EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV (EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap);
|
||||
#endif
|
||||
#endif /* EGL_NV_native_query */
|
||||
|
||||
#ifndef EGL_NV_post_convert_rounding
|
||||
#define EGL_NV_post_convert_rounding 1
|
||||
#endif /* EGL_NV_post_convert_rounding */
|
||||
|
||||
#ifndef EGL_NV_post_sub_buffer
|
||||
#define EGL_NV_post_sub_buffer 1
|
||||
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif
|
||||
#endif /* EGL_NV_post_sub_buffer */
|
||||
|
||||
#ifndef EGL_NV_stream_sync
|
||||
#define EGL_NV_stream_sync 1
|
||||
#define EGL_SYNC_NEW_FRAME_NV 0x321F
|
||||
typedef EGLSyncKHR (EGLAPIENTRYP PFNEGLCREATESTREAMSYNCNVPROC) (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncKHR EGLAPIENTRY eglCreateStreamSyncNV (EGLDisplay dpy, EGLStreamKHR stream, EGLenum type, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif /* EGL_NV_stream_sync */
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */
|
||||
#ifndef EGL_NV_sync
|
||||
#define EGL_NV_sync 1
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
|
||||
#define EGL_SYNC_STATUS_NV 0x30E7
|
||||
#define EGL_SIGNALED_NV 0x30E8
|
||||
#define EGL_UNSIGNALED_NV 0x30E9
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
|
||||
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_ALREADY_SIGNALED_NV 0x30EA
|
||||
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
|
||||
#define EGL_CONDITION_SATISFIED_NV 0x30EC
|
||||
#define EGL_SYNC_TYPE_NV 0x30ED
|
||||
#define EGL_SYNC_CONDITION_NV 0x30EE
|
||||
#define EGL_SYNC_FENCE_NV 0x30EF
|
||||
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
|
||||
typedef void* EGLSyncNV;
|
||||
typedef void *EGLSyncNV;
|
||||
typedef khronos_utime_nanoseconds_t EGLTimeNV;
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6
|
||||
#define EGL_SYNC_STATUS_NV 0x30E7
|
||||
#define EGL_SIGNALED_NV 0x30E8
|
||||
#define EGL_UNSIGNALED_NV 0x30E9
|
||||
#define EGL_SYNC_FLUSH_COMMANDS_BIT_NV 0x0001
|
||||
#define EGL_FOREVER_NV 0xFFFFFFFFFFFFFFFFull
|
||||
#define EGL_ALREADY_SIGNALED_NV 0x30EA
|
||||
#define EGL_TIMEOUT_EXPIRED_NV 0x30EB
|
||||
#define EGL_CONDITION_SATISFIED_NV 0x30EC
|
||||
#define EGL_SYNC_TYPE_NV 0x30ED
|
||||
#define EGL_SYNC_CONDITION_NV 0x30EE
|
||||
#define EGL_SYNC_FENCE_NV 0x30EF
|
||||
#define EGL_NO_SYNC_NV ((EGLSyncNV)0)
|
||||
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync);
|
||||
|
@ -214,253 +604,22 @@ EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync);
|
|||
EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLFENCENVPROC) (EGLSyncNV sync);
|
||||
typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value);
|
||||
#endif
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_NV_sync */
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_fence_sync
|
||||
#define EGL_KHR_fence_sync 1
|
||||
/* Reuses most tokens and entry points from EGL_KHR_reusable_sync */
|
||||
#define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR 0x30F0
|
||||
#define EGL_SYNC_CONDITION_KHR 0x30F8
|
||||
#define EGL_SYNC_FENCE_KHR 0x30F9
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_HI_clientpixmap
|
||||
#define EGL_HI_clientpixmap 1
|
||||
|
||||
/* Surface Attribute */
|
||||
#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74
|
||||
/*
|
||||
* Structure representing a client pixmap
|
||||
* (pixmap's data is in client-space memory).
|
||||
*/
|
||||
struct EGLClientPixmapHI
|
||||
{
|
||||
void* pData;
|
||||
EGLint iWidth;
|
||||
EGLint iHeight;
|
||||
EGLint iStride;
|
||||
};
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap);
|
||||
#endif /* EGL_HI_clientpixmap */
|
||||
|
||||
#ifndef EGL_HI_colorformats
|
||||
#define EGL_HI_colorformats 1
|
||||
/* Config Attribute */
|
||||
#define EGL_COLOR_FORMAT_HI 0x8F70
|
||||
/* Color Formats */
|
||||
#define EGL_COLOR_RGB_HI 0x8F71
|
||||
#define EGL_COLOR_RGBA_HI 0x8F72
|
||||
#define EGL_COLOR_ARGB_HI 0x8F73
|
||||
#endif /* EGL_HI_colorformats */
|
||||
|
||||
#ifndef EGL_MESA_drm_image
|
||||
#define EGL_MESA_drm_image 1
|
||||
#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */
|
||||
#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */
|
||||
#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */
|
||||
#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */
|
||||
#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4
|
||||
#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */
|
||||
#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_post_sub_buffer
|
||||
#define EGL_NV_post_sub_buffer 1
|
||||
#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_query_surface_pointer
|
||||
#define EGL_ANGLE_query_surface_pointer 1
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#endif
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle
|
||||
#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1
|
||||
#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200
|
||||
#endif
|
||||
|
||||
#ifndef EGL_NV_coverage_sample_resolve
|
||||
#define EGL_NV_coverage_sample_resolve 1
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132
|
||||
#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */
|
||||
#ifndef EGL_NV_system_time
|
||||
#define EGL_NV_system_time 1
|
||||
|
||||
typedef khronos_utime_nanoseconds_t EGLuint64NV;
|
||||
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void);
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
#ifdef KHRONOS_SUPPORT_INT64
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void);
|
||||
typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */
|
||||
#ifndef EGL_KHR_stream
|
||||
#define EGL_KHR_stream 1
|
||||
typedef void* EGLStreamKHR;
|
||||
typedef khronos_uint64_t EGLuint64KHR;
|
||||
#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0)
|
||||
#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210
|
||||
#define EGL_PRODUCER_FRAME_KHR 0x3212
|
||||
#define EGL_CONSUMER_FRAME_KHR 0x3213
|
||||
#define EGL_STREAM_STATE_KHR 0x3214
|
||||
#define EGL_STREAM_STATE_CREATED_KHR 0x3215
|
||||
#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216
|
||||
#define EGL_STREAM_STATE_EMPTY_KHR 0x3217
|
||||
#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218
|
||||
#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219
|
||||
#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A
|
||||
#define EGL_BAD_STREAM_KHR 0x321B
|
||||
#define EGL_BAD_STATE_KHR 0x321C
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_consumer_gltexture
|
||||
#define EGL_KHR_stream_consumer_gltexture 1
|
||||
#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_producer_eglsurface
|
||||
#define EGL_KHR_stream_producer_eglsurface 1
|
||||
#define EGL_STREAM_BIT_KHR 0x0800
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_producer_aldatalocator
|
||||
#define EGL_KHR_stream_producer_aldatalocator 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_fifo
|
||||
#define EGL_KHR_stream_fifo 1
|
||||
/* reuse EGLTimeKHR */
|
||||
#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC
|
||||
#define EGL_STREAM_TIME_NOW_KHR 0x31FD
|
||||
#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE
|
||||
#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_EXT_create_context_robustness
|
||||
#define EGL_EXT_create_context_robustness 1
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138
|
||||
#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF
|
||||
#endif
|
||||
|
||||
#ifndef EGL_ANGLE_d3d_share_handle_client_buffer
|
||||
#define EGL_ANGLE_d3d_share_handle_client_buffer 1
|
||||
/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_create_context
|
||||
#define EGL_KHR_create_context 1
|
||||
#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION
|
||||
#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB
|
||||
#define EGL_CONTEXT_FLAGS_KHR 0x30FC
|
||||
#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD
|
||||
#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD
|
||||
#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE
|
||||
#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF
|
||||
#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002
|
||||
#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004
|
||||
#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001
|
||||
#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002
|
||||
#define EGL_OPENGL_ES3_BIT_KHR 0x00000040
|
||||
#endif
|
||||
|
||||
#ifndef EGL_KHR_surfaceless_context
|
||||
#define EGL_KHR_surfaceless_context 1
|
||||
/* No tokens/entry points, just relaxes an error condition */
|
||||
#endif
|
||||
|
||||
#ifdef EGL_KHR_stream /* Requires KHR_stream extension */
|
||||
#ifndef EGL_KHR_stream_cross_process_fd
|
||||
#define EGL_KHR_stream_cross_process_fd 1
|
||||
typedef int EGLNativeFileDescriptorKHR;
|
||||
#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1))
|
||||
#ifdef EGL_EGLEXT_PROTOTYPES
|
||||
EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#endif /* EGL_EGLEXT_PROTOTYPES */
|
||||
typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream);
|
||||
typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef EGL_EXT_multiview_window
|
||||
#define EGL_EXT_multiview_window 1
|
||||
#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV (void);
|
||||
EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV (void);
|
||||
#endif
|
||||
#endif /* KHRONOS_SUPPORT_INT64 */
|
||||
#endif /* EGL_NV_system_time */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue