summaryrefslogtreecommitdiffstats
path: root/gfx/angle/src/libGLESv2/entry_points_egl.cpp
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-07-11 23:29:50 +0200
committerwolfbeast <mcwerewolf@gmail.com>2018-07-11 23:31:02 +0200
commit70dd5e7c66b1fe3f82e5b4db2406050baba15f05 (patch)
tree3f012200ef3c934f33db1a4ef2b790fae3141860 /gfx/angle/src/libGLESv2/entry_points_egl.cpp
parent3b7ffb477eec078c7036c92c6a51bb5de6de4f28 (diff)
parent8481fa25d246f1968d0a254ee3c6cdd82c60781a (diff)
downloadUXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar
UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.gz
UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.lz
UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.tar.xz
UXP-70dd5e7c66b1fe3f82e5b4db2406050baba15f05.zip
Merge branch 'ANGLE-rollback'
This resolves #624 Note: Cherry-picked some fixes on top of the ANGLE version that we want to keep.
Diffstat (limited to 'gfx/angle/src/libGLESv2/entry_points_egl.cpp')
-rwxr-xr-xgfx/angle/src/libGLESv2/entry_points_egl.cpp467
1 files changed, 168 insertions, 299 deletions
diff --git a/gfx/angle/src/libGLESv2/entry_points_egl.cpp b/gfx/angle/src/libGLESv2/entry_points_egl.cpp
index dc0ccb5f7..1ed04eaf1 100755
--- a/gfx/angle/src/libGLESv2/entry_points_egl.cpp
+++ b/gfx/angle/src/libGLESv2/entry_points_egl.cpp
@@ -17,15 +17,12 @@
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/Texture.h"
-#include "libANGLE/Thread.h"
#include "libANGLE/Surface.h"
#include "libANGLE/validationEGL.h"
#include "common/debug.h"
#include "common/version.h"
-#include "platform/Platform.h"
-
#include <EGL/eglext.h>
namespace egl
@@ -35,10 +32,9 @@ namespace egl
EGLint EGLAPIENTRY GetError(void)
{
EVENT("()");
- Thread *thread = GetCurrentThread();
- EGLint error = thread->getError();
- thread->setError(Error(EGL_SUCCESS));
+ EGLint error = GetGlobalError();
+ SetGlobalError(Error(EGL_SUCCESS));
return error;
}
@@ -51,58 +47,58 @@ EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id)
EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
{
- EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)", dpy,
- major, minor);
- Thread *thread = GetCurrentThread();
+ EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint *major = 0x%0.8p, EGLint *minor = 0x%0.8p)",
+ dpy, major, minor);
Display *display = static_cast<Display *>(dpy);
if (dpy == EGL_NO_DISPLAY || !Display::isValidDisplay(display))
{
- thread->setError(Error(EGL_BAD_DISPLAY));
+ SetGlobalError(Error(EGL_BAD_DISPLAY));
return EGL_FALSE;
}
Error error = display->initialize();
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (major) *major = 1;
if (minor) *minor = 4;
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy)
{
EVENT("(EGLDisplay dpy = 0x%0.8p)", dpy);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display *>(dpy);
if (dpy == EGL_NO_DISPLAY || !Display::isValidDisplay(display))
{
- thread->setError(Error(EGL_BAD_DISPLAY));
+ SetGlobalError(Error(EGL_BAD_DISPLAY));
return EGL_FALSE;
}
- if (display->isValidContext(thread->getContext()))
+ gl::Context *context = GetGlobalContext();
+
+ if (display->isValidContext(context))
{
- thread->setCurrent(nullptr, nullptr, nullptr, nullptr);
+ SetGlobalContext(NULL);
+ SetGlobalDisplay(NULL);
}
display->terminate();
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint name = %d)", dpy, name);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
if (!(display == EGL_NO_DISPLAY && name == EGL_EXTENSIONS))
@@ -110,7 +106,7 @@ const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name)
Error error = ValidateDisplay(display);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return NULL;
}
}
@@ -138,34 +134,32 @@ const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name)
result = "1.4 (ANGLE " ANGLE_VERSION_STRING ")";
break;
default:
- thread->setError(Error(EGL_BAD_PARAMETER));
- return NULL;
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
+ return NULL;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return result;
}
EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, "
- "EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
- dpy, configs, config_size, num_config);
- Thread *thread = GetCurrentThread();
+ EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig *configs = 0x%0.8p, "
+ "EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
+ dpy, configs, config_size, num_config);
Display *display = static_cast<Display*>(dpy);
Error error = ValidateDisplay(display);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (!num_config)
{
- thread->setError(Error(EGL_BAD_PARAMETER));
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_FALSE;
}
@@ -180,30 +174,28 @@ EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint con
}
*num_config = static_cast<EGLint>(filteredConfigs.size());
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, "
- "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
- dpy, attrib_list, configs, config_size, num_config);
- Thread *thread = GetCurrentThread();
+ EVENT("(EGLDisplay dpy = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p, "
+ "EGLConfig *configs = 0x%0.8p, EGLint config_size = %d, EGLint *num_config = 0x%0.8p)",
+ dpy, attrib_list, configs, config_size, num_config);
Display *display = static_cast<Display*>(dpy);
Error error = ValidateDisplay(display);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (!num_config)
{
- thread->setError(Error(EGL_BAD_PARAMETER));
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_FALSE;
}
@@ -219,17 +211,14 @@ EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, E
}
*num_config = static_cast<EGLint>(filteredConfigs.size());
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint "
- "*value = 0x%0.8p)",
- dpy, config, attribute, value);
- Thread *thread = GetCurrentThread();
+ EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
+ dpy, config, attribute, value);
Display *display = static_cast<Display*>(dpy);
Config *configuration = static_cast<Config*>(config);
@@ -237,27 +226,24 @@ EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint
Error error = ValidateConfig(display, configuration);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (!display->getConfigAttrib(configuration, attribute, value))
{
- thread->setError(Error(EGL_BAD_ATTRIBUTE));
+ SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_FALSE;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, "
- "const EGLint *attrib_list = 0x%0.8p)",
- dpy, config, win, attrib_list);
- Thread *thread = GetCurrentThread();
+ EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativeWindowType win = 0x%0.8p, "
+ "const EGLint *attrib_list = 0x%0.8p)", dpy, config, win, attrib_list);
Display *display = static_cast<Display*>(dpy);
Config *configuration = static_cast<Config*>(config);
@@ -266,7 +252,7 @@ EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGL
Error error = ValidateCreateWindowSurface(display, configuration, win, attributes);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_SURFACE;
}
@@ -274,7 +260,7 @@ EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGL
error = display->createWindowSurface(configuration, win, attributes, &surface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_SURFACE;
}
@@ -283,11 +269,8 @@ EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGL
EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
{
- EVENT(
- "(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = "
- "0x%0.8p)",
- dpy, config, attrib_list);
- Thread *thread = GetCurrentThread();
+ EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
+ dpy, config, attrib_list);
Display *display = static_cast<Display*>(dpy);
Config *configuration = static_cast<Config*>(config);
@@ -296,7 +279,7 @@ EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, co
Error error = ValidateCreatePbufferSurface(display, configuration, attributes);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_SURFACE;
}
@@ -304,7 +287,7 @@ EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, co
error = display->createPbufferSurface(configuration, attributes, &surface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_SURFACE;
}
@@ -315,7 +298,6 @@ EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGL
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLNativePixmapType pixmap = 0x%0.8p, "
"const EGLint *attrib_list = 0x%0.8p)", dpy, config, pixmap, attrib_list);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Config *configuration = static_cast<Config*>(config);
@@ -323,20 +305,19 @@ EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGL
Error error = ValidateConfig(display, configuration);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_SURFACE;
}
UNIMPLEMENTED(); // FIXME
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_NO_SURFACE;
}
EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = static_cast<Surface*>(surface);
@@ -344,19 +325,19 @@ EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface)
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (surface == EGL_NO_SURFACE)
{
- thread->setError(Error(EGL_BAD_SURFACE));
+ SetGlobalError(Error(EGL_BAD_SURFACE));
return EGL_FALSE;
}
display->destroySurface((Surface*)surface);
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
@@ -364,7 +345,6 @@ EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint a
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
dpy, surface, attribute, value);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = (Surface*)surface;
@@ -372,13 +352,13 @@ EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint a
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (surface == EGL_NO_SURFACE)
{
- thread->setError(Error(EGL_BAD_SURFACE));
+ SetGlobalError(Error(EGL_BAD_SURFACE));
return EGL_FALSE;
}
@@ -435,7 +415,7 @@ EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint a
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
if (!display->getExtensions().postSubBuffer)
{
- thread->setError(Error(EGL_BAD_ATTRIBUTE));
+ SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_FALSE;
}
*value = eglSurface->isPostSubBufferSupported();
@@ -443,7 +423,7 @@ EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint a
case EGL_FIXED_SIZE_ANGLE:
if (!display->getExtensions().windowFixedSize)
{
- thread->setError(Error(EGL_BAD_ATTRIBUTE));
+ SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
return EGL_FALSE;
}
*value = eglSurface->isFixedSize();
@@ -451,7 +431,7 @@ EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint a
case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
if (!display->getExtensions().flexibleSurfaceCompatibility)
{
- thread->setError(
+ SetGlobalError(
Error(EGL_BAD_ATTRIBUTE,
"EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE cannot be used without "
"EGL_ANGLE_flexible_surface_compatibility support."));
@@ -462,9 +442,9 @@ EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint a
case EGL_SURFACE_ORIENTATION_ANGLE:
if (!display->getExtensions().surfaceOrientation)
{
- thread->setError(Error(EGL_BAD_ATTRIBUTE,
- "EGL_SURFACE_ORIENTATION_ANGLE cannot be queried without "
- "EGL_ANGLE_surface_orientation support."));
+ SetGlobalError(Error(EGL_BAD_ATTRIBUTE,
+ "EGL_SURFACE_ORIENTATION_ANGLE cannot be queried without "
+ "EGL_ANGLE_surface_orientation support."));
return EGL_FALSE;
}
*value = eglSurface->getOrientation();
@@ -472,19 +452,19 @@ EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint a
case EGL_DIRECT_COMPOSITION_ANGLE:
if (!display->getExtensions().directComposition)
{
- thread->setError(Error(EGL_BAD_ATTRIBUTE,
- "EGL_DIRECT_COMPOSITION_ANGLE cannot be used without "
- "EGL_ANGLE_direct_composition support."));
+ SetGlobalError(Error(EGL_BAD_ATTRIBUTE,
+ "EGL_DIRECT_COMPOSITION_ANGLE cannot be used without "
+ "EGL_ANGLE_direct_composition support."));
return EGL_FALSE;
}
*value = eglSurface->directComposition();
break;
default:
- thread->setError(Error(EGL_BAD_ATTRIBUTE));
- return EGL_FALSE;
+ SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+ return EGL_FALSE;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
@@ -492,7 +472,6 @@ EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContex
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, EGLContext share_context = 0x%0.8p, "
"const EGLint *attrib_list = 0x%0.8p)", dpy, config, share_context, attrib_list);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Config *configuration = static_cast<Config*>(config);
@@ -502,7 +481,7 @@ EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContex
Error error = ValidateCreateContext(display, configuration, sharedGLContext, attributes);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_CONTEXT;
}
@@ -510,18 +489,17 @@ EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContex
error = display->createContext(configuration, sharedGLContext, attributes, &context);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_CONTEXT;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return static_cast<EGLContext>(context);
}
EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p)", dpy, ctx);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
gl::Context *context = static_cast<gl::Context*>(ctx);
@@ -529,24 +507,25 @@ EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx)
Error error = ValidateContext(display, context);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (ctx == EGL_NO_CONTEXT)
{
- thread->setError(Error(EGL_BAD_CONTEXT));
+ SetGlobalError(Error(EGL_BAD_CONTEXT));
return EGL_FALSE;
}
- if (context == thread->getContext())
+ if (context == GetGlobalContext())
{
- thread->setCurrent(nullptr, thread->getDrawSurface(), thread->getReadSurface(), nullptr);
+ SetGlobalDisplay(NULL);
+ SetGlobalContext(NULL);
}
display->destroyContext(context);
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
@@ -554,7 +533,6 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface draw = 0x%0.8p, EGLSurface read = 0x%0.8p, EGLContext ctx = 0x%0.8p)",
dpy, draw, read, ctx);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
gl::Context *context = static_cast<gl::Context*>(ctx);
@@ -563,13 +541,13 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
// error is generated.
if (ctx == EGL_NO_CONTEXT && (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
{
- thread->setError(Error(EGL_BAD_MATCH));
+ SetGlobalError(Error(EGL_BAD_MATCH));
return EGL_FALSE;
}
if (ctx != EGL_NO_CONTEXT && draw == EGL_NO_SURFACE && read == EGL_NO_SURFACE)
{
- thread->setError(Error(EGL_BAD_MATCH));
+ SetGlobalError(Error(EGL_BAD_MATCH));
return EGL_FALSE;
}
@@ -577,21 +555,21 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
// EGL_BAD_MATCH error is generated.
if ((read == EGL_NO_SURFACE) != (draw == EGL_NO_SURFACE))
{
- thread->setError(Error(
+ SetGlobalError(Error(
EGL_BAD_MATCH, "read and draw must both be valid surfaces, or both be EGL_NO_SURFACE"));
return EGL_FALSE;
}
if (dpy == EGL_NO_DISPLAY || !Display::isValidDisplay(display))
{
- thread->setError(Error(EGL_BAD_DISPLAY, "'dpy' not a valid EGLDisplay handle"));
+ SetGlobalError(Error(EGL_BAD_DISPLAY, "'dpy' not a valid EGLDisplay handle"));
return EGL_FALSE;
}
// EGL 1.5 spec: dpy can be uninitialized if all other parameters are null
if (!display->isInitialized() && (ctx != EGL_NO_CONTEXT || draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE))
{
- thread->setError(Error(EGL_NOT_INITIALIZED, "'dpy' not initialized"));
+ SetGlobalError(Error(EGL_NOT_INITIALIZED, "'dpy' not initialized"));
return EGL_FALSE;
}
@@ -600,14 +578,14 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
Error error = ValidateContext(display, context);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
}
if (display->isInitialized() && display->testDeviceLost())
{
- thread->setError(Error(EGL_CONTEXT_LOST));
+ SetGlobalError(Error(EGL_CONTEXT_LOST));
return EGL_FALSE;
}
@@ -617,7 +595,7 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
Error error = ValidateSurface(display, drawSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
}
@@ -628,7 +606,7 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
Error error = ValidateSurface(display, readSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
}
@@ -640,7 +618,7 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
context->getConfig(), readSurface->getType());
if (readCompatError.isError())
{
- thread->setError(readCompatError);
+ SetGlobalError(readCompatError);
return EGL_FALSE;
}
}
@@ -656,7 +634,7 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
context->getConfig(), drawSurface->getType());
if (drawCompatError.isError())
{
- thread->setError(drawCompatError);
+ SetGlobalError(drawCompatError);
return EGL_FALSE;
}
}
@@ -665,12 +643,16 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
Error makeCurrentError = display->makeCurrent(drawSurface, readSurface, context);
if (makeCurrentError.isError())
{
- thread->setError(makeCurrentError);
+ SetGlobalError(makeCurrentError);
return EGL_FALSE;
}
- gl::Context *previousContext = thread->getContext();
- thread->setCurrent(display, drawSurface, readSurface, context);
+ gl::Context *previousContext = GetGlobalContext();
+
+ SetGlobalDisplay(display);
+ SetGlobalDrawSurface(drawSurface);
+ SetGlobalReadSurface(readSurface);
+ SetGlobalContext(context);
// Release the surface from the previously-current context, to allow
// destroyed surfaces to delete themselves.
@@ -679,28 +661,27 @@ EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface r
previousContext->releaseSurface();
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw)
{
EVENT("(EGLint readdraw = %d)", readdraw);
- Thread *thread = GetCurrentThread();
if (readdraw == EGL_READ)
{
- thread->setError(Error(EGL_SUCCESS));
- return thread->getReadSurface();
+ SetGlobalError(Error(EGL_SUCCESS));
+ return GetGlobalReadSurface();
}
else if (readdraw == EGL_DRAW)
{
- thread->setError(Error(EGL_SUCCESS));
- return thread->getDrawSurface();
+ SetGlobalError(Error(EGL_SUCCESS));
+ return GetGlobalDrawSurface();
}
else
{
- thread->setError(Error(EGL_BAD_PARAMETER));
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_NO_SURFACE;
}
}
@@ -708,11 +689,10 @@ EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw)
EGLDisplay EGLAPIENTRY GetCurrentDisplay(void)
{
EVENT("()");
- Thread *thread = GetCurrentThread();
- EGLDisplay dpy = thread->getDisplay();
+ EGLDisplay dpy = GetGlobalDisplay();
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return dpy;
}
@@ -720,7 +700,6 @@ EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attri
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLint attribute = %d, EGLint *value = 0x%0.8p)",
dpy, ctx, attribute, value);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
gl::Context *context = static_cast<gl::Context*>(ctx);
@@ -728,7 +707,7 @@ EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attri
Error error = ValidateContext(display, context);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
@@ -747,25 +726,24 @@ EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attri
*value = context->getRenderBuffer();
break;
default:
- thread->setError(Error(EGL_BAD_ATTRIBUTE));
- return EGL_FALSE;
+ SetGlobalError(Error(EGL_BAD_ATTRIBUTE));
+ return EGL_FALSE;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY WaitGL(void)
{
EVENT("()");
- Thread *thread = GetCurrentThread();
- Display *display = thread->getDisplay();
+ Display *display = GetGlobalDisplay();
Error error = ValidateDisplay(display);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
@@ -774,49 +752,47 @@ EGLBoolean EGLAPIENTRY WaitGL(void)
error = display->waitClient();
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY WaitNative(EGLint engine)
{
EVENT("(EGLint engine = %d)", engine);
- Thread *thread = GetCurrentThread();
- Display *display = thread->getDisplay();
+ Display *display = GetGlobalDisplay();
Error error = ValidateDisplay(display);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (engine != EGL_CORE_NATIVE_ENGINE)
{
- thread->setError(
+ SetGlobalError(
Error(EGL_BAD_PARAMETER, "the 'engine' parameter has an unrecognized value"));
}
- error = display->waitNative(engine, thread->getDrawSurface(), thread->getReadSurface());
+ error = display->waitNative(engine, GetGlobalDrawSurface(), GetGlobalReadSurface());
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p)", dpy, surface);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = (Surface*)surface;
@@ -824,37 +800,36 @@ EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface)
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (display->testDeviceLost())
{
- thread->setError(Error(EGL_CONTEXT_LOST));
+ SetGlobalError(Error(EGL_CONTEXT_LOST));
return EGL_FALSE;
}
if (surface == EGL_NO_SURFACE)
{
- thread->setError(Error(EGL_BAD_SURFACE));
+ SetGlobalError(Error(EGL_BAD_SURFACE));
return EGL_FALSE;
}
error = eglSurface->swap();
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLNativePixmapType target = 0x%0.8p)", dpy, surface, target);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = static_cast<Surface*>(surface);
@@ -862,19 +837,19 @@ EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNative
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (display->testDeviceLost())
{
- thread->setError(Error(EGL_CONTEXT_LOST));
+ SetGlobalError(Error(EGL_CONTEXT_LOST));
return EGL_FALSE;
}
UNIMPLEMENTED(); // FIXME
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return 0;
}
@@ -882,7 +857,6 @@ EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNative
EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = static_cast<Surface*>(surface);
@@ -890,35 +864,35 @@ EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint b
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (buffer != EGL_BACK_BUFFER)
{
- thread->setError(Error(EGL_BAD_PARAMETER));
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_FALSE;
}
if (surface == EGL_NO_SURFACE || eglSurface->getType() == EGL_WINDOW_BIT)
{
- thread->setError(Error(EGL_BAD_SURFACE));
+ SetGlobalError(Error(EGL_BAD_SURFACE));
return EGL_FALSE;
}
if (eglSurface->getBoundTexture())
{
- thread->setError(Error(EGL_BAD_ACCESS));
+ SetGlobalError(Error(EGL_BAD_ACCESS));
return EGL_FALSE;
}
if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
{
- thread->setError(Error(EGL_BAD_MATCH));
+ SetGlobalError(Error(EGL_BAD_MATCH));
return EGL_FALSE;
}
- gl::Context *context = thread->getContext();
+ gl::Context *context = GetGlobalContext();
if (context)
{
gl::Texture *textureObject = context->getTargetTexture(GL_TEXTURE_2D);
@@ -926,19 +900,19 @@ EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint b
if (textureObject->getImmutableFormat())
{
- thread->setError(Error(EGL_BAD_MATCH));
+ SetGlobalError(Error(EGL_BAD_MATCH));
return EGL_FALSE;
}
error = eglSurface->bindTexImage(textureObject, buffer);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
@@ -946,7 +920,6 @@ EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, EGLint value = %d)",
dpy, surface, attribute, value);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = static_cast<Surface*>(surface);
@@ -954,20 +927,19 @@ EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
UNIMPLEMENTED(); // FIXME
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint buffer = %d)", dpy, surface, buffer);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = static_cast<Surface*>(surface);
@@ -975,25 +947,25 @@ EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLin
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
if (buffer != EGL_BACK_BUFFER)
{
- thread->setError(Error(EGL_BAD_PARAMETER));
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
return EGL_FALSE;
}
if (surface == EGL_NO_SURFACE || eglSurface->getType() == EGL_WINDOW_BIT)
{
- thread->setError(Error(EGL_BAD_SURFACE));
+ SetGlobalError(Error(EGL_BAD_SURFACE));
return EGL_FALSE;
}
if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE)
{
- thread->setError(Error(EGL_BAD_MATCH));
+ SetGlobalError(Error(EGL_BAD_MATCH));
return EGL_FALSE;
}
@@ -1004,34 +976,33 @@ EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLin
error = eglSurface->releaseTexImage(buffer);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint interval = %d)", dpy, interval);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Error error = ValidateDisplay(display);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
- Surface *draw_surface = static_cast<Surface *>(thread->getDrawSurface());
+ Surface *draw_surface = static_cast<Surface*>(GetGlobalDrawSurface());
if (draw_surface == NULL)
{
- thread->setError(Error(EGL_BAD_SURFACE));
+ SetGlobalError(Error(EGL_BAD_SURFACE));
return EGL_FALSE;
}
@@ -1040,7 +1011,7 @@ EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval)
draw_surface->setSwapInterval(clampedInterval);
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
@@ -1049,35 +1020,33 @@ EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval)
EGLBoolean EGLAPIENTRY BindAPI(EGLenum api)
{
EVENT("(EGLenum api = 0x%X)", api);
- Thread *thread = GetCurrentThread();
switch (api)
{
case EGL_OPENGL_API:
case EGL_OPENVG_API:
- thread->setError(Error(EGL_BAD_PARAMETER));
- return EGL_FALSE; // Not supported by this implementation
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
+ return EGL_FALSE; // Not supported by this implementation
case EGL_OPENGL_ES_API:
break;
default:
- thread->setError(Error(EGL_BAD_PARAMETER));
- return EGL_FALSE;
+ SetGlobalError(Error(EGL_BAD_PARAMETER));
+ return EGL_FALSE;
}
- thread->setAPI(api);
+ SetGlobalAPI(api);
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLenum EGLAPIENTRY QueryAPI(void)
{
EVENT("()");
- Thread *thread = GetCurrentThread();
- EGLenum API = thread->getAPI();
+ EGLenum API = GetGlobalAPI();
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return API;
}
@@ -1086,7 +1055,6 @@ EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buf
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLenum buftype = 0x%X, EGLClientBuffer buffer = 0x%0.8p, "
"EGLConfig config = 0x%0.8p, const EGLint *attrib_list = 0x%0.8p)",
dpy, buftype, buffer, config, attrib_list);
- Thread *thread = GetCurrentThread();
Display *display = static_cast<Display*>(dpy);
Config *configuration = static_cast<Config*>(config);
@@ -1095,16 +1063,15 @@ EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buf
Error error = ValidateCreatePbufferFromClientBuffer(display, buftype, buffer, configuration, attributes);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_SURFACE;
}
egl::Surface *surface = nullptr;
- error = display->createPbufferFromClientBuffer(configuration, buftype, buffer, attributes,
- &surface);
+ error = display->createPbufferFromClientBuffer(configuration, buffer, attributes, &surface);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_NO_SURFACE;
}
@@ -1114,36 +1081,34 @@ EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buf
EGLBoolean EGLAPIENTRY ReleaseThread(void)
{
EVENT("()");
- Thread *thread = GetCurrentThread();
MakeCurrent(EGL_NO_DISPLAY, EGL_NO_CONTEXT, EGL_NO_SURFACE, EGL_NO_SURFACE);
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
EGLBoolean EGLAPIENTRY WaitClient(void)
{
EVENT("()");
- Thread *thread = GetCurrentThread();
- Display *display = thread->getDisplay();
+ Display *display = GetGlobalDisplay();
Error error = ValidateDisplay(display);
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
error = display->waitClient();
if (error.isError())
{
- thread->setError(error);
+ SetGlobalError(error);
return EGL_FALSE;
}
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return EGL_TRUE;
}
@@ -1151,11 +1116,10 @@ EGLBoolean EGLAPIENTRY WaitClient(void)
EGLContext EGLAPIENTRY GetCurrentContext(void)
{
EVENT("()");
- Thread *thread = GetCurrentThread();
- gl::Context *context = thread->getContext();
+ gl::Context *context = GetGlobalContext();
- thread->setError(Error(EGL_SUCCESS));
+ SetGlobalError(Error(EGL_SUCCESS));
return static_cast<EGLContext>(context);
}
@@ -1163,40 +1127,32 @@ EGLContext EGLAPIENTRY GetCurrentContext(void)
EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLenum type = 0x%X, const EGLint* attrib_list = 0x%0.8p)", dpy, type, attrib_list);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglCreateSync unimplemented."));
return EGL_NO_SYNC;
}
EGLBoolean EGLAPIENTRY DestroySync(EGLDisplay dpy, EGLSync sync)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p)", dpy, sync);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglDestroySync unimplemented."));
return EGL_FALSE;
}
EGLint EGLAPIENTRY ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint flags = 0x%X, EGLTime timeout = %d)", dpy, sync, flags, timeout);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglClientWaitSync unimplemented."));
return 0;
}
EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint attribute = 0x%X, EGLAttrib *value = 0x%0.8p)", dpy, sync, attribute, value);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglSyncAttrib unimplemented."));
return EGL_FALSE;
}
@@ -1205,20 +1161,16 @@ EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target,
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLContext ctx = 0x%0.8p, EGLenum target = 0x%X, "
"EGLClientBuffer buffer = 0x%0.8p, const EGLAttrib *attrib_list = 0x%0.8p)",
dpy, ctx, target, buffer, attrib_list);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglCreateImage unimplemented."));
return EGL_NO_IMAGE;
}
EGLBoolean EGLAPIENTRY DestroyImage(EGLDisplay dpy, EGLImage image)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLImage image = 0x%0.8p)", dpy, image);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglDestroyImage unimplemented."));
return EGL_FALSE;
}
@@ -1226,10 +1178,8 @@ EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display
{
EVENT("(EGLenum platform = %d, void* native_display = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)",
platform, native_display, attrib_list);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglGetPlatformDisplay unimplemented."));
return EGL_NO_DISPLAY;
}
@@ -1237,10 +1187,8 @@ EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig con
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void* native_window = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)",
dpy, config, native_window, attrib_list);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglCreatePlatformWindowSurface unimplemented."));
return EGL_NO_SURFACE;
}
@@ -1248,27 +1196,22 @@ EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig con
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLConfig config = 0x%0.8p, void* native_pixmap = 0x%0.8p, const EGLint* attrib_list = 0x%0.8p)",
dpy, config, native_pixmap, attrib_list);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglCraetePlatformPixmaSurface unimplemented."));
return EGL_NO_SURFACE;
}
EGLBoolean EGLAPIENTRY WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
{
EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSync sync = 0x%0.8p, EGLint flags = 0x%X)", dpy, sync, flags);
- Thread *thread = GetCurrentThread();
UNIMPLEMENTED();
- thread->setError(Error(EGL_BAD_DISPLAY, "eglWaitSync unimplemented."));
return EGL_FALSE;
}
__eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname)
{
EVENT("(const char *procname = \"%s\")", procname);
- Thread *thread = GetCurrentThread();
typedef std::map<std::string, __eglMustCastToProperFunctionPointerType> ProcAddressMap;
auto generateProcAddressMap = []()
@@ -1277,9 +1220,6 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *
#define INSERT_PROC_ADDRESS(ns, proc) \
map[#ns #proc] = reinterpret_cast<__eglMustCastToProperFunctionPointerType>(ns::proc)
-#define INSERT_PROC_ADDRESS_NO_NS(name, proc) \
- map[name] = reinterpret_cast<__eglMustCastToProperFunctionPointerType>(proc)
-
// GLES2 core
INSERT_PROC_ADDRESS(gl, ActiveTexture);
INSERT_PROC_ADDRESS(gl, AttachShader);
@@ -1532,74 +1472,6 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *
INSERT_PROC_ADDRESS(gl, CopyTextureCHROMIUM);
INSERT_PROC_ADDRESS(gl, CopySubTextureCHROMIUM);
- // GL_CHROMIUM_copy_compressed_texture
- INSERT_PROC_ADDRESS(gl, CompressedCopyTextureCHROMIUM);
-
- // GL_ANGLE_webgl_compatibility
- INSERT_PROC_ADDRESS(gl, EnableExtensionANGLE);
-
- // GL_ANGLE_robust_client_memory
- INSERT_PROC_ADDRESS(gl, GetBooleanvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetBufferParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetFloatvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetFramebufferAttachmentParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetIntegervRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetProgramivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetRenderbufferParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetShaderivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetTexParameterfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetTexParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetUniformfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetUniformivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetVertexAttribfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetVertexAttribivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetVertexAttribPointervRobustANGLE);
- INSERT_PROC_ADDRESS(gl, ReadPixelsRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexImage2DRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexParameterfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexSubImage2DRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexImage3DRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexSubImage3DRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetQueryivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetQueryObjectuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetBufferPointervRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetIntegeri_vRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetInternalformativRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetVertexAttribIivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetVertexAttribIuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetUniformuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetActiveUniformBlockivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetInteger64vRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetInteger64i_vRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetBufferParameteri64vRobustANGLE);
- INSERT_PROC_ADDRESS(gl, SamplerParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, SamplerParameterfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetSamplerParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetSamplerParameterfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetFramebufferParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetProgramInterfaceivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetBooleani_vRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetMultisamplefvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetTexLevelParameterivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetTexLevelParameterfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetPointervRobustANGLERobustANGLE);
- INSERT_PROC_ADDRESS(gl, ReadnPixelsRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetnUniformfvRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetnUniformivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetnUniformuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexParameterIivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, TexParameterIuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetTexParameterIivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetTexParameterIuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, SamplerParameterIivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, SamplerParameterIuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetSamplerParameterIivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetSamplerParameterIuivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetQueryObjectivRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetQueryObjecti64vRobustANGLE);
- INSERT_PROC_ADDRESS(gl, GetQueryObjectui64vRobustANGLE);
-
// GLES3 core
INSERT_PROC_ADDRESS(gl, ReadBuffer);
INSERT_PROC_ADDRESS(gl, DrawRangeElements);
@@ -1671,8 +1543,8 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *
INSERT_PROC_ADDRESS(gl, UniformBlockBinding);
INSERT_PROC_ADDRESS(gl, DrawArraysInstanced);
INSERT_PROC_ADDRESS(gl, DrawElementsInstanced);
- // FenceSync is the name of a class, the function has an added _ to prevent a name conflict.
- INSERT_PROC_ADDRESS_NO_NS("glFenceSync", gl::FenceSync_);
+ map["glFenceSync"] =
+ reinterpret_cast<__eglMustCastToProperFunctionPointerType>(gl::FenceSync_);
INSERT_PROC_ADDRESS(gl, IsSync);
INSERT_PROC_ADDRESS(gl, DeleteSync);
INSERT_PROC_ADDRESS(gl, ClientWaitSync);
@@ -1872,24 +1744,21 @@ __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *
INSERT_PROC_ADDRESS(egl, CreateStreamProducerD3DTextureNV12ANGLE);
INSERT_PROC_ADDRESS(egl, StreamPostD3DTextureNV12ANGLE);
- // EGL_EXT_swap_buffers_with_damage
- INSERT_PROC_ADDRESS(egl, SwapBuffersWithDamageEXT);
-
- // angle::Platform related entry points
- INSERT_PROC_ADDRESS_NO_NS("ANGLEPlatformInitialize", ANGLEPlatformInitialize);
- INSERT_PROC_ADDRESS_NO_NS("ANGLEPlatformShutdown", ANGLEPlatformShutdown);
-
#undef INSERT_PROC_ADDRESS
-#undef INSERT_PROC_ADDRESS_NO_NS
-
return map;
};
static const ProcAddressMap procAddressMap = generateProcAddressMap();
- thread->setError(Error(EGL_SUCCESS));
auto iter = procAddressMap.find(procname);
- return iter != procAddressMap.end() ? iter->second : nullptr;
+ if (iter != procAddressMap.end())
+ {
+ return iter->second;
+ }
+ else
+ {
+ return nullptr;
+ }
}
}