diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /gfx/angle/src/libGLESv2 | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'gfx/angle/src/libGLESv2')
19 files changed, 17190 insertions, 0 deletions
diff --git a/gfx/angle/src/libGLESv2/entry_points_egl.cpp b/gfx/angle/src/libGLESv2/entry_points_egl.cpp new file mode 100755 index 000000000..dc0ccb5f7 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_egl.cpp @@ -0,0 +1,1895 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_egl.cpp : Implements the EGL entry points. + +#include "libGLESv2/entry_points_egl.h" +#include "libGLESv2/entry_points_egl_ext.h" +#include "libGLESv2/entry_points_gles_2_0.h" +#include "libGLESv2/entry_points_gles_2_0_ext.h" +#include "libGLESv2/entry_points_gles_3_0.h" +#include "libGLESv2/entry_points_gles_3_1.h" +#include "libGLESv2/global_state.h" + +#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 +{ + +// EGL 1.0 +EGLint EGLAPIENTRY GetError(void) +{ + EVENT("()"); + Thread *thread = GetCurrentThread(); + + EGLint error = thread->getError(); + thread->setError(Error(EGL_SUCCESS)); + return error; +} + +EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id) +{ + EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id); + + return Display::GetDisplayFromAttribs(reinterpret_cast<void *>(display_id), AttributeMap()); +} + +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(); + + Display *display = static_cast<Display *>(dpy); + if (dpy == EGL_NO_DISPLAY || !Display::isValidDisplay(display)) + { + thread->setError(Error(EGL_BAD_DISPLAY)); + return EGL_FALSE; + } + + Error error = display->initialize(); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (major) *major = 1; + if (minor) *minor = 4; + + thread->setError(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)); + return EGL_FALSE; + } + + if (display->isValidContext(thread->getContext())) + { + thread->setCurrent(nullptr, nullptr, nullptr, nullptr); + } + + display->terminate(); + + thread->setError(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)) + { + Error error = ValidateDisplay(display); + if (error.isError()) + { + thread->setError(error); + return NULL; + } + } + + const char *result; + switch (name) + { + case EGL_CLIENT_APIS: + result = "OpenGL_ES"; + break; + case EGL_EXTENSIONS: + if (display == EGL_NO_DISPLAY) + { + result = Display::getClientExtensionString().c_str(); + } + else + { + result = display->getExtensionString().c_str(); + } + break; + case EGL_VENDOR: + result = display->getVendorString().c_str(); + break; + case EGL_VERSION: + result = "1.4 (ANGLE " ANGLE_VERSION_STRING ")"; + break; + default: + thread->setError(Error(EGL_BAD_PARAMETER)); + return NULL; + } + + thread->setError(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(); + + Display *display = static_cast<Display*>(dpy); + + Error error = ValidateDisplay(display); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (!num_config) + { + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_FALSE; + } + + std::vector<const Config*> filteredConfigs = display->getConfigs(AttributeMap()); + if (configs) + { + filteredConfigs.resize(std::min<size_t>(filteredConfigs.size(), config_size)); + for (size_t i = 0; i < filteredConfigs.size(); i++) + { + configs[i] = const_cast<Config*>(filteredConfigs[i]); + } + } + *num_config = static_cast<EGLint>(filteredConfigs.size()); + + thread->setError(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(); + + Display *display = static_cast<Display*>(dpy); + + Error error = ValidateDisplay(display); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (!num_config) + { + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_FALSE; + } + + std::vector<const Config *> filteredConfigs = + display->getConfigs(AttributeMap::CreateFromIntArray(attrib_list)); + if (configs) + { + filteredConfigs.resize(std::min<size_t>(filteredConfigs.size(), config_size)); + for (size_t i = 0; i < filteredConfigs.size(); i++) + { + configs[i] = const_cast<Config*>(filteredConfigs[i]); + } + } + *num_config = static_cast<EGLint>(filteredConfigs.size()); + + thread->setError(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(); + + Display *display = static_cast<Display*>(dpy); + Config *configuration = static_cast<Config*>(config); + + Error error = ValidateConfig(display, configuration); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (!display->getConfigAttrib(configuration, attribute, value)) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + + thread->setError(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(); + + Display *display = static_cast<Display*>(dpy); + Config *configuration = static_cast<Config*>(config); + AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); + + Error error = ValidateCreateWindowSurface(display, configuration, win, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_SURFACE; + } + + egl::Surface *surface = nullptr; + error = display->createWindowSurface(configuration, win, attributes, &surface); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_SURFACE; + } + + return static_cast<EGLSurface>(surface); +} + +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(); + + Display *display = static_cast<Display*>(dpy); + Config *configuration = static_cast<Config*>(config); + AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); + + Error error = ValidateCreatePbufferSurface(display, configuration, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_SURFACE; + } + + egl::Surface *surface = nullptr; + error = display->createPbufferSurface(configuration, attributes, &surface); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_SURFACE; + } + + return static_cast<EGLSurface>(surface); +} + +EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list) +{ + 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); + + Error error = ValidateConfig(display, configuration); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_SURFACE; + } + + UNIMPLEMENTED(); // FIXME + + thread->setError(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); + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (surface == EGL_NO_SURFACE) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + display->destroySurface((Surface*)surface); + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value) +{ + 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; + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (surface == EGL_NO_SURFACE) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + switch (attribute) + { + case EGL_VG_ALPHA_FORMAT: + UNIMPLEMENTED(); // FIXME + break; + case EGL_VG_COLORSPACE: + UNIMPLEMENTED(); // FIXME + break; + case EGL_CONFIG_ID: + *value = eglSurface->getConfig()->configID; + break; + case EGL_HEIGHT: + *value = eglSurface->getHeight(); + break; + case EGL_HORIZONTAL_RESOLUTION: + UNIMPLEMENTED(); // FIXME + break; + case EGL_LARGEST_PBUFFER: + UNIMPLEMENTED(); // FIXME + break; + case EGL_MIPMAP_TEXTURE: + UNIMPLEMENTED(); // FIXME + break; + case EGL_MIPMAP_LEVEL: + UNIMPLEMENTED(); // FIXME + break; + case EGL_MULTISAMPLE_RESOLVE: + UNIMPLEMENTED(); // FIXME + break; + case EGL_PIXEL_ASPECT_RATIO: + *value = eglSurface->getPixelAspectRatio(); + break; + case EGL_RENDER_BUFFER: + *value = eglSurface->getRenderBuffer(); + break; + case EGL_SWAP_BEHAVIOR: + *value = eglSurface->getSwapBehavior(); + break; + case EGL_TEXTURE_FORMAT: + *value = eglSurface->getTextureFormat(); + break; + case EGL_TEXTURE_TARGET: + *value = eglSurface->getTextureTarget(); + break; + case EGL_VERTICAL_RESOLUTION: + UNIMPLEMENTED(); // FIXME + break; + case EGL_WIDTH: + *value = eglSurface->getWidth(); + break; + case EGL_POST_SUB_BUFFER_SUPPORTED_NV: + if (!display->getExtensions().postSubBuffer) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + *value = eglSurface->isPostSubBufferSupported(); + break; + case EGL_FIXED_SIZE_ANGLE: + if (!display->getExtensions().windowFixedSize) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + *value = eglSurface->isFixedSize(); + break; + case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE: + if (!display->getExtensions().flexibleSurfaceCompatibility) + { + thread->setError( + Error(EGL_BAD_ATTRIBUTE, + "EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE cannot be used without " + "EGL_ANGLE_flexible_surface_compatibility support.")); + return EGL_FALSE; + } + *value = eglSurface->flexibleSurfaceCompatibilityRequested(); + break; + 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.")); + return EGL_FALSE; + } + *value = eglSurface->getOrientation(); + break; + 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.")); + return EGL_FALSE; + } + *value = eglSurface->directComposition(); + break; + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list) +{ + 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); + gl::Context* sharedGLContext = static_cast<gl::Context*>(share_context); + AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); + + Error error = ValidateCreateContext(display, configuration, sharedGLContext, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_CONTEXT; + } + + gl::Context *context = nullptr; + error = display->createContext(configuration, sharedGLContext, attributes, &context); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_CONTEXT; + } + + thread->setError(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); + + Error error = ValidateContext(display, context); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (ctx == EGL_NO_CONTEXT) + { + thread->setError(Error(EGL_BAD_CONTEXT)); + return EGL_FALSE; + } + + if (context == thread->getContext()) + { + thread->setCurrent(nullptr, thread->getDrawSurface(), thread->getReadSurface(), nullptr); + } + + display->destroyContext(context); + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx) +{ + 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); + + // If ctx is EGL_NO_CONTEXT and either draw or read are not EGL_NO_SURFACE, an EGL_BAD_MATCH + // error is generated. + if (ctx == EGL_NO_CONTEXT && (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE)) + { + thread->setError(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)); + return EGL_FALSE; + } + + // If either of draw or read is a valid surface and the other is EGL_NO_SURFACE, an + // EGL_BAD_MATCH error is generated. + if ((read == EGL_NO_SURFACE) != (draw == EGL_NO_SURFACE)) + { + thread->setError(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")); + 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")); + return EGL_FALSE; + } + + if (ctx != EGL_NO_CONTEXT) + { + Error error = ValidateContext(display, context); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + } + + if (display->isInitialized() && display->testDeviceLost()) + { + thread->setError(Error(EGL_CONTEXT_LOST)); + return EGL_FALSE; + } + + Surface *drawSurface = static_cast<Surface*>(draw); + if (draw != EGL_NO_SURFACE) + { + Error error = ValidateSurface(display, drawSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + } + + Surface *readSurface = static_cast<Surface*>(read); + if (read != EGL_NO_SURFACE) + { + Error error = ValidateSurface(display, readSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + } + + if (readSurface) + { + Error readCompatError = + ValidateCompatibleConfigs(display, readSurface->getConfig(), readSurface, + context->getConfig(), readSurface->getType()); + if (readCompatError.isError()) + { + thread->setError(readCompatError); + return EGL_FALSE; + } + } + + if (draw != read) + { + UNIMPLEMENTED(); // FIXME + + if (drawSurface) + { + Error drawCompatError = + ValidateCompatibleConfigs(display, drawSurface->getConfig(), drawSurface, + context->getConfig(), drawSurface->getType()); + if (drawCompatError.isError()) + { + thread->setError(drawCompatError); + return EGL_FALSE; + } + } + } + + Error makeCurrentError = display->makeCurrent(drawSurface, readSurface, context); + if (makeCurrentError.isError()) + { + thread->setError(makeCurrentError); + return EGL_FALSE; + } + + gl::Context *previousContext = thread->getContext(); + thread->setCurrent(display, drawSurface, readSurface, context); + + // Release the surface from the previously-current context, to allow + // destroyed surfaces to delete themselves. + if (previousContext != nullptr && context != previousContext) + { + previousContext->releaseSurface(); + } + + thread->setError(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(); + } + else if (readdraw == EGL_DRAW) + { + thread->setError(Error(EGL_SUCCESS)); + return thread->getDrawSurface(); + } + else + { + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_NO_SURFACE; + } +} + +EGLDisplay EGLAPIENTRY GetCurrentDisplay(void) +{ + EVENT("()"); + Thread *thread = GetCurrentThread(); + + EGLDisplay dpy = thread->getDisplay(); + + thread->setError(Error(EGL_SUCCESS)); + return dpy; +} + +EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value) +{ + 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); + + Error error = ValidateContext(display, context); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + switch (attribute) + { + case EGL_CONFIG_ID: + *value = context->getConfig()->configID; + break; + case EGL_CONTEXT_CLIENT_TYPE: + *value = context->getClientType(); + break; + case EGL_CONTEXT_CLIENT_VERSION: + *value = context->getClientMajorVersion(); + break; + case EGL_RENDER_BUFFER: + *value = context->getRenderBuffer(); + break; + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY WaitGL(void) +{ + EVENT("()"); + Thread *thread = GetCurrentThread(); + + Display *display = thread->getDisplay(); + + Error error = ValidateDisplay(display); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + // eglWaitGL like calling eglWaitClient with the OpenGL ES API bound. Since we only implement + // OpenGL ES we can do the call directly. + error = display->waitClient(); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY WaitNative(EGLint engine) +{ + EVENT("(EGLint engine = %d)", engine); + Thread *thread = GetCurrentThread(); + + Display *display = thread->getDisplay(); + + Error error = ValidateDisplay(display); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (engine != EGL_CORE_NATIVE_ENGINE) + { + thread->setError( + Error(EGL_BAD_PARAMETER, "the 'engine' parameter has an unrecognized value")); + } + + error = display->waitNative(engine, thread->getDrawSurface(), thread->getReadSurface()); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(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; + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (display->testDeviceLost()) + { + thread->setError(Error(EGL_CONTEXT_LOST)); + return EGL_FALSE; + } + + if (surface == EGL_NO_SURFACE) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + error = eglSurface->swap(); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(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); + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (display->testDeviceLost()) + { + thread->setError(Error(EGL_CONTEXT_LOST)); + return EGL_FALSE; + } + + UNIMPLEMENTED(); // FIXME + + thread->setError(Error(EGL_SUCCESS)); + return 0; +} + +// EGL 1.1 +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); + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (buffer != EGL_BACK_BUFFER) + { + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_FALSE; + } + + if (surface == EGL_NO_SURFACE || eglSurface->getType() == EGL_WINDOW_BIT) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + if (eglSurface->getBoundTexture()) + { + thread->setError(Error(EGL_BAD_ACCESS)); + return EGL_FALSE; + } + + if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE) + { + thread->setError(Error(EGL_BAD_MATCH)); + return EGL_FALSE; + } + + gl::Context *context = thread->getContext(); + if (context) + { + gl::Texture *textureObject = context->getTargetTexture(GL_TEXTURE_2D); + ASSERT(textureObject != NULL); + + if (textureObject->getImmutableFormat()) + { + thread->setError(Error(EGL_BAD_MATCH)); + return EGL_FALSE; + } + + error = eglSurface->bindTexImage(textureObject, buffer); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + } + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) +{ + 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); + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + UNIMPLEMENTED(); // FIXME + + thread->setError(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); + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (buffer != EGL_BACK_BUFFER) + { + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_FALSE; + } + + if (surface == EGL_NO_SURFACE || eglSurface->getType() == EGL_WINDOW_BIT) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + if (eglSurface->getTextureFormat() == EGL_NO_TEXTURE) + { + thread->setError(Error(EGL_BAD_MATCH)); + return EGL_FALSE; + } + + gl::Texture *texture = eglSurface->getBoundTexture(); + + if (texture) + { + error = eglSurface->releaseTexImage(buffer); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + } + + thread->setError(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); + return EGL_FALSE; + } + + Surface *draw_surface = static_cast<Surface *>(thread->getDrawSurface()); + + if (draw_surface == NULL) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + const egl::Config *surfaceConfig = draw_surface->getConfig(); + EGLint clampedInterval = std::min(std::max(interval, surfaceConfig->minSwapInterval), surfaceConfig->maxSwapInterval); + + draw_surface->setSwapInterval(clampedInterval); + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + + +// EGL 1.2 +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 + case EGL_OPENGL_ES_API: + break; + default: + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_FALSE; + } + + thread->setAPI(api); + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +EGLenum EGLAPIENTRY QueryAPI(void) +{ + EVENT("()"); + Thread *thread = GetCurrentThread(); + + EGLenum API = thread->getAPI(); + + thread->setError(Error(EGL_SUCCESS)); + return API; +} + +EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list) +{ + 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); + AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); + + Error error = ValidateCreatePbufferFromClientBuffer(display, buftype, buffer, configuration, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_SURFACE; + } + + egl::Surface *surface = nullptr; + error = display->createPbufferFromClientBuffer(configuration, buftype, buffer, attributes, + &surface); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_SURFACE; + } + + return static_cast<EGLSurface>(surface); +} + +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)); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY WaitClient(void) +{ + EVENT("()"); + Thread *thread = GetCurrentThread(); + + Display *display = thread->getDisplay(); + + Error error = ValidateDisplay(display); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = display->waitClient(); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +// EGL 1.4 +EGLContext EGLAPIENTRY GetCurrentContext(void) +{ + EVENT("()"); + Thread *thread = GetCurrentThread(); + + gl::Context *context = thread->getContext(); + + thread->setError(Error(EGL_SUCCESS)); + return static_cast<EGLContext>(context); +} + +// EGL 1.5 +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; +} + +EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list) +{ + 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; +} + +EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list) +{ + 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; +} + +EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list) +{ + 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; +} + +EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list) +{ + 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 = []() + { + ProcAddressMap map; +#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); + INSERT_PROC_ADDRESS(gl, BindAttribLocation); + INSERT_PROC_ADDRESS(gl, BindBuffer); + INSERT_PROC_ADDRESS(gl, BindFramebuffer); + INSERT_PROC_ADDRESS(gl, BindRenderbuffer); + INSERT_PROC_ADDRESS(gl, BindTexture); + INSERT_PROC_ADDRESS(gl, BlendColor); + INSERT_PROC_ADDRESS(gl, BlendEquation); + INSERT_PROC_ADDRESS(gl, BlendEquationSeparate); + INSERT_PROC_ADDRESS(gl, BlendFunc); + INSERT_PROC_ADDRESS(gl, BlendFuncSeparate); + INSERT_PROC_ADDRESS(gl, BufferData); + INSERT_PROC_ADDRESS(gl, BufferSubData); + INSERT_PROC_ADDRESS(gl, CheckFramebufferStatus); + INSERT_PROC_ADDRESS(gl, Clear); + INSERT_PROC_ADDRESS(gl, ClearColor); + INSERT_PROC_ADDRESS(gl, ClearDepthf); + INSERT_PROC_ADDRESS(gl, ClearStencil); + INSERT_PROC_ADDRESS(gl, ColorMask); + INSERT_PROC_ADDRESS(gl, CompileShader); + INSERT_PROC_ADDRESS(gl, CompressedTexImage2D); + INSERT_PROC_ADDRESS(gl, CompressedTexSubImage2D); + INSERT_PROC_ADDRESS(gl, CopyTexImage2D); + INSERT_PROC_ADDRESS(gl, CopyTexSubImage2D); + INSERT_PROC_ADDRESS(gl, CreateProgram); + INSERT_PROC_ADDRESS(gl, CreateShader); + INSERT_PROC_ADDRESS(gl, CullFace); + INSERT_PROC_ADDRESS(gl, DeleteBuffers); + INSERT_PROC_ADDRESS(gl, DeleteFramebuffers); + INSERT_PROC_ADDRESS(gl, DeleteProgram); + INSERT_PROC_ADDRESS(gl, DeleteRenderbuffers); + INSERT_PROC_ADDRESS(gl, DeleteShader); + INSERT_PROC_ADDRESS(gl, DeleteTextures); + INSERT_PROC_ADDRESS(gl, DepthFunc); + INSERT_PROC_ADDRESS(gl, DepthMask); + INSERT_PROC_ADDRESS(gl, DepthRangef); + INSERT_PROC_ADDRESS(gl, DetachShader); + INSERT_PROC_ADDRESS(gl, Disable); + INSERT_PROC_ADDRESS(gl, DisableVertexAttribArray); + INSERT_PROC_ADDRESS(gl, DrawArrays); + INSERT_PROC_ADDRESS(gl, DrawElements); + INSERT_PROC_ADDRESS(gl, Enable); + INSERT_PROC_ADDRESS(gl, EnableVertexAttribArray); + INSERT_PROC_ADDRESS(gl, Finish); + INSERT_PROC_ADDRESS(gl, Flush); + INSERT_PROC_ADDRESS(gl, FramebufferRenderbuffer); + INSERT_PROC_ADDRESS(gl, FramebufferTexture2D); + INSERT_PROC_ADDRESS(gl, FrontFace); + INSERT_PROC_ADDRESS(gl, GenBuffers); + INSERT_PROC_ADDRESS(gl, GenerateMipmap); + INSERT_PROC_ADDRESS(gl, GenFramebuffers); + INSERT_PROC_ADDRESS(gl, GenRenderbuffers); + INSERT_PROC_ADDRESS(gl, GenTextures); + INSERT_PROC_ADDRESS(gl, GetActiveAttrib); + INSERT_PROC_ADDRESS(gl, GetActiveUniform); + INSERT_PROC_ADDRESS(gl, GetAttachedShaders); + INSERT_PROC_ADDRESS(gl, GetAttribLocation); + INSERT_PROC_ADDRESS(gl, GetBooleanv); + INSERT_PROC_ADDRESS(gl, GetBufferParameteriv); + INSERT_PROC_ADDRESS(gl, GetError); + INSERT_PROC_ADDRESS(gl, GetFloatv); + INSERT_PROC_ADDRESS(gl, GetFramebufferAttachmentParameteriv); + INSERT_PROC_ADDRESS(gl, GetIntegerv); + INSERT_PROC_ADDRESS(gl, GetProgramiv); + INSERT_PROC_ADDRESS(gl, GetProgramInfoLog); + INSERT_PROC_ADDRESS(gl, GetRenderbufferParameteriv); + INSERT_PROC_ADDRESS(gl, GetShaderiv); + INSERT_PROC_ADDRESS(gl, GetShaderInfoLog); + INSERT_PROC_ADDRESS(gl, GetShaderPrecisionFormat); + INSERT_PROC_ADDRESS(gl, GetShaderSource); + INSERT_PROC_ADDRESS(gl, GetString); + INSERT_PROC_ADDRESS(gl, GetTexParameterfv); + INSERT_PROC_ADDRESS(gl, GetTexParameteriv); + INSERT_PROC_ADDRESS(gl, GetUniformfv); + INSERT_PROC_ADDRESS(gl, GetUniformiv); + INSERT_PROC_ADDRESS(gl, GetUniformLocation); + INSERT_PROC_ADDRESS(gl, GetVertexAttribfv); + INSERT_PROC_ADDRESS(gl, GetVertexAttribiv); + INSERT_PROC_ADDRESS(gl, GetVertexAttribPointerv); + INSERT_PROC_ADDRESS(gl, Hint); + INSERT_PROC_ADDRESS(gl, IsBuffer); + INSERT_PROC_ADDRESS(gl, IsEnabled); + INSERT_PROC_ADDRESS(gl, IsFramebuffer); + INSERT_PROC_ADDRESS(gl, IsProgram); + INSERT_PROC_ADDRESS(gl, IsRenderbuffer); + INSERT_PROC_ADDRESS(gl, IsShader); + INSERT_PROC_ADDRESS(gl, IsTexture); + INSERT_PROC_ADDRESS(gl, LineWidth); + INSERT_PROC_ADDRESS(gl, LinkProgram); + INSERT_PROC_ADDRESS(gl, PixelStorei); + INSERT_PROC_ADDRESS(gl, PolygonOffset); + INSERT_PROC_ADDRESS(gl, ReadPixels); + INSERT_PROC_ADDRESS(gl, ReleaseShaderCompiler); + INSERT_PROC_ADDRESS(gl, RenderbufferStorage); + INSERT_PROC_ADDRESS(gl, SampleCoverage); + INSERT_PROC_ADDRESS(gl, Scissor); + INSERT_PROC_ADDRESS(gl, ShaderBinary); + INSERT_PROC_ADDRESS(gl, ShaderSource); + INSERT_PROC_ADDRESS(gl, StencilFunc); + INSERT_PROC_ADDRESS(gl, StencilFuncSeparate); + INSERT_PROC_ADDRESS(gl, StencilMask); + INSERT_PROC_ADDRESS(gl, StencilMaskSeparate); + INSERT_PROC_ADDRESS(gl, StencilOp); + INSERT_PROC_ADDRESS(gl, StencilOpSeparate); + INSERT_PROC_ADDRESS(gl, TexImage2D); + INSERT_PROC_ADDRESS(gl, TexParameterf); + INSERT_PROC_ADDRESS(gl, TexParameterfv); + INSERT_PROC_ADDRESS(gl, TexParameteri); + INSERT_PROC_ADDRESS(gl, TexParameteriv); + INSERT_PROC_ADDRESS(gl, TexSubImage2D); + INSERT_PROC_ADDRESS(gl, Uniform1f); + INSERT_PROC_ADDRESS(gl, Uniform1fv); + INSERT_PROC_ADDRESS(gl, Uniform1i); + INSERT_PROC_ADDRESS(gl, Uniform1iv); + INSERT_PROC_ADDRESS(gl, Uniform2f); + INSERT_PROC_ADDRESS(gl, Uniform2fv); + INSERT_PROC_ADDRESS(gl, Uniform2i); + INSERT_PROC_ADDRESS(gl, Uniform2iv); + INSERT_PROC_ADDRESS(gl, Uniform3f); + INSERT_PROC_ADDRESS(gl, Uniform3fv); + INSERT_PROC_ADDRESS(gl, Uniform3i); + INSERT_PROC_ADDRESS(gl, Uniform3iv); + INSERT_PROC_ADDRESS(gl, Uniform4f); + INSERT_PROC_ADDRESS(gl, Uniform4fv); + INSERT_PROC_ADDRESS(gl, Uniform4i); + INSERT_PROC_ADDRESS(gl, Uniform4iv); + INSERT_PROC_ADDRESS(gl, UniformMatrix2fv); + INSERT_PROC_ADDRESS(gl, UniformMatrix3fv); + INSERT_PROC_ADDRESS(gl, UniformMatrix4fv); + INSERT_PROC_ADDRESS(gl, UseProgram); + INSERT_PROC_ADDRESS(gl, ValidateProgram); + INSERT_PROC_ADDRESS(gl, VertexAttrib1f); + INSERT_PROC_ADDRESS(gl, VertexAttrib1fv); + INSERT_PROC_ADDRESS(gl, VertexAttrib2f); + INSERT_PROC_ADDRESS(gl, VertexAttrib2fv); + INSERT_PROC_ADDRESS(gl, VertexAttrib3f); + INSERT_PROC_ADDRESS(gl, VertexAttrib3fv); + INSERT_PROC_ADDRESS(gl, VertexAttrib4f); + INSERT_PROC_ADDRESS(gl, VertexAttrib4fv); + INSERT_PROC_ADDRESS(gl, VertexAttribPointer); + INSERT_PROC_ADDRESS(gl, Viewport); + + // GL_ANGLE_framebuffer_blit + INSERT_PROC_ADDRESS(gl, BlitFramebufferANGLE); + + // GL_ANGLE_framebuffer_multisample + INSERT_PROC_ADDRESS(gl, RenderbufferStorageMultisampleANGLE); + + // GL_EXT_discard_framebuffer + INSERT_PROC_ADDRESS(gl, DiscardFramebufferEXT); + + // GL_NV_fence + INSERT_PROC_ADDRESS(gl, DeleteFencesNV); + INSERT_PROC_ADDRESS(gl, GenFencesNV); + INSERT_PROC_ADDRESS(gl, IsFenceNV); + INSERT_PROC_ADDRESS(gl, TestFenceNV); + INSERT_PROC_ADDRESS(gl, GetFenceivNV); + INSERT_PROC_ADDRESS(gl, FinishFenceNV); + INSERT_PROC_ADDRESS(gl, SetFenceNV); + + // GL_ANGLE_translated_shader_source + INSERT_PROC_ADDRESS(gl, GetTranslatedShaderSourceANGLE); + + // GL_EXT_texture_storage + INSERT_PROC_ADDRESS(gl, TexStorage2DEXT); + + // GL_EXT_robustness + INSERT_PROC_ADDRESS(gl, GetGraphicsResetStatusEXT); + INSERT_PROC_ADDRESS(gl, ReadnPixelsEXT); + INSERT_PROC_ADDRESS(gl, GetnUniformfvEXT); + INSERT_PROC_ADDRESS(gl, GetnUniformivEXT); + + // GL_EXT_occlusion_query_boolean + INSERT_PROC_ADDRESS(gl, GenQueriesEXT); + INSERT_PROC_ADDRESS(gl, DeleteQueriesEXT); + INSERT_PROC_ADDRESS(gl, IsQueryEXT); + INSERT_PROC_ADDRESS(gl, BeginQueryEXT); + INSERT_PROC_ADDRESS(gl, EndQueryEXT); + INSERT_PROC_ADDRESS(gl, GetQueryivEXT); + INSERT_PROC_ADDRESS(gl, GetQueryObjectuivEXT); + + // GL_EXT_disjoint_timer_query + INSERT_PROC_ADDRESS(gl, GenQueriesEXT); + INSERT_PROC_ADDRESS(gl, DeleteQueriesEXT); + INSERT_PROC_ADDRESS(gl, IsQueryEXT); + INSERT_PROC_ADDRESS(gl, BeginQueryEXT); + INSERT_PROC_ADDRESS(gl, EndQueryEXT); + INSERT_PROC_ADDRESS(gl, QueryCounterEXT); + INSERT_PROC_ADDRESS(gl, GetQueryivEXT); + INSERT_PROC_ADDRESS(gl, GetQueryObjectivEXT); + INSERT_PROC_ADDRESS(gl, GetQueryObjectuivEXT); + INSERT_PROC_ADDRESS(gl, GetQueryObjecti64vEXT); + INSERT_PROC_ADDRESS(gl, GetQueryObjectui64vEXT); + + // GL_EXT_draw_buffers + INSERT_PROC_ADDRESS(gl, DrawBuffersEXT); + + // GL_ANGLE_instanced_arrays + INSERT_PROC_ADDRESS(gl, DrawArraysInstancedANGLE); + INSERT_PROC_ADDRESS(gl, DrawElementsInstancedANGLE); + INSERT_PROC_ADDRESS(gl, VertexAttribDivisorANGLE); + + // GL_OES_get_program_binary + INSERT_PROC_ADDRESS(gl, GetProgramBinaryOES); + INSERT_PROC_ADDRESS(gl, ProgramBinaryOES); + + // GL_OES_mapbuffer + INSERT_PROC_ADDRESS(gl, MapBufferOES); + INSERT_PROC_ADDRESS(gl, UnmapBufferOES); + INSERT_PROC_ADDRESS(gl, GetBufferPointervOES); + + // GL_EXT_map_buffer_range + INSERT_PROC_ADDRESS(gl, MapBufferRangeEXT); + INSERT_PROC_ADDRESS(gl, FlushMappedBufferRangeEXT); + + // GL_EXT_debug_marker + INSERT_PROC_ADDRESS(gl, InsertEventMarkerEXT); + INSERT_PROC_ADDRESS(gl, PushGroupMarkerEXT); + INSERT_PROC_ADDRESS(gl, PopGroupMarkerEXT); + + // GL_OES_EGL_image + INSERT_PROC_ADDRESS(gl, EGLImageTargetTexture2DOES); + INSERT_PROC_ADDRESS(gl, EGLImageTargetRenderbufferStorageOES); + + // GL_OES_vertex_array_object + INSERT_PROC_ADDRESS(gl, BindVertexArrayOES); + INSERT_PROC_ADDRESS(gl, DeleteVertexArraysOES); + INSERT_PROC_ADDRESS(gl, GenVertexArraysOES); + INSERT_PROC_ADDRESS(gl, IsVertexArrayOES); + + // GL_KHR_debug + INSERT_PROC_ADDRESS(gl, DebugMessageControlKHR); + INSERT_PROC_ADDRESS(gl, DebugMessageInsertKHR); + INSERT_PROC_ADDRESS(gl, DebugMessageCallbackKHR); + INSERT_PROC_ADDRESS(gl, GetDebugMessageLogKHR); + INSERT_PROC_ADDRESS(gl, PushDebugGroupKHR); + INSERT_PROC_ADDRESS(gl, PopDebugGroupKHR); + INSERT_PROC_ADDRESS(gl, ObjectLabelKHR); + INSERT_PROC_ADDRESS(gl, GetObjectLabelKHR); + INSERT_PROC_ADDRESS(gl, ObjectPtrLabelKHR); + INSERT_PROC_ADDRESS(gl, GetObjectPtrLabelKHR); + INSERT_PROC_ADDRESS(gl, GetPointervKHR); + + // GL_CHROMIUM_bind_uniform_location + INSERT_PROC_ADDRESS(gl, BindUniformLocationCHROMIUM); + + // GL_CHROMIUM_copy_texture + 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); + INSERT_PROC_ADDRESS(gl, TexImage3D); + INSERT_PROC_ADDRESS(gl, TexSubImage3D); + INSERT_PROC_ADDRESS(gl, CopyTexSubImage3D); + INSERT_PROC_ADDRESS(gl, CompressedTexImage3D); + INSERT_PROC_ADDRESS(gl, CompressedTexSubImage3D); + INSERT_PROC_ADDRESS(gl, GenQueries); + INSERT_PROC_ADDRESS(gl, DeleteQueries); + INSERT_PROC_ADDRESS(gl, IsQuery); + INSERT_PROC_ADDRESS(gl, BeginQuery); + INSERT_PROC_ADDRESS(gl, EndQuery); + INSERT_PROC_ADDRESS(gl, GetQueryiv); + INSERT_PROC_ADDRESS(gl, GetQueryObjectuiv); + INSERT_PROC_ADDRESS(gl, UnmapBuffer); + INSERT_PROC_ADDRESS(gl, GetBufferPointerv); + INSERT_PROC_ADDRESS(gl, DrawBuffers); + INSERT_PROC_ADDRESS(gl, UniformMatrix2x3fv); + INSERT_PROC_ADDRESS(gl, UniformMatrix3x2fv); + INSERT_PROC_ADDRESS(gl, UniformMatrix2x4fv); + INSERT_PROC_ADDRESS(gl, UniformMatrix4x2fv); + INSERT_PROC_ADDRESS(gl, UniformMatrix3x4fv); + INSERT_PROC_ADDRESS(gl, UniformMatrix4x3fv); + INSERT_PROC_ADDRESS(gl, BlitFramebuffer); + INSERT_PROC_ADDRESS(gl, RenderbufferStorageMultisample); + INSERT_PROC_ADDRESS(gl, FramebufferTextureLayer); + INSERT_PROC_ADDRESS(gl, MapBufferRange); + INSERT_PROC_ADDRESS(gl, FlushMappedBufferRange); + INSERT_PROC_ADDRESS(gl, BindVertexArray); + INSERT_PROC_ADDRESS(gl, DeleteVertexArrays); + INSERT_PROC_ADDRESS(gl, GenVertexArrays); + INSERT_PROC_ADDRESS(gl, IsVertexArray); + INSERT_PROC_ADDRESS(gl, GetIntegeri_v); + INSERT_PROC_ADDRESS(gl, BeginTransformFeedback); + INSERT_PROC_ADDRESS(gl, EndTransformFeedback); + INSERT_PROC_ADDRESS(gl, BindBufferRange); + INSERT_PROC_ADDRESS(gl, BindBufferBase); + INSERT_PROC_ADDRESS(gl, TransformFeedbackVaryings); + INSERT_PROC_ADDRESS(gl, GetTransformFeedbackVarying); + INSERT_PROC_ADDRESS(gl, VertexAttribIPointer); + INSERT_PROC_ADDRESS(gl, GetVertexAttribIiv); + INSERT_PROC_ADDRESS(gl, GetVertexAttribIuiv); + INSERT_PROC_ADDRESS(gl, VertexAttribI4i); + INSERT_PROC_ADDRESS(gl, VertexAttribI4ui); + INSERT_PROC_ADDRESS(gl, VertexAttribI4iv); + INSERT_PROC_ADDRESS(gl, VertexAttribI4uiv); + INSERT_PROC_ADDRESS(gl, GetUniformuiv); + INSERT_PROC_ADDRESS(gl, GetFragDataLocation); + INSERT_PROC_ADDRESS(gl, Uniform1ui); + INSERT_PROC_ADDRESS(gl, Uniform2ui); + INSERT_PROC_ADDRESS(gl, Uniform3ui); + INSERT_PROC_ADDRESS(gl, Uniform4ui); + INSERT_PROC_ADDRESS(gl, Uniform1uiv); + INSERT_PROC_ADDRESS(gl, Uniform2uiv); + INSERT_PROC_ADDRESS(gl, Uniform3uiv); + INSERT_PROC_ADDRESS(gl, Uniform4uiv); + INSERT_PROC_ADDRESS(gl, ClearBufferiv); + INSERT_PROC_ADDRESS(gl, ClearBufferuiv); + INSERT_PROC_ADDRESS(gl, ClearBufferfv); + INSERT_PROC_ADDRESS(gl, ClearBufferfi); + INSERT_PROC_ADDRESS(gl, GetStringi); + INSERT_PROC_ADDRESS(gl, CopyBufferSubData); + INSERT_PROC_ADDRESS(gl, GetUniformIndices); + INSERT_PROC_ADDRESS(gl, GetActiveUniformsiv); + INSERT_PROC_ADDRESS(gl, GetUniformBlockIndex); + INSERT_PROC_ADDRESS(gl, GetActiveUniformBlockiv); + INSERT_PROC_ADDRESS(gl, GetActiveUniformBlockName); + 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_); + INSERT_PROC_ADDRESS(gl, IsSync); + INSERT_PROC_ADDRESS(gl, DeleteSync); + INSERT_PROC_ADDRESS(gl, ClientWaitSync); + INSERT_PROC_ADDRESS(gl, WaitSync); + INSERT_PROC_ADDRESS(gl, GetInteger64v); + INSERT_PROC_ADDRESS(gl, GetSynciv); + INSERT_PROC_ADDRESS(gl, GetInteger64i_v); + INSERT_PROC_ADDRESS(gl, GetBufferParameteri64v); + INSERT_PROC_ADDRESS(gl, GenSamplers); + INSERT_PROC_ADDRESS(gl, DeleteSamplers); + INSERT_PROC_ADDRESS(gl, IsSampler); + INSERT_PROC_ADDRESS(gl, BindSampler); + INSERT_PROC_ADDRESS(gl, SamplerParameteri); + INSERT_PROC_ADDRESS(gl, SamplerParameteriv); + INSERT_PROC_ADDRESS(gl, SamplerParameterf); + INSERT_PROC_ADDRESS(gl, SamplerParameterfv); + INSERT_PROC_ADDRESS(gl, GetSamplerParameteriv); + INSERT_PROC_ADDRESS(gl, GetSamplerParameterfv); + INSERT_PROC_ADDRESS(gl, VertexAttribDivisor); + INSERT_PROC_ADDRESS(gl, BindTransformFeedback); + INSERT_PROC_ADDRESS(gl, DeleteTransformFeedbacks); + INSERT_PROC_ADDRESS(gl, GenTransformFeedbacks); + INSERT_PROC_ADDRESS(gl, IsTransformFeedback); + INSERT_PROC_ADDRESS(gl, PauseTransformFeedback); + INSERT_PROC_ADDRESS(gl, ResumeTransformFeedback); + INSERT_PROC_ADDRESS(gl, GetProgramBinary); + INSERT_PROC_ADDRESS(gl, ProgramBinary); + INSERT_PROC_ADDRESS(gl, ProgramParameteri); + INSERT_PROC_ADDRESS(gl, InvalidateFramebuffer); + INSERT_PROC_ADDRESS(gl, InvalidateSubFramebuffer); + INSERT_PROC_ADDRESS(gl, TexStorage2D); + INSERT_PROC_ADDRESS(gl, TexStorage3D); + INSERT_PROC_ADDRESS(gl, GetInternalformativ); + + // GLES31 core + INSERT_PROC_ADDRESS(gl, DispatchCompute); + INSERT_PROC_ADDRESS(gl, DispatchComputeIndirect); + INSERT_PROC_ADDRESS(gl, DrawArraysIndirect); + INSERT_PROC_ADDRESS(gl, DrawElementsIndirect); + INSERT_PROC_ADDRESS(gl, FramebufferParameteri); + INSERT_PROC_ADDRESS(gl, GetFramebufferParameteriv); + INSERT_PROC_ADDRESS(gl, GetProgramInterfaceiv); + INSERT_PROC_ADDRESS(gl, GetProgramResourceIndex); + INSERT_PROC_ADDRESS(gl, GetProgramResourceName); + INSERT_PROC_ADDRESS(gl, GetProgramResourceiv); + INSERT_PROC_ADDRESS(gl, GetProgramResourceLocation); + INSERT_PROC_ADDRESS(gl, UseProgramStages); + INSERT_PROC_ADDRESS(gl, ActiveShaderProgram); + INSERT_PROC_ADDRESS(gl, CreateShaderProgramv); + INSERT_PROC_ADDRESS(gl, BindProgramPipeline); + INSERT_PROC_ADDRESS(gl, DeleteProgramPipelines); + INSERT_PROC_ADDRESS(gl, GenProgramPipelines); + INSERT_PROC_ADDRESS(gl, IsProgramPipeline); + INSERT_PROC_ADDRESS(gl, GetProgramPipelineiv); + INSERT_PROC_ADDRESS(gl, ProgramUniform1i); + INSERT_PROC_ADDRESS(gl, ProgramUniform2i); + INSERT_PROC_ADDRESS(gl, ProgramUniform3i); + INSERT_PROC_ADDRESS(gl, ProgramUniform4i); + INSERT_PROC_ADDRESS(gl, ProgramUniform1ui); + INSERT_PROC_ADDRESS(gl, ProgramUniform2ui); + INSERT_PROC_ADDRESS(gl, ProgramUniform3ui); + INSERT_PROC_ADDRESS(gl, ProgramUniform4ui); + INSERT_PROC_ADDRESS(gl, ProgramUniform1f); + INSERT_PROC_ADDRESS(gl, ProgramUniform2f); + INSERT_PROC_ADDRESS(gl, ProgramUniform3f); + INSERT_PROC_ADDRESS(gl, ProgramUniform4f); + INSERT_PROC_ADDRESS(gl, ProgramUniform1iv); + INSERT_PROC_ADDRESS(gl, ProgramUniform2iv); + INSERT_PROC_ADDRESS(gl, ProgramUniform3iv); + INSERT_PROC_ADDRESS(gl, ProgramUniform4iv); + INSERT_PROC_ADDRESS(gl, ProgramUniform1uiv); + INSERT_PROC_ADDRESS(gl, ProgramUniform2uiv); + INSERT_PROC_ADDRESS(gl, ProgramUniform3uiv); + INSERT_PROC_ADDRESS(gl, ProgramUniform4uiv); + INSERT_PROC_ADDRESS(gl, ProgramUniform1fv); + INSERT_PROC_ADDRESS(gl, ProgramUniform2fv); + INSERT_PROC_ADDRESS(gl, ProgramUniform3fv); + INSERT_PROC_ADDRESS(gl, ProgramUniform4fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix2fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix3fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix4fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix2x3fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix3x2fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix2x4fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix4x2fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix3x4fv); + INSERT_PROC_ADDRESS(gl, ProgramUniformMatrix4x3fv); + INSERT_PROC_ADDRESS(gl, ValidateProgramPipeline); + INSERT_PROC_ADDRESS(gl, GetProgramPipelineInfoLog); + INSERT_PROC_ADDRESS(gl, BindImageTexture); + INSERT_PROC_ADDRESS(gl, GetBooleani_v); + INSERT_PROC_ADDRESS(gl, MemoryBarrier); + INSERT_PROC_ADDRESS(gl, MemoryBarrierByRegion); + INSERT_PROC_ADDRESS(gl, TexStorage2DMultisample); + INSERT_PROC_ADDRESS(gl, GetMultisamplefv); + INSERT_PROC_ADDRESS(gl, SampleMaski); + INSERT_PROC_ADDRESS(gl, GetTexLevelParameteriv); + INSERT_PROC_ADDRESS(gl, GetTexLevelParameterfv); + INSERT_PROC_ADDRESS(gl, BindVertexBuffer); + INSERT_PROC_ADDRESS(gl, VertexAttribFormat); + INSERT_PROC_ADDRESS(gl, VertexAttribIFormat); + INSERT_PROC_ADDRESS(gl, VertexAttribBinding); + INSERT_PROC_ADDRESS(gl, VertexBindingDivisor); + + // EGL 1.0 + INSERT_PROC_ADDRESS(egl, ChooseConfig); + INSERT_PROC_ADDRESS(egl, CopyBuffers); + INSERT_PROC_ADDRESS(egl, CreateContext); + INSERT_PROC_ADDRESS(egl, CreatePbufferSurface); + INSERT_PROC_ADDRESS(egl, CreatePixmapSurface); + INSERT_PROC_ADDRESS(egl, CreateWindowSurface); + INSERT_PROC_ADDRESS(egl, DestroyContext); + INSERT_PROC_ADDRESS(egl, DestroySurface); + INSERT_PROC_ADDRESS(egl, GetConfigAttrib); + INSERT_PROC_ADDRESS(egl, GetConfigs); + INSERT_PROC_ADDRESS(egl, GetCurrentDisplay); + INSERT_PROC_ADDRESS(egl, GetCurrentSurface); + INSERT_PROC_ADDRESS(egl, GetDisplay); + INSERT_PROC_ADDRESS(egl, GetError); + INSERT_PROC_ADDRESS(egl, GetProcAddress); + INSERT_PROC_ADDRESS(egl, Initialize); + INSERT_PROC_ADDRESS(egl, MakeCurrent); + INSERT_PROC_ADDRESS(egl, QueryContext); + INSERT_PROC_ADDRESS(egl, QueryString); + INSERT_PROC_ADDRESS(egl, QuerySurface); + INSERT_PROC_ADDRESS(egl, SwapBuffers); + INSERT_PROC_ADDRESS(egl, Terminate); + INSERT_PROC_ADDRESS(egl, WaitGL); + INSERT_PROC_ADDRESS(egl, WaitNative); + + // EGL 1.1 + INSERT_PROC_ADDRESS(egl, BindTexImage); + INSERT_PROC_ADDRESS(egl, ReleaseTexImage); + INSERT_PROC_ADDRESS(egl, SurfaceAttrib); + INSERT_PROC_ADDRESS(egl, SwapInterval); + + // EGL 1.2 + INSERT_PROC_ADDRESS(egl, BindAPI); + INSERT_PROC_ADDRESS(egl, QueryAPI); + INSERT_PROC_ADDRESS(egl, CreatePbufferFromClientBuffer); + INSERT_PROC_ADDRESS(egl, ReleaseThread); + INSERT_PROC_ADDRESS(egl, WaitClient); + + // EGL 1.4 + INSERT_PROC_ADDRESS(egl, GetCurrentContext); + + // EGL 1.5 + INSERT_PROC_ADDRESS(egl, CreateSync); + INSERT_PROC_ADDRESS(egl, DestroySync); + INSERT_PROC_ADDRESS(egl, ClientWaitSync); + INSERT_PROC_ADDRESS(egl, GetSyncAttrib); + INSERT_PROC_ADDRESS(egl, CreateImage); + INSERT_PROC_ADDRESS(egl, DestroyImage); + INSERT_PROC_ADDRESS(egl, GetPlatformDisplay); + INSERT_PROC_ADDRESS(egl, CreatePlatformWindowSurface); + INSERT_PROC_ADDRESS(egl, CreatePlatformPixmapSurface); + INSERT_PROC_ADDRESS(egl, WaitSync); + + // EGL_ANGLE_query_surface_pointer + INSERT_PROC_ADDRESS(egl, QuerySurfacePointerANGLE); + + // EGL_NV_post_sub_buffer + INSERT_PROC_ADDRESS(egl, PostSubBufferNV); + + // EGL_EXT_platform_base + INSERT_PROC_ADDRESS(egl, GetPlatformDisplayEXT); + + // EGL_EXT_device_query + INSERT_PROC_ADDRESS(egl, QueryDisplayAttribEXT); + INSERT_PROC_ADDRESS(egl, QueryDeviceAttribEXT); + INSERT_PROC_ADDRESS(egl, QueryDeviceStringEXT); + + // EGL_KHR_image_base/EGL_KHR_image + INSERT_PROC_ADDRESS(egl, CreateImageKHR); + INSERT_PROC_ADDRESS(egl, DestroyImageKHR); + + // EGL_EXT_device_creation + INSERT_PROC_ADDRESS(egl, CreateDeviceANGLE); + INSERT_PROC_ADDRESS(egl, ReleaseDeviceANGLE); + + // EGL_KHR_stream + INSERT_PROC_ADDRESS(egl, CreateStreamKHR); + INSERT_PROC_ADDRESS(egl, DestroyStreamKHR); + INSERT_PROC_ADDRESS(egl, StreamAttribKHR); + INSERT_PROC_ADDRESS(egl, QueryStreamKHR); + INSERT_PROC_ADDRESS(egl, QueryStreamu64KHR); + + // EGL_KHR_stream_consumer_gltexture + INSERT_PROC_ADDRESS(egl, StreamConsumerGLTextureExternalKHR); + INSERT_PROC_ADDRESS(egl, StreamConsumerAcquireKHR); + INSERT_PROC_ADDRESS(egl, StreamConsumerReleaseKHR); + + // EGL_NV_stream_consumer_gltexture_yuv + INSERT_PROC_ADDRESS(egl, StreamConsumerGLTextureExternalAttribsNV); + + // EGL_ANGLE_stream_producer_d3d_texture_nv12 + 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; +} + +} diff --git a/gfx/angle/src/libGLESv2/entry_points_egl.h b/gfx/angle/src/libGLESv2/entry_points_egl.h new file mode 100755 index 000000000..259a20968 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_egl.h @@ -0,0 +1,74 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_egl.h : Defines the EGL entry points. + +#ifndef LIBGLESV2_ENTRYPOINTSEGL_H_ +#define LIBGLESV2_ENTRYPOINTSEGL_H_ + +#include <EGL/egl.h> +#include <export.h> + +namespace egl +{ + +// EGL 1.0 +ANGLE_EXPORT EGLBoolean EGLAPIENTRY ChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY CopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target); +ANGLE_EXPORT EGLContext EGLAPIENTRY CreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list); +ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list); +ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list); +ANGLE_EXPORT EGLSurface EGLAPIENTRY CreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyContext(EGLDisplay dpy, EGLContext ctx); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroySurface(EGLDisplay dpy, EGLSurface surface); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config); +ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetCurrentDisplay(void); +ANGLE_EXPORT EGLSurface EGLAPIENTRY GetCurrentSurface(EGLint readdraw); +ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetDisplay(EGLNativeDisplayType display_id); +ANGLE_EXPORT EGLint EGLAPIENTRY GetError(void); +ANGLE_EXPORT __eglMustCastToProperFunctionPointerType EGLAPIENTRY GetProcAddress(const char *procname); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY Initialize(EGLDisplay dpy, EGLint *major, EGLint *minor); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY MakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value); +ANGLE_EXPORT const char *EGLAPIENTRY QueryString(EGLDisplay dpy, EGLint name); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY QuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY SwapBuffers(EGLDisplay dpy, EGLSurface surface); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY Terminate(EGLDisplay dpy); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitGL(void); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitNative(EGLint engine); + +// EGL 1.1 +ANGLE_EXPORT EGLBoolean EGLAPIENTRY BindTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EGLint buffer); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY SurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY SwapInterval(EGLDisplay dpy, EGLint interval); + +// EGL 1.2 +ANGLE_EXPORT EGLBoolean EGLAPIENTRY BindAPI(EGLenum api); +ANGLE_EXPORT EGLenum EGLAPIENTRY QueryAPI(void); +ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseThread(void); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitClient(void); + +// EGL 1.4 +ANGLE_EXPORT EGLContext EGLAPIENTRY GetCurrentContext(void); + +// EGL 1.5 +ANGLE_EXPORT EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroySync(EGLDisplay dpy, EGLSync sync); +ANGLE_EXPORT EGLint EGLAPIENTRY ClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags, EGLTime timeout); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY GetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value); +ANGLE_EXPORT EGLImage EGLAPIENTRY CreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyImage(EGLDisplay dpy, EGLImage image); +ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list); +ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list); +ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags); + +} + +#endif // LIBGLESV2_ENTRYPOINTSEGL_H_ diff --git a/gfx/angle/src/libGLESv2/entry_points_egl_ext.cpp b/gfx/angle/src/libGLESv2/entry_points_egl_ext.cpp new file mode 100755 index 000000000..b18a10d92 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_egl_ext.cpp @@ -0,0 +1,957 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_ext.cpp : Implements the EGL extension entry points. + +#include "libGLESv2/entry_points_egl_ext.h" +#include "libGLESv2/global_state.h" + +#include "libANGLE/Context.h" +#include "libANGLE/Display.h" +#include "libANGLE/Device.h" +#include "libANGLE/Surface.h" +#include "libANGLE/Stream.h" +#include "libANGLE/Thread.h" +#include "libANGLE/validationEGL.h" + +#include "common/debug.h" + +namespace egl +{ + +// EGL_ANGLE_query_surface_pointer +EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint attribute = %d, void **value = 0x%0.8p)", + dpy, surface, attribute, value); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display*>(dpy); + Surface *eglSurface = static_cast<Surface*>(surface); + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (!display->getExtensions().querySurfacePointer) + { + thread->setError(Error(EGL_SUCCESS)); + return EGL_FALSE; + } + + if (surface == EGL_NO_SURFACE) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + // validate the attribute parameter + switch (attribute) + { + case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE: + if (!display->getExtensions().surfaceD3DTexture2DShareHandle) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + break; + case EGL_DXGI_KEYED_MUTEX_ANGLE: + if (!display->getExtensions().keyedMutex) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + break; + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + + error = eglSurface->querySurfacePointerANGLE(attribute, value); + thread->setError(error); + return (error.isError() ? EGL_FALSE : EGL_TRUE); +} + + +// EGL_NV_post_sub_buffer +EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint x = %d, EGLint y = %d, EGLint width = %d, EGLint height = %d)", dpy, surface, x, y, width, height); + Thread *thread = GetCurrentThread(); + + if (x < 0 || y < 0 || width < 0 || height < 0) + { + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_FALSE; + } + + Display *display = static_cast<Display*>(dpy); + Surface *eglSurface = static_cast<Surface*>(surface); + + Error error = ValidateSurface(display, eglSurface); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (display->testDeviceLost()) + { + thread->setError(Error(EGL_CONTEXT_LOST)); + return EGL_FALSE; + } + + if (surface == EGL_NO_SURFACE) + { + thread->setError(Error(EGL_BAD_SURFACE)); + return EGL_FALSE; + } + + if (!display->getExtensions().postSubBuffer) + { + // Spec is not clear about how this should be handled. + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; + } + + error = eglSurface->postSubBuffer(x, y, width, height); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(Error(EGL_SUCCESS)); + return EGL_TRUE; +} + +// EGL_EXT_platform_base +EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) +{ + 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(); + + const ClientExtensions &clientExtensions = Display::getClientExtensions(); + + switch (platform) + { + case EGL_PLATFORM_ANGLE_ANGLE: + if (!clientExtensions.platformANGLE) + { + thread->setError(Error(EGL_BAD_PARAMETER)); + return EGL_NO_DISPLAY; + } + break; + case EGL_PLATFORM_DEVICE_EXT: + if (!clientExtensions.platformDevice) + { + thread->setError(Error(EGL_BAD_PARAMETER, "Platform Device extension is not active")); + return EGL_NO_DISPLAY; + } + break; + default: + thread->setError(Error(EGL_BAD_CONFIG)); + return EGL_NO_DISPLAY; + } + + if (platform == EGL_PLATFORM_ANGLE_ANGLE) + { + EGLint platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; + EGLint deviceType = EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE; + bool majorVersionSpecified = false; + bool minorVersionSpecified = false; + bool enableAutoTrimSpecified = false; + bool deviceTypeSpecified = false; + bool presentPathSpecified = false; + + if (attrib_list) + { + for (const EGLint *curAttrib = attrib_list; curAttrib[0] != EGL_NONE; curAttrib += 2) + { + switch (curAttrib[0]) + { + case EGL_PLATFORM_ANGLE_TYPE_ANGLE: + switch (curAttrib[1]) + { + case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE: + break; + + case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE: + case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE: + if (!clientExtensions.platformANGLED3D) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_NO_DISPLAY; + } + break; + + case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE: + case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE: + if (!clientExtensions.platformANGLEOpenGL) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_NO_DISPLAY; + } + break; + + case EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE: + if (!clientExtensions.platformANGLENULL) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE, + "Display type " + "EGL_PLATFORM_ANGLE_TYPE_NULL_ANGLE " + "requires EGL_ANGLE_platform_angle_null.")); + return EGL_NO_DISPLAY; + } + break; + + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_NO_DISPLAY; + } + platformType = curAttrib[1]; + break; + + case EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE: + if (curAttrib[1] != EGL_DONT_CARE) + { + majorVersionSpecified = true; + } + break; + + case EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE: + if (curAttrib[1] != EGL_DONT_CARE) + { + minorVersionSpecified = true; + } + break; + + case EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE: + switch (curAttrib[1]) + { + case EGL_TRUE: + case EGL_FALSE: + break; + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_NO_DISPLAY; + } + enableAutoTrimSpecified = true; + break; + + case EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE: + if (!clientExtensions.experimentalPresentPath) + { + thread->setError( + Error(EGL_BAD_ATTRIBUTE, + "EGL_ANGLE_experimental_present_path extension not active")); + return EGL_NO_DISPLAY; + } + + switch (curAttrib[1]) + { + case EGL_EXPERIMENTAL_PRESENT_PATH_FAST_ANGLE: + case EGL_EXPERIMENTAL_PRESENT_PATH_COPY_ANGLE: + break; + default: + thread->setError( + Error(EGL_BAD_ATTRIBUTE, + "Invalid value for EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE")); + return EGL_NO_DISPLAY; + } + presentPathSpecified = true; + break; + + case EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE: + switch (curAttrib[1]) + { + case EGL_PLATFORM_ANGLE_DEVICE_TYPE_HARDWARE_ANGLE: + case EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE: + case EGL_PLATFORM_ANGLE_DEVICE_TYPE_REFERENCE_ANGLE: + deviceTypeSpecified = true; + break; + + case EGL_PLATFORM_ANGLE_DEVICE_TYPE_NULL_ANGLE: + // This is a hidden option, accepted by the OpenGL back-end. + break; + + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE, + "Invalid value for " + "EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE " + "attrib")); + return EGL_NO_DISPLAY; + } + deviceType = curAttrib[1]; + break; + + default: + break; + } + } + } + + if (!majorVersionSpecified && minorVersionSpecified) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_NO_DISPLAY; + } + + if (deviceType == EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE && + platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) + { + thread->setError( + Error(EGL_BAD_ATTRIBUTE, + "EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE requires a device type of " + "EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.")); + return EGL_NO_DISPLAY; + } + + if (enableAutoTrimSpecified && platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) + { + thread->setError( + Error(EGL_BAD_ATTRIBUTE, + "EGL_PLATFORM_ANGLE_ENABLE_AUTOMATIC_TRIM_ANGLE requires a device type of " + "EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.")); + return EGL_NO_DISPLAY; + } + + if (presentPathSpecified && platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE, + "EGL_EXPERIMENTAL_PRESENT_PATH_ANGLE requires a device type of " + "EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE.")); + return EGL_NO_DISPLAY; + } + + if (deviceTypeSpecified && platformType != EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE && + platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) + { + thread->setError( + Error(EGL_BAD_ATTRIBUTE, + "EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE requires a device type of " + "EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE or EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE.")); + return EGL_NO_DISPLAY; + } + + thread->setError(Error(EGL_SUCCESS)); + return Display::GetDisplayFromAttribs(native_display, + AttributeMap::CreateFromIntArray(attrib_list)); + } + else if (platform == EGL_PLATFORM_DEVICE_EXT) + { + Device *eglDevice = reinterpret_cast<Device *>(native_display); + if (eglDevice == nullptr || !Device::IsValidDevice(eglDevice)) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE, + "native_display should be a valid EGL device if platform equals " + "EGL_PLATFORM_DEVICE_EXT")); + return EGL_NO_DISPLAY; + } + + thread->setError(Error(EGL_SUCCESS)); + return Display::GetDisplayFromDevice(native_display); + } + else + { + UNREACHABLE(); + return EGL_NO_DISPLAY; + } +} + +// EGL_EXT_device_query +EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value) +{ + EVENT("(EGLDeviceEXT device = 0x%0.8p, EGLint attribute = %d, EGLAttrib *value = 0x%0.8p)", + device, attribute, value); + Thread *thread = GetCurrentThread(); + + Device *dev = static_cast<Device*>(device); + if (dev == EGL_NO_DEVICE_EXT || !Device::IsValidDevice(dev)) + { + thread->setError(Error(EGL_BAD_ACCESS)); + return EGL_FALSE; + } + + // If the device was created by (and is owned by) a display, and that display doesn't support + // device querying, then this call should fail + Display *owningDisplay = dev->getOwningDisplay(); + if (owningDisplay != nullptr && !owningDisplay->getExtensions().deviceQuery) + { + thread->setError(Error(EGL_BAD_ACCESS, + "Device wasn't created using eglCreateDeviceANGLE, and the Display " + "that created it doesn't support device querying")); + return EGL_FALSE; + } + + Error error(EGL_SUCCESS); + + // validate the attribute parameter + switch (attribute) + { + case EGL_D3D11_DEVICE_ANGLE: + case EGL_D3D9_DEVICE_ANGLE: + if (!dev->getExtensions().deviceD3D || dev->getType() != attribute) + { + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + error = dev->getDevice(value); + break; + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + + thread->setError(error); + return (error.isError() ? EGL_FALSE : EGL_TRUE); +} + +// EGL_EXT_device_query +const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name) +{ + EVENT("(EGLDeviceEXT device = 0x%0.8p, EGLint name = %d)", + device, name); + Thread *thread = GetCurrentThread(); + + Device *dev = static_cast<Device*>(device); + if (dev == EGL_NO_DEVICE_EXT || !Device::IsValidDevice(dev)) + { + thread->setError(Error(EGL_BAD_DEVICE_EXT)); + return nullptr; + } + + const char *result; + switch (name) + { + case EGL_EXTENSIONS: + result = dev->getExtensionString().c_str(); + break; + default: + thread->setError(Error(EGL_BAD_DEVICE_EXT)); + return nullptr; + } + + thread->setError(Error(EGL_SUCCESS)); + return result; +} + +// EGL_EXT_device_query +EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLint attribute = %d, EGLAttrib *value = 0x%0.8p)", + dpy, attribute, value); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display*>(dpy); + + Error error = ValidateDisplay(display); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + if (!display->getExtensions().deviceQuery) + { + thread->setError(Error(EGL_BAD_ACCESS)); + return EGL_FALSE; + } + + // validate the attribute parameter + switch (attribute) + { + case EGL_DEVICE_EXT: + *value = reinterpret_cast<EGLAttrib>(display->getDevice()); + break; + + default: + thread->setError(Error(EGL_BAD_ATTRIBUTE)); + return EGL_FALSE; + } + + thread->setError(error); + return (error.isError() ? EGL_FALSE : EGL_TRUE); +} + +ANGLE_EXPORT EGLImageKHR EGLAPIENTRY CreateImageKHR(EGLDisplay dpy, + EGLContext ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint *attrib_list) +{ + 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(); + + Display *display = static_cast<Display *>(dpy); + gl::Context *context = static_cast<gl::Context *>(ctx); + AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); + + Error error = ValidateCreateImageKHR(display, context, target, buffer, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_IMAGE; + } + + Image *image = nullptr; + error = display->createImage(context, target, buffer, attributes, &image); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_IMAGE; + } + + return static_cast<EGLImage>(image); +} + +ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLImage image = 0x%0.8p)", dpy, image); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Image *img = static_cast<Image *>(image); + + Error error = ValidateDestroyImageKHR(display, img); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + display->destroyImage(img); + + return EGL_TRUE; +} + +ANGLE_EXPORT EGLDeviceEXT EGLAPIENTRY CreateDeviceANGLE(EGLint device_type, + void *native_device, + const EGLAttrib *attrib_list) +{ + EVENT( + "(EGLint device_type = %d, void* native_device = 0x%0.8p, const EGLAttrib* attrib_list = " + "0x%0.8p)", + device_type, native_device, attrib_list); + Thread *thread = GetCurrentThread(); + + Error error = ValidateCreateDeviceANGLE(device_type, native_device, attrib_list); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_DEVICE_EXT; + } + + Device *device = nullptr; + error = Device::CreateDevice(native_device, device_type, &device); + if (error.isError()) + { + ASSERT(device == nullptr); + thread->setError(error); + return EGL_NO_DEVICE_EXT; + } + + return device; +} + +ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseDeviceANGLE(EGLDeviceEXT device) +{ + EVENT("(EGLDeviceEXT device = 0x%0.8p)", device); + Thread *thread = GetCurrentThread(); + + Device *dev = static_cast<Device *>(device); + + Error error = ValidateReleaseDeviceANGLE(dev); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + SafeDelete(dev); + + return EGL_TRUE; +} + +// EGL_KHR_stream +EGLStreamKHR EGLAPIENTRY CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, const EGLAttrib* attrib_list = 0x%0.8p)", dpy, attrib_list); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list); + + Error error = ValidateCreateStreamKHR(display, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_STREAM_KHR; + } + + Stream *stream; + error = display->createStream(attributes, &stream); + if (error.isError()) + { + thread->setError(error); + return EGL_NO_STREAM_KHR; + } + + thread->setError(error); + return static_cast<EGLStreamKHR>(stream); +} + +EGLBoolean EGLAPIENTRY DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + + Error error = ValidateDestroyStreamKHR(display, streamObject); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + display->destroyStream(streamObject); + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY StreamAttribKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint value) +{ + EVENT( + "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLenum attribute = 0x%X, " + "EGLint value = 0x%X)", + dpy, stream, attribute, value); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + + Error error = ValidateStreamAttribKHR(display, streamObject, attribute, value); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + switch (attribute) + { + case EGL_CONSUMER_LATENCY_USEC_KHR: + streamObject->setConsumerLatency(value); + break; + case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR: + streamObject->setConsumerAcquireTimeout(value); + break; + default: + UNREACHABLE(); + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY QueryStreamKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint *value) +{ + EVENT( + "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLenum attribute = 0x%X, " + "EGLint value = 0x%0.8p)", + dpy, stream, attribute, value); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + + Error error = ValidateQueryStreamKHR(display, streamObject, attribute, value); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + switch (attribute) + { + case EGL_STREAM_STATE_KHR: + *value = streamObject->getState(); + break; + case EGL_CONSUMER_LATENCY_USEC_KHR: + *value = streamObject->getConsumerLatency(); + break; + case EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR: + *value = streamObject->getConsumerAcquireTimeout(); + break; + default: + UNREACHABLE(); + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY QueryStreamu64KHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLuint64KHR *value) +{ + EVENT( + "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLenum attribute = 0x%X, " + "EGLuint64KHR value = 0x%0.8p)", + dpy, stream, attribute, value); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + + Error error = ValidateQueryStreamu64KHR(display, streamObject, attribute, value); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + switch (attribute) + { + case EGL_PRODUCER_FRAME_KHR: + *value = streamObject->getProducerFrame(); + break; + case EGL_CONSUMER_FRAME_KHR: + *value = streamObject->getConsumerFrame(); + break; + default: + UNREACHABLE(); + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + gl::Context *context = gl::GetValidGlobalContext(); + + Error error = ValidateStreamConsumerGLTextureExternalKHR(display, context, streamObject); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = streamObject->createConsumerGLTextureExternal(AttributeMap(), context); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + gl::Context *context = gl::GetValidGlobalContext(); + + Error error = ValidateStreamConsumerAcquireKHR(display, context, streamObject); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = streamObject->consumerAcquire(); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream) +{ + EVENT("(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR = 0x%0.8p)", dpy, stream); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + gl::Context *context = gl::GetValidGlobalContext(); + + Error error = ValidateStreamConsumerReleaseKHR(display, context, streamObject); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = streamObject->consumerRelease(); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy, + EGLStreamKHR stream, + const EGLAttrib *attrib_list) +{ + EVENT( + "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLAttrib attrib_list = 0x%0.8p", + dpy, stream, attrib_list); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + gl::Context *context = gl::GetValidGlobalContext(); + AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list); + + Error error = ValidateStreamConsumerGLTextureExternalAttribsNV(display, context, streamObject, + attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = streamObject->createConsumerGLTextureExternal(attributes, context); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY CreateStreamProducerD3DTextureNV12ANGLE(EGLDisplay dpy, + EGLStreamKHR stream, + const EGLAttrib *attrib_list) +{ + EVENT( + "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, EGLAttrib attrib_list = 0x%0.8p", + dpy, stream, attrib_list); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list); + + Error error = + ValidateCreateStreamProducerD3DTextureNV12ANGLE(display, streamObject, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = streamObject->createProducerD3D11TextureNV12(attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(error); + return EGL_TRUE; +} + +EGLBoolean EGLAPIENTRY StreamPostD3DTextureNV12ANGLE(EGLDisplay dpy, + EGLStreamKHR stream, + void *texture, + const EGLAttrib *attrib_list) +{ + EVENT( + "(EGLDisplay dpy = 0x%0.8p, EGLStreamKHR stream = 0x%0.8p, void* texture = 0x%0.8p, " + "EGLAttrib attrib_list = 0x%0.8p", + dpy, stream, texture, attrib_list); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Stream *streamObject = static_cast<Stream *>(stream); + AttributeMap attributes = AttributeMap::CreateFromAttribArray(attrib_list); + + Error error = ValidateStreamPostD3DTextureNV12ANGLE(display, streamObject, texture, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = streamObject->postD3D11NV12Texture(texture, attributes); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + thread->setError(error); + return EGL_TRUE; +} + +ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy, + EGLSurface surface, + EGLint *rects, + EGLint n_rects) +{ + EVENT( + "(EGLDisplay dpy = 0x%0.8p, EGLSurface surface = 0x%0.8p, EGLint *rects = 0x%0.8p, EGLint " + "n_rects = %d)", + dpy, surface, rects, n_rects); + Thread *thread = GetCurrentThread(); + + Display *display = static_cast<Display *>(dpy); + Surface *eglSurface = static_cast<Surface *>(surface); + + Error error = ValidateSwapBuffersWithDamageEXT(display, eglSurface, rects, n_rects); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + error = eglSurface->swapWithDamage(rects, n_rects); + if (error.isError()) + { + thread->setError(error); + return EGL_FALSE; + } + + return EGL_TRUE; +} +} diff --git a/gfx/angle/src/libGLESv2/entry_points_egl_ext.h b/gfx/angle/src/libGLESv2/entry_points_egl_ext.h new file mode 100755 index 000000000..eb57ad05e --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_egl_ext.h @@ -0,0 +1,91 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_egl_ext.h : Defines the EGL extension entry points. + +#ifndef LIBGLESV2_ENTRYPOINTSEGLEXT_H_ +#define LIBGLESV2_ENTRYPOINTSEGLEXT_H_ + +#include <EGL/egl.h> +#include <EGL/eglext.h> +#include <export.h> + +namespace egl +{ + +// EGL_ANGLE_query_surface_pointer +ANGLE_EXPORT EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); + +// EGL_NV_post_sub_buffer +ANGLE_EXPORT EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); + +// EGL_EXT_platform_base +ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list); + +// EGL_EXT_device_query +ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, EGLAttrib *value); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value); +ANGLE_EXPORT const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name); + +// EGL_KHR_image_base/EGL_KHR_image +ANGLE_EXPORT EGLImageKHR EGLAPIENTRY CreateImageKHR(EGLDisplay dpy, + EGLContext ctx, + EGLenum target, + EGLClientBuffer buffer, + const EGLint *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyImageKHR(EGLDisplay dpy, EGLImageKHR image); + +// EGL_EXT_device_creation +ANGLE_EXPORT EGLDeviceEXT EGLAPIENTRY CreateDeviceANGLE(EGLint device_type, + void *native_device, + const EGLAttrib *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY ReleaseDeviceANGLE(EGLDeviceEXT device); + +// EGL_KHR_stream +ANGLE_EXPORT EGLStreamKHR EGLAPIENTRY CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY DestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamAttribKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint value); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryStreamKHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLint *value); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY QueryStreamu64KHR(EGLDisplay dpy, + EGLStreamKHR stream, + EGLenum attribute, + EGLuint64KHR *value); + +// EGL_KHR_stream_consumer_gltexture +ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamConsumerGLTextureExternalKHR(EGLDisplay dpy, + EGLStreamKHR stream); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY +StreamConsumerGLTextureExternalAttribsNV(EGLDisplay dpy, + EGLStreamKHR stream, + const EGLAttrib *attrib_list); + +// EGL_ANGLE_stream_producer_d3d_texture_nv12 +ANGLE_EXPORT EGLBoolean EGLAPIENTRY +CreateStreamProducerD3DTextureNV12ANGLE(EGLDisplay dpy, + EGLStreamKHR stream, + const EGLAttrib *attrib_list); +ANGLE_EXPORT EGLBoolean EGLAPIENTRY StreamPostD3DTextureNV12ANGLE(EGLDisplay dpy, + EGLStreamKHR stream, + void *texture, + const EGLAttrib *attrib_list); + +// EGL_EXT_swap_buffers_with_damage +ANGLE_EXPORT EGLBoolean SwapBuffersWithDamageEXT(EGLDisplay dpy, + EGLSurface surface, + EGLint *rects, + EGLint n_rects); + +} // namespace egl + +#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_ diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_2_0.cpp b/gfx/angle/src/libGLESv2/entry_points_gles_2_0.cpp new file mode 100755 index 000000000..ca6129800 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_2_0.cpp @@ -0,0 +1,2881 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_2_0.cpp : Implements the GLES 2.0 entry points. + +#include "libGLESv2/entry_points_gles_2_0.h" + +#include "libGLESv2/global_state.h" + +#include "libANGLE/formatutils.h" +#include "libANGLE/Buffer.h" +#include "libANGLE/Compiler.h" +#include "libANGLE/Context.h" +#include "libANGLE/Error.h" +#include "libANGLE/Framebuffer.h" +#include "libANGLE/Renderbuffer.h" +#include "libANGLE/Shader.h" +#include "libANGLE/Program.h" +#include "libANGLE/Texture.h" +#include "libANGLE/VertexArray.h" +#include "libANGLE/VertexAttribute.h" +#include "libANGLE/FramebufferAttachment.h" + +#include "libANGLE/validationES.h" +#include "libANGLE/validationES2.h" +#include "libANGLE/validationES3.h" +#include "libANGLE/queryconversions.h" +#include "libANGLE/queryutils.h" + +#include "common/debug.h" +#include "common/utilities.h" +#include "common/version.h" + +namespace gl +{ + +void GL_APIENTRY ActiveTexture(GLenum texture) +{ + EVENT("(GLenum texture = 0x%X)", texture); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateActiveTexture(context, texture)) + { + return; + } + + context->activeTexture(texture); + } +} + +void GL_APIENTRY AttachShader(GLuint program, GLuint shader) +{ + EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateAttachShader(context, program, shader)) + { + return; + } + + context->attachShader(program, shader); + } +} + +void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar* name) +{ + EVENT("(GLuint program = %d, GLuint index = %d, const GLchar* name = 0x%0.8p)", program, index, name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateBindAttribLocation(context, program, index, name)) + { + return; + } + + context->bindAttribLocation(program, index, name); + } +} + +void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer) +{ + EVENT("(GLenum target = 0x%X, GLuint buffer = %d)", target, buffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBindBuffer(context, target, buffer)) + { + return; + } + + context->bindBuffer(target, buffer); + } +} + +void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer) +{ + EVENT("(GLenum target = 0x%X, GLuint framebuffer = %d)", target, framebuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBindFramebuffer(context, target, framebuffer)) + { + return; + } + + context->bindFramebuffer(target, framebuffer); + } +} + +void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer) +{ + EVENT("(GLenum target = 0x%X, GLuint renderbuffer = %d)", target, renderbuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBindRenderbuffer(context, target, renderbuffer)) + { + return; + } + + context->bindRenderbuffer(target, renderbuffer); + } +} + +void GL_APIENTRY BindTexture(GLenum target, GLuint texture) +{ + EVENT("(GLenum target = 0x%X, GLuint texture = %d)", target, texture); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBindTexture(context, target, texture)) + { + return; + } + + context->bindTexture(target, texture); + } +} + +void GL_APIENTRY BlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)", + red, green, blue, alpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->blendColor(red, green, blue, alpha); + } +} + +void GL_APIENTRY BlendEquation(GLenum mode) +{ + EVENT("(GLenum mode = 0x%X)", mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBlendEquation(context, mode)) + { + return; + } + + context->blendEquation(mode); + } +} + +void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) +{ + EVENT("(GLenum modeRGB = 0x%X, GLenum modeAlpha = 0x%X)", modeRGB, modeAlpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateBlendEquationSeparate(context, modeRGB, modeAlpha)) + { + return; + } + + context->blendEquationSeparate(modeRGB, modeAlpha); + } +} + +void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor) +{ + EVENT("(GLenum sfactor = 0x%X, GLenum dfactor = 0x%X)", sfactor, dfactor); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBlendFunc(context, sfactor, dfactor)) + { + return; + } + + context->blendFunc(sfactor, dfactor); + } +} + +void GL_APIENTRY BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) +{ + EVENT("(GLenum srcRGB = 0x%X, GLenum dstRGB = 0x%X, GLenum srcAlpha = 0x%X, GLenum dstAlpha = 0x%X)", + srcRGB, dstRGB, srcAlpha, dstAlpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateBlendFuncSeparate(context, srcRGB, dstRGB, srcAlpha, dstAlpha)) + { + return; + } + + context->blendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); + } +} + +void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) +{ + EVENT("(GLenum target = 0x%X, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p, GLenum usage = %d)", + target, size, data, usage); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBufferData(context, target, size, data, usage)) + { + return; + } + + context->bufferData(target, size, data, usage); + } +} + +void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) +{ + EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr size = %d, const GLvoid* data = 0x%0.8p)", + target, offset, size, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateBufferSubData(context, target, offset, size, data)) + { + return; + } + + context->bufferSubData(target, offset, size, data); + } +} + +GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target) +{ + EVENT("(GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidFramebufferTarget(target)) + { + context->handleError(Error(GL_INVALID_ENUM)); + return 0; + } + + Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target); + ASSERT(framebuffer); + + return framebuffer->checkStatus(context->getContextState()); + } + + return 0; +} + +void GL_APIENTRY Clear(GLbitfield mask) +{ + EVENT("(GLbitfield mask = 0x%X)", mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateClear(context, mask)) + { + return; + } + + context->clear(mask); + } +} + +void GL_APIENTRY ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +{ + EVENT("(GLclampf red = %f, GLclampf green = %f, GLclampf blue = %f, GLclampf alpha = %f)", + red, green, blue, alpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->clearColor(red, green, blue, alpha); + } +} + +void GL_APIENTRY ClearDepthf(GLclampf depth) +{ + EVENT("(GLclampf depth = %f)", depth); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->clearDepthf(depth); + } +} + +void GL_APIENTRY ClearStencil(GLint s) +{ + EVENT("(GLint s = %d)", s); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->clearStencil(s); + } +} + +void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + EVENT("(GLboolean red = %d, GLboolean green = %u, GLboolean blue = %u, GLboolean alpha = %u)", + red, green, blue, alpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->colorMask(red, green, blue, alpha); + } +} + +void GL_APIENTRY CompileShader(GLuint shader) +{ + EVENT("(GLuint shader = %d)", shader); + + Context *context = GetValidGlobalContext(); + if (context) + { + Shader *shaderObject = GetValidShader(context, shader); + if (!shaderObject) + { + return; + } + shaderObject->compile(context); + } +} + +void GL_APIENTRY CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, + GLint border, GLsizei imageSize, const GLvoid* data) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " + "GLsizei height = %d, GLint border = %d, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", + target, level, internalformat, width, height, border, imageSize, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCompressedTexImage2D(context, target, level, internalformat, width, height, + border, imageSize, data)) + { + return; + } + + context->compressedTexImage2D(target, level, internalformat, width, height, border, + imageSize, data); + } +} + +void GL_APIENTRY CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, const GLvoid* data) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, " + "GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", + target, level, xoffset, yoffset, width, height, format, imageSize, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCompressedTexSubImage2D(context, target, level, xoffset, yoffset, width, + height, format, imageSize, data)) + { + return; + } + + context->compressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, + imageSize, data); + } +} + +void GL_APIENTRY CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, " + "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, GLint border = %d)", + target, level, internalformat, x, y, width, height, border); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCopyTexImage2D(context, target, level, internalformat, x, y, width, height, + border)) + { + return; + } + context->copyTexImage2D(target, level, internalformat, x, y, width, height, border); + } +} + +void GL_APIENTRY CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", + target, level, xoffset, yoffset, x, y, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCopyTexSubImage2D(context, target, level, xoffset, yoffset, x, y, width, + height)) + { + return; + } + + context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); + } +} + +GLuint GL_APIENTRY CreateProgram(void) +{ + EVENT("()"); + + Context *context = GetValidGlobalContext(); + if (context) + { + return context->createProgram(); + } + + return 0; +} + +GLuint GL_APIENTRY CreateShader(GLenum type) +{ + EVENT("(GLenum type = 0x%X)", type); + + Context *context = GetValidGlobalContext(); + if (context) + { + + if (!context->skipValidation() && !ValidateCreateShader(context, type)) + { + return 0; + } + return context->createShader(type); + } + return 0; +} + +void GL_APIENTRY CullFace(GLenum mode) +{ + EVENT("(GLenum mode = 0x%X)", mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (mode) + { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->cullFace(mode); + } +} + +void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint* buffers) +{ + EVENT("(GLsizei n = %d, const GLuint* buffers = 0x%0.8p)", n, buffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteBuffers(context, n, buffers)) + { + return; + } + + for (int i = 0; i < n; i++) + { + context->deleteBuffer(buffers[i]); + } + } +} + +void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) +{ + EVENT("(GLsizei n = %d, const GLuint* framebuffers = 0x%0.8p)", n, framebuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteFramebuffers(context, n, framebuffers)) + { + return; + } + + for (int i = 0; i < n; i++) + { + if (framebuffers[i] != 0) + { + context->deleteFramebuffer(framebuffers[i]); + } + } + } +} + +void GL_APIENTRY DeleteProgram(GLuint program) +{ + EVENT("(GLuint program = %d)", program); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (program == 0) + { + return; + } + + if (!context->getProgram(program)) + { + if(context->getShader(program)) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + else + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + } + + context->deleteProgram(program); + } +} + +void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) +{ + EVENT("(GLsizei n = %d, const GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteRenderbuffers(context, n, renderbuffers)) + { + return; + } + + for (int i = 0; i < n; i++) + { + context->deleteRenderbuffer(renderbuffers[i]); + } + } +} + +void GL_APIENTRY DeleteShader(GLuint shader) +{ + EVENT("(GLuint shader = %d)", shader); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (shader == 0) + { + return; + } + + if (!context->getShader(shader)) + { + if(context->getProgram(shader)) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + else + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + } + + context->deleteShader(shader); + } +} + +void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint* textures) +{ + EVENT("(GLsizei n = %d, const GLuint* textures = 0x%0.8p)", n, textures); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteTextures(context, n, textures)) + { + return; + } + + for (int i = 0; i < n; i++) + { + if (textures[i] != 0) + { + context->deleteTexture(textures[i]); + } + } + } +} + +void GL_APIENTRY DepthFunc(GLenum func) +{ + EVENT("(GLenum func = 0x%X)", func); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (func) + { + case GL_NEVER: + case GL_ALWAYS: + case GL_LESS: + case GL_LEQUAL: + case GL_EQUAL: + case GL_GREATER: + case GL_GEQUAL: + case GL_NOTEQUAL: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->depthFunc(func); + } +} + +void GL_APIENTRY DepthMask(GLboolean flag) +{ + EVENT("(GLboolean flag = %u)", flag); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->depthMask(flag); + } +} + +void GL_APIENTRY DepthRangef(GLclampf zNear, GLclampf zFar) +{ + EVENT("(GLclampf zNear = %f, GLclampf zFar = %f)", zNear, zFar); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->depthRangef(zNear, zFar); + } +} + +void GL_APIENTRY DetachShader(GLuint program, GLuint shader) +{ + EVENT("(GLuint program = %d, GLuint shader = %d)", program, shader); + + Context *context = GetValidGlobalContext(); + if (context) + { + Program *programObject = GetValidProgram(context, program); + if (!programObject) + { + return; + } + + Shader *shaderObject = GetValidShader(context, shader); + if (!shaderObject) + { + return; + } + + if (!programObject->detachShader(shaderObject)) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + } +} + +void GL_APIENTRY Disable(GLenum cap) +{ + EVENT("(GLenum cap = 0x%X)", cap); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDisable(context, cap)) + { + return; + } + + context->disable(cap); + } +} + +void GL_APIENTRY DisableVertexAttribArray(GLuint index) +{ + EVENT("(GLuint index = %d)", index); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->disableVertexAttribArray(index); + } +} + +void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count) +{ + EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d)", mode, first, count); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateDrawArrays(context, mode, first, count, 1)) + { + return; + } + + Error error = context->drawArrays(mode, first, count); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) +{ + EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p)", + mode, count, type, indices); + + Context *context = GetValidGlobalContext(); + if (context) + { + IndexRange indexRange; + if (!ValidateDrawElements(context, mode, count, type, indices, 1, &indexRange)) + { + return; + } + + Error error = context->drawElements(mode, count, type, indices, indexRange); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY Enable(GLenum cap) +{ + EVENT("(GLenum cap = 0x%X)", cap); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateEnable(context, cap)) + { + return; + } + + context->enable(cap); + } +} + +void GL_APIENTRY EnableVertexAttribArray(GLuint index) +{ + EVENT("(GLuint index = %d)", index); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->enableVertexAttribArray(index); + } +} + +void GL_APIENTRY Finish(void) +{ + EVENT("()"); + + Context *context = GetValidGlobalContext(); + if (context) + { + Error error = context->finish(); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY Flush(void) +{ + EVENT("()"); + + Context *context = GetValidGlobalContext(); + if (context) + { + Error error = context->flush(); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum renderbuffertarget = 0x%X, " + "GLuint renderbuffer = %d)", target, attachment, renderbuffertarget, renderbuffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateFramebufferRenderbuffer(context, target, attachment, renderbuffertarget, + renderbuffer)) + { + return; + } + + context->framebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); + } +} + +void GL_APIENTRY FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum textarget = 0x%X, " + "GLuint texture = %d, GLint level = %d)", target, attachment, textarget, texture, level); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateFramebufferTexture2D(context, target, attachment, textarget, texture, level)) + { + return; + } + + context->framebufferTexture2D(target, attachment, textarget, texture, level); + } +} + +void GL_APIENTRY FrontFace(GLenum mode) +{ + EVENT("(GLenum mode = 0x%X)", mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (mode) + { + case GL_CW: + case GL_CCW: + break; + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->frontFace(mode); + } +} + +void GL_APIENTRY GenBuffers(GLsizei n, GLuint* buffers) +{ + EVENT("(GLsizei n = %d, GLuint* buffers = 0x%0.8p)", n, buffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenBuffers(context, n, buffers)) + { + return; + } + + for (int i = 0; i < n; i++) + { + buffers[i] = context->createBuffer(); + } + } +} + +void GL_APIENTRY GenerateMipmap(GLenum target) +{ + EVENT("(GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenerateMipmap(context, target)) + { + return; + } + + context->generateMipmap(target); + } +} + +void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint* framebuffers) +{ + EVENT("(GLsizei n = %d, GLuint* framebuffers = 0x%0.8p)", n, framebuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenFramebuffers(context, n, framebuffers)) + { + return; + } + + for (int i = 0; i < n; i++) + { + framebuffers[i] = context->createFramebuffer(); + } + } +} + +void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint* renderbuffers) +{ + EVENT("(GLsizei n = %d, GLuint* renderbuffers = 0x%0.8p)", n, renderbuffers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenRenderbuffers(context, n, renderbuffers)) + { + return; + } + + for (int i = 0; i < n; i++) + { + renderbuffers[i] = context->createRenderbuffer(); + } + } +} + +void GL_APIENTRY GenTextures(GLsizei n, GLuint* textures) +{ + EVENT("(GLsizei n = %d, GLuint* textures = 0x%0.8p)", n, textures); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenTextures(context, n, textures)) + { + return; + } + + for (int i = 0; i < n; i++) + { + textures[i] = context->createTexture(); + } + } +} + +void GL_APIENTRY GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, GLchar *name) +{ + EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, GLsizei *length = 0x%0.8p, " + "GLint *size = 0x%0.8p, GLenum *type = %0.8p, GLchar *name = %0.8p)", + program, index, bufsize, length, size, type, name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (bufsize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + if (index >= (GLuint)programObject->getActiveAttributeCount()) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + programObject->getActiveAttribute(index, bufsize, length, size, type, name); + } +} + +void GL_APIENTRY GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) +{ + EVENT("(GLuint program = %d, GLuint index = %d, GLsizei bufsize = %d, " + "GLsizei* length = 0x%0.8p, GLint* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", + program, index, bufsize, length, size, type, name); + + + Context *context = GetValidGlobalContext(); + if (context) + { + if (bufsize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + if (index >= (GLuint)programObject->getActiveUniformCount()) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + programObject->getActiveUniform(index, bufsize, length, size, type, name); + } +} + +void GL_APIENTRY GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) +{ + EVENT("(GLuint program = %d, GLsizei maxcount = %d, GLsizei* count = 0x%0.8p, GLuint* shaders = 0x%0.8p)", + program, maxcount, count, shaders); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (maxcount < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + return programObject->getAttachedShaders(maxcount, count, shaders); + } +} + +GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar* name) +{ + EVENT("(GLuint program = %d, const GLchar* name = %s)", program, name); + + Context *context = GetValidGlobalContext(); + if (context) + { + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return -1; + } + + if (!programObject->isLinked()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return -1; + } + + return programObject->getAttributeLocation(name); + } + + return -1; +} + +void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean* params) +{ + EVENT("(GLenum pname = 0x%X, GLboolean* params = 0x%0.8p)", pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLenum nativeType; + unsigned int numParams = 0; + if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_BOOL) + { + context->getBooleanv(pname, params); + } + else + { + CastStateValues(context, nativeType, pname, numParams, params); + } + } +} + +void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetBufferParameteriv(context, target, pname, params)) + { + return; + } + + Buffer *buffer = context->getGLState().getTargetBuffer(target); + QueryBufferParameteriv(buffer, pname, params); + } +} + +GLenum GL_APIENTRY GetError(void) +{ + EVENT("()"); + + Context *context = GetGlobalContext(); + + if (context) + { + return context->getError(); + } + + return GL_NO_ERROR; +} + +void GL_APIENTRY GetFloatv(GLenum pname, GLfloat* params) +{ + EVENT("(GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLenum nativeType; + unsigned int numParams = 0; + if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_FLOAT) + { + context->getFloatv(pname, params); + } + else + { + CastStateValues(context, nativeType, pname, numParams, params); + } + } +} + +void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) +{ + EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", + target, attachment, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!context->skipValidation() && + !ValidateGetFramebufferAttachmentParameteriv(context, target, attachment, pname, + &numParams)) + { + return; + } + + const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target); + QueryFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params); + } +} + +void GL_APIENTRY GetIntegerv(GLenum pname, GLint* params) +{ + EVENT("(GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLenum nativeType; + unsigned int numParams = 0; + + if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_INT) + { + context->getIntegerv(pname, params); + } + else + { + CastStateValues(context, nativeType, pname, numParams, params); + } + } +} + +void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint* params) +{ + EVENT("(GLuint program = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", program, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!context->skipValidation() && + !ValidateGetProgramiv(context, program, pname, &numParams)) + { + return; + } + + Program *programObject = context->getProgram(program); + QueryProgramiv(programObject, pname, params); + } +} + +void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) +{ + EVENT("(GLuint program = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)", + program, bufsize, length, infolog); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (bufsize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + if (!programObject) + { + return; + } + + programObject->getInfoLog(bufsize, length, infolog); + } +} + +void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetRenderbufferParameteriv(context, target, pname, params)) + { + return; + } + + Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer(); + QueryRenderbufferiv(renderbuffer, pname, params); + } +} + +void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint* params) +{ + EVENT("(GLuint shader = %d, GLenum pname = %d, GLint* params = 0x%0.8p)", shader, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGetShaderiv(context, shader, pname, params)) + { + return; + } + + Shader *shaderObject = context->getShader(shader); + QueryShaderiv(shaderObject, pname, params); + } +} + +void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) +{ + EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* infolog = 0x%0.8p)", + shader, bufsize, length, infolog); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (bufsize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Shader *shaderObject = GetValidShader(context, shader); + if (!shaderObject) + { + return; + } + + shaderObject->getInfoLog(bufsize, length, infolog); + } +} + +void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) +{ + EVENT("(GLenum shadertype = 0x%X, GLenum precisiontype = 0x%X, GLint* range = 0x%0.8p, GLint* precision = 0x%0.8p)", + shadertype, precisiontype, range, precision); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (shadertype) + { + case GL_VERTEX_SHADER: + switch (precisiontype) + { + case GL_LOW_FLOAT: + context->getCaps().vertexLowpFloat.get(range, precision); + break; + case GL_MEDIUM_FLOAT: + context->getCaps().vertexMediumpFloat.get(range, precision); + break; + case GL_HIGH_FLOAT: + context->getCaps().vertexHighpFloat.get(range, precision); + break; + + case GL_LOW_INT: + context->getCaps().vertexLowpInt.get(range, precision); + break; + case GL_MEDIUM_INT: + context->getCaps().vertexMediumpInt.get(range, precision); + break; + case GL_HIGH_INT: + context->getCaps().vertexHighpInt.get(range, precision); + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + break; + case GL_FRAGMENT_SHADER: + switch (precisiontype) + { + case GL_LOW_FLOAT: + context->getCaps().fragmentLowpFloat.get(range, precision); + break; + case GL_MEDIUM_FLOAT: + context->getCaps().fragmentMediumpFloat.get(range, precision); + break; + case GL_HIGH_FLOAT: + context->getCaps().fragmentHighpFloat.get(range, precision); + break; + + case GL_LOW_INT: + context->getCaps().fragmentLowpInt.get(range, precision); + break; + case GL_MEDIUM_INT: + context->getCaps().fragmentMediumpInt.get(range, precision); + break; + case GL_HIGH_INT: + context->getCaps().fragmentHighpInt.get(range, precision); + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + break; + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + } +} + +void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) +{ + EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", + shader, bufsize, length, source); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (bufsize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Shader *shaderObject = GetValidShader(context, shader); + if (!shaderObject) + { + return; + } + + shaderObject->getSource(bufsize, length, source); + } +} + +const GLubyte *GL_APIENTRY GetString(GLenum name) +{ + EVENT("(GLenum name = 0x%X)", name); + + Context *context = GetValidGlobalContext(); + + if (context) + { + switch (name) + { + case GL_VENDOR: + return reinterpret_cast<const GLubyte *>("Google Inc."); + + case GL_RENDERER: + return reinterpret_cast<const GLubyte *>(context->getRendererString()); + + case GL_VERSION: + if (context->getClientMajorVersion() == 2) + { + return reinterpret_cast<const GLubyte *>( + "OpenGL ES 2.0 (ANGLE " ANGLE_VERSION_STRING ")"); + } + else + { + return reinterpret_cast<const GLubyte *>( + "OpenGL ES 3.0 (ANGLE " ANGLE_VERSION_STRING ")"); + } + + case GL_SHADING_LANGUAGE_VERSION: + if (context->getClientMajorVersion() == 2) + { + return reinterpret_cast<const GLubyte *>( + "OpenGL ES GLSL ES 1.00 (ANGLE " ANGLE_VERSION_STRING ")"); + } + else + { + return reinterpret_cast<const GLubyte *>( + "OpenGL ES GLSL ES 3.00 (ANGLE " ANGLE_VERSION_STRING ")"); + } + + case GL_EXTENSIONS: + return reinterpret_cast<const GLubyte *>(context->getExtensionString()); + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return nullptr; + } + } + + return nullptr; +} + +void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetTexParameterfv(context, target, pname, params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + QueryTexParameterfv(texture, pname, params); + } +} + +void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint* params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetTexParameteriv(context, target, pname, params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + QueryTexParameteriv(texture, pname, params); + } +} + +void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat* params) +{ + EVENT("(GLuint program = %d, GLint location = %d, GLfloat* params = 0x%0.8p)", program, location, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetUniformfv(context, program, location, params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformfv(location, params); + } +} + +void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint* params) +{ + EVENT("(GLuint program = %d, GLint location = %d, GLint* params = 0x%0.8p)", program, location, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetUniformiv(context, program, location, params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformiv(location, params); + } +} + +GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar* name) +{ + EVENT("(GLuint program = %d, const GLchar* name = 0x%0.8p)", program, name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (strstr(name, "gl_") == name) + { + return -1; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return -1; + } + + if (!programObject->isLinked()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return -1; + } + + return programObject->getUniformLocation(name); + } + + return -1; +} + +void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) +{ + EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", index, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGetVertexAttribfv(context, index, pname, params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribfv(attrib, currentValues, pname, params); + } +} + +void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint* params) +{ + EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", index, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGetVertexAttribiv(context, index, pname, params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribiv(attrib, currentValues, pname, params); + } +} + +void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) +{ + EVENT("(GLuint index = %d, GLenum pname = 0x%X, GLvoid** pointer = 0x%0.8p)", index, pname, pointer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetVertexAttribPointerv(context, index, pname, pointer)) + { + return; + } + + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribPointerv(attrib, pname, pointer); + } +} + +void GL_APIENTRY Hint(GLenum target, GLenum mode) +{ + EVENT("(GLenum target = 0x%X, GLenum mode = 0x%X)", target, mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (mode) + { + case GL_FASTEST: + case GL_NICEST: + case GL_DONT_CARE: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + switch (target) + { + case GL_GENERATE_MIPMAP_HINT: + case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->hint(target, mode); + } +} + +GLboolean GL_APIENTRY IsBuffer(GLuint buffer) +{ + EVENT("(GLuint buffer = %d)", buffer); + + Context *context = GetValidGlobalContext(); + if (context && buffer) + { + Buffer *bufferObject = context->getBuffer(buffer); + + if (bufferObject) + { + return GL_TRUE; + } + } + + return GL_FALSE; +} + +GLboolean GL_APIENTRY IsEnabled(GLenum cap) +{ + EVENT("(GLenum cap = 0x%X)", cap); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateIsEnabled(context, cap)) + { + return GL_FALSE; + } + + return context->getGLState().getEnableFeature(cap); + } + + return false; +} + +GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer) +{ + EVENT("(GLuint framebuffer = %d)", framebuffer); + + Context *context = GetValidGlobalContext(); + if (context && framebuffer) + { + Framebuffer *framebufferObject = context->getFramebuffer(framebuffer); + + if (framebufferObject) + { + return GL_TRUE; + } + } + + return GL_FALSE; +} + +GLboolean GL_APIENTRY IsProgram(GLuint program) +{ + EVENT("(GLuint program = %d)", program); + + Context *context = GetValidGlobalContext(); + if (context && program) + { + Program *programObject = context->getProgram(program); + + if (programObject) + { + return GL_TRUE; + } + } + + return GL_FALSE; +} + +GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer) +{ + EVENT("(GLuint renderbuffer = %d)", renderbuffer); + + Context *context = GetValidGlobalContext(); + if (context && renderbuffer) + { + Renderbuffer *renderbufferObject = context->getRenderbuffer(renderbuffer); + + if (renderbufferObject) + { + return GL_TRUE; + } + } + + return GL_FALSE; +} + +GLboolean GL_APIENTRY IsShader(GLuint shader) +{ + EVENT("(GLuint shader = %d)", shader); + + Context *context = GetValidGlobalContext(); + if (context && shader) + { + Shader *shaderObject = context->getShader(shader); + + if (shaderObject) + { + return GL_TRUE; + } + } + + return GL_FALSE; +} + +GLboolean GL_APIENTRY IsTexture(GLuint texture) +{ + EVENT("(GLuint texture = %d)", texture); + + Context *context = GetValidGlobalContext(); + if (context && texture) + { + Texture *textureObject = context->getTexture(texture); + + if (textureObject) + { + return GL_TRUE; + } + } + + return GL_FALSE; +} + +void GL_APIENTRY LineWidth(GLfloat width) +{ + EVENT("(GLfloat width = %f)", width); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (width <= 0.0f) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->lineWidth(width); + } +} + +void GL_APIENTRY LinkProgram(GLuint program) +{ + EVENT("(GLuint program = %d)", program); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateLinkProgram(context, program)) + { + return; + } + + Program *programObject = GetValidProgram(context, program); + if (!programObject) + { + return; + } + + Error error = programObject->link(context->getContextState()); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY PixelStorei(GLenum pname, GLint param) +{ + EVENT("(GLenum pname = 0x%X, GLint param = %d)", pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + switch (pname) + { + case GL_UNPACK_IMAGE_HEIGHT: + case GL_UNPACK_SKIP_IMAGES: + context->handleError(Error(GL_INVALID_ENUM)); + return; + + case GL_UNPACK_ROW_LENGTH: + case GL_UNPACK_SKIP_ROWS: + case GL_UNPACK_SKIP_PIXELS: + if (!context->getExtensions().unpackSubimage) + { + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + break; + + case GL_PACK_ROW_LENGTH: + case GL_PACK_SKIP_ROWS: + case GL_PACK_SKIP_PIXELS: + if (!context->getExtensions().packSubimage) + { + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + break; + } + } + + if (param < 0) + { + context->handleError( + Error(GL_INVALID_VALUE, "Cannot use negative values in PixelStorei")); + return; + } + + switch (pname) + { + case GL_UNPACK_ALIGNMENT: + if (param != 1 && param != 2 && param != 4 && param != 8) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + break; + + case GL_PACK_ALIGNMENT: + if (param != 1 && param != 2 && param != 4 && param != 8) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + break; + + case GL_PACK_REVERSE_ROW_ORDER_ANGLE: + case GL_UNPACK_ROW_LENGTH: + case GL_UNPACK_IMAGE_HEIGHT: + case GL_UNPACK_SKIP_IMAGES: + case GL_UNPACK_SKIP_ROWS: + case GL_UNPACK_SKIP_PIXELS: + case GL_PACK_ROW_LENGTH: + case GL_PACK_SKIP_ROWS: + case GL_PACK_SKIP_PIXELS: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->pixelStorei(pname, param); + } +} + +void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units) +{ + EVENT("(GLfloat factor = %f, GLfloat units = %f)", factor, units); + + Context *context = GetValidGlobalContext(); + if (context) + { + context->polygonOffset(factor, units); + } +} + +void GL_APIENTRY ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLvoid* pixels) +{ + EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " + "GLenum format = 0x%X, GLenum type = 0x%X, GLvoid* pixels = 0x%0.8p)", + x, y, width, height, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateReadPixels(context, x, y, width, height, format, type, pixels)) + { + return; + } + + context->readPixels(x, y, width, height, format, type, pixels); + } +} + +void GL_APIENTRY ReleaseShaderCompiler(void) +{ + EVENT("()"); + + Context *context = GetValidGlobalContext(); + + if (context) + { + Compiler *compiler = context->getCompiler(); + Error error = compiler->release(); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", + target, internalformat, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateRenderbufferStorageParametersANGLE(context, target, 0, internalformat, + width, height)) + { + return; + } + + Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer(); + Error error = renderbuffer->setStorage(internalformat, width, height); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY SampleCoverage(GLclampf value, GLboolean invert) +{ + EVENT("(GLclampf value = %f, GLboolean invert = %u)", value, invert); + + Context* context = GetValidGlobalContext(); + + if (context) + { + context->sampleCoverage(value, invert); + } +} + +void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ + EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height); + + Context* context = GetValidGlobalContext(); + if (context) + { + if (width < 0 || height < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->scissor(x, y, width, height); + } +} + +void GL_APIENTRY ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) +{ + EVENT("(GLsizei n = %d, const GLuint* shaders = 0x%0.8p, GLenum binaryformat = 0x%X, " + "const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", + n, shaders, binaryformat, binary, length); + + Context* context = GetValidGlobalContext(); + if (context) + { + const std::vector<GLenum> &shaderBinaryFormats = context->getCaps().shaderBinaryFormats; + if (std::find(shaderBinaryFormats.begin(), shaderBinaryFormats.end(), binaryformat) == shaderBinaryFormats.end()) + { + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + // No binary shader formats are supported. + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length) +{ + EVENT("(GLuint shader = %d, GLsizei count = %d, const GLchar** string = 0x%0.8p, const GLint* length = 0x%0.8p)", + shader, count, string, length); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (count < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Shader *shaderObject = GetValidShader(context, shader); + if (!shaderObject) + { + return; + } + shaderObject->setSource(count, string, length); + } +} + +void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask) +{ + StencilFuncSeparate(GL_FRONT_AND_BACK, func, ref, mask); +} + +void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + EVENT("(GLenum face = 0x%X, GLenum func = 0x%X, GLint ref = %d, GLuint mask = %d)", face, func, ref, mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (face) + { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + switch (func) + { + case GL_NEVER: + case GL_ALWAYS: + case GL_LESS: + case GL_LEQUAL: + case GL_EQUAL: + case GL_GEQUAL: + case GL_GREATER: + case GL_NOTEQUAL: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->stencilFuncSeparate(face, func, ref, mask); + } +} + +void GL_APIENTRY StencilMask(GLuint mask) +{ + StencilMaskSeparate(GL_FRONT_AND_BACK, mask); +} + +void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask) +{ + EVENT("(GLenum face = 0x%X, GLuint mask = %d)", face, mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (face) + { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->stencilMaskSeparate(face, mask); + } +} + +void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass) +{ + StencilOpSeparate(GL_FRONT_AND_BACK, fail, zfail, zpass); +} + +void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +{ + EVENT("(GLenum face = 0x%X, GLenum fail = 0x%X, GLenum zfail = 0x%X, GLenum zpas = 0x%Xs)", + face, fail, zfail, zpass); + + Context *context = GetValidGlobalContext(); + if (context) + { + switch (face) + { + case GL_FRONT: + case GL_BACK: + case GL_FRONT_AND_BACK: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + switch (fail) + { + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + case GL_INCR_WRAP: + case GL_DECR_WRAP: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + switch (zfail) + { + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + case GL_INCR_WRAP: + case GL_DECR_WRAP: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + switch (zpass) + { + case GL_ZERO: + case GL_KEEP: + case GL_REPLACE: + case GL_INCR: + case GL_DECR: + case GL_INVERT: + case GL_INCR_WRAP: + case GL_DECR_WRAP: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + context->stencilOpSeparate(face, fail, zfail, zpass); + } +} + +void GL_APIENTRY TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, + GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, GLsizei height = %d, " + "GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", + target, level, internalformat, width, height, border, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateTexImage2D(context, target, level, internalformat, width, height, border, + format, type, pixels)) + { + return; + } + + context->texImage2D(target, level, internalformat, width, height, border, format, type, + pixels); + } +} + +void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %f)", target, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateTexParameterf(context, target, pname, param)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + SetTexParameterf(texture, pname, param); + } +} + +void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLfloat* params = 0x%0.8p)", target, + pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateTexParameterfv(context, target, pname, params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + SetTexParameterfv(texture, pname, params); + } +} + +void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateTexParameteri(context, target, pname, param)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + SetTexParameteri(texture, pname, param); + } +} + +void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, const GLint* params = 0x%0.8p)", target, + pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateTexParameteriv(context, target, pname, params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + SetTexParameteriv(texture, pname, params); + } +} + +void GL_APIENTRY TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLenum type, const GLvoid* pixels) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, " + "const GLvoid* pixels = 0x%0.8p)", + target, level, xoffset, yoffset, width, height, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateTexSubImage2D(context, target, level, xoffset, yoffset, width, height, format, + type, pixels)) + { + return; + } + + context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, + pixels); + } +} + +void GL_APIENTRY Uniform1f(GLint location, GLfloat x) +{ + Uniform1fv(location, 1, &x); +} + +void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_FLOAT, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform1fv(location, count, v); + } +} + +void GL_APIENTRY Uniform1i(GLint location, GLint x) +{ + Uniform1iv(location, 1, &x); +} + +void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_INT, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform1iv(location, count, v); + } +} + +void GL_APIENTRY Uniform2f(GLint location, GLfloat x, GLfloat y) +{ + GLfloat xy[2] = {x, y}; + + Uniform2fv(location, 1, xy); +} + +void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_FLOAT_VEC2, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform2fv(location, count, v); + } +} + +void GL_APIENTRY Uniform2i(GLint location, GLint x, GLint y) +{ + GLint xy[2] = {x, y}; + + Uniform2iv(location, 1, xy); +} + +void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_INT_VEC2, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform2iv(location, count, v); + } +} + +void GL_APIENTRY Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) +{ + GLfloat xyz[3] = {x, y, z}; + + Uniform3fv(location, 1, xyz); +} + +void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_FLOAT_VEC3, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform3fv(location, count, v); + } +} + +void GL_APIENTRY Uniform3i(GLint location, GLint x, GLint y, GLint z) +{ + GLint xyz[3] = {x, y, z}; + + Uniform3iv(location, 1, xyz); +} + +void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_INT_VEC3, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform3iv(location, count, v); + } +} + +void GL_APIENTRY Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + GLfloat xyzw[4] = {x, y, z, w}; + + Uniform4fv(location, 1, xyzw); +} + +void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLfloat* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_FLOAT_VEC4, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform4fv(location, count, v); + } +} + +void GL_APIENTRY Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) +{ + GLint xyzw[4] = {x, y, z, w}; + + Uniform4iv(location, 1, xyzw); +} + +void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint* v) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLint* v = 0x%0.8p)", location, count, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_INT_VEC4, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform4iv(location, count, v); + } +} + +void GL_APIENTRY UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix2fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix3fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix4fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UseProgram(GLuint program) +{ + EVENT("(GLuint program = %d)", program); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateUseProgram(context, program)) + { + return; + } + + context->useProgram(program); + } +} + +void GL_APIENTRY ValidateProgram(GLuint program) +{ + EVENT("(GLuint program = %d)", program); + + Context *context = GetValidGlobalContext(); + if (context) + { + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + programObject->validate(context->getCaps()); + } +} + +void GL_APIENTRY VertexAttrib1f(GLuint index, GLfloat x) +{ + EVENT("(GLuint index = %d, GLfloat x = %f)", index, x); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib1f(index, x); + } +} + +void GL_APIENTRY VertexAttrib1fv(GLuint index, const GLfloat* values) +{ + EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib1fv(index, values); + } +} + +void GL_APIENTRY VertexAttrib2f(GLuint index, GLfloat x, GLfloat y) +{ + EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f)", index, x, y); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib2f(index, x, y); + } +} + +void GL_APIENTRY VertexAttrib2fv(GLuint index, const GLfloat* values) +{ + EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib2fv(index, values); + } +} + +void GL_APIENTRY VertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) +{ + EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f)", index, x, y, z); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib3f(index, x, y, z); + } +} + +void GL_APIENTRY VertexAttrib3fv(GLuint index, const GLfloat* values) +{ + EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib3fv(index, values); + } +} + +void GL_APIENTRY VertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + EVENT("(GLuint index = %d, GLfloat x = %f, GLfloat y = %f, GLfloat z = %f, GLfloat w = %f)", index, x, y, z, w); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib4f(index, x, y, z, w); + } +} + +void GL_APIENTRY VertexAttrib4fv(GLuint index, const GLfloat* values) +{ + EVENT("(GLuint index = %d, const GLfloat* values = 0x%0.8p)", index, values); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttrib4fv(index, values); + } +} + +void GL_APIENTRY VertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) +{ + EVENT("(GLuint index = %d, GLint size = %d, GLenum type = 0x%X, " + "GLboolean normalized = %u, GLsizei stride = %d, const GLvoid* ptr = 0x%0.8p)", + index, size, type, normalized, stride, ptr); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + if (size < 1 || size > 4) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + switch (type) + { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_FIXED: + case GL_FLOAT: + break; + + case GL_HALF_FLOAT: + case GL_INT: + case GL_UNSIGNED_INT: + case GL_INT_2_10_10_10_REV: + case GL_UNSIGNED_INT_2_10_10_10_REV: + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + if (stride < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + if ((type == GL_INT_2_10_10_10_REV || type == GL_UNSIGNED_INT_2_10_10_10_REV) && size != 4) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + // [OpenGL ES 3.0.2] Section 2.8 page 24: + // An INVALID_OPERATION error is generated when a non-zero vertex array object + // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, + // and the pointer argument is not NULL. + if (context->getGLState().getVertexArray()->id() != 0 && + context->getGLState().getArrayBufferId() == 0 && ptr != NULL) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + context->vertexAttribPointer(index, size, type, normalized, stride, ptr); + } +} + +void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", x, y, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (width < 0 || height < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->viewport(x, y, width, height); + } +} + +} // namespace gl diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_2_0.h b/gfx/angle/src/libGLESv2/entry_points_gles_2_0.h new file mode 100755 index 000000000..eee5fb546 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_2_0.h @@ -0,0 +1,163 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_2_0.h : Defines the GLES 2.0 entry points. + +#ifndef LIBGLESV2_ENTRYPOINTGLES20_H_ +#define LIBGLESV2_ENTRYPOINTGLES20_H_ + +#include <GLES2/gl2.h> +#include <export.h> + +namespace gl +{ + +ANGLE_EXPORT void GL_APIENTRY ActiveTexture(GLenum texture); +ANGLE_EXPORT void GL_APIENTRY AttachShader(GLuint program, GLuint shader); +ANGLE_EXPORT void GL_APIENTRY BindAttribLocation(GLuint program, GLuint index, const GLchar* name); +ANGLE_EXPORT void GL_APIENTRY BindBuffer(GLenum target, GLuint buffer); +ANGLE_EXPORT void GL_APIENTRY BindFramebuffer(GLenum target, GLuint framebuffer); +ANGLE_EXPORT void GL_APIENTRY BindRenderbuffer(GLenum target, GLuint renderbuffer); +ANGLE_EXPORT void GL_APIENTRY BindTexture(GLenum target, GLuint texture); +ANGLE_EXPORT void GL_APIENTRY BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +ANGLE_EXPORT void GL_APIENTRY BlendEquation(GLenum mode); +ANGLE_EXPORT void GL_APIENTRY BlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); +ANGLE_EXPORT void GL_APIENTRY BlendFunc(GLenum sfactor, GLenum dfactor); +ANGLE_EXPORT void GL_APIENTRY BlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +ANGLE_EXPORT void GL_APIENTRY BufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +ANGLE_EXPORT void GL_APIENTRY BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +ANGLE_EXPORT GLenum GL_APIENTRY CheckFramebufferStatus(GLenum target); +ANGLE_EXPORT void GL_APIENTRY Clear(GLbitfield mask); +ANGLE_EXPORT void GL_APIENTRY ClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +ANGLE_EXPORT void GL_APIENTRY ClearDepthf(GLfloat depth); +ANGLE_EXPORT void GL_APIENTRY ClearStencil(GLint s); +ANGLE_EXPORT void GL_APIENTRY ColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +ANGLE_EXPORT void GL_APIENTRY CompileShader(GLuint shader); +ANGLE_EXPORT void GL_APIENTRY CompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); +ANGLE_EXPORT void GL_APIENTRY CopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +ANGLE_EXPORT GLuint GL_APIENTRY CreateProgram(void); +ANGLE_EXPORT GLuint GL_APIENTRY CreateShader(GLenum type); +ANGLE_EXPORT void GL_APIENTRY CullFace(GLenum mode); +ANGLE_EXPORT void GL_APIENTRY DeleteBuffers(GLsizei n, const GLuint* buffers); +ANGLE_EXPORT void GL_APIENTRY DeleteFramebuffers(GLsizei n, const GLuint* framebuffers); +ANGLE_EXPORT void GL_APIENTRY DeleteProgram(GLuint program); +ANGLE_EXPORT void GL_APIENTRY DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers); +ANGLE_EXPORT void GL_APIENTRY DeleteShader(GLuint shader); +ANGLE_EXPORT void GL_APIENTRY DeleteTextures(GLsizei n, const GLuint* textures); +ANGLE_EXPORT void GL_APIENTRY DepthFunc(GLenum func); +ANGLE_EXPORT void GL_APIENTRY DepthMask(GLboolean flag); +ANGLE_EXPORT void GL_APIENTRY DepthRangef(GLfloat n, GLfloat f); +ANGLE_EXPORT void GL_APIENTRY DetachShader(GLuint program, GLuint shader); +ANGLE_EXPORT void GL_APIENTRY Disable(GLenum cap); +ANGLE_EXPORT void GL_APIENTRY DisableVertexAttribArray(GLuint index); +ANGLE_EXPORT void GL_APIENTRY DrawArrays(GLenum mode, GLint first, GLsizei count); +ANGLE_EXPORT void GL_APIENTRY DrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); +ANGLE_EXPORT void GL_APIENTRY Enable(GLenum cap); +ANGLE_EXPORT void GL_APIENTRY EnableVertexAttribArray(GLuint index); +ANGLE_EXPORT void GL_APIENTRY Finish(void); +ANGLE_EXPORT void GL_APIENTRY Flush(void); +ANGLE_EXPORT void GL_APIENTRY FramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +ANGLE_EXPORT void GL_APIENTRY FramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +ANGLE_EXPORT void GL_APIENTRY FrontFace(GLenum mode); +ANGLE_EXPORT void GL_APIENTRY GenBuffers(GLsizei n, GLuint* buffers); +ANGLE_EXPORT void GL_APIENTRY GenerateMipmap(GLenum target); +ANGLE_EXPORT void GL_APIENTRY GenFramebuffers(GLsizei n, GLuint* framebuffers); +ANGLE_EXPORT void GL_APIENTRY GenRenderbuffers(GLsizei n, GLuint* renderbuffers); +ANGLE_EXPORT void GL_APIENTRY GenTextures(GLsizei n, GLuint* textures); +ANGLE_EXPORT void GL_APIENTRY GetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +ANGLE_EXPORT void GL_APIENTRY GetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +ANGLE_EXPORT void GL_APIENTRY GetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +ANGLE_EXPORT GLint GL_APIENTRY GetAttribLocation(GLuint program, const GLchar* name); +ANGLE_EXPORT void GL_APIENTRY GetBooleanv(GLenum pname, GLboolean* params); +ANGLE_EXPORT void GL_APIENTRY GetBufferParameteriv(GLenum target, GLenum pname, GLint* params); +ANGLE_EXPORT GLenum GL_APIENTRY GetError(void); +ANGLE_EXPORT void GL_APIENTRY GetFloatv(GLenum pname, GLfloat* params); +ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetIntegerv(GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetProgramiv(GLuint program, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetShaderiv(GLuint shader, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +ANGLE_EXPORT void GL_APIENTRY GetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +ANGLE_EXPORT void GL_APIENTRY GetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +ANGLE_EXPORT const GLubyte *GL_APIENTRY GetString(GLenum name); +ANGLE_EXPORT void GL_APIENTRY GetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); +ANGLE_EXPORT void GL_APIENTRY GetTexParameteriv(GLenum target, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetUniformfv(GLuint program, GLint location, GLfloat* params); +ANGLE_EXPORT void GL_APIENTRY GetUniformiv(GLuint program, GLint location, GLint* params); +ANGLE_EXPORT GLint GL_APIENTRY GetUniformLocation(GLuint program, const GLchar* name); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribiv(GLuint index, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer); +ANGLE_EXPORT void GL_APIENTRY Hint(GLenum target, GLenum mode); +ANGLE_EXPORT GLboolean GL_APIENTRY IsBuffer(GLuint buffer); +ANGLE_EXPORT GLboolean GL_APIENTRY IsEnabled(GLenum cap); +ANGLE_EXPORT GLboolean GL_APIENTRY IsFramebuffer(GLuint framebuffer); +ANGLE_EXPORT GLboolean GL_APIENTRY IsProgram(GLuint program); +ANGLE_EXPORT GLboolean GL_APIENTRY IsRenderbuffer(GLuint renderbuffer); +ANGLE_EXPORT GLboolean GL_APIENTRY IsShader(GLuint shader); +ANGLE_EXPORT GLboolean GL_APIENTRY IsTexture(GLuint texture); +ANGLE_EXPORT void GL_APIENTRY LineWidth(GLfloat width); +ANGLE_EXPORT void GL_APIENTRY LinkProgram(GLuint program); +ANGLE_EXPORT void GL_APIENTRY PixelStorei(GLenum pname, GLint param); +ANGLE_EXPORT void GL_APIENTRY PolygonOffset(GLfloat factor, GLfloat units); +ANGLE_EXPORT void GL_APIENTRY ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); +ANGLE_EXPORT void GL_APIENTRY ReleaseShaderCompiler(void); +ANGLE_EXPORT void GL_APIENTRY RenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +ANGLE_EXPORT void GL_APIENTRY SampleCoverage(GLfloat value, GLboolean invert); +ANGLE_EXPORT void GL_APIENTRY Scissor(GLint x, GLint y, GLsizei width, GLsizei height); +ANGLE_EXPORT void GL_APIENTRY ShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +ANGLE_EXPORT void GL_APIENTRY ShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length); +ANGLE_EXPORT void GL_APIENTRY StencilFunc(GLenum func, GLint ref, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilMask(GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilMaskSeparate(GLenum face, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilOp(GLenum fail, GLenum zfail, GLenum zpass); +ANGLE_EXPORT void GL_APIENTRY StencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +ANGLE_EXPORT void GL_APIENTRY TexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +ANGLE_EXPORT void GL_APIENTRY TexParameterf(GLenum target, GLenum pname, GLfloat param); +ANGLE_EXPORT void GL_APIENTRY TexParameterfv(GLenum target, GLenum pname, const GLfloat* params); +ANGLE_EXPORT void GL_APIENTRY TexParameteri(GLenum target, GLenum pname, GLint param); +ANGLE_EXPORT void GL_APIENTRY TexParameteriv(GLenum target, GLenum pname, const GLint* params); +ANGLE_EXPORT void GL_APIENTRY TexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +ANGLE_EXPORT void GL_APIENTRY Uniform1f(GLint location, GLfloat x); +ANGLE_EXPORT void GL_APIENTRY Uniform1fv(GLint location, GLsizei count, const GLfloat* v); +ANGLE_EXPORT void GL_APIENTRY Uniform1i(GLint location, GLint x); +ANGLE_EXPORT void GL_APIENTRY Uniform1iv(GLint location, GLsizei count, const GLint* v); +ANGLE_EXPORT void GL_APIENTRY Uniform2f(GLint location, GLfloat x, GLfloat y); +ANGLE_EXPORT void GL_APIENTRY Uniform2fv(GLint location, GLsizei count, const GLfloat* v); +ANGLE_EXPORT void GL_APIENTRY Uniform2i(GLint location, GLint x, GLint y); +ANGLE_EXPORT void GL_APIENTRY Uniform2iv(GLint location, GLsizei count, const GLint* v); +ANGLE_EXPORT void GL_APIENTRY Uniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z); +ANGLE_EXPORT void GL_APIENTRY Uniform3fv(GLint location, GLsizei count, const GLfloat* v); +ANGLE_EXPORT void GL_APIENTRY Uniform3i(GLint location, GLint x, GLint y, GLint z); +ANGLE_EXPORT void GL_APIENTRY Uniform3iv(GLint location, GLsizei count, const GLint* v); +ANGLE_EXPORT void GL_APIENTRY Uniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +ANGLE_EXPORT void GL_APIENTRY Uniform4fv(GLint location, GLsizei count, const GLfloat* v); +ANGLE_EXPORT void GL_APIENTRY Uniform4i(GLint location, GLint x, GLint y, GLint z, GLint w); +ANGLE_EXPORT void GL_APIENTRY Uniform4iv(GLint location, GLsizei count, const GLint* v); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UseProgram(GLuint program); +ANGLE_EXPORT void GL_APIENTRY ValidateProgram(GLuint program); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib1f(GLuint indx, GLfloat x); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib1fv(GLuint indx, const GLfloat* values); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib2fv(GLuint indx, const GLfloat* values); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib3fv(GLuint indx, const GLfloat* values); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +ANGLE_EXPORT void GL_APIENTRY VertexAttrib4fv(GLuint indx, const GLfloat* values); +ANGLE_EXPORT void GL_APIENTRY VertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); +ANGLE_EXPORT void GL_APIENTRY Viewport(GLint x, GLint y, GLsizei width, GLsizei height); + +} + +#endif // LIBGLESV2_ENTRYPOINTGLES20_H_ diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_2_0_ext.cpp b/gfx/angle/src/libGLESv2/entry_points_gles_2_0_ext.cpp new file mode 100755 index 000000000..bf96affdb --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_2_0_ext.cpp @@ -0,0 +1,3376 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_2_0_ext.cpp : Implements the GLES 2.0 extension entry points. + +#include "libGLESv2/entry_points_gles_2_0_ext.h" +#include "libGLESv2/global_state.h" + +#include "libANGLE/Buffer.h" +#include "libANGLE/Context.h" +#include "libANGLE/Error.h" +#include "libANGLE/Fence.h" +#include "libANGLE/Framebuffer.h" +#include "libANGLE/Shader.h" +#include "libANGLE/Query.h" +#include "libANGLE/queryconversions.h" +#include "libANGLE/queryutils.h" +#include "libANGLE/Thread.h" +#include "libANGLE/VertexArray.h" + +#include "libANGLE/validationES.h" +#include "libANGLE/validationES2.h" +#include "libANGLE/validationES3.h" +#include "libANGLE/validationES31.h" + +#include "common/debug.h" +#include "common/utilities.h" + +namespace gl +{ + +namespace +{ + +void SetRobustLengthParam(GLsizei *length, GLsizei value) +{ + if (length) + { + *length = value; + } +} + +} // anonymous namespace + +void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint *ids) +{ + EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenQueriesEXT(context, n)) + { + return; + } + + for (GLsizei i = 0; i < n; i++) + { + ids[i] = context->createQuery(); + } + } +} + +void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids) +{ + EVENT("(GLsizei n = %d, const GLuint *ids = 0x%0.8p)", n, ids); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteQueriesEXT(context, n)) + { + return; + } + + for (int i = 0; i < n; i++) + { + context->deleteQuery(ids[i]); + } + } +} + +GLboolean GL_APIENTRY IsQueryEXT(GLuint id) +{ + EVENT("(GLuint id = %d)", id); + + Context *context = GetValidGlobalContext(); + if (context) + { + return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE; + } + + return GL_FALSE; +} + +void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id) +{ + EVENT("(GLenum target = 0x%X, GLuint %d)", target, id); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateBeginQueryEXT(context, target, id)) + { + return; + } + + Error error = context->beginQuery(target, id); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY EndQueryEXT(GLenum target) +{ + EVENT("GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateEndQueryEXT(context, target)) + { + return; + } + + Error error = context->endQuery(target); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY QueryCounterEXT(GLuint id, GLenum target) +{ + EVENT("GLuint id = %d, GLenum target = 0x%X)", id, target); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateQueryCounterEXT(context, id, target)) + { + return; + } + + Error error = context->queryCounter(id, target); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params) +{ + EVENT("GLenum target = 0x%X, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", target, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetQueryivEXT(context, target, pname, params)) + { + return; + } + + context->getQueryiv(target, pname, params); + } +} + +void GL_APIENTRY GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params) +{ + EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetQueryObjectivEXT(context, id, pname, params)) + { + return; + } + + context->getQueryObjectiv(id, pname, params); + } +} + +void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) +{ + EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.8p)", id, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetQueryObjectuivEXT(context, id, pname, params)) + { + return; + } + + context->getQueryObjectuiv(id, pname, params); + } +} + +void GL_APIENTRY GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params) +{ + EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.16p)", id, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetQueryObjecti64vEXT(context, id, pname, params)) + { + return; + } + + context->getQueryObjecti64v(id, pname, params); + } +} + +void GL_APIENTRY GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params) +{ + EVENT("(GLuint id = %d, GLenum pname = 0x%X, GLuint *params = 0x%0.16p)", id, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetQueryObjectui64vEXT(context, id, pname, params)) + { + return; + } + + context->getQueryObjectui64v(id, pname, params); + } +} + +void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint *fences) +{ + EVENT("(GLsizei n = %d, const GLuint* fences = 0x%0.8p)", n, fences); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (n < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + for (int i = 0; i < n; i++) + { + context->deleteFenceNV(fences[i]); + } + } +} + +void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode, + GLint first, + GLsizei count, + GLsizei primcount) +{ + EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei primcount = %d)", + mode, first, count, primcount); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateDrawArraysInstancedANGLE(context, mode, first, count, primcount)) + { + return; + } + + Error error = context->drawArraysInstanced(mode, first, count, primcount); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode, + GLsizei count, + GLenum type, + const GLvoid *indices, + GLsizei primcount) +{ + EVENT( + "(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = " + "0x%0.8p, GLsizei primcount = %d)", + mode, count, type, indices, primcount); + + Context *context = GetValidGlobalContext(); + if (context) + { + IndexRange indexRange; + if (!ValidateDrawElementsInstancedANGLE(context, mode, count, type, indices, primcount, + &indexRange)) + { + return; + } + + Error error = + context->drawElementsInstanced(mode, count, type, indices, primcount, indexRange); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY FinishFenceNV(GLuint fence) +{ + EVENT("(GLuint fence = %d)", fence); + + Context *context = GetValidGlobalContext(); + if (context) + { + FenceNV *fenceObject = context->getFenceNV(fence); + + if (fenceObject == NULL) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (fenceObject->isSet() != GL_TRUE) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + fenceObject->finish(); + } +} + +void GL_APIENTRY GenFencesNV(GLsizei n, GLuint *fences) +{ + EVENT("(GLsizei n = %d, GLuint* fences = 0x%0.8p)", n, fences); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (n < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + for (int i = 0; i < n; i++) + { + fences[i] = context->createFenceNV(); + } + } +} + +void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params) +{ + EVENT("(GLuint fence = %d, GLenum pname = 0x%X, GLint *params = 0x%0.8p)", fence, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + FenceNV *fenceObject = context->getFenceNV(fence); + + if (fenceObject == NULL) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (fenceObject->isSet() != GL_TRUE) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + switch (pname) + { + case GL_FENCE_STATUS_NV: + { + // GL_NV_fence spec: + // Once the status of a fence has been finished (via FinishFenceNV) or tested and the returned status is TRUE (via either TestFenceNV + // or GetFenceivNV querying the FENCE_STATUS_NV), the status remains TRUE until the next SetFenceNV of the fence. + GLboolean status = GL_TRUE; + if (fenceObject->getStatus() != GL_TRUE) + { + Error error = fenceObject->test(&status); + if (error.isError()) + { + context->handleError(error); + return; + } + } + *params = status; + break; + } + + case GL_FENCE_CONDITION_NV: + { + *params = static_cast<GLint>(fenceObject->getCondition()); + break; + } + + default: + { + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + } + } +} + +GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void) +{ + EVENT("()"); + + Context *context = GetGlobalContext(); + + if (context) + { + return context->getResetStatus(); + } + + return GL_NO_ERROR; +} + +void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) +{ + EVENT("(GLuint shader = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLchar* source = 0x%0.8p)", + shader, bufsize, length, source); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (bufsize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Shader *shaderObject = context->getShader(shader); + + if (!shaderObject) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + shaderObject->getTranslatedSourceWithDebugInfo(bufsize, length, source); + } +} + +void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat* params) +{ + EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLfloat* params = 0x%0.8p)", + program, location, bufSize, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetnUniformfvEXT(context, program, location, bufSize, params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformfv(location, params); + } +} + +void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint* params) +{ + EVENT("(GLuint program = %d, GLint location = %d, GLsizei bufSize = %d, GLint* params = 0x%0.8p)", + program, location, bufSize, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetnUniformivEXT(context, program, location, bufSize, params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformiv(location, params); + } +} + +GLboolean GL_APIENTRY IsFenceNV(GLuint fence) +{ + EVENT("(GLuint fence = %d)", fence); + + Context *context = GetValidGlobalContext(); + if (context) + { + FenceNV *fenceObject = context->getFenceNV(fence); + + if (fenceObject == NULL) + { + return GL_FALSE; + } + + // GL_NV_fence spec: + // A name returned by GenFencesNV, but not yet set via SetFenceNV, is not the name of an existing fence. + return fenceObject->isSet(); + } + + return GL_FALSE; +} + +void GL_APIENTRY ReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, + GLenum format, GLenum type, GLsizei bufSize, + GLvoid *data) +{ + EVENT("(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " + "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufSize = 0x%d, GLvoid *data = 0x%0.8p)", + x, y, width, height, format, type, bufSize, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateReadnPixelsEXT(context, x, y, width, height, format, type, bufSize, data)) + { + return; + } + + context->readPixels(x, y, width, height, format, type, data); + } +} + +void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", + target, samples, internalformat, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateRenderbufferStorageParametersANGLE(context, target, samples, internalformat, + width, height)) + { + return; + } + + Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer(); + Error error = renderbuffer->setStorageMultisample(samples, internalformat, width, height); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition) +{ + EVENT("(GLuint fence = %d, GLenum condition = 0x%X)", fence, condition); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (condition != GL_ALL_COMPLETED_NV) + { + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + FenceNV *fenceObject = context->getFenceNV(fence); + + if (fenceObject == NULL) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + Error error = fenceObject->set(condition); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +GLboolean GL_APIENTRY TestFenceNV(GLuint fence) +{ + EVENT("(GLuint fence = %d)", fence); + + Context *context = GetValidGlobalContext(); + if (context) + { + FenceNV *fenceObject = context->getFenceNV(fence); + + if (fenceObject == NULL) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_TRUE; + } + + if (fenceObject->isSet() != GL_TRUE) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_TRUE; + } + + GLboolean result; + Error error = fenceObject->test(&result); + if (error.isError()) + { + context->handleError(error); + return GL_TRUE; + } + + return result; + } + + return GL_TRUE; +} + +void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", + target, levels, internalformat, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->getExtensions().textureStorage) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (context->getClientMajorVersion() < 3 && + !ValidateES2TexStorageParameters(context, target, levels, internalformat, width, + height)) + { + return; + } + + if (context->getClientMajorVersion() >= 3 && + !ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width, + height, 1)) + { + return; + } + + Extents size(width, height, 1); + Texture *texture = context->getTargetTexture(target); + Error error = texture->setStorage(target, levels, internalformat, size); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor) +{ + EVENT("(GLuint index = %d, GLuint divisor = %d)", index, divisor); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + if (context->getLimitations().attributeZeroRequiresZeroDivisorInEXT) + { + if (index == 0 && divisor != 0) + { + const char *errorMessage = "The current context doesn't support setting a non-zero divisor on the attribute with index zero. " + "Please reorder the attributes in your vertex shader so that attribute zero can have a zero divisor."; + context->handleError(Error(GL_INVALID_OPERATION, errorMessage)); + + // We also output an error message to the debugger window if tracing is active, so that developers can see the error message. + ERR("%s", errorMessage); + + return; + } + } + + context->setVertexAttribDivisor(index, divisor); + } +} + +void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, + GLbitfield mask, GLenum filter) +{ + EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, " + "GLint dstX0 = %d, GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, " + "GLbitfield mask = 0x%X, GLenum filter = 0x%X)", + srcX0, srcY0, srcX1, srcX1, dstX0, dstY0, dstX1, dstY1, mask, filter); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateBlitFramebufferANGLE(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, + dstY1, mask, filter)) + { + return; + } + + context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, + filter); + } +} + +void GL_APIENTRY DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) +{ + EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, attachments = 0x%0.8p)", target, numAttachments, attachments); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateDiscardFramebufferEXT(context, target, numAttachments, attachments)) + { + return; + } + + context->discardFramebuffer(target, numAttachments, attachments); + } +} + +void GL_APIENTRY TexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, + GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, " + "GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, GLint border = %d, " + "GLenum format = 0x%X, GLenum type = 0x%x, const GLvoid* pixels = 0x%0.8p)", + target, level, internalformat, width, height, depth, border, format, type, pixels); + + UNIMPLEMENTED(); // FIXME +} + +void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary) +{ + EVENT("(GLenum program = 0x%X, bufSize = %d, length = 0x%0.8p, binaryFormat = 0x%0.8p, binary = 0x%0.8p)", + program, bufSize, length, binaryFormat, binary); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetProgramBinaryOES(context, program, bufSize, length, binaryFormat, binary)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject != nullptr); + + Error error = programObject->saveBinary(binaryFormat, binary, bufSize, length); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY ProgramBinaryOES(GLuint program, GLenum binaryFormat, const void *binary, GLint length) +{ + EVENT("(GLenum program = 0x%X, binaryFormat = 0x%x, binary = 0x%0.8p, length = %d)", + program, binaryFormat, binary, length); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateProgramBinaryOES(context, program, binaryFormat, binary, length)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject != nullptr); + + Error error = programObject->loadBinary(binaryFormat, binary, length); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs) +{ + EVENT("(GLenum n = %d, bufs = 0x%0.8p)", n, bufs); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDrawBuffersEXT(context, n, bufs)) + { + return; + } + + context->drawBuffers(n, bufs); + } +} + +void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, void** params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetBufferPointervOES(context, target, pname, params)) + { + return; + } + + context->getBufferPointerv(target, pname, params); + } +} + +void *GL_APIENTRY MapBufferOES(GLenum target, GLenum access) +{ + EVENT("(GLenum target = 0x%X, GLbitfield access = 0x%X)", target, access); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateMapBufferOES(context, target, access)) + { + return nullptr; + } + + return context->mapBuffer(target, access); + } + + return nullptr; +} + +GLboolean GL_APIENTRY UnmapBufferOES(GLenum target) +{ + EVENT("(GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateUnmapBufferOES(context, target)) + { + return GL_FALSE; + } + + return context->unmapBuffer(target); + } + + return GL_FALSE; +} + +void *GL_APIENTRY MapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +{ + EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", + target, offset, length, access); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateMapBufferRangeEXT(context, target, offset, length, access)) + { + return nullptr; + } + + return context->mapBufferRange(target, offset, length, access); + } + + return nullptr; +} + +void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length) +{ + EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateFlushMappedBufferRangeEXT(context, target, offset, length)) + { + return; + } + + context->flushMappedBufferRange(target, offset, length); + } +} + +void GL_APIENTRY InsertEventMarkerEXT(GLsizei length, const char *marker) +{ + // Don't run an EVENT() macro on the EXT_debug_marker entry points. + // It can interfere with the debug events being set by the caller. + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->getExtensions().debugMarker) + { + // The debug marker calls should not set error state + // However, it seems reasonable to set an error state if the extension is not enabled + context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled")); + return; + } + + if (!ValidateInsertEventMarkerEXT(context, length, marker)) + { + return; + } + + context->insertEventMarker(length, marker); + } +} + +void GL_APIENTRY PushGroupMarkerEXT(GLsizei length, const char *marker) +{ + // Don't run an EVENT() macro on the EXT_debug_marker entry points. + // It can interfere with the debug events being set by the caller. + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->getExtensions().debugMarker) + { + // The debug marker calls should not set error state + // However, it seems reasonable to set an error state if the extension is not enabled + context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled")); + return; + } + + if (!ValidatePushGroupMarkerEXT(context, length, marker)) + { + return; + } + + if (marker == nullptr) + { + // From the EXT_debug_marker spec, + // "If <marker> is null then an empty string is pushed on the stack." + context->pushGroupMarker(length, ""); + } + else + { + context->pushGroupMarker(length, marker); + } + } +} + +void GL_APIENTRY PopGroupMarkerEXT() +{ + // Don't run an EVENT() macro on the EXT_debug_marker entry points. + // It can interfere with the debug events being set by the caller. + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->getExtensions().debugMarker) + { + // The debug marker calls should not set error state + // However, it seems reasonable to set an error state if the extension is not enabled + context->handleError(Error(GL_INVALID_OPERATION, "Extension not enabled")); + return; + } + + context->popGroupMarker(); + } +} + +ANGLE_EXPORT void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) +{ + EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%0.8p)", target, image); + + egl::Thread *thread = egl::GetCurrentThread(); + Context *context = thread->getValidContext(); + if (context) + { + egl::Display *display = thread->getDisplay(); + egl::Image *imageObject = reinterpret_cast<egl::Image *>(image); + if (!ValidateEGLImageTargetTexture2DOES(context, display, target, imageObject)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + Error error = texture->setEGLImageTarget(target, imageObject); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +ANGLE_EXPORT void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target, + GLeglImageOES image) +{ + EVENT("(GLenum target = 0x%X, GLeglImageOES image = 0x%0.8p)", target, image); + + egl::Thread *thread = egl::GetCurrentThread(); + Context *context = thread->getValidContext(); + if (context) + { + egl::Display *display = thread->getDisplay(); + egl::Image *imageObject = reinterpret_cast<egl::Image *>(image); + if (!ValidateEGLImageTargetRenderbufferStorageOES(context, display, target, imageObject)) + { + return; + } + + Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer(); + Error error = renderbuffer->setStorageEGLImageTarget(imageObject); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY BindVertexArrayOES(GLuint array) +{ + EVENT("(GLuint array = %u)", array); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateBindVertexArrayOES(context, array)) + { + return; + } + + context->bindVertexArray(array); + } +} + +void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays) +{ + EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateDeleteVertexArraysOES(context, n)) + { + return; + } + + for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) + { + if (arrays[arrayIndex] != 0) + { + context->deleteVertexArray(arrays[arrayIndex]); + } + } + } +} + +void GL_APIENTRY GenVertexArraysOES(GLsizei n, GLuint *arrays) +{ + EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGenVertexArraysOES(context, n)) + { + return; + } + + for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) + { + arrays[arrayIndex] = context->createVertexArray(); + } + } +} + +GLboolean GL_APIENTRY IsVertexArrayOES(GLuint array) +{ + EVENT("(GLuint array = %u)", array); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateIsVertexArrayOES(context)) + { + return GL_FALSE; + } + + if (array == 0) + { + return GL_FALSE; + } + + VertexArray *vao = context->getVertexArray(array); + + return (vao != nullptr ? GL_TRUE : GL_FALSE); + } + + return GL_FALSE; +} + +void GL_APIENTRY DebugMessageControlKHR(GLenum source, + GLenum type, + GLenum severity, + GLsizei count, + const GLuint *ids, + GLboolean enabled) +{ + EVENT( + "(GLenum source = 0x%X, GLenum type = 0x%X, GLenum severity = 0x%X, GLsizei count = %d, " + "GLint *ids = 0x%0.8p, GLboolean enabled = %d)", + source, type, severity, count, ids, enabled); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateDebugMessageControlKHR(context, source, type, severity, count, ids, enabled)) + { + return; + } + + context->debugMessageControl(source, type, severity, count, ids, enabled); + } +} + +void GL_APIENTRY DebugMessageInsertKHR(GLenum source, + GLenum type, + GLuint id, + GLenum severity, + GLsizei length, + const GLchar *buf) +{ + EVENT( + "(GLenum source = 0x%X, GLenum type = 0x%X, GLint id = %d, GLenum severity = 0x%X, GLsizei " + "length = %d, const GLchar *buf = 0x%0.8p)", + source, type, id, severity, length, buf); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateDebugMessageInsertKHR(context, source, type, id, severity, length, buf)) + { + return; + } + + context->debugMessageInsert(source, type, id, severity, length, buf); + } +} + +void GL_APIENTRY DebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam) +{ + EVENT("(GLDEBUGPROCKHR callback = 0x%0.8p, const void *userParam = 0x%0.8p)", callback, + userParam); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateDebugMessageCallbackKHR(context, callback, userParam)) + { + return; + } + + context->debugMessageCallback(callback, userParam); + } +} + +GLuint GL_APIENTRY GetDebugMessageLogKHR(GLuint count, + GLsizei bufSize, + GLenum *sources, + GLenum *types, + GLuint *ids, + GLenum *severities, + GLsizei *lengths, + GLchar *messageLog) +{ + EVENT( + "(GLsizei count = %d, GLsizei bufSize = %d, GLenum *sources, GLenum *types = 0x%0.8p, " + "GLuint *ids = 0x%0.8p, GLenum *severities = 0x%0.8p, GLsizei *lengths = 0x%0.8p, GLchar " + "*messageLog = 0x%0.8p)", + count, bufSize, sources, types, ids, severities, lengths, messageLog); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetDebugMessageLogKHR(context, count, bufSize, sources, types, ids, severities, + lengths, messageLog)) + { + return 0; + } + + return context->getDebugMessageLog(count, bufSize, sources, types, ids, severities, lengths, + messageLog); + } + + return 0; +} + +void GL_APIENTRY PushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar *message) +{ + EVENT( + "(GLenum source = 0x%X, GLuint id = 0x%X, GLsizei length = %d, const GLchar *message = " + "0x%0.8p)", + source, id, length, message); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidatePushDebugGroupKHR(context, source, id, length, message)) + { + return; + } + + std::string msg(message, (length > 0) ? static_cast<size_t>(length) : strlen(message)); + context->pushDebugGroup(source, id, length, message); + } +} + +void GL_APIENTRY PopDebugGroupKHR(void) +{ + EVENT("()"); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidatePopDebugGroupKHR(context)) + { + return; + } + + context->popDebugGroup(); + } +} + +void GL_APIENTRY ObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar *label) +{ + EVENT( + "(GLenum identifier = 0x%X, GLuint name = %u, GLsizei length = %d, const GLchar *label = " + "0x%0.8p)", + identifier, name, length, label); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateObjectLabelKHR(context, identifier, name, length, label)) + { + return; + } + + context->objectLabel(identifier, name, length, label); + } +} + +void GL_APIENTRY +GetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label) +{ + EVENT( + "(GLenum identifier = 0x%X, GLuint name = %u, GLsizei bufSize = %d, GLsizei *length = " + "0x%0.8p, GLchar *label = 0x%0.8p)", + identifier, name, bufSize, length, label); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetObjectLabelKHR(context, identifier, name, bufSize, length, label)) + { + return; + } + + context->getObjectLabel(identifier, name, bufSize, length, label); + } +} + +void GL_APIENTRY ObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label) +{ + EVENT("(const void *ptr = 0x%0.8p, GLsizei length = %d, const GLchar *label = 0x%0.8p)", ptr, + length, label); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateObjectPtrLabelKHR(context, ptr, length, label)) + { + return; + } + + context->objectPtrLabel(ptr, length, label); + } +} + +void GL_APIENTRY GetObjectPtrLabelKHR(const void *ptr, + GLsizei bufSize, + GLsizei *length, + GLchar *label) +{ + EVENT( + "(const void *ptr = 0x%0.8p, GLsizei bufSize = %d, GLsizei *length = 0x%0.8p, GLchar " + "*label = 0x%0.8p)", + ptr, bufSize, length, label); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetObjectPtrLabelKHR(context, ptr, bufSize, length, label)) + { + return; + } + + context->getObjectPtrLabel(ptr, bufSize, length, label); + } +} + +void GL_APIENTRY GetPointervKHR(GLenum pname, void **params) +{ + EVENT("(GLenum pname = 0x%X, void **params = 0x%0.8p)", pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetPointervKHR(context, pname, params)) + { + return; + } + + context->getPointerv(pname, params); + } +} + +ANGLE_EXPORT void GL_APIENTRY BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const GLchar *name) +{ + EVENT("(GLuint program = %u, GLint location = %d, const GLchar *name = 0x%0.8p)", program, + location, name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateBindUniformLocationCHROMIUM(context, program, location, name)) + { + return; + } + + context->bindUniformLocation(program, location, name); + } +} + +ANGLE_EXPORT void GL_APIENTRY CoverageModulationCHROMIUM(GLenum components) +{ + EVENT("(GLenum components = %u)", components); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateCoverageModulationCHROMIUM(context, components)) + { + return; + } + context->setCoverageModulation(components); + } +} + +// CHROMIUM_path_rendering +ANGLE_EXPORT void GL_APIENTRY MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix) +{ + EVENT("(GLenum matrixMode = %u)", matrixMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateMatrix(context, matrixMode, matrix)) + { + return; + } + context->loadPathRenderingMatrix(matrixMode, matrix); + } +} + +ANGLE_EXPORT void GL_APIENTRY MatrixLoadIdentityCHROMIUM(GLenum matrixMode) +{ + EVENT("(GLenum matrixMode = %u)", matrixMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateMatrixMode(context, matrixMode)) + { + return; + } + context->loadPathRenderingIdentityMatrix(matrixMode); + } +} + +ANGLE_EXPORT GLuint GL_APIENTRY GenPathsCHROMIUM(GLsizei range) +{ + EVENT("(GLsizei range = %d)", range); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenPaths(context, range)) + { + return 0; + } + return context->createPaths(range); + } + return 0; +} + +ANGLE_EXPORT void GL_APIENTRY DeletePathsCHROMIUM(GLuint first, GLsizei range) +{ + EVENT("(GLuint first = %u, GLsizei range = %d)", first, range); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeletePaths(context, first, range)) + { + return; + } + context->deletePaths(first, range); + } +} + +ANGLE_EXPORT GLboolean GL_APIENTRY IsPathCHROMIUM(GLuint path) +{ + EVENT("(GLuint path = %u)", path); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateIsPath(context)) + { + return GL_FALSE; + } + return context->hasPathData(path); + } + return GL_FALSE; +} + +ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUM(GLuint path, + GLsizei numCommands, + const GLubyte *commands, + GLsizei numCoords, + GLenum coordType, + const void *coords) +{ + EVENT( + "(GLuint path = %u, GLsizei numCommands = %d, commands = %p, " + "GLsizei numCoords = %d, GLenum coordType = %u, void* coords = %p)", + path, numCommands, commands, numCoords, coordType, coords); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + if (!ValidatePathCommands(context, path, numCommands, commands, numCoords, coordType, + coords)) + { + return; + } + } + context->setPathCommands(path, numCommands, commands, numCoords, coordType, coords); + } +} + +ANGLE_EXPORT void GL_APIENTRY PathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value) +{ + EVENT("(GLuint path = %u, GLenum pname = %u, GLfloat value = %f)", path, pname, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateSetPathParameter(context, path, pname, value)) + { + return; + } + context->setPathParameterf(path, pname, value); + } +} + +ANGLE_EXPORT void GL_APIENTRY PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value) +{ + PathParameterfCHROMIUM(path, pname, static_cast<GLfloat>(value)); +} + +ANGLE_EXPORT void GL_APIENTRY GetPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat *value) +{ + EVENT("(GLuint path = %u, GLenum pname = %u)", path, pname); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGetPathParameter(context, path, pname, value)) + { + return; + } + context->getPathParameterfv(path, pname, value); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint *value) +{ + GLfloat val = 0.0f; + GetPathParameterfCHROMIUM(path, pname, value != nullptr ? &val : nullptr); + if (value) + *value = static_cast<GLint>(val); +} + +ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask) +{ + EVENT("(GLenum func = %u, GLint ref = %d, GLuint mask = %u)", func, ref, mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidatePathStencilFunc(context, func, ref, mask)) + { + return; + } + context->setPathStencilFunc(func, ref, mask); + } +} + +ANGLE_EXPORT void GL_APIENTRY StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask) +{ + EVENT("(GLuint path = %u, GLenum fillMode = %u, GLuint mask = %u)", path, fillMode, mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateStencilFillPath(context, path, fillMode, mask)) + { + return; + } + context->stencilFillPath(path, fillMode, mask); + } +} + +ANGLE_EXPORT void GL_APIENTRY StencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask) +{ + EVENT("(GLuint path = %u, GLint ference = %d, GLuint mask = %u)", path, reference, mask); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateStencilStrokePath(context, path, reference, mask)) + { + return; + } + context->stencilStrokePath(path, reference, mask); + } +} + +ANGLE_EXPORT void GL_APIENTRY CoverFillPathCHROMIUM(GLuint path, GLenum coverMode) +{ + EVENT("(GLuint path = %u, GLenum coverMode = %u)", path, coverMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateCoverPath(context, path, coverMode)) + { + return; + } + context->coverFillPath(path, coverMode); + } +} + +ANGLE_EXPORT void GL_APIENTRY CoverStrokePathCHROMIUM(GLuint path, GLenum coverMode) +{ + EVENT("(GLuint path = %u, GLenum coverMode = %u)", path, coverMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateCoverPath(context, path, coverMode)) + { + return; + } + context->coverStrokePath(path, coverMode); + } +} + +ANGLE_EXPORT void GL_APIENTRY StencilThenCoverFillPathCHROMIUM(GLuint path, + GLenum fillMode, + GLuint mask, + GLenum coverMode) +{ + EVENT("(GLuint path = %u, GLenum fillMode = %u, GLuint mask = %u, GLenum coverMode = %u)", path, + fillMode, mask, coverMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateStencilThenCoverFillPath(context, path, fillMode, mask, coverMode)) + { + return; + } + context->stencilThenCoverFillPath(path, fillMode, mask, coverMode); + } +} + +ANGLE_EXPORT void GL_APIENTRY StencilThenCoverStrokePathCHROMIUM(GLuint path, + GLint reference, + GLuint mask, + GLenum coverMode) +{ + EVENT("(GLuint path = %u, GLint reference = %d, GLuint mask = %u, GLenum coverMode = %u)", path, + reference, mask, coverMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateStencilThenCoverStrokePath(context, path, reference, mask, coverMode)) + { + return; + } + context->stencilThenCoverStrokePath(path, reference, mask, coverMode); + } +} + +ANGLE_EXPORT void GL_APIENTRY CoverFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + EVENT( + "(GLsizei numPaths = %d, GLenum pathNameType = %u, const void *paths = %p " + "GLuint pathBase = %u, GLenum coverMode = %u, GLenum transformType = %u " + "const GLfloat *transformValues = %p)", + numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCoverFillPathInstanced(context, numPaths, pathNameType, paths, pathBase, + coverMode, transformType, transformValues)) + { + return; + } + context->coverFillPathInstanced(numPaths, pathNameType, paths, pathBase, coverMode, + transformType, transformValues); + } +} + +ANGLE_EXPORT void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + EVENT( + "(GLsizei numPaths = %d, GLenum pathNameType = %u, const void *paths = %p " + "GLuint pathBase = %u, GLenum coverMode = %u, GLenum transformType = %u " + "const GLfloat *transformValues = %p)", + numPaths, pathNameType, paths, pathBase, coverMode, transformType, transformValues); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCoverStrokePathInstanced(context, numPaths, pathNameType, paths, pathBase, + coverMode, transformType, transformValues)) + { + return; + } + context->coverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, coverMode, + transformType, transformValues); + } +} + +ANGLE_EXPORT void GL_APIENTRY StencilStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLint reference, + GLuint mask, + GLenum transformType, + const GLfloat *transformValues) +{ + EVENT( + "(GLsizei numPaths = %u, GLenum pathNameType = %u, const void *paths = %p " + "GLuint pathBase = %u, GLint reference = %d GLuint mask = %u GLenum transformType = %u " + "const GLfloat *transformValues = %p)", + numPaths, pathNameType, paths, pathBase, reference, mask, transformType, transformValues); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateStencilStrokePathInstanced(context, numPaths, pathNameType, paths, pathBase, + reference, mask, transformType, transformValues)) + { + return; + } + context->stencilStrokePathInstanced(numPaths, pathNameType, paths, pathBase, reference, + mask, transformType, transformValues); + } +} + +ANGLE_EXPORT void GL_APIENTRY StencilFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum fillMode, + GLuint mask, + GLenum transformType, + const GLfloat *transformValues) +{ + EVENT( + "(GLsizei numPaths = %u, GLenum pathNameType = %u const void *paths = %p " + "GLuint pathBase = %u, GLenum fillMode = %u, GLuint mask = %u, GLenum transformType = %u " + "const GLfloat *transformValues = %p)", + numPaths, pathNameType, paths, pathBase, fillMode, mask, transformType, transformValues); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateStencilFillPathInstanced(context, numPaths, pathNameType, paths, pathBase, + fillMode, mask, transformType, transformValues)) + { + return; + } + context->stencilFillPathInstanced(numPaths, pathNameType, paths, pathBase, fillMode, mask, + transformType, transformValues); + } +} + +ANGLE_EXPORT void GL_APIENTRY +StencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum fillMode, + GLuint mask, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + EVENT( + "(GLsizei numPaths = %u, GLenum pathNameType = %u const void *paths = %p " + "GLuint pathBase = %u, GLenum coverMode = %u, GLuint mask = %u, GLenum transformType = %u " + "const GLfloat *transformValues = %p)", + numPaths, pathNameType, paths, pathBase, coverMode, mask, transformType, transformValues); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateStencilThenCoverFillPathInstanced(context, numPaths, pathNameType, paths, + pathBase, fillMode, mask, coverMode, + transformType, transformValues)) + { + return; + } + context->stencilThenCoverFillPathInstanced(numPaths, pathNameType, paths, pathBase, + fillMode, mask, coverMode, transformType, + transformValues); + } +} + +ANGLE_EXPORT void GL_APIENTRY +StencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLint reference, + GLuint mask, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + EVENT( + "(GLsizei numPaths = %u, GLenum pathNameType = %u, const void *paths = %p " + "GLuint pathBase = %u GLenum coverMode = %u GLint reference = %d GLuint mask = %u GLenum " + "transformType = %u " + "const GLfloat *transformValues = %p)", + numPaths, pathNameType, paths, pathBase, coverMode, reference, mask, transformType, + transformValues); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateStencilThenCoverStrokePathInstanced(context, numPaths, pathNameType, paths, + pathBase, reference, mask, coverMode, + transformType, transformValues)) + { + return; + } + context->stencilThenCoverStrokePathInstanced(numPaths, pathNameType, paths, pathBase, + reference, mask, coverMode, transformType, + transformValues); + } +} + +ANGLE_EXPORT void GL_APIENTRY BindFragmentInputLocationCHROMIUM(GLuint program, + GLint location, + const GLchar *name) +{ + EVENT("(GLuint program = %u, GLint location = %d, const GLchar *name = %p)", program, location, + name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateBindFragmentInputLocation(context, program, location, name)) + { + return; + } + context->bindFragmentInputLocation(program, location, name); + } +} + +ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program, + GLint location, + GLenum genMode, + GLint components, + const GLfloat *coeffs) +{ + EVENT( + "(GLuint program = %u, GLint location %d, GLenum genMode = %u, GLint components = %d, " + "const GLfloat * coeffs = %p)", + program, location, genMode, components, coeffs); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateProgramPathFragmentInputGen(context, program, location, genMode, components, + coeffs)) + { + return; + } + context->programPathFragmentInputGen(program, location, genMode, components, coeffs); + } +} + +ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId, + GLuint destId, + GLint internalFormat, + GLenum destType, + GLboolean unpackFlipY, + GLboolean unpackPremultiplyAlpha, + GLboolean unpackUnmultiplyAlpha) +{ + EVENT( + "(GLuint sourceId = %u, GLuint destId = %u, GLint internalFormat = 0x%X, GLenum destType = " + "0x%X, GLboolean unpackFlipY = %u, GLboolean unpackPremultiplyAlpha = %u, GLboolean " + "unpackUnmultiplyAlpha = %u)", + sourceId, destId, internalFormat, destType, unpackFlipY, unpackPremultiplyAlpha, + unpackUnmultiplyAlpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCopyTextureCHROMIUM(context, sourceId, destId, internalFormat, destType, + unpackFlipY, unpackPremultiplyAlpha, + unpackUnmultiplyAlpha)) + { + return; + } + + context->copyTextureCHROMIUM(sourceId, destId, internalFormat, destType, unpackFlipY, + unpackPremultiplyAlpha, unpackUnmultiplyAlpha); + } +} + +ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId, + GLuint destId, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpackFlipY, + GLboolean unpackPremultiplyAlpha, + GLboolean unpackUnmultiplyAlpha) +{ + EVENT( + "(GLuint sourceId = %u, GLuint destId = %u, , GLboolean unpackFlipY = %u, GLint xoffset = " + "%d, GLint yoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = " + "%d, GLboolean unpackPremultiplyAlpha = %u, GLboolean unpackUnmultiplyAlpha = %u)", + sourceId, destId, xoffset, yoffset, x, y, width, height, unpackFlipY, + unpackPremultiplyAlpha, unpackUnmultiplyAlpha); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCopySubTextureCHROMIUM(context, sourceId, destId, xoffset, yoffset, x, y, + width, height, unpackFlipY, unpackPremultiplyAlpha, + unpackUnmultiplyAlpha)) + { + return; + } + + context->copySubTextureCHROMIUM(sourceId, destId, xoffset, yoffset, x, y, width, height, + unpackFlipY, unpackPremultiplyAlpha, unpackUnmultiplyAlpha); + } +} + +ANGLE_EXPORT void GL_APIENTRY CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId) +{ + EVENT("(GLuint sourceId = %u, GLuint destId = %u)", sourceId, destId); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCompressedCopyTextureCHROMIUM(context, sourceId, destId)) + { + return; + } + + context->compressedCopyTextureCHROMIUM(sourceId, destId); + } +} + +GL_APICALL GLboolean GL_APIENTRY EnableExtensionANGLE(const GLchar *name) +{ + EVENT("(const GLchar *name = %p)", name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateEnableExtensionANGLE(context, name)) + { + return GL_FALSE; + } + + return context->enableExtension(name) ? GL_TRUE : GL_FALSE; + } + + return GL_FALSE; +} + +ANGLE_EXPORT void GL_APIENTRY GetBooleanvRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLboolean *params) +{ + EVENT( + "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLboolean* params " + "= 0x%0.8p)", + pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLenum nativeType; + unsigned int numParams = 0; + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_BOOL) + { + context->getBooleanv(pname, params); + } + else + { + CastStateValues(context, nativeType, pname, numParams, params); + } + + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetBufferParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetBufferParameterivRobustANGLE(context, target, pname, bufSize, &numParams, + params)) + { + return; + } + + Buffer *buffer = context->getGLState().getTargetBuffer(target); + QueryBufferParameteriv(buffer, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetFloatvRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + EVENT( + "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLfloat* params = " + "0x%0.8p)", + pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLenum nativeType; + unsigned int numParams = 0; + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_FLOAT) + { + context->getFloatv(pname, params); + } + else + { + CastStateValues(context, nativeType, pname, numParams, params); + } + + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivRobustANGLE(GLenum target, + GLenum attachment, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum attachment = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = " + "%d, GLsizei* length = 0x%0.8p, GLint* params = 0x%0.8p)", + target, attachment, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetFramebufferAttachmentParameterivRobustANGLE(context, target, attachment, + pname, bufSize, &numParams)) + { + return; + } + + const Framebuffer *framebuffer = context->getGLState().getTargetFramebuffer(target); + QueryFramebufferAttachmentParameteriv(framebuffer, attachment, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetIntegervRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *data) +{ + EVENT( + "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLint* params = " + "0x%0.8p)", + pname, bufSize, length, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLenum nativeType; + unsigned int numParams = 0; + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_INT) + { + context->getIntegerv(pname, data); + } + else + { + CastStateValues(context, nativeType, pname, numParams, data); + } + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetProgramivRobustANGLE(GLuint program, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint program = %d, GLenum pname = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLint* params = 0x%0.8p)", + program, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetProgramivRobustANGLE(context, program, pname, bufSize, &numParams)) + { + return; + } + + Program *programObject = context->getProgram(program); + QueryProgramiv(programObject, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint* params = 0x%0.8p)", + target, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetRenderbufferParameterivRobustANGLE(context, target, pname, bufSize, + &numParams, params)) + { + return; + } + + Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer(); + QueryRenderbufferiv(renderbuffer, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY +GetShaderivRobustANGLE(GLuint shader, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params) +{ + EVENT( + "(GLuint shader = %d, GLenum pname = %d, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLint* params = 0x%0.8p)", + shader, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetShaderivRobustANGLE(context, shader, pname, bufSize, &numParams, params)) + { + return; + } + + Shader *shaderObject = context->getShader(shader); + QueryShaderiv(shaderObject, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLfloat* params = 0x%0.8p)", + target, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetTexParameterfvRobustANGLE(context, target, pname, bufSize, &numParams, + params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + QueryTexParameterfv(texture, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLfloat* params = 0x%0.8p)", + target, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetTexParameterivRobustANGLE(context, target, pname, bufSize, &numParams, + params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + QueryTexParameteriv(texture, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + EVENT( + "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLfloat* params = 0x%0.8p)", + program, location, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetUniformfvRobustANGLE(context, program, location, bufSize, &writeLength, + params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformfv(location, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetUniformivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint* params = 0x%0.8p)", + program, location, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetUniformivRobustANGLE(context, program, location, bufSize, &writeLength, + params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformiv(location, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfvRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + EVENT( + "(GLuint index = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLfloat* params = 0x%0.8p)", + index, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetVertexAttribfvRobustANGLE(context, index, pname, bufSize, &writeLength, + params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribfv(attrib, currentValues, pname, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribivRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint index = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLint* params = 0x%0.8p)", + index, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetVertexAttribivRobustANGLE(context, index, pname, bufSize, &writeLength, + params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribiv(attrib, currentValues, pname, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointervRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **pointer) +{ + EVENT( + "(GLuint index = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLvoid** pointer = 0x%0.8p)", + index, pname, bufSize, length, pointer); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetVertexAttribPointervRobustANGLE(context, index, pname, bufSize, + &writeLength, pointer)) + { + return; + } + + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribPointerv(attrib, pname, pointer); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY ReadPixelsRobustANGLE(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + void *pixels) +{ + EVENT( + "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " + "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLvoid* pixels = 0x%0.8p)", + x, y, width, height, format, type, bufSize, length, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateReadPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize, + &writeLength, pixels)) + { + return; + } + + context->readPixels(x, y, width, height, format, type, pixels); + + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY TexImage2DRobustANGLE(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " + "GLsizei height = %d, GLint border = %d, GLenum format = 0x%X, GLenum type = 0x%X, GLsizei " + "bufSize = %d, const GLvoid* pixels = 0x%0.8p)", + target, level, internalformat, width, height, border, format, type, bufSize, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateTexImage2DRobust(context, target, level, internalformat, width, height, border, + format, type, bufSize, pixels)) + { + return; + } + + context->texImage2D(target, level, internalformat, width, height, border, format, type, + pixels); + } +} + +ANGLE_EXPORT void GL_APIENTRY TexParameterfvRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLfloat *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLfloat* params = " + "0x%0.8p)", + target, pname, bufSize, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateTexParameterfvRobustANGLE(context, target, pname, bufSize, params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + SetTexParameterfv(texture, pname, params); + } +} + +ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLfloat* params = " + "0x%0.8p)", + target, pname, bufSize, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateTexParameterivRobustANGLE(context, target, pname, bufSize, params)) + { + return; + } + + Texture *texture = context->getTargetTexture(target); + SetTexParameteriv(texture, pname, params); + } +} + +ANGLE_EXPORT void GL_APIENTRY TexSubImage2DRobustANGLE(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLsizei width = %d, GLsizei height = %d, GLenum format = 0x%X, GLenum type = 0x%X, " + "GLsizei bufsize = %d, const GLvoid* pixels = 0x%0.8p)", + target, level, xoffset, yoffset, width, height, format, type, bufSize, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateTexSubImage2DRobustANGLE(context, target, level, xoffset, yoffset, width, + height, format, type, bufSize, pixels)) + { + return; + } + + context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, + pixels); + } +} + +ANGLE_EXPORT void GL_APIENTRY TexImage3DRobustANGLE(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " + "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " + "GLenum type = 0x%X, GLsizei bufsize = %d, const GLvoid* pixels = 0x%0.8p)", + target, level, internalformat, width, height, depth, border, format, type, bufSize, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateTexImage3DRobustANGLE(context, target, level, internalformat, width, height, + depth, border, format, type, bufSize, pixels)) + { + return; + } + + context->texImage3D(target, level, internalformat, width, height, depth, border, format, + type, pixels); + } +} + +ANGLE_EXPORT void GL_APIENTRY TexSubImage3DRobustANGLE(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " + "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufsize = %d, const GLvoid* pixels = " + "0x%0.8p)", + target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, bufSize, + pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateTexSubImage3DRobustANGLE(context, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, type, bufSize, pixels)) + { + return; + } + + context->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, + format, type, pixels); + } +} + +ANGLE_EXPORT void GL_APIENTRY +GetQueryivRobustANGLE(GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint* params = 0x%0.8p)", + target, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetQueryivRobustANGLE(context, target, pname, bufSize, &numParams, params)) + { + return; + } + + context->getQueryiv(target, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + EVENT( + "(GLuint id = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLint* params = 0x%0.8p)", + id, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetQueryObjectuivRobustANGLE(context, id, pname, bufSize, &numParams, params)) + { + return; + } + + context->getQueryObjectuiv(id, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetBufferPointervRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLvoid** params = 0x%0.8p)", + target, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetBufferPointervRobustANGLE(context, target, pname, bufSize, &numParams, + params)) + { + return; + } + + context->getBufferPointerv(target, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY +GetIntegeri_vRobustANGLE(GLenum target, GLuint index, GLsizei bufSize, GLsizei *length, GLint *data) +{ + EVENT( + "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint* data = 0x%0.8p)", + target, index, bufSize, length, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetIntegeri_vRobustANGLE(context, target, index, bufSize, &numParams, data)) + { + return; + } + + context->getIntegeri_v(target, index, data); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetInternalformativRobustANGLE(GLenum target, + GLenum internalformat, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize " + "= %d, GLsizei* length = 0x%0.8p, GLint* params = 0x%0.8p)", + target, internalformat, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetInternalFormativRobustANGLE(context, target, internalformat, pname, bufSize, + &numParams, params)) + { + return; + } + + const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); + QueryInternalFormativ(formatCaps, pname, bufSize, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIivRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLint* params = 0x%0.8p)", + index, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetVertexAttribIivRobustANGLE(context, index, pname, bufSize, &writeLength, + params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribIiv(attrib, currentValues, pname, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuivRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + EVENT( + "(GLuint index = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLuint* params = 0x%0.8p)", + index, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetVertexAttribIuivRobustANGLE(context, index, pname, bufSize, &writeLength, + params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribIuiv(attrib, currentValues, pname, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetUniformuivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLuint* params = 0x%0.8p)", + program, location, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetUniformuivRobustANGLE(context, program, location, bufSize, &writeLength, + params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformuiv(location, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockivRobustANGLE(GLuint program, + GLuint uniformBlockIndex, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLsizei bufsize " + "= %d, GLsizei* length = 0x%0.8p, GLint* params = 0x%0.8p)", + program, uniformBlockIndex, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateGetActiveUniformBlockivRobustANGLE(context, program, uniformBlockIndex, pname, + bufSize, &writeLength, params)) + { + return; + } + + const Program *programObject = context->getProgram(program); + QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params); + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *data) +{ + EVENT( + "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, GLint64* params = " + "0x%0.8p)", + pname, bufSize, length, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLenum nativeType; + unsigned int numParams = 0; + if (!ValidateRobustStateQuery(context, pname, bufSize, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_INT_64_ANGLEX) + { + context->getInteger64v(pname, data); + } + else + { + CastStateValues(context, nativeType, pname, numParams, data); + } + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLint64 *data) +{ + EVENT( + "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint64* data = 0x%0.8p)", + target, index, bufSize, length, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetInteger64i_vRobustANGLE(context, target, index, bufSize, &numParams, data)) + { + return; + } + + context->getInteger64i_v(target, index, data); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", target, pname, + bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetBufferParameteri64vRobustANGLE(context, target, pname, bufSize, &numParams, + params)) + { + return; + } + + Buffer *buffer = context->getGLState().getTargetBuffer(target); + QueryBufferParameteri64v(buffer, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param) +{ + EVENT( + "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLint* params = " + "0x%0.8p)", + sampler, pname, bufSize, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, param)) + { + return; + } + + context->samplerParameteriv(sampler, pname, param); + } +} + +ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLfloat *param) +{ + EVENT( + "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLfloat* params = " + "0x%0.8p)", + sampler, pname, bufSize, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, param)) + { + return; + } + + context->samplerParameterfv(sampler, pname, param); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint sampler = %u, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint* params = 0x%0.8p)", + sampler, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetSamplerParameterivRobustANGLE(context, sampler, pname, bufSize, &numParams, + params)) + { + return; + } + + context->getSamplerParameteriv(sampler, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + EVENT( + "(GLuint sample = %ur, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLfloat* params = 0x%0.8p)", + sampler, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetSamplerParameterfvRobustANGLE(context, sampler, pname, bufSize, &numParams, + params)) + { + return; + } + + context->getSamplerParameterfv(sampler, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint* params = 0x%0.8p)", + target, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceivRobustANGLE(GLuint program, + GLenum programInterface, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint program = %u, GLenum programInterface = 0x%X, GLenum pname = 0x%X, GLsizei " + "bufsize = %d, GLsizei* length = 0x%0.8p, GLint* params = 0x%0.8p)", + program, programInterface, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetBooleani_vRobustANGLE(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLboolean *data) +{ + EVENT( + "(GLenum target = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLboolean* data = 0x%0.8p)", + target, index, bufSize, length, data); + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetBooleani_vRobustANGLE(context, target, index, bufSize, &numParams, data)) + { + return; + } + + context->getBooleani_v(target, index, data); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvRobustANGLE(GLenum pname, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLfloat *val) +{ + EVENT( + "(GLenum pname = 0x%X, GLuint index = %u, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLfloat* val = 0x%0.8p)", + pname, index, bufSize, length, val); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterivRobustANGLE(GLenum target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, " + "GLsizei* length = 0x%0.8p, GLint* params = 0x%0.8p)", + target, level, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfvRobustANGLE(GLenum target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, " + "GLsizei* length = 0x%0.8p, GLfloat* params = 0x%0.8p)", + target, level, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetPointervRobustANGLERobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params) +{ + EVENT( + "(GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, void **params = " + "0x%0.8p)", + pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY ReadnPixelsRobustANGLE(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + void *data) +{ + EVENT( + "(GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d, " + "GLenum format = 0x%X, GLenum type = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLvoid *data = 0x%0.8p)", + x, y, width, height, format, type, bufSize, length, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei writeLength = 0; + if (!ValidateReadnPixelsRobustANGLE(context, x, y, width, height, format, type, bufSize, + &writeLength, data)) + { + return; + } + + context->readPixels(x, y, width, height, format, type, data); + + SetRobustLengthParam(length, writeLength); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetnUniformfvRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params) +{ + EVENT( + "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLfloat* params = 0x%0.8p)", + program, location, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetnUniformivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint program = %d, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint* params = 0x%0.8p)", + program, location, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetnUniformuivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLuint* params = 0x%0.8p)", + program, location, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY TexParameterIivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLint *params = " + "0x%0.8p)", + target, pname, bufSize, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY TexParameterIuivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLuint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLuint *params = " + "0x%0.8p)", + target, pname, bufSize, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetTexParameterIivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint *params = 0x%0.8p)", + target, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetTexParameterIuivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + EVENT( + "(GLenum target = 0x%X, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLuint *params = 0x%0.8p)", + target, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY SamplerParameterIivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param) +{ + EVENT( + "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLint *param = " + "0x%0.8p)", + sampler, pname, bufSize, param); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLuint *param) +{ + EVENT( + "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, const GLuint *param = " + "0x%0.8p)", + sampler, pname, bufSize, param); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLint *params = 0x%0.8p)", + sampler, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params) +{ + EVENT( + "(GLuint sampler = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = " + "0x%0.8p, GLuint *params = 0x%0.8p)", + sampler, pname, bufSize, length, params); + UNIMPLEMENTED(); +} + +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint id = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLuint *params = 0x%0.8p)", + id, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetQueryObjectivRobustANGLE(context, id, pname, bufSize, &numParams, params)) + { + return; + } + + context->getQueryObjectiv(id, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params) +{ + EVENT( + "(GLuint id = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLint64 *params = 0x%0.8p)", + id, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetQueryObjecti64vRobustANGLE(context, id, pname, bufSize, &numParams, params)) + { + return; + } + + context->getQueryObjecti64v(id, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint64 *params) +{ + EVENT( + "(GLuint id = %d, GLenum pname = 0x%X, GLsizei bufsize = %d, GLsizei* length = 0x%0.8p, " + "GLuint64 *params = 0x%0.8p)", + id, pname, bufSize, length, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + GLsizei numParams = 0; + if (!ValidateGetQueryObjectui64vRobustANGLE(context, id, pname, bufSize, &numParams, + params)) + { + return; + } + + context->getQueryObjectui64v(id, pname, params); + SetRobustLengthParam(length, numParams); + } +} + +} // gl diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_2_0_ext.h b/gfx/angle/src/libGLESv2/entry_points_gles_2_0_ext.h new file mode 100755 index 000000000..69d549224 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_2_0_ext.h @@ -0,0 +1,596 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_2_0_ext.h : Defines the GLES 2.0 extension entry points. + +#ifndef LIBGLESV2_ENTRYPOINTGLES20EXT_H_ +#define LIBGLESV2_ENTRYPOINTGLES20EXT_H_ + +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> +#include <export.h> + +namespace gl +{ + +// GL_ANGLE_framebuffer_blit +ANGLE_EXPORT void GL_APIENTRY BlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); + +// GL_ANGLE_framebuffer_multisample +ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); + +// GL_EXT_discard_framebuffer +ANGLE_EXPORT void GL_APIENTRY DiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments); + +// GL_NV_fence +ANGLE_EXPORT void GL_APIENTRY DeleteFencesNV(GLsizei n, const GLuint* fences); +ANGLE_EXPORT void GL_APIENTRY GenFencesNV(GLsizei n, GLuint* fences); +ANGLE_EXPORT GLboolean GL_APIENTRY IsFenceNV(GLuint fence); +ANGLE_EXPORT GLboolean GL_APIENTRY TestFenceNV(GLuint fence); +ANGLE_EXPORT void GL_APIENTRY GetFenceivNV(GLuint fence, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY FinishFenceNV(GLuint fence); +ANGLE_EXPORT void GL_APIENTRY SetFenceNV(GLuint fence, GLenum condition); + +// GL_ANGLE_translated_shader_source +ANGLE_EXPORT void GL_APIENTRY GetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); + +// GL_EXT_texture_storage +ANGLE_EXPORT void GL_APIENTRY TexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); + +// GL_EXT_robustness +ANGLE_EXPORT GLenum GL_APIENTRY GetGraphicsResetStatusEXT(void); +ANGLE_EXPORT void GL_APIENTRY ReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +ANGLE_EXPORT void GL_APIENTRY GetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params); +ANGLE_EXPORT void GL_APIENTRY GetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params); + +// GL_EXT_occlusion_query_boolean +ANGLE_EXPORT void GL_APIENTRY GenQueriesEXT(GLsizei n, GLuint *ids); +ANGLE_EXPORT void GL_APIENTRY DeleteQueriesEXT(GLsizei n, const GLuint *ids); +ANGLE_EXPORT GLboolean GL_APIENTRY IsQueryEXT(GLuint id); +ANGLE_EXPORT void GL_APIENTRY BeginQueryEXT(GLenum target, GLuint id); +ANGLE_EXPORT void GL_APIENTRY EndQueryEXT(GLenum target); +ANGLE_EXPORT void GL_APIENTRY GetQueryivEXT(GLenum target, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params); + +// GL_EXT_disjoint_timer_query +ANGLE_EXPORT void GL_APIENTRY QueryCounterEXT(GLuint id, GLenum target); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params); + +// GL_EXT_draw_buffers +ANGLE_EXPORT void GL_APIENTRY DrawBuffersEXT(GLsizei n, const GLenum *bufs); + +// GL_ANGLE_instanced_arrays +ANGLE_EXPORT void GL_APIENTRY DrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); +ANGLE_EXPORT void GL_APIENTRY DrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisorANGLE(GLuint index, GLuint divisor); + +// GL_OES_get_program_binary +ANGLE_EXPORT void GL_APIENTRY GetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +ANGLE_EXPORT void GL_APIENTRY ProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); + +// GL_OES_mapbuffer +ANGLE_EXPORT void *GL_APIENTRY MapBufferOES(GLenum target, GLenum access); +ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBufferOES(GLenum target); +ANGLE_EXPORT void GL_APIENTRY GetBufferPointervOES(GLenum target, GLenum pname, GLvoid **params); + +// GL_EXT_map_buffer_range +ANGLE_EXPORT void *GL_APIENTRY MapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length); + +// GL_EXT_debug_marker +ANGLE_EXPORT void GL_APIENTRY InsertEventMarkerEXT(GLsizei length, const char *marker); +ANGLE_EXPORT void GL_APIENTRY PushGroupMarkerEXT(GLsizei length, const char *marker); +ANGLE_EXPORT void GL_APIENTRY PopGroupMarkerEXT(); + +// GL_OES_EGL_image +ANGLE_EXPORT void GL_APIENTRY EGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image); +ANGLE_EXPORT void GL_APIENTRY EGLImageTargetRenderbufferStorageOES(GLenum target, + GLeglImageOES image); + +// GL_OES_vertex_array_object +ANGLE_EXPORT void GL_APIENTRY BindVertexArrayOES(GLuint array); +ANGLE_EXPORT void GL_APIENTRY DeleteVertexArraysOES(GLsizei n, const GLuint *arrays); +ANGLE_EXPORT void GL_APIENTRY GenVertexArraysOES(GLsizei n, GLuint *arrays); +ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArrayOES(GLuint array); + +// GL_KHR_debug +ANGLE_EXPORT void GL_APIENTRY DebugMessageControlKHR(GLenum source, + GLenum type, + GLenum severity, + GLsizei count, + const GLuint *ids, + GLboolean enabled); +ANGLE_EXPORT void GL_APIENTRY DebugMessageInsertKHR(GLenum source, + GLenum type, + GLuint id, + GLenum severity, + GLsizei length, + const GLchar *buf); +ANGLE_EXPORT void GL_APIENTRY DebugMessageCallbackKHR(GLDEBUGPROCKHR callback, + const void *userParam); +ANGLE_EXPORT GLuint GL_APIENTRY GetDebugMessageLogKHR(GLuint count, + GLsizei bufSize, + GLenum *sources, + GLenum *types, + GLuint *ids, + GLenum *severities, + GLsizei *lengths, + GLchar *messageLog); +ANGLE_EXPORT void GL_APIENTRY PushDebugGroupKHR(GLenum source, + GLuint id, + GLsizei length, + const GLchar *message); +ANGLE_EXPORT void GL_APIENTRY PopDebugGroupKHR(void); +ANGLE_EXPORT void GL_APIENTRY ObjectLabelKHR(GLenum identifier, + GLuint name, + GLsizei length, + const GLchar *label); +ANGLE_EXPORT void GL_APIENTRY +GetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); +ANGLE_EXPORT void GL_APIENTRY ObjectPtrLabelKHR(const void *ptr, + GLsizei length, + const GLchar *label); +ANGLE_EXPORT void GL_APIENTRY GetObjectPtrLabelKHR(const void *ptr, + GLsizei bufSize, + GLsizei *length, + GLchar *label); +ANGLE_EXPORT void GL_APIENTRY GetPointervKHR(GLenum pname, void **params); + +// GL_CHROMIUM_bind_uniform_location +ANGLE_EXPORT void GL_APIENTRY BindUniformLocationCHROMIUM(GLuint program, + GLint location, + const GLchar *name); + +// GL_CHROMIUM_framebuffer_mixed_samples +ANGLE_EXPORT void GL_APIENTRY MatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix); +ANGLE_EXPORT void GL_APIENTRY MatrixLoadIdentityCHROMIUM(GLenum matrixMode); + +ANGLE_EXPORT void GL_APIENTRY CoverageModulationCHROMIUM(GLenum components); + +// GL_CHROMIUM_path_rendering +ANGLE_EXPORT GLuint GL_APIENTRY GenPathsCHROMIUM(GLsizei chromium); +ANGLE_EXPORT void GL_APIENTRY DeletePathsCHROMIUM(GLuint first, GLsizei range); +ANGLE_EXPORT GLboolean GL_APIENTRY IsPathCHROMIUM(GLuint path); +ANGLE_EXPORT void GL_APIENTRY PathCommandsCHROMIUM(GLuint path, + GLsizei numCommands, + const GLubyte *commands, + GLsizei numCoords, + GLenum coordType, + const void *coords); +ANGLE_EXPORT void GL_APIENTRY PathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value); +ANGLE_EXPORT void GL_APIENTRY PathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value); +ANGLE_EXPORT void GL_APIENTRY GetPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY GetPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint *value); +ANGLE_EXPORT void GL_APIENTRY PathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY StencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask); +ANGLE_EXPORT void GL_APIENTRY CoverFillPathCHROMIUM(GLuint path, GLenum coverMode); +ANGLE_EXPORT void GL_APIENTRY CoverStrokePathCHROMIUM(GLuint path, GLenum coverMode); +ANGLE_EXPORT void GL_APIENTRY StencilThenCoverFillPathCHROMIUM(GLuint path, + GLenum fillMode, + GLuint mask, + GLenum coverMode); +ANGLE_EXPORT void GL_APIENTRY StencilThenCoverStrokePathCHROMIUM(GLuint path, + GLint reference, + GLuint mask, + GLenum coverMode); +ANGLE_EXPORT void GL_APIENTRY CoverFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues); +ANGLE_EXPORT void GL_APIENTRY CoverStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues); +ANGLE_EXPORT void GL_APIENTRY StencilFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBAse, + GLenum fillMode, + GLuint mask, + GLenum transformType, + const GLfloat *transformValues); +ANGLE_EXPORT void GL_APIENTRY StencilStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLint reference, + GLuint mask, + GLenum transformType, + const GLfloat *transformValues); +ANGLE_EXPORT void GL_APIENTRY +StencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum fillMode, + GLuint mask, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues); +ANGLE_EXPORT void GL_APIENTRY +StencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLint reference, + GLuint mask, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues); +ANGLE_EXPORT void GL_APIENTRY BindFragmentInputLocationCHROMIUM(GLuint program, + GLint location, + const GLchar *name); +ANGLE_EXPORT void GL_APIENTRY ProgramPathFragmentInputGenCHROMIUM(GLuint program, + GLint location, + GLenum genMode, + GLint components, + const GLfloat *coeffs); + +// GL_CHROMIUM_copy_texture +ANGLE_EXPORT void GL_APIENTRY CopyTextureCHROMIUM(GLuint sourceId, + GLuint destId, + GLint internalFormat, + GLenum destType, + GLboolean unpackFlipY, + GLboolean unpackPremultiplyAlpha, + GLboolean unpackUnmultiplyAlpha); + +ANGLE_EXPORT void GL_APIENTRY CopySubTextureCHROMIUM(GLuint sourceId, + GLuint destId, + GLint xoffset, + GLint yoffset, + GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLboolean unpackFlipY, + GLboolean unpackPremultiplyAlpha, + GLboolean unpackUnmultiplyAlpha); + +// GL_CHROMIUM_copy_compressed_texture +ANGLE_EXPORT void GL_APIENTRY CompressedCopyTextureCHROMIUM(GLuint sourceId, GLuint destId); + +// GL_ANGLE_webgl_compatibility +GL_APICALL GLboolean GL_APIENTRY EnableExtensionANGLE(const GLchar *name); + +// GL_ANGLE_robust_client_memory +ANGLE_EXPORT void GL_APIENTRY GetBooleanvRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLboolean *data); +ANGLE_EXPORT void GL_APIENTRY GetBufferParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetFloatvRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *data); +ANGLE_EXPORT void GL_APIENTRY GetFramebufferAttachmentParameterivRobustANGLE(GLenum target, + GLenum attachment, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetIntegervRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *data); +ANGLE_EXPORT void GL_APIENTRY GetProgramivRobustANGLE(GLuint program, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetRenderbufferParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetShaderivRobustANGLE(GLuint shader, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetTexParameterfvRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY GetTexParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetUniformfvRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY GetUniformivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribfvRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribivRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribPointervRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **pointer); +ANGLE_EXPORT void GL_APIENTRY ReadPixelsRobustANGLE(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + void *pixels); +ANGLE_EXPORT void GL_APIENTRY TexImage2DRobustANGLE(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); +ANGLE_EXPORT void GL_APIENTRY TexParameterfvRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY TexParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLint *params); +ANGLE_EXPORT void GL_APIENTRY TexSubImage2DRobustANGLE(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); + +ANGLE_EXPORT void GL_APIENTRY TexImage3DRobustANGLE(GLenum target, + GLint level, + GLint internalformat, + GLsizei width, + GLsizei height, + GLsizei depth, + GLint border, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); +ANGLE_EXPORT void GL_APIENTRY TexSubImage3DRobustANGLE(GLenum target, + GLint level, + GLint xoffset, + GLint yoffset, + GLint zoffset, + GLsizei width, + GLsizei height, + GLsizei depth, + GLenum format, + GLenum type, + GLsizei bufSize, + const void *pixels); +ANGLE_EXPORT void GL_APIENTRY +GetQueryivRobustANGLE(GLenum target, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuivRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); +ANGLE_EXPORT void GL_APIENTRY GetBufferPointervRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params); +ANGLE_EXPORT void GL_APIENTRY GetIntegeri_vRobustANGLE(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLint *data); +ANGLE_EXPORT void GL_APIENTRY GetInternalformativRobustANGLE(GLenum target, + GLenum internalformat, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIivRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuivRobustANGLE(GLuint index, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); +ANGLE_EXPORT void GL_APIENTRY GetUniformuivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params); +ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockivRobustANGLE(GLuint program, + GLuint uniformBlockIndex, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetInteger64vRobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *data); +ANGLE_EXPORT void GL_APIENTRY GetInteger64i_vRobustANGLE(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLint64 *data); +ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64vRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params); +ANGLE_EXPORT void GL_APIENTRY SamplerParameterivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param); +ANGLE_EXPORT void GL_APIENTRY SamplerParameterfvRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLfloat *param); +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfvRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); + +ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameterivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceivRobustANGLE(GLuint program, + GLenum programInterface, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetBooleani_vRobustANGLE(GLenum target, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLboolean *data); +ANGLE_EXPORT void GL_APIENTRY GetMultisamplefvRobustANGLE(GLenum pname, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLfloat *val); +ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterivRobustANGLE(GLenum target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfvRobustANGLE(GLenum target, + GLint level, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); + +ANGLE_EXPORT void GL_APIENTRY GetPointervRobustANGLERobustANGLE(GLenum pname, + GLsizei bufSize, + GLsizei *length, + void **params); +ANGLE_EXPORT void GL_APIENTRY ReadnPixelsRobustANGLE(GLint x, + GLint y, + GLsizei width, + GLsizei height, + GLenum format, + GLenum type, + GLsizei bufSize, + GLsizei *length, + void *data); +ANGLE_EXPORT void GL_APIENTRY GetnUniformfvRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY GetnUniformivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetnUniformuivRobustANGLE(GLuint program, + GLint location, + GLsizei bufSize, + GLsizei *length, + GLuint *params); +ANGLE_EXPORT void GL_APIENTRY TexParameterIivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLint *params); +ANGLE_EXPORT void GL_APIENTRY TexParameterIuivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + const GLuint *params); +ANGLE_EXPORT void GL_APIENTRY GetTexParameterIivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetTexParameterIuivRobustANGLE(GLenum target, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); +ANGLE_EXPORT void GL_APIENTRY SamplerParameterIivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLint *param); +ANGLE_EXPORT void GL_APIENTRY SamplerParameterIuivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + const GLuint *param); +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterIuivRobustANGLE(GLuint sampler, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint *params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectivRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjecti64vRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLint64 *params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectui64vRobustANGLE(GLuint id, + GLenum pname, + GLsizei bufSize, + GLsizei *length, + GLuint64 *params); + +} // namespace gl + +#endif // LIBGLESV2_ENTRYPOINTGLES20EXT_H_ diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_3_0.cpp b/gfx/angle/src/libGLESv2/entry_points_gles_3_0.cpp new file mode 100755 index 000000000..b0b485e36 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_3_0.cpp @@ -0,0 +1,2575 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_3_0.cpp : Implements the GLES 3.0 entry points. + +#include "libGLESv2/entry_points_gles_3_0.h" +#include "libGLESv2/entry_points_gles_2_0_ext.h" +#include "libGLESv2/global_state.h" + +#include "libANGLE/formatutils.h" +#include "libANGLE/Buffer.h" +#include "libANGLE/Context.h" +#include "libANGLE/Error.h" +#include "libANGLE/Fence.h" +#include "libANGLE/Framebuffer.h" +#include "libANGLE/Query.h" +#include "libANGLE/VertexArray.h" + +#include "libANGLE/validationES.h" +#include "libANGLE/validationES3.h" +#include "libANGLE/queryconversions.h" +#include "libANGLE/queryutils.h" + +#include "common/debug.h" + +namespace gl +{ + +void GL_APIENTRY ReadBuffer(GLenum mode) +{ + EVENT("(GLenum mode = 0x%X)", mode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateReadBuffer(context, mode)) + { + return; + } + + context->readBuffer(mode); + } +} + +void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) +{ + EVENT("(GLenum mode = 0x%X, GLuint start = %u, GLuint end = %u, GLsizei count = %d, GLenum type = 0x%X, " + "const GLvoid* indices = 0x%0.8p)", mode, start, end, count, type, indices); + + Context *context = GetValidGlobalContext(); + if (context) + { + IndexRange indexRange; + if (!context->skipValidation() && + !ValidateDrawRangeElements(context, mode, start, end, count, type, indices, + &indexRange)) + { + return; + } + + // As long as index validation is done, it doesn't matter whether the context receives a drawElements or + // a drawRangeElements call - the GL back-end is free to choose to call drawRangeElements based on the + // validated index range. If index validation is removed, adding drawRangeElements to the context interface + // should be reconsidered. + Error error = + context->drawRangeElements(mode, start, end, count, type, indices, indexRange); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint internalformat = %d, GLsizei width = %d, " + "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLenum format = 0x%X, " + "GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", + target, level, internalformat, width, height, depth, border, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateTexImage3D(context, target, level, internalformat, width, height, depth, + border, format, type, pixels)) + { + return; + } + + context->texImage3D(target, level, internalformat, width, height, depth, border, format, + type, pixels); + } +} + +void GL_APIENTRY TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " + "GLenum format = 0x%X, GLenum type = 0x%X, const GLvoid* pixels = 0x%0.8p)", + target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, width, height, + depth, format, type, pixels)) + { + return; + } + + context->texSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, + format, type, pixels); + } +} + +void GL_APIENTRY CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLint zoffset = %d, GLint x = %d, GLint y = %d, GLsizei width = %d, GLsizei height = %d)", + target, level, xoffset, yoffset, zoffset, x, y, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCopyTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, x, y, + width, height)) + { + return; + } + + context->copyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); + } +} + +void GL_APIENTRY CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " + "GLsizei height = %d, GLsizei depth = %d, GLint border = %d, GLsizei imageSize = %d, " + "const GLvoid* data = 0x%0.8p)", + target, level, internalformat, width, height, depth, border, imageSize, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCompressedTexImage3D(context, target, level, internalformat, width, height, + depth, border, imageSize, data)) + { + return; + } + + context->compressedTexImage3D(target, level, internalformat, width, height, depth, border, + imageSize, data); + } +} + +void GL_APIENTRY CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLint xoffset = %d, GLint yoffset = %d, " + "GLint zoffset = %d, GLsizei width = %d, GLsizei height = %d, GLsizei depth = %d, " + "GLenum format = 0x%X, GLsizei imageSize = %d, const GLvoid* data = 0x%0.8p)", + target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCompressedTexSubImage3D(context, target, level, xoffset, yoffset, zoffset, + width, height, depth, format, imageSize, data)) + { + return; + } + + context->compressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, + depth, format, imageSize, data); + } +} + +void GL_APIENTRY GenQueries(GLsizei n, GLuint* ids) +{ + EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenQueries(context, n, ids)) + { + return; + } + + for (GLsizei i = 0; i < n; i++) + { + ids[i] = context->createQuery(); + } + } +} + +void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint* ids) +{ + EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteQueries(context, n, ids)) + { + return; + } + + for (int i = 0; i < n; i++) + { + context->deleteQuery(ids[i]); + } + } +} + +GLboolean GL_APIENTRY IsQuery(GLuint id) +{ + EVENT("(GLuint id = %u)", id); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_FALSE; + } + + return (context->getQuery(id, false, GL_NONE) != NULL) ? GL_TRUE : GL_FALSE; + } + + return GL_FALSE; +} + +void GL_APIENTRY BeginQuery(GLenum target, GLuint id) +{ + EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateBeginQuery(context, target, id)) + { + return; + } + + Error error = context->beginQuery(target, id); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY EndQuery(GLenum target) +{ + EVENT("(GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateEndQuery(context, target)) + { + return; + } + + Error error = context->endQuery(target); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint* params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetQueryiv(context, target, pname, params)) + { + return; + } + + context->getQueryiv(target, pname, params); + } +} + +void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) +{ + EVENT("(GLuint id = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", id, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetQueryObjectuiv(context, id, pname, params)) + { + return; + } + + context->getQueryObjectuiv(id, pname, params); + } +} + +GLboolean GL_APIENTRY UnmapBuffer(GLenum target) +{ + EVENT("(GLenum target = 0x%X)", target); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateUnmapBuffer(context, target)) + { + return GL_FALSE; + } + + return context->unmapBuffer(target); + } + + return GL_FALSE; +} + +void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLvoid** params = 0x%0.8p)", target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetBufferPointerv(context, target, pname, params)) + { + return; + } + + context->getBufferPointerv(target, pname, params); + } +} + +void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum* bufs) +{ + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDrawBuffers(context, n, bufs)) + { + return; + } + + context->drawBuffers(n, bufs); + } +} + +void GL_APIENTRY UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x3, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix2x3fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x2, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix3x2fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT2x4, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix2x4fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x2, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix4x2fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT3x4, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix3x4fv(location, count, transpose, value); + } +} + +void GL_APIENTRY UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, const GLfloat* value = 0x%0.8p)", + location, count, transpose, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniformMatrix(context, GL_FLOAT_MAT4x3, location, count, transpose)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniformMatrix4x3fv(location, count, transpose, value); + } +} + +void GL_APIENTRY BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +{ + EVENT("(GLint srcX0 = %d, GLint srcY0 = %d, GLint srcX1 = %d, GLint srcY1 = %d, GLint dstX0 = %d, " + "GLint dstY0 = %d, GLint dstX1 = %d, GLint dstY1 = %d, GLbitfield mask = 0x%X, GLenum filter = 0x%X)", + srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateBlitFramebuffer(context, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, + dstY1, mask, filter)) + { + return; + } + + context->blitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, + filter); + } +} + +void GL_APIENTRY RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", + target, samples, internalformat, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (!ValidateES3RenderbufferStorageParameters(context, target, samples, internalformat, width, height)) + { + return; + } + + Renderbuffer *renderbuffer = context->getGLState().getCurrentRenderbuffer(); + renderbuffer->setStorageMultisample(samples, internalformat, width, height); + } +} + +void GL_APIENTRY FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) +{ + EVENT("(GLenum target = 0x%X, GLenum attachment = 0x%X, GLuint texture = %u, GLint level = %d, GLint layer = %d)", + target, attachment, texture, level, layer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateFramebufferTextureLayer(context, target, attachment, texture, level, layer)) + { + return; + } + + context->framebufferTextureLayer(target, attachment, texture, level, layer); + } +} + +GLvoid *GL_APIENTRY MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +{ + EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d, GLbitfield access = 0x%X)", + target, offset, length, access); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateMapBufferRange(context, target, offset, length, access)) + { + return nullptr; + } + + return context->mapBufferRange(target, offset, length, access); + } + + return nullptr; +} + +void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) +{ + EVENT("(GLenum target = 0x%X, GLintptr offset = %d, GLsizeiptr length = %d)", target, offset, length); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateFlushMappedBufferRange(context, target, offset, length)) + { + return; + } + + context->flushMappedBufferRange(target, offset, length); + } +} + +void GL_APIENTRY BindVertexArray(GLuint array) +{ + EVENT("(GLuint array = %u)", array); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateBindVertexArray(context, array)) + { + return; + } + + context->bindVertexArray(array); + } +} + +void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint* arrays) +{ + EVENT("(GLsizei n = %d, const GLuint* arrays = 0x%0.8p)", n, arrays); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteVertexArrays(context, n, arrays)) + { + return; + } + + for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) + { + if (arrays[arrayIndex] != 0) + { + context->deleteVertexArray(arrays[arrayIndex]); + } + } + } +} + +void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint* arrays) +{ + EVENT("(GLsizei n = %d, GLuint* arrays = 0x%0.8p)", n, arrays); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenVertexArrays(context, n, arrays)) + { + return; + } + + for (int arrayIndex = 0; arrayIndex < n; arrayIndex++) + { + arrays[arrayIndex] = context->createVertexArray(); + } + } +} + +GLboolean GL_APIENTRY IsVertexArray(GLuint array) +{ + EVENT("(GLuint array = %u)", array); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateIsVertexArray(context)) + { + return GL_FALSE; + } + + if (array == 0) + { + return GL_FALSE; + } + + VertexArray *vao = context->getVertexArray(array); + + return (vao != NULL ? GL_TRUE : GL_FALSE); + } + + return GL_FALSE; +} + +void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint *data) +{ + EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint* data = 0x%0.8p)", + target, index, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGetIntegeri_v(context, target, index, data)) + { + return; + } + context->getIntegeri_v(target, index, data); + } +} + +void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode) +{ + EVENT("(GLenum primitiveMode = 0x%X)", primitiveMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateBeginTransformFeedback(context, primitiveMode)) + { + return; + } + + context->beginTransformFeedback(primitiveMode); + } +} + +void GL_APIENTRY EndTransformFeedback(void) +{ + EVENT("(void)"); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + TransformFeedback *transformFeedback = context->getGLState().getCurrentTransformFeedback(); + ASSERT(transformFeedback != NULL); + + if (!transformFeedback->isActive()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + transformFeedback->end(); + } +} + +void GL_APIENTRY BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizeiptr size = %d)", + target, index, buffer, offset, size); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + const Caps &caps = context->getCaps(); + switch (target) + { + case GL_TRANSFORM_FEEDBACK_BUFFER: + if (index >= caps.maxTransformFeedbackSeparateAttributes) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + break; + + case GL_UNIFORM_BUFFER: + if (index >= caps.maxUniformBufferBindings) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + if (buffer != 0 && size <= 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + if (!context->getGLState().isBindGeneratesResourceEnabled() && + !context->isBufferGenerated(buffer)) + { + context->handleError(Error(GL_INVALID_OPERATION, "Buffer was not generated")); + return; + } + + switch (target) + { + case GL_TRANSFORM_FEEDBACK_BUFFER: + { + // size and offset must be a multiple of 4 + if (buffer != 0 && ((offset % 4) != 0 || (size % 4) != 0)) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + // Cannot bind a transform feedback buffer if the current transform feedback is active (3.0.4 pg 91 section 2.15.2) + TransformFeedback *curTransformFeedback = + context->getGLState().getCurrentTransformFeedback(); + if (curTransformFeedback && curTransformFeedback->isActive()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + context->bindIndexedTransformFeedbackBuffer(buffer, index, offset, size); + context->bindGenericTransformFeedbackBuffer(buffer); + break; + } + + case GL_UNIFORM_BUFFER: + + // it is an error to bind an offset not a multiple of the alignment + if (buffer != 0 && (offset % caps.uniformBufferOffsetAlignment) != 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->bindIndexedUniformBuffer(buffer, index, offset, size); + context->bindGenericUniformBuffer(buffer); + break; + + default: + UNREACHABLE(); + } + } +} + +void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer) +{ + EVENT("(GLenum target = 0x%X, GLuint index = %u, GLuint buffer = %u)", + target, index, buffer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + const Caps &caps = context->getCaps(); + switch (target) + { + case GL_TRANSFORM_FEEDBACK_BUFFER: + if (index >= caps.maxTransformFeedbackSeparateAttributes) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + break; + + case GL_UNIFORM_BUFFER: + if (index >= caps.maxUniformBufferBindings) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + if (!context->getGLState().isBindGeneratesResourceEnabled() && + !context->isBufferGenerated(buffer)) + { + context->handleError(Error(GL_INVALID_OPERATION, "Buffer was not generated")); + return; + } + + switch (target) + { + case GL_TRANSFORM_FEEDBACK_BUFFER: + { + // Cannot bind a transform feedback buffer if the current transform feedback is active (3.0.4 pg 91 section 2.15.2) + TransformFeedback *curTransformFeedback = + context->getGLState().getCurrentTransformFeedback(); + if (curTransformFeedback && curTransformFeedback->isActive()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + context->bindIndexedTransformFeedbackBuffer(buffer, index, 0, 0); + context->bindGenericTransformFeedbackBuffer(buffer); + break; + } + case GL_UNIFORM_BUFFER: + context->bindIndexedUniformBuffer(buffer, index, 0, 0); + context->bindGenericUniformBuffer(buffer); + break; + + default: + UNREACHABLE(); + } + } +} + +void GL_APIENTRY TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) +{ + EVENT("(GLuint program = %u, GLsizei count = %d, const GLchar* const* varyings = 0x%0.8p, GLenum bufferMode = 0x%X)", + program, count, varyings, bufferMode); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (count < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + const Caps &caps = context->getCaps(); + switch (bufferMode) + { + case GL_INTERLEAVED_ATTRIBS: + break; + case GL_SEPARATE_ATTRIBS: + if (static_cast<GLuint>(count) > caps.maxTransformFeedbackSeparateAttributes) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + break; + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + Program *programObject = GetValidProgram(context, program); + if (!programObject) + { + return; + } + + programObject->setTransformFeedbackVaryings(count, varyings, bufferMode); + } +} + +void GL_APIENTRY GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) +{ + EVENT("(GLuint program = %u, GLuint index = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, " + "GLsizei* size = 0x%0.8p, GLenum* type = 0x%0.8p, GLchar* name = 0x%0.8p)", + program, index, bufSize, length, size, type, name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (bufSize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + if (!programObject) + { + return; + } + + if (index >= static_cast<GLuint>(programObject->getTransformFeedbackVaryingCount())) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + programObject->getTransformFeedbackVarying(index, bufSize, length, size, type, name); + } +} + +void GL_APIENTRY VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) +{ + EVENT("(GLuint index = %u, GLint size = %d, GLenum type = 0x%X, GLsizei stride = %d, const GLvoid* pointer = 0x%0.8p)", + index, size, type, stride, pointer); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + if (size < 1 || size > 4) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + switch (type) + { + case GL_BYTE: + case GL_UNSIGNED_BYTE: + case GL_SHORT: + case GL_UNSIGNED_SHORT: + case GL_INT: + case GL_UNSIGNED_INT: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + if (stride < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + // [OpenGL ES 3.0.2] Section 2.8 page 24: + // An INVALID_OPERATION error is generated when a non-zero vertex array object + // is bound, zero is bound to the ARRAY_BUFFER buffer object binding point, + // and the pointer argument is not NULL. + if (context->getGLState().getVertexArray()->id() != 0 && + context->getGLState().getArrayBufferId() == 0 && pointer != NULL) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + context->vertexAttribIPointer(index, size, type, stride, pointer); + } +} + +void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) +{ + EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", + index, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetVertexAttribIiv(context, index, pname, params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribIiv(attrib, currentValues, pname, params); + } +} + +void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) +{ + EVENT("(GLuint index = %u, GLenum pname = 0x%X, GLuint* params = 0x%0.8p)", + index, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetVertexAttribIuiv(context, index, pname, params)) + { + return; + } + + const VertexAttribCurrentValueData ¤tValues = + context->getGLState().getVertexAttribCurrentValue(index); + const VertexAttribute &attrib = + context->getGLState().getVertexArray()->getVertexAttribute(index); + QueryVertexAttribIuiv(attrib, currentValues, pname, params); + } +} + +void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) +{ + EVENT("(GLuint index = %u, GLint x = %d, GLint y = %d, GLint z = %d, GLint w = %d)", + index, x, y, z, w); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttribI4i(index, x, y, z, w); + } +} + +void GL_APIENTRY VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) +{ + EVENT("(GLuint index = %u, GLuint x = %u, GLuint y = %u, GLuint z = %u, GLuint w = %u)", + index, x, y, z, w); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttribI4ui(index, x, y, z, w); + } +} + +void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint* v) +{ + EVENT("(GLuint index = %u, const GLint* v = 0x%0.8p)", index, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttribI4iv(index, v); + } +} + +void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint* v) +{ + EVENT("(GLuint index = %u, const GLuint* v = 0x%0.8p)", index, v); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->vertexAttribI4uiv(index, v); + } +} + +void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint* params) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLuint* params = 0x%0.8p)", + program, location, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetUniformuiv(context, program, location, params)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject); + + programObject->getUniformuiv(location, params); + } +} + +GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name) +{ + EVENT("(GLuint program = %u, const GLchar *name = 0x%0.8p)", + program, name); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return -1; + } + + if (program == 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return -1; + } + + Program *programObject = context->getProgram(program); + + if (!programObject || !programObject->isLinked()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return -1; + } + + return programObject->getFragDataLocation(name); + } + + return 0; +} + +void GL_APIENTRY Uniform1ui(GLint location, GLuint v0) +{ + Uniform1uiv(location, 1, &v0); +} + +void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1) +{ + const GLuint xy[] = { v0, v1 }; + Uniform2uiv(location, 1, xy); +} + +void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) +{ + const GLuint xyz[] = { v0, v1, v2 }; + Uniform3uiv(location, 1, xyz); +} + +void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +{ + const GLuint xyzw[] = { v0, v1, v2, v3 }; + Uniform4uiv(location, 1, xyzw); +} + +void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", + location, count, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_UNSIGNED_INT, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform1uiv(location, count, value); + } +} + +void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", + location, count, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC2, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform2uiv(location, count, value); + } +} + +void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value)", + location, count, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC3, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform3uiv(location, count, value); + } +} + +void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint* value) +{ + EVENT("(GLint location = %d, GLsizei count = %d, const GLuint* value = 0x%0.8p)", + location, count, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateUniform(context, GL_UNSIGNED_INT_VEC4, location, count)) + { + return; + } + + Program *program = context->getGLState().getProgram(); + program->setUniform4uiv(location, count, value); + } +} + +void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) +{ + EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLint* value = 0x%0.8p)", + buffer, drawbuffer, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateClearBufferiv(context, buffer, drawbuffer, value)) + { + return; + } + + context->clearBufferiv(buffer, drawbuffer, value); + } +} + +void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) +{ + EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLuint* value = 0x%0.8p)", + buffer, drawbuffer, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateClearBufferuiv(context, buffer, drawbuffer, value)) + { + return; + } + + context->clearBufferuiv(buffer, drawbuffer, value); + } +} + +void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) +{ + EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, const GLfloat* value = 0x%0.8p)", + buffer, drawbuffer, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateClearBufferfv(context, buffer, drawbuffer, value)) + { + return; + } + + context->clearBufferfv(buffer, drawbuffer, value); + } +} + +void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) +{ + EVENT("(GLenum buffer = 0x%X, GLint drawbuffer = %d, GLfloat depth, GLint stencil = %d)", + buffer, drawbuffer, depth, stencil); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateClearBufferfi(context, buffer, drawbuffer, depth, stencil)) + { + return; + } + + context->clearBufferfi(buffer, drawbuffer, depth, stencil); + } +} + +const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index) +{ + EVENT("(GLenum name = 0x%X, GLuint index = %u)", name, index); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return NULL; + } + + if (name != GL_EXTENSIONS) + { + context->handleError(Error(GL_INVALID_ENUM)); + return NULL; + } + + if (index >= context->getExtensionStringCount()) + { + context->handleError(Error(GL_INVALID_VALUE)); + return NULL; + } + + return reinterpret_cast<const GLubyte *>(context->getExtensionString(index)); + } + + return NULL; +} + +void GL_APIENTRY CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) +{ + EVENT("(GLenum readTarget = 0x%X, GLenum writeTarget = 0x%X, GLintptr readOffset = %d, GLintptr writeOffset = %d, GLsizeiptr size = %d)", + readTarget, writeTarget, readOffset, writeOffset, size); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateCopyBufferSubData(context, readTarget, writeTarget, readOffset, writeOffset, + size)) + { + return; + } + + context->copyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size); + } +} + +void GL_APIENTRY GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) +{ + EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLchar* const* uniformNames = 0x%0.8p, GLuint* uniformIndices = 0x%0.8p)", + program, uniformCount, uniformNames, uniformIndices); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (uniformCount < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + if (!programObject->isLinked()) + { + for (int uniformId = 0; uniformId < uniformCount; uniformId++) + { + uniformIndices[uniformId] = GL_INVALID_INDEX; + } + } + else + { + for (int uniformId = 0; uniformId < uniformCount; uniformId++) + { + uniformIndices[uniformId] = programObject->getUniformIndex(uniformNames[uniformId]); + } + } + } +} + +void GL_APIENTRY GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) +{ + EVENT("(GLuint program = %u, GLsizei uniformCount = %d, const GLuint* uniformIndices = 0x%0.8p, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", + program, uniformCount, uniformIndices, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (uniformCount < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + switch (pname) + { + case GL_UNIFORM_TYPE: + case GL_UNIFORM_SIZE: + case GL_UNIFORM_NAME_LENGTH: + case GL_UNIFORM_BLOCK_INDEX: + case GL_UNIFORM_OFFSET: + case GL_UNIFORM_ARRAY_STRIDE: + case GL_UNIFORM_MATRIX_STRIDE: + case GL_UNIFORM_IS_ROW_MAJOR: + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + + if (uniformCount > programObject->getActiveUniformCount()) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + for (int uniformId = 0; uniformId < uniformCount; uniformId++) + { + const GLuint index = uniformIndices[uniformId]; + + if (index >= static_cast<GLuint>(programObject->getActiveUniformCount())) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + } + + for (int uniformId = 0; uniformId < uniformCount; uniformId++) + { + const GLuint index = uniformIndices[uniformId]; + params[uniformId] = programObject->getActiveUniformi(index, pname); + } + } +} + +GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) +{ + EVENT("(GLuint program = %u, const GLchar* uniformBlockName = 0x%0.8p)", program, uniformBlockName); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_INVALID_INDEX; + } + + Program *programObject = GetValidProgram(context, program); + if (!programObject) + { + return GL_INVALID_INDEX; + } + + return programObject->getUniformBlockIndex(uniformBlockName); + } + + return 0; +} + +void GL_APIENTRY GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) +{ + EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", + program, uniformBlockIndex, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetActiveUniformBlockiv(context, program, uniformBlockIndex, pname, params)) + { + return; + } + + const Program *programObject = context->getProgram(program); + QueryActiveUniformBlockiv(programObject, uniformBlockIndex, pname, params); + } +} + +void GL_APIENTRY GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) +{ + EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* uniformBlockName = 0x%0.8p)", + program, uniformBlockIndex, bufSize, length, uniformBlockName); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + if (uniformBlockIndex >= programObject->getActiveUniformBlockCount()) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + programObject->getActiveUniformBlockName(uniformBlockIndex, bufSize, length, uniformBlockName); + } +} + +void GL_APIENTRY UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) +{ + EVENT("(GLuint program = %u, GLuint uniformBlockIndex = %u, GLuint uniformBlockBinding = %u)", + program, uniformBlockIndex, uniformBlockBinding); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (uniformBlockBinding >= context->getCaps().maxUniformBufferBindings) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Program *programObject = GetValidProgram(context, program); + + if (!programObject) + { + return; + } + + // if never linked, there won't be any uniform blocks + if (uniformBlockIndex >= programObject->getActiveUniformBlockCount()) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + programObject->bindUniformBlock(uniformBlockIndex, uniformBlockBinding); + } +} + +void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) +{ + EVENT("(GLenum mode = 0x%X, GLint first = %d, GLsizei count = %d, GLsizei instanceCount = %d)", + mode, first, count, instanceCount); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (!ValidateDrawArraysInstanced(context, mode, first, count, instanceCount)) + { + return; + } + + Error error = context->drawArraysInstanced(mode, first, count, instanceCount); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) +{ + EVENT("(GLenum mode = 0x%X, GLsizei count = %d, GLenum type = 0x%X, const GLvoid* indices = 0x%0.8p, GLsizei instanceCount = %d)", + mode, count, type, indices, instanceCount); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + IndexRange indexRange; + if (!ValidateDrawElementsInstanced(context, mode, count, type, indices, instanceCount, &indexRange)) + { + return; + } + + Error error = + context->drawElementsInstanced(mode, count, type, indices, instanceCount, indexRange); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +GLsync GL_APIENTRY FenceSync_(GLenum condition, GLbitfield flags) +{ + EVENT("(GLenum condition = 0x%X, GLbitfield flags = 0x%X)", condition, flags); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return 0; + } + + if (condition != GL_SYNC_GPU_COMMANDS_COMPLETE) + { + context->handleError(Error(GL_INVALID_ENUM)); + return 0; + } + + if (flags != 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return 0; + } + + GLsync fenceSync = context->createFenceSync(); + + FenceSync *fenceSyncObject = context->getFenceSync(fenceSync); + Error error = fenceSyncObject->set(condition, flags); + if (error.isError()) + { + context->deleteFenceSync(fenceSync); + context->handleError(error); + return NULL; + } + + return fenceSync; + } + + return NULL; +} + +GLboolean GL_APIENTRY IsSync(GLsync sync) +{ + EVENT("(GLsync sync = 0x%0.8p)", sync); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_FALSE; + } + + return (context->getFenceSync(sync) != NULL); + } + + return GL_FALSE; +} + +void GL_APIENTRY DeleteSync(GLsync sync) +{ + EVENT("(GLsync sync = 0x%0.8p)", sync); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (sync != static_cast<GLsync>(0) && !context->getFenceSync(sync)) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->deleteFenceSync(sync); + } +} + +GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", + sync, flags, timeout); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_WAIT_FAILED; + } + + if ((flags & ~(GL_SYNC_FLUSH_COMMANDS_BIT)) != 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return GL_WAIT_FAILED; + } + + FenceSync *fenceSync = context->getFenceSync(sync); + + if (!fenceSync) + { + context->handleError(Error(GL_INVALID_VALUE)); + return GL_WAIT_FAILED; + } + + GLenum result = GL_WAIT_FAILED; + Error error = fenceSync->clientWait(flags, timeout, &result); + if (error.isError()) + { + context->handleError(error); + return GL_WAIT_FAILED; + } + + return result; + } + + return GL_FALSE; +} + +void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + EVENT("(GLsync sync = 0x%0.8p, GLbitfield flags = 0x%X, GLuint64 timeout = %llu)", + sync, flags, timeout); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (flags != 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + if (timeout != GL_TIMEOUT_IGNORED) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + FenceSync *fenceSync = context->getFenceSync(sync); + + if (!fenceSync) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + Error error = fenceSync->serverWait(flags, timeout); + if (error.isError()) + { + context->handleError(error); + } + } +} + +void GL_APIENTRY GetInteger64v(GLenum pname, GLint64* params) +{ + EVENT("(GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", + pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + GLenum nativeType; + unsigned int numParams = 0; + if (!ValidateStateQuery(context, pname, &nativeType, &numParams)) + { + return; + } + + if (nativeType == GL_INT_64_ANGLEX) + { + context->getInteger64v(pname, params); + } + else + { + CastStateValues(context, nativeType, pname, numParams, params); + } + } +} + +void GL_APIENTRY GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) +{ + EVENT("(GLsync sync = 0x%0.8p, GLenum pname = 0x%X, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLint* values = 0x%0.8p)", + sync, pname, bufSize, length, values); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (bufSize < 0) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + FenceSync *fenceSync = context->getFenceSync(sync); + + if (!fenceSync) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + switch (pname) + { + case GL_OBJECT_TYPE: values[0] = static_cast<GLint>(GL_SYNC_FENCE); break; + case GL_SYNC_CONDITION: values[0] = static_cast<GLint>(fenceSync->getCondition()); break; + case GL_SYNC_FLAGS: values[0] = static_cast<GLint>(fenceSync->getFlags()); break; + + case GL_SYNC_STATUS: + { + Error error = fenceSync->getStatus(values); + if (error.isError()) + { + context->handleError(error); + return; + } + break; + } + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + } +} + +void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64* data) +{ + EVENT("(GLenum target = 0x%X, GLuint index = %u, GLint64* data = 0x%0.8p)", + target, index, data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGetInteger64i_v(context, target, index, data)) + { + return; + } + context->getInteger64i_v(target, index, data); + } +} + +void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint64* params = 0x%0.8p)", + target, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetBufferParameteri64v(context, target, pname, params)) + { + return; + } + + Buffer *buffer = context->getGLState().getTargetBuffer(target); + QueryBufferParameteri64v(buffer, pname, params); + } +} + +void GL_APIENTRY GenSamplers(GLsizei count, GLuint* samplers) +{ + EVENT("(GLsizei count = %d, GLuint* samplers = 0x%0.8p)", count, samplers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenSamplers(context, count, samplers)) + { + return; + } + + for (int i = 0; i < count; i++) + { + samplers[i] = context->createSampler(); + } + } +} + +void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint* samplers) +{ + EVENT("(GLsizei count = %d, const GLuint* samplers = 0x%0.8p)", count, samplers); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteSamplers(context, count, samplers)) + { + return; + } + + for (int i = 0; i < count; i++) + { + context->deleteSampler(samplers[i]); + } + } +} + +GLboolean GL_APIENTRY IsSampler(GLuint sampler) +{ + EVENT("(GLuint sampler = %u)", sampler); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_FALSE; + } + + return context->isSampler(sampler); + } + + return GL_FALSE; +} + +void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler) +{ + EVENT("(GLuint unit = %u, GLuint sampler = %u)", unit, sampler); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (sampler != 0 && !context->isSampler(sampler)) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (unit >= context->getCaps().maxCombinedTextureImageUnits) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->bindSampler(unit, sampler); + } +} + +void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param) +{ + EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint param = %d)", sampler, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateSamplerParameteri(context, sampler, pname, param)) + { + return; + } + + context->samplerParameteri(sampler, pname, param); + } +} + +void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) +{ + EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLint* params = 0x%0.8p)", sampler, + pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateSamplerParameteriv(context, sampler, pname, param)) + { + return; + } + + context->samplerParameteriv(sampler, pname, param); + } +} + +void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) +{ + EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLfloat param = %g)", sampler, pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateSamplerParameterf(context, sampler, pname, param)) + { + return; + } + + context->samplerParameterf(sampler, pname, param); + } +} + +void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) +{ + EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, const GLfloat* params = 0x%0.8p)", sampler, + pname, param); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateSamplerParameterfv(context, sampler, pname, param)) + { + return; + } + + context->samplerParameterfv(sampler, pname, param); + } +} + +void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint *params) +{ + EVENT("(GLuint sampler = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", sampler, pname, + params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetSamplerParameteriv(context, sampler, pname, params)) + { + return; + } + + context->getSamplerParameteriv(sampler, pname, params); + } +} + +void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) +{ + EVENT("(GLuint sample = %ur, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", sampler, pname, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetSamplerParameterfv(context, sampler, pname, params)) + { + return; + } + + context->getSamplerParameterfv(sampler, pname, params); + } +} + +void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor) +{ + EVENT("(GLuint index = %u, GLuint divisor = %u)", index, divisor); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (index >= MAX_VERTEX_ATTRIBS) + { + context->handleError(Error(GL_INVALID_VALUE)); + return; + } + + context->setVertexAttribDivisor(index, divisor); + } +} + +void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id) +{ + EVENT("(GLenum target = 0x%X, GLuint id = %u)", target, id); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + switch (target) + { + case GL_TRANSFORM_FEEDBACK: + { + // Cannot bind a transform feedback object if the current one is started and not paused (3.0.2 pg 85 section 2.14.1) + TransformFeedback *curTransformFeedback = + context->getGLState().getCurrentTransformFeedback(); + if (curTransformFeedback && curTransformFeedback->isActive() && !curTransformFeedback->isPaused()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + // Cannot bind a transform feedback object that does not exist (3.0.2 pg 85 section 2.14.1) + if (!context->isTransformFeedbackGenerated(id)) + { + context->handleError( + Error(GL_INVALID_OPERATION, + "Cannot bind a transform feedback object that does not exist.")); + return; + } + + context->bindTransformFeedback(id); + } + break; + + default: + context->handleError(Error(GL_INVALID_ENUM)); + return; + } + } +} + +void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint* ids) +{ + EVENT("(GLsizei n = %d, const GLuint* ids = 0x%0.8p)", n, ids); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateDeleteTransformFeedbacks(context, n, ids)) + { + return; + } + + for (int i = 0; i < n; i++) + { + context->deleteTransformFeedback(ids[i]); + } + } +} + +void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint* ids) +{ + EVENT("(GLsizei n = %d, GLuint* ids = 0x%0.8p)", n, ids); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGenTransformFeedbacks(context, n, ids)) + { + return; + } + + for (int i = 0; i < n; i++) + { + ids[i] = context->createTransformFeedback(); + } + } +} + +GLboolean GL_APIENTRY IsTransformFeedback(GLuint id) +{ + EVENT("(GLuint id = %u)", id); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return GL_FALSE; + } + + if (id == 0) + { + // The 3.0.4 spec [section 6.1.11] states that if ID is zero, IsTransformFeedback + // returns FALSE + return GL_FALSE; + } + + const TransformFeedback *transformFeedback = context->getTransformFeedback(id); + return ((transformFeedback != nullptr) ? GL_TRUE : GL_FALSE); + } + + return GL_FALSE; +} + +void GL_APIENTRY PauseTransformFeedback(void) +{ + EVENT("(void)"); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + TransformFeedback *transformFeedback = context->getGLState().getCurrentTransformFeedback(); + ASSERT(transformFeedback != NULL); + + // Current transform feedback must be active and not paused in order to pause (3.0.2 pg 86) + if (!transformFeedback->isActive() || transformFeedback->isPaused()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + transformFeedback->pause(); + } +} + +void GL_APIENTRY ResumeTransformFeedback(void) +{ + EVENT("(void)"); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + TransformFeedback *transformFeedback = context->getGLState().getCurrentTransformFeedback(); + ASSERT(transformFeedback != NULL); + + // Current transform feedback must be active and paused in order to resume (3.0.2 pg 86) + if (!transformFeedback->isActive() || !transformFeedback->isPaused()) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + transformFeedback->resume(); + } +} + +void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) +{ + EVENT("(GLuint program = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLenum* binaryFormat = 0x%0.8p, GLvoid* binary = 0x%0.8p)", + program, bufSize, length, binaryFormat, binary); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateGetProgramBinary(context, program, bufSize, length, binaryFormat, binary)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject != nullptr); + + Error error = programObject->saveBinary(binaryFormat, binary, bufSize, length); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) +{ + EVENT("(GLuint program = %u, GLenum binaryFormat = 0x%X, const GLvoid* binary = 0x%0.8p, GLsizei length = %d)", + program, binaryFormat, binary, length); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!ValidateProgramBinary(context, program, binaryFormat, binary, length)) + { + return; + } + + Program *programObject = context->getProgram(program); + ASSERT(programObject != nullptr); + + Error error = programObject->loadBinary(binaryFormat, binary, length); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value) +{ + EVENT("(GLuint program = %u, GLenum pname = 0x%X, GLint value = %d)", + program, pname, value); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateProgramParameteri(context, program, pname, value)) + { + return; + } + + context->programParameteri(program, pname, value); + } +} + +void GL_APIENTRY InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) +{ + EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p)", + target, numAttachments, attachments); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateInvalidateFramebuffer(context, target, numAttachments, attachments)) + { + return; + } + + context->invalidateFramebuffer(target, numAttachments, attachments); + } +} + +void GL_APIENTRY InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLsizei numAttachments = %d, const GLenum* attachments = 0x%0.8p, GLint x = %d, " + "GLint y = %d, GLsizei width = %d, GLsizei height = %d)", + target, numAttachments, attachments, x, y, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateInvalidateFramebuffer(context, target, numAttachments, attachments)) + { + return; + } + + context->invalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height); + } +} + +void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) +{ + EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, GLsizei height = %d)", + target, levels, internalformat, width, height); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (!ValidateES3TexStorage2DParameters(context, target, levels, internalformat, width, + height, 1)) + { + return; + } + + Extents size(width, height, 1); + Texture *texture = context->getTargetTexture(target); + Error error = texture->setStorage(target, levels, internalformat, size); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) +{ + EVENT("(GLenum target = 0x%X, GLsizei levels = %d, GLenum internalformat = 0x%X, GLsizei width = %d, " + "GLsizei height = %d, GLsizei depth = %d)", + target, levels, internalformat, width, height, depth); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (context->getClientMajorVersion() < 3) + { + context->handleError(Error(GL_INVALID_OPERATION)); + return; + } + + if (!ValidateES3TexStorage3DParameters(context, target, levels, internalformat, width, + height, depth)) + { + return; + } + + Extents size(width, height, depth); + Texture *texture = context->getTargetTexture(target); + Error error = texture->setStorage(target, levels, internalformat, size); + if (error.isError()) + { + context->handleError(error); + return; + } + } +} + +void GL_APIENTRY GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) +{ + EVENT("(GLenum target = 0x%X, GLenum internalformat = 0x%X, GLenum pname = 0x%X, GLsizei bufSize = %d, " + "GLint* params = 0x%0.8p)", + target, internalformat, pname, bufSize, params); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && + !ValidateGetInternalFormativ(context, target, internalformat, pname, bufSize, params)) + { + return; + } + + const TextureCaps &formatCaps = context->getTextureCaps().get(internalformat); + QueryInternalFormativ(formatCaps, pname, bufSize, params); + } +} + +} diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_3_0.h b/gfx/angle/src/libGLESv2/entry_points_gles_3_0.h new file mode 100755 index 000000000..09ca0e464 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_3_0.h @@ -0,0 +1,125 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_3_0.h : Defines the GLES 3.0 entry points. + +#ifndef LIBGLESV2_ENTRYPOINTGLES30_H_ +#define LIBGLESV2_ENTRYPOINTGLES30_H_ + +#include <GLES3/gl3.h> +#include <export.h> + +namespace gl +{ + +ANGLE_EXPORT void GL_APIENTRY ReadBuffer(GLenum mode); +ANGLE_EXPORT void GL_APIENTRY DrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices); +ANGLE_EXPORT void GL_APIENTRY TexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +ANGLE_EXPORT void GL_APIENTRY TexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +ANGLE_EXPORT void GL_APIENTRY CopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +ANGLE_EXPORT void GL_APIENTRY CompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +ANGLE_EXPORT void GL_APIENTRY CompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +ANGLE_EXPORT void GL_APIENTRY GenQueries(GLsizei n, GLuint* ids); +ANGLE_EXPORT void GL_APIENTRY DeleteQueries(GLsizei n, const GLuint* ids); +ANGLE_EXPORT GLboolean GL_APIENTRY IsQuery(GLuint id); +ANGLE_EXPORT void GL_APIENTRY BeginQuery(GLenum target, GLuint id); +ANGLE_EXPORT void GL_APIENTRY EndQuery(GLenum target); +ANGLE_EXPORT void GL_APIENTRY GetQueryiv(GLenum target, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params); +ANGLE_EXPORT GLboolean GL_APIENTRY UnmapBuffer(GLenum target); +ANGLE_EXPORT void GL_APIENTRY GetBufferPointerv(GLenum target, GLenum pname, GLvoid** params); +ANGLE_EXPORT void GL_APIENTRY DrawBuffers(GLsizei n, const GLenum* bufs); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY UniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY BlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +ANGLE_EXPORT void GL_APIENTRY RenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +ANGLE_EXPORT void GL_APIENTRY FramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); +ANGLE_EXPORT GLvoid* GL_APIENTRY MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); +ANGLE_EXPORT void GL_APIENTRY FlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length); +ANGLE_EXPORT void GL_APIENTRY BindVertexArray(GLuint array); +ANGLE_EXPORT void GL_APIENTRY DeleteVertexArrays(GLsizei n, const GLuint* arrays); +ANGLE_EXPORT void GL_APIENTRY GenVertexArrays(GLsizei n, GLuint* arrays); +ANGLE_EXPORT GLboolean GL_APIENTRY IsVertexArray(GLuint array); +ANGLE_EXPORT void GL_APIENTRY GetIntegeri_v(GLenum target, GLuint index, GLint* data); +ANGLE_EXPORT void GL_APIENTRY BeginTransformFeedback(GLenum primitiveMode); +ANGLE_EXPORT void GL_APIENTRY EndTransformFeedback(void); +ANGLE_EXPORT void GL_APIENTRY BindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); +ANGLE_EXPORT void GL_APIENTRY BindBufferBase(GLenum target, GLuint index, GLuint buffer); +ANGLE_EXPORT void GL_APIENTRY TransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode); +ANGLE_EXPORT void GL_APIENTRY GetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name); +ANGLE_EXPORT void GL_APIENTRY VertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIiv(GLuint index, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params); +ANGLE_EXPORT void GL_APIENTRY VertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); +ANGLE_EXPORT void GL_APIENTRY VertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); +ANGLE_EXPORT void GL_APIENTRY VertexAttribI4iv(GLuint index, const GLint* v); +ANGLE_EXPORT void GL_APIENTRY VertexAttribI4uiv(GLuint index, const GLuint* v); +ANGLE_EXPORT void GL_APIENTRY GetUniformuiv(GLuint program, GLint location, GLuint* params); +ANGLE_EXPORT GLint GL_APIENTRY GetFragDataLocation(GLuint program, const GLchar *name); +ANGLE_EXPORT void GL_APIENTRY Uniform1ui(GLint location, GLuint v0); +ANGLE_EXPORT void GL_APIENTRY Uniform2ui(GLint location, GLuint v0, GLuint v1); +ANGLE_EXPORT void GL_APIENTRY Uniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2); +ANGLE_EXPORT void GL_APIENTRY Uniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +ANGLE_EXPORT void GL_APIENTRY Uniform1uiv(GLint location, GLsizei count, const GLuint* value); +ANGLE_EXPORT void GL_APIENTRY Uniform2uiv(GLint location, GLsizei count, const GLuint* value); +ANGLE_EXPORT void GL_APIENTRY Uniform3uiv(GLint location, GLsizei count, const GLuint* value); +ANGLE_EXPORT void GL_APIENTRY Uniform4uiv(GLint location, GLsizei count, const GLuint* value); +ANGLE_EXPORT void GL_APIENTRY ClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value); +ANGLE_EXPORT void GL_APIENTRY ClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value); +ANGLE_EXPORT void GL_APIENTRY ClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value); +ANGLE_EXPORT void GL_APIENTRY ClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); +ANGLE_EXPORT const GLubyte *GL_APIENTRY GetStringi(GLenum name, GLuint index); +ANGLE_EXPORT void GL_APIENTRY CopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +ANGLE_EXPORT void GL_APIENTRY GetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices); +ANGLE_EXPORT void GL_APIENTRY GetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params); +ANGLE_EXPORT GLuint GL_APIENTRY GetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName); +ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName); +ANGLE_EXPORT void GL_APIENTRY UniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); +ANGLE_EXPORT void GL_APIENTRY DrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount); +ANGLE_EXPORT void GL_APIENTRY DrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount); +ANGLE_EXPORT GLsync GL_APIENTRY FenceSync_(GLenum condition, GLbitfield flags); +ANGLE_EXPORT GLboolean GL_APIENTRY IsSync(GLsync sync); +ANGLE_EXPORT void GL_APIENTRY DeleteSync(GLsync sync); +ANGLE_EXPORT GLenum GL_APIENTRY ClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); +ANGLE_EXPORT void GL_APIENTRY WaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); +ANGLE_EXPORT void GL_APIENTRY GetInteger64v(GLenum pname, GLint64* params); +ANGLE_EXPORT void GL_APIENTRY GetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values); +ANGLE_EXPORT void GL_APIENTRY GetInteger64i_v(GLenum target, GLuint index, GLint64* data); +ANGLE_EXPORT void GL_APIENTRY GetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params); +ANGLE_EXPORT void GL_APIENTRY GenSamplers(GLsizei count, GLuint* samplers); +ANGLE_EXPORT void GL_APIENTRY DeleteSamplers(GLsizei count, const GLuint* samplers); +ANGLE_EXPORT GLboolean GL_APIENTRY IsSampler(GLuint sampler); +ANGLE_EXPORT void GL_APIENTRY BindSampler(GLuint unit, GLuint sampler); +ANGLE_EXPORT void GL_APIENTRY SamplerParameteri(GLuint sampler, GLenum pname, GLint param); +ANGLE_EXPORT void GL_APIENTRY SamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param); +ANGLE_EXPORT void GL_APIENTRY SamplerParameterf(GLuint sampler, GLenum pname, GLfloat param); +ANGLE_EXPORT void GL_APIENTRY SamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param); +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params); +ANGLE_EXPORT void GL_APIENTRY GetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params); +ANGLE_EXPORT void GL_APIENTRY VertexAttribDivisor(GLuint index, GLuint divisor); +ANGLE_EXPORT void GL_APIENTRY BindTransformFeedback(GLenum target, GLuint id); +ANGLE_EXPORT void GL_APIENTRY DeleteTransformFeedbacks(GLsizei n, const GLuint* ids); +ANGLE_EXPORT void GL_APIENTRY GenTransformFeedbacks(GLsizei n, GLuint* ids); +ANGLE_EXPORT GLboolean GL_APIENTRY IsTransformFeedback(GLuint id); +ANGLE_EXPORT void GL_APIENTRY PauseTransformFeedback(void); +ANGLE_EXPORT void GL_APIENTRY ResumeTransformFeedback(void); +ANGLE_EXPORT void GL_APIENTRY GetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary); +ANGLE_EXPORT void GL_APIENTRY ProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length); +ANGLE_EXPORT void GL_APIENTRY ProgramParameteri(GLuint program, GLenum pname, GLint value); +ANGLE_EXPORT void GL_APIENTRY InvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments); +ANGLE_EXPORT void GL_APIENTRY InvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height); +ANGLE_EXPORT void GL_APIENTRY TexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +ANGLE_EXPORT void GL_APIENTRY TexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +ANGLE_EXPORT void GL_APIENTRY GetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params); + +} + +#endif // LIBGLESV2_ENTRYPOINTGLES30_H_ diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_3_1.cpp b/gfx/angle/src/libGLESv2/entry_points_gles_3_1.cpp new file mode 100755 index 000000000..ae0405e99 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_3_1.cpp @@ -0,0 +1,1201 @@ +// +// Copyright(c) 2016 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_3_1.cpp : Implements the GLES 3.1 Entry point. + +#include "libGLESv2/entry_points_gles_3_1.h" +#include "libGLESv2/global_state.h" + +#include "libANGLE/Context.h" +#include "libANGLE/Error.h" + +#include "libANGLE/validationES31.h" + +#include "common/debug.h" + +namespace gl +{ + +void GL_APIENTRY DispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ) +{ + EVENT("(GLuint numGroupsX = %u, GLuint numGroupsY = %u, numGroupsZ = %u", numGroupsX, + numGroupsY, numGroupsZ); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY DispatchComputeIndirect(GLintptr indirect) +{ + EVENT("(GLintptr indirect = %d)", indirect); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY DrawArraysIndirect(GLenum mode, const void *indirect) +{ + EVENT("(GLenum mode = 0x%X, const void* indirect)", mode, indirect); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) +{ + EVENT("(GLenum mode = 0x%X, GLenum type = 0x%X, const void* indirect)", mode, type, indirect); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY FramebufferParameteri(GLenum target, GLenum pname, GLint param) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint param = %d)", target, pname, param); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", target, pname, + params); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GetProgramInterfaceiv(GLuint program, + GLenum programInterface, + GLenum pname, + GLint *params) +{ + EVENT( + "(GLuint program = %u, GLenum programInterface = 0x%X, GLenum pname = 0x%X, GLint* params " + "= 0x%0.8p)", + program, programInterface, pname, params); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +GLuint GL_APIENTRY GetProgramResourceIndex(GLuint program, + GLenum programInterface, + const GLchar *name) +{ + EVENT("(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar* name = 0x%0.8p)", + program, programInterface, name); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } + return 0u; +} + +void GL_APIENTRY GetProgramResourceName(GLuint program, + GLenum programInterface, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLchar *name) +{ + EVENT( + "(GLuint program = %u, GLenum programInterface = 0x%X, GLuint index = %u, GLsizei bufSize " + "= %d, GLsizei* length = 0x%0.8p, GLchar* name = 0x%0.8p)", + program, programInterface, index, bufSize, length, name); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GetProgramResourceiv(GLuint program, + GLenum programInterface, + GLuint index, + GLsizei propCount, + const GLenum *props, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + EVENT( + "(GLuint program = %u, GLenum programInterface = 0x%X, GLuint index = %u, GLsizei " + "propCount = %d, const GLenum* props = 0x%0.8p, GLsizei bufSize = %d, GLsizei* length = " + "0x%0.8p, GLint* params = 0x%0.8p)", + program, programInterface, index, propCount, props, bufSize, length, params); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +GLint GL_APIENTRY GetProgramResourceLocation(GLuint program, + GLenum programInterface, + const GLchar *name) +{ + EVENT("(GLuint program = %u, GLenum programInterface = 0x%X, const GLchar* name = 0x%0.8p)", + program, programInterface, name); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } + return 0; +} + +void GL_APIENTRY UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) +{ + EVENT("(GLuint pipeline = %u, GLbitfield stages = 0x%X, GLuint program = %u)", pipeline, stages, + program); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ActiveShaderProgram(GLuint pipeline, GLuint program) +{ + EVENT("(GLuint pipeline = %u, GLuint program = %u)", pipeline, program); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +GLuint GL_APIENTRY CreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings) +{ + EVENT("(GLenum type = %0x%X, GLsizei count = %d, const GLchar *const* = 0x%0.8p)", type, count, + strings); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } + return 0u; +} + +void GL_APIENTRY BindProgramPipeline(GLuint pipeline) +{ + EVENT("(GLuint pipeline = %u)", pipeline); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines) +{ + EVENT("(GLsizei n = %d, const GLuint* pipelines = 0x%0.8p)", n, pipelines); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines) +{ + EVENT("(GLsizei n = %d, GLuint* pipelines = 0x%0.8p)", n, pipelines); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline) +{ + EVENT("(GLuint pipeline = %u)", pipeline); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } + return false; +} + +void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) +{ + EVENT("(GLuint pipeline = %u, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", pipeline, pname, + params); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform1i(GLuint program, GLint location, GLint v0) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d)", program, location, v0); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d)", program, + location, v0, v1); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d)", + program, location, v0, v1, v2); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY +ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLint v0 = %d, GLint v1 = %d, GLint v2 = %d, " + "GLint v3 = %d)", + program, location, v0, v1, v2, v3); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform1ui(GLuint program, GLint location, GLuint v0) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u)", program, location, v0); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u)", program, + location, v0, v1); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = " + "%u)", + program, location, v0, v1, v2); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY +ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLuint v0 = %u, GLuint v1 = %u, GLuint v2 = " + "%u, GLuint v3 = %u)", + program, location, v0, v1, v2, v3); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform1f(GLuint program, GLint location, GLfloat v0) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %g)", program, location, v0); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) +{ + EVENT("(GLuint program = %u, GLint location = %d, GLfloat v0 = %g, GLfloat v1 = %g)", program, + location, v0, v1); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY +ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLfloat v0 = %g, GLfloat v1 = %g, GLfloat v2 = " + "%g)", + program, location, v0, v1, v2); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY +ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLfloat v0 = %g, GLfloat v1 = %g, GLfloat v2 = " + "%g, GLfloat v3 = %g)", + program, location, v0, v1, v2, v3); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform1iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform2iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform3iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform4iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform1uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform2uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform3uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform4uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLuint* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform1fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform2fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform3fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniform4fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, const GLfloat* value = " + "0x%0.8p)", + program, location, count, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix2x3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix3x2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix2x4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix4x2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix3x4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ProgramUniformMatrix4x3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + EVENT( + "(GLuint program = %u, GLint location = %d, GLsizei count = %d, GLboolean transpose = %u, " + "const GLfloat* value = 0x%0.8p)", + program, location, count, transpose, value); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY ValidateProgramPipeline(GLuint pipeline) +{ + EVENT("(GLuint pipeline = %u)", pipeline); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GetProgramPipelineInfoLog(GLuint pipeline, + GLsizei bufSize, + GLsizei *length, + GLchar *infoLog) +{ + EVENT( + "(GLuint pipeline = %u, GLsizei bufSize = %d, GLsizei* length = 0x%0.8p, GLchar* infoLog = " + "0x%0.8p)", + pipeline, bufSize, length, infoLog); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY BindImageTexture(GLuint unit, + GLuint texture, + GLint level, + GLboolean layered, + GLint layer, + GLenum access, + GLenum format) +{ + EVENT( + "(GLuint unit = %u, GLuint texture = %u, GLint level = %d, GLboolean layered = %u, GLint " + "layer = %d, GLenum access = 0x%X, GLenum format = 0x%X)", + unit, texture, level, layered, layer, access, format); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GetBooleani_v(GLenum target, GLuint index, GLboolean *data) +{ + EVENT("(GLenum target = 0x%X, GLuint index = %u, GLboolean* data = 0x%0.8p)", target, index, + data); + + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation() && !ValidateGetBooleani_v(context, target, index, data)) + { + return; + } + context->getBooleani_v(target, index, data); + } +} + +void GL_APIENTRY MemoryBarrier(GLbitfield barriers) +{ + EVENT("(GLbitfield barriers = 0x%X)", barriers); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers) +{ + EVENT("(GLbitfield barriers = 0x%X)", barriers); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY TexStorage2DMultisample(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLboolean fixedsamplelocations) +{ + EVENT( + "(GLenum target = 0x%X, GLsizei samples = %d, GLenum internalformat = 0x%X, GLsizei width " + "= %d, GLsizei height = %d, GLboolean fixedsamplelocations = %u)", + target, samples, internalformat, width, height, fixedsamplelocations); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val) +{ + EVENT("(GLenum pname = 0x%X, GLuint index = %u, GLfloat* val = 0x%0.8p)", pname, index, val); + UNIMPLEMENTED(); +} + +void GL_APIENTRY SampleMaski(GLuint maskNumber, GLbitfield mask) +{ + EVENT("(GLuint maskNumber = %u, GLbitfield mask = 0x%X)", maskNumber, mask); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY GetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) +{ + EVENT("(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLint* params = 0x%0.8p)", + target, level, pname, params); + UNIMPLEMENTED(); +} + +void GL_APIENTRY GetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params) +{ + EVENT( + "(GLenum target = 0x%X, GLint level = %d, GLenum pname = 0x%X, GLfloat* params = 0x%0.8p)", + target, level, pname, params); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY BindVertexBuffer(GLuint bindingindex, + GLuint buffer, + GLintptr offset, + GLsizei stride) +{ + EVENT( + "(GLuint bindingindex = %u, GLuint buffer = %u, GLintptr offset = %d, GLsizei stride = %d)", + bindingindex, buffer, offset, stride); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY VertexAttribFormat(GLuint attribindex, + GLint size, + GLenum type, + GLboolean normalized, + GLuint relativeoffset) +{ + EVENT( + "(GLuint attribindex = %u, GLint size = %d, GLenum type = 0x%X, GLboolean normalized = %u, " + "GLuint relativeoffset = %u)", + attribindex, size, type, normalized, relativeoffset); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY VertexAttribIFormat(GLuint attribindex, + GLint size, + GLenum type, + GLuint relativeoffset) +{ + EVENT( + "(GLuint attribindex = %u, GLint size = %d, GLenum type = 0x%X, GLuint relativeoffset = " + "%u)", + attribindex, size, type, relativeoffset); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY VertexAttribBinding(GLuint attribindex, GLuint bindingindex) +{ + EVENT("(GLuint attribindex = %u, GLuint bindingindex = %u)", attribindex, bindingindex); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} + +void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor) +{ + EVENT("(GLuint bindingindex = %u, GLuint divisor = %u)", bindingindex, divisor); + Context *context = GetValidGlobalContext(); + if (context) + { + if (!context->skipValidation()) + { + context->handleError(Error(GL_INVALID_OPERATION, "Entry point not implemented")); + } + UNIMPLEMENTED(); + } +} +} // namespace gl diff --git a/gfx/angle/src/libGLESv2/entry_points_gles_3_1.h b/gfx/angle/src/libGLESv2/entry_points_gles_3_1.h new file mode 100755 index 000000000..1500fdee8 --- /dev/null +++ b/gfx/angle/src/libGLESv2/entry_points_gles_3_1.h @@ -0,0 +1,229 @@ +// +// Copyright(c) 2016 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// entry_points_gles_3_1.h : Defines the GLES 3.1 entry points. + +#ifndef LIBGLESV2_ENTRYPOINTGLES31_H_ +#define LIBGLESV2_ENTRYPOINTGLES31_H_ + +#include <GLES3/gl31.h> +#include <export.h> + +// we include the platform.h header since it undefines the conflicting MemoryBarrier macro +#include "common/platform.h" + +namespace gl +{ + +ANGLE_EXPORT void GL_APIENTRY DispatchCompute(GLuint numGroupsX, + GLuint numGroupsY, + GLuint numGroupsZ); +ANGLE_EXPORT void GL_APIENTRY DispatchComputeIndirect(GLintptr indirect); +ANGLE_EXPORT void GL_APIENTRY DrawArraysIndirect(GLenum mode, const void *indirect); +ANGLE_EXPORT void GL_APIENTRY DrawElementsIndirect(GLenum mode, GLenum type, const void *indirect); +ANGLE_EXPORT void GL_APIENTRY FramebufferParameteri(GLenum target, GLenum pname, GLint param); +ANGLE_EXPORT void GL_APIENTRY GetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetProgramInterfaceiv(GLuint program, + GLenum programInterface, + GLenum pname, + GLint *params); +ANGLE_EXPORT GLuint GL_APIENTRY GetProgramResourceIndex(GLuint program, + GLenum programInterface, + const GLchar *name); +ANGLE_EXPORT void GL_APIENTRY GetProgramResourceName(GLuint program, + GLenum programInterface, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLchar *name); +ANGLE_EXPORT void GL_APIENTRY GetProgramResourceiv(GLuint program, + GLenum programInterface, + GLuint index, + GLsizei propCount, + const GLenum *props, + GLsizei bufSize, + GLsizei *length, + GLint *params); +ANGLE_EXPORT GLint GL_APIENTRY GetProgramResourceLocation(GLuint program, + GLenum programInterface, + const GLchar *name); +ANGLE_EXPORT void GL_APIENTRY UseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program); +ANGLE_EXPORT void GL_APIENTRY ActiveShaderProgram(GLuint pipeline, GLuint program); +ANGLE_EXPORT GLuint GL_APIENTRY CreateShaderProgramv(GLenum type, + GLsizei count, + const GLchar *const *strings); +ANGLE_EXPORT void GL_APIENTRY BindProgramPipeline(GLuint pipeline); +ANGLE_EXPORT void GL_APIENTRY DeleteProgramPipelines(GLsizei n, const GLuint *pipelines); +ANGLE_EXPORT void GL_APIENTRY GenProgramPipelines(GLsizei n, GLuint *pipelines); +ANGLE_EXPORT GLboolean GL_APIENTRY IsProgramPipeline(GLuint pipeline); +ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform1i(GLuint program, GLint location, GLint v0); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1); +ANGLE_EXPORT void GL_APIENTRY +ProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2); +ANGLE_EXPORT void GL_APIENTRY +ProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform1ui(GLuint program, GLint location, GLuint v0); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform2ui(GLuint program, + GLint location, + GLuint v0, + GLuint v1); +ANGLE_EXPORT void GL_APIENTRY +ProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); +ANGLE_EXPORT void GL_APIENTRY +ProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform1f(GLuint program, GLint location, GLfloat v0); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform2f(GLuint program, + GLint location, + GLfloat v0, + GLfloat v1); +ANGLE_EXPORT void GL_APIENTRY +ProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); +ANGLE_EXPORT void GL_APIENTRY +ProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform1iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform2iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform3iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform4iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform1uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform2uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform3uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform4uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform1fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform2fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform3fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniform4fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2x3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3x2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix2x4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4x2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix3x4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ProgramUniformMatrix4x3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value); +ANGLE_EXPORT void GL_APIENTRY ValidateProgramPipeline(GLuint pipeline); +ANGLE_EXPORT void GL_APIENTRY GetProgramPipelineInfoLog(GLuint pipeline, + GLsizei bufSize, + GLsizei *length, + GLchar *infoLog); +ANGLE_EXPORT void GL_APIENTRY BindImageTexture(GLuint unit, + GLuint texture, + GLint level, + GLboolean layered, + GLint layer, + GLenum access, + GLenum format); +ANGLE_EXPORT void GL_APIENTRY GetBooleani_v(GLenum target, GLuint index, GLboolean *data); + +ANGLE_EXPORT void GL_APIENTRY MemoryBarrier(GLbitfield barriers); +ANGLE_EXPORT void GL_APIENTRY MemoryBarrierByRegion(GLbitfield barriers); +ANGLE_EXPORT void GL_APIENTRY TexStorage2DMultisample(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLboolean fixedsamplelocations); +ANGLE_EXPORT void GL_APIENTRY GetMultisamplefv(GLenum pname, GLuint index, GLfloat *val); +ANGLE_EXPORT void GL_APIENTRY SampleMaski(GLuint maskNumber, GLbitfield mask); +ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameteriv(GLenum target, + GLint level, + GLenum pname, + GLint *params); +ANGLE_EXPORT void GL_APIENTRY GetTexLevelParameterfv(GLenum target, + GLint level, + GLenum pname, + GLfloat *params); +ANGLE_EXPORT void GL_APIENTRY BindVertexBuffer(GLuint bindingindex, + GLuint buffer, + GLintptr offset, + GLsizei stride); +ANGLE_EXPORT void GL_APIENTRY VertexAttribFormat(GLuint attribindex, + GLint size, + GLenum type, + GLboolean normalized, + GLuint relativeoffset); +ANGLE_EXPORT void GL_APIENTRY VertexAttribIFormat(GLuint attribindex, + GLint size, + GLenum type, + GLuint relativeoffset); +ANGLE_EXPORT void GL_APIENTRY VertexAttribBinding(GLuint attribindex, GLuint bindingindex); +ANGLE_EXPORT void GL_APIENTRY VertexBindingDivisor(GLuint bindingindex, GLuint divisor); +}; + +#endif // LIBGLESV2_ENTRYPOINTGLES31_H_ diff --git a/gfx/angle/src/libGLESv2/global_state.cpp b/gfx/angle/src/libGLESv2/global_state.cpp new file mode 100755 index 000000000..bc776b1f7 --- /dev/null +++ b/gfx/angle/src/libGLESv2/global_state.cpp @@ -0,0 +1,148 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// global_state.cpp : Implements functions for querying the thread-local GL and EGL state. + +#include "libGLESv2/global_state.h" + +#include "common/debug.h" +#include "common/platform.h" +#include "common/tls.h" + +#include "libANGLE/Thread.h" + +namespace gl +{ + +Context *GetGlobalContext() +{ + egl::Thread *thread = egl::GetCurrentThread(); + return thread->getContext(); +} + +Context *GetValidGlobalContext() +{ + egl::Thread *thread = egl::GetCurrentThread(); + return thread->getValidContext(); +} + +} // namespace gl + +namespace egl +{ + +namespace +{ + +static TLSIndex threadTLS = TLS_INVALID_INDEX; + +Thread *AllocateCurrentThread() +{ + ASSERT(threadTLS != TLS_INVALID_INDEX); + if (threadTLS == TLS_INVALID_INDEX) + { + return nullptr; + } + + Thread *thread = new Thread(); + if (!SetTLSValue(threadTLS, thread)) + { + ERR("Could not set thread local storage."); + return nullptr; + } + + return thread; +} + +} // anonymous namespace + +Thread *GetCurrentThread() +{ + // Create a TLS index if one has not been created for this DLL + if (threadTLS == TLS_INVALID_INDEX) + { + threadTLS = CreateTLSIndex(); + } + + Thread *current = static_cast<Thread *>(GetTLSValue(threadTLS)); + + // ANGLE issue 488: when the dll is loaded after thread initialization, + // thread local storage (current) might not exist yet. + return (current ? current : AllocateCurrentThread()); +} + +} // namespace egl + +#ifdef ANGLE_PLATFORM_WINDOWS +namespace egl +{ + +namespace +{ + +bool DeallocateCurrentThread() +{ + Thread *thread = static_cast<Thread *>(GetTLSValue(threadTLS)); + SafeDelete(thread); + return SetTLSValue(threadTLS, nullptr); +} + +bool InitializeProcess() +{ + threadTLS = CreateTLSIndex(); + if (threadTLS == TLS_INVALID_INDEX) + { + return false; + } + + return AllocateCurrentThread() != nullptr; +} + +bool TerminateProcess() +{ + if (!DeallocateCurrentThread()) + { + return false; + } + + if (threadTLS != TLS_INVALID_INDEX) + { + TLSIndex tlsCopy = threadTLS; + threadTLS = TLS_INVALID_INDEX; + + if (!DestroyTLSIndex(tlsCopy)) + { + return false; + } + } + + return true; +} + +} // anonymous namespace + +} // namespace egl + +extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD reason, LPVOID) +{ + switch (reason) + { + case DLL_PROCESS_ATTACH: + return static_cast<BOOL>(egl::InitializeProcess()); + + case DLL_THREAD_ATTACH: + return static_cast<BOOL>(egl::AllocateCurrentThread() != nullptr); + + case DLL_THREAD_DETACH: + return static_cast<BOOL>(egl::DeallocateCurrentThread()); + + case DLL_PROCESS_DETACH: + return static_cast<BOOL>(egl::TerminateProcess()); + } + + return TRUE; +} +#endif // ANGLE_PLATFORM_WINDOWS diff --git a/gfx/angle/src/libGLESv2/global_state.h b/gfx/angle/src/libGLESv2/global_state.h new file mode 100755 index 000000000..3e3740c90 --- /dev/null +++ b/gfx/angle/src/libGLESv2/global_state.h @@ -0,0 +1,29 @@ +// +// Copyright(c) 2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// global_state.h : Defines functions for querying the thread-local GL and EGL state. + +#ifndef LIBGLESV2_GLOBALSTATE_H_ +#define LIBGLESV2_GLOBALSTATE_H_ + +namespace gl +{ +class Context; + +Context *GetGlobalContext(); +Context *GetValidGlobalContext(); + +} // namespace gl + +namespace egl +{ +class Thread; + +Thread *GetCurrentThread(); + +} // namespace egl + +#endif // LIBGLESV2_GLOBALSTATE_H_ diff --git a/gfx/angle/src/libGLESv2/libGLESv2.cpp b/gfx/angle/src/libGLESv2/libGLESv2.cpp new file mode 100755 index 000000000..1d9a2d6ad --- /dev/null +++ b/gfx/angle/src/libGLESv2/libGLESv2.cpp @@ -0,0 +1,2231 @@ +// +// Copyright (c) 2002-2014 The ANGLE Project Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. +// + +// libGLESv2.cpp: Implements the exported OpenGL ES 2.0 functions. + +#include "libGLESv2/entry_points_gles_2_0.h" +#include "libGLESv2/entry_points_gles_2_0_ext.h" +#include "libGLESv2/entry_points_gles_3_0.h" +#include "libGLESv2/entry_points_gles_3_1.h" + +#include "common/event_tracer.h" + +extern "C" +{ + +void GL_APIENTRY glActiveTexture(GLenum texture) +{ + return gl::ActiveTexture(texture); +} + +void GL_APIENTRY glAttachShader(GLuint program, GLuint shader) +{ + return gl::AttachShader(program, shader); +} + +void GL_APIENTRY glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) +{ + return gl::BindAttribLocation(program, index, name); +} + +void GL_APIENTRY glBindBuffer(GLenum target, GLuint buffer) +{ + return gl::BindBuffer(target, buffer); +} + +void GL_APIENTRY glBindFramebuffer(GLenum target, GLuint framebuffer) +{ + return gl::BindFramebuffer(target, framebuffer); +} + +void GL_APIENTRY glBindRenderbuffer(GLenum target, GLuint renderbuffer) +{ + return gl::BindRenderbuffer(target, renderbuffer); +} + +void GL_APIENTRY glBindTexture(GLenum target, GLuint texture) +{ + return gl::BindTexture(target, texture); +} + +void GL_APIENTRY glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + return gl::BlendColor(red, green, blue, alpha); +} + +void GL_APIENTRY glBlendEquation(GLenum mode) +{ + return gl::BlendEquation(mode); +} + +void GL_APIENTRY glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha) +{ + return gl::BlendEquationSeparate(modeRGB, modeAlpha); +} + +void GL_APIENTRY glBlendFunc(GLenum sfactor, GLenum dfactor) +{ + return gl::BlendFunc(sfactor, dfactor); +} + +void GL_APIENTRY glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) +{ + return gl::BlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); +} + +void GL_APIENTRY glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) +{ + return gl::BufferData(target, size, data, usage); +} + +void GL_APIENTRY glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) +{ + return gl::BufferSubData(target, offset, size, data); +} + +GLenum GL_APIENTRY glCheckFramebufferStatus(GLenum target) +{ + return gl::CheckFramebufferStatus(target); +} + +void GL_APIENTRY glClear(GLbitfield mask) +{ + return gl::Clear(mask); +} + +void GL_APIENTRY glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) +{ + return gl::ClearColor(red, green, blue, alpha); +} + +void GL_APIENTRY glClearDepthf(GLfloat depth) +{ + return gl::ClearDepthf(depth); +} + +void GL_APIENTRY glClearStencil(GLint s) +{ + return gl::ClearStencil(s); +} + +void GL_APIENTRY glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) +{ + return gl::ColorMask(red, green, blue, alpha); +} + +void GL_APIENTRY glCompileShader(GLuint shader) +{ + return gl::CompileShader(shader); +} + +void GL_APIENTRY glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) +{ + return gl::CompressedTexImage2D(target, level, internalformat, width, height, border, imageSize, data); +} + +void GL_APIENTRY glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) +{ + return gl::CompressedTexSubImage2D(target, level, xoffset, yoffset, width, height, format, imageSize, data); +} + +void GL_APIENTRY glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) +{ + return gl::CopyTexImage2D(target, level, internalformat, x, y, width, height, border); +} + +void GL_APIENTRY glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + return gl::CopyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height); +} + +GLuint GL_APIENTRY glCreateProgram(void) +{ + return gl::CreateProgram(); +} + +GLuint GL_APIENTRY glCreateShader(GLenum type) +{ + return gl::CreateShader(type); +} + +void GL_APIENTRY glCullFace(GLenum mode) +{ + return gl::CullFace(mode); +} + +void GL_APIENTRY glDeleteBuffers(GLsizei n, const GLuint* buffers) +{ + return gl::DeleteBuffers(n, buffers); +} + +void GL_APIENTRY glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) +{ + return gl::DeleteFramebuffers(n, framebuffers); +} + +void GL_APIENTRY glDeleteProgram(GLuint program) +{ + return gl::DeleteProgram(program); +} + +void GL_APIENTRY glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) +{ + return gl::DeleteRenderbuffers(n, renderbuffers); +} + +void GL_APIENTRY glDeleteShader(GLuint shader) +{ + return gl::DeleteShader(shader); +} + +void GL_APIENTRY glDeleteTextures(GLsizei n, const GLuint* textures) +{ + return gl::DeleteTextures(n, textures); +} + +void GL_APIENTRY glDepthFunc(GLenum func) +{ + return gl::DepthFunc(func); +} + +void GL_APIENTRY glDepthMask(GLboolean flag) +{ + return gl::DepthMask(flag); +} + +void GL_APIENTRY glDepthRangef(GLfloat n, GLfloat f) +{ + return gl::DepthRangef(n, f); +} + +void GL_APIENTRY glDetachShader(GLuint program, GLuint shader) +{ + return gl::DetachShader(program, shader); +} + +void GL_APIENTRY glDisable(GLenum cap) +{ + return gl::Disable(cap); +} + +void GL_APIENTRY glDisableVertexAttribArray(GLuint index) +{ + return gl::DisableVertexAttribArray(index); +} + +void GL_APIENTRY glDrawArrays(GLenum mode, GLint first, GLsizei count) +{ + return gl::DrawArrays(mode, first, count); +} + +void GL_APIENTRY glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) +{ + return gl::DrawElements(mode, count, type, indices); +} + +void GL_APIENTRY glEnable(GLenum cap) +{ + return gl::Enable(cap); +} + +void GL_APIENTRY glEnableVertexAttribArray(GLuint index) +{ + return gl::EnableVertexAttribArray(index); +} + +void GL_APIENTRY glFinish(void) +{ + return gl::Finish(); +} + +void GL_APIENTRY glFlush(void) +{ + return gl::Flush(); +} + +void GL_APIENTRY glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) +{ + return gl::FramebufferRenderbuffer(target, attachment, renderbuffertarget, renderbuffer); +} + +void GL_APIENTRY glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) +{ + return gl::FramebufferTexture2D(target, attachment, textarget, texture, level); +} + +void GL_APIENTRY glFrontFace(GLenum mode) +{ + return gl::FrontFace(mode); +} + +void GL_APIENTRY glGenBuffers(GLsizei n, GLuint* buffers) +{ + return gl::GenBuffers(n, buffers); +} + +void GL_APIENTRY glGenerateMipmap(GLenum target) +{ + return gl::GenerateMipmap(target); +} + +void GL_APIENTRY glGenFramebuffers(GLsizei n, GLuint* framebuffers) +{ + return gl::GenFramebuffers(n, framebuffers); +} + +void GL_APIENTRY glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) +{ + return gl::GenRenderbuffers(n, renderbuffers); +} + +void GL_APIENTRY glGenTextures(GLsizei n, GLuint* textures) +{ + return gl::GenTextures(n, textures); +} + +void GL_APIENTRY glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) +{ + return gl::GetActiveAttrib(program, index, bufsize, length, size, type, name); +} + +void GL_APIENTRY glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) +{ + return gl::GetActiveUniform(program, index, bufsize, length, size, type, name); +} + +void GL_APIENTRY glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) +{ + return gl::GetAttachedShaders(program, maxcount, count, shaders); +} + +GLint GL_APIENTRY glGetAttribLocation(GLuint program, const GLchar* name) +{ + return gl::GetAttribLocation(program, name); +} + +void GL_APIENTRY glGetBooleanv(GLenum pname, GLboolean* params) +{ + return gl::GetBooleanv(pname, params); +} + +void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + return gl::GetBufferParameteriv(target, pname, params); +} + +GLenum GL_APIENTRY glGetError(void) +{ + return gl::GetError(); +} + +void GL_APIENTRY glGetFloatv(GLenum pname, GLfloat* params) +{ + return gl::GetFloatv(pname, params); +} + +void GL_APIENTRY glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) +{ + return gl::GetFramebufferAttachmentParameteriv(target, attachment, pname, params); +} + +void GL_APIENTRY glGetIntegerv(GLenum pname, GLint* params) +{ + return gl::GetIntegerv(pname, params); +} + +void GL_APIENTRY glGetProgramiv(GLuint program, GLenum pname, GLint* params) +{ + return gl::GetProgramiv(program, pname, params); +} + +void GL_APIENTRY glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) +{ + return gl::GetProgramInfoLog(program, bufsize, length, infolog); +} + +void GL_APIENTRY glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) +{ + return gl::GetRenderbufferParameteriv(target, pname, params); +} + +void GL_APIENTRY glGetShaderiv(GLuint shader, GLenum pname, GLint* params) +{ + return gl::GetShaderiv(shader, pname, params); +} + +void GL_APIENTRY glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) +{ + return gl::GetShaderInfoLog(shader, bufsize, length, infolog); +} + +void GL_APIENTRY glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) +{ + return gl::GetShaderPrecisionFormat(shadertype, precisiontype, range, precision); +} + +void GL_APIENTRY glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) +{ + return gl::GetShaderSource(shader, bufsize, length, source); +} + +const GLubyte* GL_APIENTRY glGetString(GLenum name) +{ + return gl::GetString(name); +} + +void GL_APIENTRY glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) +{ + return gl::GetTexParameterfv(target, pname, params); +} + +void GL_APIENTRY glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) +{ + return gl::GetTexParameteriv(target, pname, params); +} + +void GL_APIENTRY glGetUniformfv(GLuint program, GLint location, GLfloat* params) +{ + return gl::GetUniformfv(program, location, params); +} + +void GL_APIENTRY glGetUniformiv(GLuint program, GLint location, GLint* params) +{ + return gl::GetUniformiv(program, location, params); +} + +GLint GL_APIENTRY glGetUniformLocation(GLuint program, const GLchar* name) +{ + return gl::GetUniformLocation(program, name); +} + +void GL_APIENTRY glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) +{ + return gl::GetVertexAttribfv(index, pname, params); +} + +void GL_APIENTRY glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) +{ + return gl::GetVertexAttribiv(index, pname, params); +} + +void GL_APIENTRY glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) +{ + return gl::GetVertexAttribPointerv(index, pname, pointer); +} + +void GL_APIENTRY glHint(GLenum target, GLenum mode) +{ + return gl::Hint(target, mode); +} + +GLboolean GL_APIENTRY glIsBuffer(GLuint buffer) +{ + return gl::IsBuffer(buffer); +} + +GLboolean GL_APIENTRY glIsEnabled(GLenum cap) +{ + return gl::IsEnabled(cap); +} + +GLboolean GL_APIENTRY glIsFramebuffer(GLuint framebuffer) +{ + return gl::IsFramebuffer(framebuffer); +} + +GLboolean GL_APIENTRY glIsProgram(GLuint program) +{ + return gl::IsProgram(program); +} + +GLboolean GL_APIENTRY glIsRenderbuffer(GLuint renderbuffer) +{ + return gl::IsRenderbuffer(renderbuffer); +} + +GLboolean GL_APIENTRY glIsShader(GLuint shader) +{ + return gl::IsShader(shader); +} + +GLboolean GL_APIENTRY glIsTexture(GLuint texture) +{ + return gl::IsTexture(texture); +} + +void GL_APIENTRY glLineWidth(GLfloat width) +{ + return gl::LineWidth(width); +} + +void GL_APIENTRY glLinkProgram(GLuint program) +{ + return gl::LinkProgram(program); +} + +void GL_APIENTRY glPixelStorei(GLenum pname, GLint param) +{ + return gl::PixelStorei(pname, param); +} + +void GL_APIENTRY glPolygonOffset(GLfloat factor, GLfloat units) +{ + return gl::PolygonOffset(factor, units); +} + +void GL_APIENTRY glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) +{ + return gl::ReadPixels(x, y, width, height, format, type, pixels); +} + +void GL_APIENTRY glReleaseShaderCompiler(void) +{ + return gl::ReleaseShaderCompiler(); +} + +void GL_APIENTRY glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) +{ + return gl::RenderbufferStorage(target, internalformat, width, height); +} + +void GL_APIENTRY glSampleCoverage(GLfloat value, GLboolean invert) +{ + return gl::SampleCoverage(value, invert); +} + +void GL_APIENTRY glScissor(GLint x, GLint y, GLsizei width, GLsizei height) +{ + return gl::Scissor(x, y, width, height); +} + +void GL_APIENTRY glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) +{ + return gl::ShaderBinary(n, shaders, binaryformat, binary, length); +} + +void GL_APIENTRY glShaderSource(GLuint shader, GLsizei count, const GLchar* const* string, const GLint* length) +{ + return gl::ShaderSource(shader, count, string, length); +} + +void GL_APIENTRY glStencilFunc(GLenum func, GLint ref, GLuint mask) +{ + return gl::StencilFunc(func, ref, mask); +} + +void GL_APIENTRY glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask) +{ + return gl::StencilFuncSeparate(face, func, ref, mask); +} + +void GL_APIENTRY glStencilMask(GLuint mask) +{ + return gl::StencilMask(mask); +} + +void GL_APIENTRY glStencilMaskSeparate(GLenum face, GLuint mask) +{ + return gl::StencilMaskSeparate(face, mask); +} + +void GL_APIENTRY glStencilOp(GLenum fail, GLenum zfail, GLenum zpass) +{ + return gl::StencilOp(fail, zfail, zpass); +} + +void GL_APIENTRY glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) +{ + return gl::StencilOpSeparate(face, fail, zfail, zpass); +} + +void GL_APIENTRY glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ + return gl::TexImage2D(target, level, internalformat, width, height, border, format, type, pixels); +} + +void GL_APIENTRY glTexParameterf(GLenum target, GLenum pname, GLfloat param) +{ + return gl::TexParameterf(target, pname, param); +} + +void GL_APIENTRY glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) +{ + return gl::TexParameterfv(target, pname, params); +} + +void GL_APIENTRY glTexParameteri(GLenum target, GLenum pname, GLint param) +{ + return gl::TexParameteri(target, pname, param); +} + +void GL_APIENTRY glTexParameteriv(GLenum target, GLenum pname, const GLint* params) +{ + return gl::TexParameteriv(target, pname, params); +} + +void GL_APIENTRY glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) +{ + return gl::TexSubImage2D(target, level, xoffset, yoffset, width, height, format, type, pixels); +} + +void GL_APIENTRY glUniform1f(GLint location, GLfloat x) +{ + return gl::Uniform1f(location, x); +} + +void GL_APIENTRY glUniform1fv(GLint location, GLsizei count, const GLfloat* v) +{ + return gl::Uniform1fv(location, count, v); +} + +void GL_APIENTRY glUniform1i(GLint location, GLint x) +{ + return gl::Uniform1i(location, x); +} + +void GL_APIENTRY glUniform1iv(GLint location, GLsizei count, const GLint* v) +{ + return gl::Uniform1iv(location, count, v); +} + +void GL_APIENTRY glUniform2f(GLint location, GLfloat x, GLfloat y) +{ + return gl::Uniform2f(location, x, y); +} + +void GL_APIENTRY glUniform2fv(GLint location, GLsizei count, const GLfloat* v) +{ + return gl::Uniform2fv(location, count, v); +} + +void GL_APIENTRY glUniform2i(GLint location, GLint x, GLint y) +{ + return gl::Uniform2i(location, x, y); +} + +void GL_APIENTRY glUniform2iv(GLint location, GLsizei count, const GLint* v) +{ + return gl::Uniform2iv(location, count, v); +} + +void GL_APIENTRY glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) +{ + return gl::Uniform3f(location, x, y, z); +} + +void GL_APIENTRY glUniform3fv(GLint location, GLsizei count, const GLfloat* v) +{ + return gl::Uniform3fv(location, count, v); +} + +void GL_APIENTRY glUniform3i(GLint location, GLint x, GLint y, GLint z) +{ + return gl::Uniform3i(location, x, y, z); +} + +void GL_APIENTRY glUniform3iv(GLint location, GLsizei count, const GLint* v) +{ + return gl::Uniform3iv(location, count, v); +} + +void GL_APIENTRY glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + return gl::Uniform4f(location, x, y, z, w); +} + +void GL_APIENTRY glUniform4fv(GLint location, GLsizei count, const GLfloat* v) +{ + return gl::Uniform4fv(location, count, v); +} + +void GL_APIENTRY glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) +{ + return gl::Uniform4i(location, x, y, z, w); +} + +void GL_APIENTRY glUniform4iv(GLint location, GLsizei count, const GLint* v) +{ + return gl::Uniform4iv(location, count, v); +} + +void GL_APIENTRY glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix2fv(location, count, transpose, value); +} + +void GL_APIENTRY glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix3fv(location, count, transpose, value); +} + +void GL_APIENTRY glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix4fv(location, count, transpose, value); +} + +void GL_APIENTRY glUseProgram(GLuint program) +{ + return gl::UseProgram(program); +} + +void GL_APIENTRY glValidateProgram(GLuint program) +{ + return gl::ValidateProgram(program); +} + +void GL_APIENTRY glVertexAttrib1f(GLuint indx, GLfloat x) +{ + return gl::VertexAttrib1f(indx, x); +} + +void GL_APIENTRY glVertexAttrib1fv(GLuint indx, const GLfloat* values) +{ + return gl::VertexAttrib1fv(indx, values); +} + +void GL_APIENTRY glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) +{ + return gl::VertexAttrib2f(indx, x, y); +} + +void GL_APIENTRY glVertexAttrib2fv(GLuint indx, const GLfloat* values) +{ + return gl::VertexAttrib2fv(indx, values); +} + +void GL_APIENTRY glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) +{ + return gl::VertexAttrib3f(indx, x, y, z); +} + +void GL_APIENTRY glVertexAttrib3fv(GLuint indx, const GLfloat* values) +{ + return gl::VertexAttrib3fv(indx, values); +} + +void GL_APIENTRY glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +{ + return gl::VertexAttrib4f(indx, x, y, z, w); +} + +void GL_APIENTRY glVertexAttrib4fv(GLuint indx, const GLfloat* values) +{ + return gl::VertexAttrib4fv(indx, values); +} + +void GL_APIENTRY glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) +{ + return gl::VertexAttribPointer(indx, size, type, normalized, stride, ptr); +} + +void GL_APIENTRY glViewport(GLint x, GLint y, GLsizei width, GLsizei height) +{ + return gl::Viewport(x, y, width, height); +} + +void GL_APIENTRY glReadBuffer(GLenum mode) +{ + return gl::ReadBuffer(mode); +} + +void GL_APIENTRY glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid* indices) +{ + return gl::DrawRangeElements(mode, start, end, count, type, indices); +} + +void GL_APIENTRY glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) +{ + return gl::TexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels); +} + +void GL_APIENTRY glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) +{ + return gl::TexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); +} + +void GL_APIENTRY glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) +{ + return gl::CopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); +} + +void GL_APIENTRY glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) +{ + return gl::CompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data); +} + +void GL_APIENTRY glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) +{ + return gl::CompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); +} + +void GL_APIENTRY glGenQueries(GLsizei n, GLuint* ids) +{ + return gl::GenQueries(n, ids); +} + +void GL_APIENTRY glDeleteQueries(GLsizei n, const GLuint* ids) +{ + return gl::DeleteQueries(n, ids); +} + +GLboolean GL_APIENTRY glIsQuery(GLuint id) +{ + return gl::IsQuery(id); +} + +void GL_APIENTRY glBeginQuery(GLenum target, GLuint id) +{ + return gl::BeginQuery(target, id); +} + +void GL_APIENTRY glEndQuery(GLenum target) +{ + return gl::EndQuery(target); +} + +void GL_APIENTRY glGetQueryiv(GLenum target, GLenum pname, GLint* params) +{ + return gl::GetQueryiv(target, pname, params); +} + +void GL_APIENTRY glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint* params) +{ + return gl::GetQueryObjectuiv(id, pname, params); +} + +GLboolean GL_APIENTRY glUnmapBuffer(GLenum target) +{ + return gl::UnmapBuffer(target); +} + +void GL_APIENTRY glGetBufferPointerv(GLenum target, GLenum pname, GLvoid** params) +{ + return gl::GetBufferPointerv(target, pname, params); +} + +void GL_APIENTRY glDrawBuffers(GLsizei n, const GLenum* bufs) +{ + return gl::DrawBuffers(n, bufs); +} + +void GL_APIENTRY glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix2x3fv(location, count, transpose, value); +} + +void GL_APIENTRY glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix3x2fv(location, count, transpose, value); +} + +void GL_APIENTRY glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix2x4fv(location, count, transpose, value); +} + +void GL_APIENTRY glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix4x2fv(location, count, transpose, value); +} + +void GL_APIENTRY glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix3x4fv(location, count, transpose, value); +} + +void GL_APIENTRY glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +{ + return gl::UniformMatrix4x3fv(location, count, transpose, value); +} + +void GL_APIENTRY glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +{ + return gl::BlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); +} + +void GL_APIENTRY glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + return gl::RenderbufferStorageMultisample(target, samples, internalformat, width, height); +} + +void GL_APIENTRY glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) +{ + return gl::FramebufferTextureLayer(target, attachment, texture, level, layer); +} + +GLvoid* GL_APIENTRY glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +{ + return gl::MapBufferRange(target, offset, length, access); +} + +void GL_APIENTRY glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) +{ + return gl::FlushMappedBufferRange(target, offset, length); +} + +void GL_APIENTRY glBindVertexArray(GLuint array) +{ + return gl::BindVertexArray(array); +} + +void GL_APIENTRY glDeleteVertexArrays(GLsizei n, const GLuint* arrays) +{ + return gl::DeleteVertexArrays(n, arrays); +} + +void GL_APIENTRY glGenVertexArrays(GLsizei n, GLuint* arrays) +{ + return gl::GenVertexArrays(n, arrays); +} + +GLboolean GL_APIENTRY glIsVertexArray(GLuint array) +{ + return gl::IsVertexArray(array); +} + +void GL_APIENTRY glGetIntegeri_v(GLenum target, GLuint index, GLint* data) +{ + return gl::GetIntegeri_v(target, index, data); +} + +void GL_APIENTRY glBeginTransformFeedback(GLenum primitiveMode) +{ + return gl::BeginTransformFeedback(primitiveMode); +} + +void GL_APIENTRY glEndTransformFeedback(void) +{ + return gl::EndTransformFeedback(); +} + +void GL_APIENTRY glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) +{ + return gl::BindBufferRange(target, index, buffer, offset, size); +} + +void GL_APIENTRY glBindBufferBase(GLenum target, GLuint index, GLuint buffer) +{ + return gl::BindBufferBase(target, index, buffer); +} + +void GL_APIENTRY glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar* const* varyings, GLenum bufferMode) +{ + return gl::TransformFeedbackVaryings(program, count, varyings, bufferMode); +} + +void GL_APIENTRY glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei* length, GLsizei* size, GLenum* type, GLchar* name) +{ + return gl::GetTransformFeedbackVarying(program, index, bufSize, length, size, type, name); +} + +void GL_APIENTRY glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid* pointer) +{ + return gl::VertexAttribIPointer(index, size, type, stride, pointer); +} + +void GL_APIENTRY glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params) +{ + return gl::GetVertexAttribIiv(index, pname, params); +} + +void GL_APIENTRY glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params) +{ + return gl::GetVertexAttribIuiv(index, pname, params); +} + +void GL_APIENTRY glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) +{ + return gl::VertexAttribI4i(index, x, y, z, w); +} + +void GL_APIENTRY glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) +{ + return gl::VertexAttribI4ui(index, x, y, z, w); +} + +void GL_APIENTRY glVertexAttribI4iv(GLuint index, const GLint* v) +{ + return gl::VertexAttribI4iv(index, v); +} + +void GL_APIENTRY glVertexAttribI4uiv(GLuint index, const GLuint* v) +{ + return gl::VertexAttribI4uiv(index, v); +} + +void GL_APIENTRY glGetUniformuiv(GLuint program, GLint location, GLuint* params) +{ + return gl::GetUniformuiv(program, location, params); +} + +GLint GL_APIENTRY glGetFragDataLocation(GLuint program, const GLchar *name) +{ + return gl::GetFragDataLocation(program, name); +} + +void GL_APIENTRY glUniform1ui(GLint location, GLuint v0) +{ + return gl::Uniform1ui(location, v0); +} + +void GL_APIENTRY glUniform2ui(GLint location, GLuint v0, GLuint v1) +{ + return gl::Uniform2ui(location, v0, v1); +} + +void GL_APIENTRY glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) +{ + return gl::Uniform3ui(location, v0, v1, v2); +} + +void GL_APIENTRY glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +{ + return gl::Uniform4ui(location, v0, v1, v2, v3); +} + +void GL_APIENTRY glUniform1uiv(GLint location, GLsizei count, const GLuint* value) +{ + return gl::Uniform1uiv(location, count, value); +} + +void GL_APIENTRY glUniform2uiv(GLint location, GLsizei count, const GLuint* value) +{ + return gl::Uniform2uiv(location, count, value); +} + +void GL_APIENTRY glUniform3uiv(GLint location, GLsizei count, const GLuint* value) +{ + return gl::Uniform3uiv(location, count, value); +} + +void GL_APIENTRY glUniform4uiv(GLint location, GLsizei count, const GLuint* value) +{ + return gl::Uniform4uiv(location, count, value); +} + +void GL_APIENTRY glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint* value) +{ + return gl::ClearBufferiv(buffer, drawbuffer, value); +} + +void GL_APIENTRY glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint* value) +{ + return gl::ClearBufferuiv(buffer, drawbuffer, value); +} + +void GL_APIENTRY glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat* value) +{ + return gl::ClearBufferfv(buffer, drawbuffer, value); +} + +void GL_APIENTRY glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) +{ + return gl::ClearBufferfi(buffer, drawbuffer, depth, stencil); +} + +const GLubyte* GL_APIENTRY glGetStringi(GLenum name, GLuint index) +{ + return gl::GetStringi(name, index); +} + +void GL_APIENTRY glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) +{ + return gl::CopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size); +} + +void GL_APIENTRY glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar* const* uniformNames, GLuint* uniformIndices) +{ + return gl::GetUniformIndices(program, uniformCount, uniformNames, uniformIndices); +} + +void GL_APIENTRY glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint* uniformIndices, GLenum pname, GLint* params) +{ + return gl::GetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params); +} + +GLuint GL_APIENTRY glGetUniformBlockIndex(GLuint program, const GLchar* uniformBlockName) +{ + return gl::GetUniformBlockIndex(program, uniformBlockName); +} + +void GL_APIENTRY glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint* params) +{ + return gl::GetActiveUniformBlockiv(program, uniformBlockIndex, pname, params); +} + +void GL_APIENTRY glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei* length, GLchar* uniformBlockName) +{ + return gl::GetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName); +} + +void GL_APIENTRY glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) +{ + return gl::UniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); +} + +void GL_APIENTRY glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount) +{ + return gl::DrawArraysInstanced(mode, first, count, instanceCount); +} + +void GL_APIENTRY glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices, GLsizei instanceCount) +{ + return gl::DrawElementsInstanced(mode, count, type, indices, instanceCount); +} + +GLsync GL_APIENTRY glFenceSync(GLenum condition, GLbitfield flags) +{ + return gl::FenceSync_(condition, flags); +} + +GLboolean GL_APIENTRY glIsSync(GLsync sync) +{ + return gl::IsSync(sync); +} + +void GL_APIENTRY glDeleteSync(GLsync sync) +{ + return gl::DeleteSync(sync); +} + +GLenum GL_APIENTRY glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + return gl::ClientWaitSync(sync, flags, timeout); +} + +void GL_APIENTRY glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) +{ + return gl::WaitSync(sync, flags, timeout); +} + +void GL_APIENTRY glGetInteger64v(GLenum pname, GLint64* params) +{ + return gl::GetInteger64v(pname, params); +} + +void GL_APIENTRY glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei* length, GLint* values) +{ + return gl::GetSynciv(sync, pname, bufSize, length, values); +} + +void GL_APIENTRY glGetInteger64i_v(GLenum target, GLuint index, GLint64* data) +{ + return gl::GetInteger64i_v(target, index, data); +} + +void GL_APIENTRY glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64* params) +{ + return gl::GetBufferParameteri64v(target, pname, params); +} + +void GL_APIENTRY glGenSamplers(GLsizei count, GLuint* samplers) +{ + return gl::GenSamplers(count, samplers); +} + +void GL_APIENTRY glDeleteSamplers(GLsizei count, const GLuint* samplers) +{ + return gl::DeleteSamplers(count, samplers); +} + +GLboolean GL_APIENTRY glIsSampler(GLuint sampler) +{ + return gl::IsSampler(sampler); +} + +void GL_APIENTRY glBindSampler(GLuint unit, GLuint sampler) +{ + return gl::BindSampler(unit, sampler); +} + +void GL_APIENTRY glSamplerParameteri(GLuint sampler, GLenum pname, GLint param) +{ + return gl::SamplerParameteri(sampler, pname, param); +} + +void GL_APIENTRY glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint* param) +{ + return gl::SamplerParameteriv(sampler, pname, param); +} + +void GL_APIENTRY glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) +{ + return gl::SamplerParameterf(sampler, pname, param); +} + +void GL_APIENTRY glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat* param) +{ + return gl::SamplerParameterfv(sampler, pname, param); +} + +void GL_APIENTRY glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint* params) +{ + return gl::GetSamplerParameteriv(sampler, pname, params); +} + +void GL_APIENTRY glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat* params) +{ + return gl::GetSamplerParameterfv(sampler, pname, params); +} + +void GL_APIENTRY glVertexAttribDivisor(GLuint index, GLuint divisor) +{ + return gl::VertexAttribDivisor(index, divisor); +} + +void GL_APIENTRY glBindTransformFeedback(GLenum target, GLuint id) +{ + return gl::BindTransformFeedback(target, id); +} + +void GL_APIENTRY glDeleteTransformFeedbacks(GLsizei n, const GLuint* ids) +{ + return gl::DeleteTransformFeedbacks(n, ids); +} + +void GL_APIENTRY glGenTransformFeedbacks(GLsizei n, GLuint* ids) +{ + return gl::GenTransformFeedbacks(n, ids); +} + +GLboolean GL_APIENTRY glIsTransformFeedback(GLuint id) +{ + return gl::IsTransformFeedback(id); +} + +void GL_APIENTRY glPauseTransformFeedback(void) +{ + return gl::PauseTransformFeedback(); +} + +void GL_APIENTRY glResumeTransformFeedback(void) +{ + return gl::ResumeTransformFeedback(); +} + +void GL_APIENTRY glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei* length, GLenum* binaryFormat, GLvoid* binary) +{ + return gl::GetProgramBinary(program, bufSize, length, binaryFormat, binary); +} + +void GL_APIENTRY glProgramBinary(GLuint program, GLenum binaryFormat, const GLvoid* binary, GLsizei length) +{ + return gl::ProgramBinary(program, binaryFormat, binary, length); +} + +void GL_APIENTRY glProgramParameteri(GLuint program, GLenum pname, GLint value) +{ + return gl::ProgramParameteri(program, pname, value); +} + +void GL_APIENTRY glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments) +{ + return gl::InvalidateFramebuffer(target, numAttachments, attachments); +} + +void GL_APIENTRY glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum* attachments, GLint x, GLint y, GLsizei width, GLsizei height) +{ + return gl::InvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height); +} + +void GL_APIENTRY glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) +{ + return gl::TexStorage2D(target, levels, internalformat, width, height); +} + +void GL_APIENTRY glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) +{ + return gl::TexStorage3D(target, levels, internalformat, width, height, depth); +} + +void GL_APIENTRY glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint* params) +{ + return gl::GetInternalformativ(target, internalformat, pname, bufSize, params); +} + +void GL_APIENTRY glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) +{ + return gl::BlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); +} + +void GL_APIENTRY glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) +{ + return gl::RenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height); +} + +void GL_APIENTRY glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) +{ + return gl::DiscardFramebufferEXT(target, numAttachments, attachments); +} + +void GL_APIENTRY glDeleteFencesNV(GLsizei n, const GLuint* fences) +{ + return gl::DeleteFencesNV(n, fences); +} + +void GL_APIENTRY glGenFencesNV(GLsizei n, GLuint* fences) +{ + return gl::GenFencesNV(n, fences); +} + +GLboolean GL_APIENTRY glIsFenceNV(GLuint fence) +{ + return gl::IsFenceNV(fence); +} + +GLboolean GL_APIENTRY glTestFenceNV(GLuint fence) +{ + return gl::TestFenceNV(fence); +} + +void GL_APIENTRY glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) +{ + return gl::GetFenceivNV(fence, pname, params); +} + +void GL_APIENTRY glFinishFenceNV(GLuint fence) +{ + return gl::FinishFenceNV(fence); +} + +void GL_APIENTRY glSetFenceNV(GLuint fence, GLenum condition) +{ + return gl::SetFenceNV(fence, condition); +} + +void GL_APIENTRY glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source) +{ + return gl::GetTranslatedShaderSourceANGLE(shader, bufsize, length, source); +} + +void GL_APIENTRY glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) +{ + return gl::TexStorage2DEXT(target, levels, internalformat, width, height); +} + +GLenum GL_APIENTRY glGetGraphicsResetStatusEXT(void) +{ + return gl::GetGraphicsResetStatusEXT(); +} + +void GL_APIENTRY glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) +{ + return gl::ReadnPixelsEXT(x, y, width, height, format, type, bufSize, data); +} + +void GL_APIENTRY glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params) +{ + return gl::GetnUniformfvEXT(program, location, bufSize, params); +} + +void GL_APIENTRY glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params) +{ + return gl::GetnUniformivEXT(program, location, bufSize, params); +} + +void GL_APIENTRY glGenQueriesEXT(GLsizei n, GLuint *ids) +{ + return gl::GenQueriesEXT(n, ids); +} + +void GL_APIENTRY glDeleteQueriesEXT(GLsizei n, const GLuint *ids) +{ + return gl::DeleteQueriesEXT(n, ids); +} + +GLboolean GL_APIENTRY glIsQueryEXT(GLuint id) +{ + return gl::IsQueryEXT(id); +} + +void GL_APIENTRY glBeginQueryEXT(GLenum target, GLuint id) +{ + return gl::BeginQueryEXT(target, id); +} + +void GL_APIENTRY glEndQueryEXT(GLenum target) +{ + return gl::EndQueryEXT(target); +} + +void GL_APIENTRY glQueryCounterEXT(GLuint id, GLenum target) +{ + return gl::QueryCounterEXT(id, target); +} + +void GL_APIENTRY glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) +{ + return gl::GetQueryivEXT(target, pname, params); +} + +void GL_APIENTRY glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint *params) +{ + return gl::GetQueryObjectivEXT(id, pname, params); +} + +void GL_APIENTRY glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) +{ + return gl::GetQueryObjectuivEXT(id, pname, params); +} + +void GL_APIENTRY glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 *params) +{ + return gl::GetQueryObjecti64vEXT(id, pname, params); +} + +void GL_APIENTRY glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 *params) +{ + return gl::GetQueryObjectui64vEXT(id, pname, params); +} + +void GL_APIENTRY glDrawBuffersEXT(GLsizei n, const GLenum *bufs) +{ + return gl::DrawBuffersEXT(n, bufs); +} + +void GL_APIENTRY glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) +{ + return gl::DrawArraysInstancedANGLE(mode, first, count, primcount); +} + +void GL_APIENTRY glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount) +{ + return gl::DrawElementsInstancedANGLE(mode, count, type, indices, primcount); +} + +void GL_APIENTRY glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) +{ + return gl::VertexAttribDivisorANGLE(index, divisor); +} + +void GL_APIENTRY glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) +{ + return gl::GetProgramBinaryOES(program, bufSize, length, binaryFormat, binary); +} + +void GL_APIENTRY glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) +{ + return gl::ProgramBinaryOES(program, binaryFormat, binary, length); +} + +void* GL_APIENTRY glMapBufferOES(GLenum target, GLenum access) +{ + return gl::MapBufferOES(target, access); +} + +GLboolean GL_APIENTRY glUnmapBufferOES(GLenum target) +{ + return gl::UnmapBufferOES(target); +} + +void GL_APIENTRY glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid **params) +{ + return gl::GetBufferPointervOES(target, pname, params); +} + +void* GL_APIENTRY glMapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +{ + return gl::MapBufferRangeEXT(target, offset, length, access); +} + +void GL_APIENTRY glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length) +{ + return gl::FlushMappedBufferRangeEXT(target, offset, length); +} + +void GL_APIENTRY glInsertEventMarkerEXT(GLsizei length, const char *marker) +{ + return gl::InsertEventMarkerEXT(length, marker); +} + +void GL_APIENTRY glPushGroupMarkerEXT(GLsizei length, const char *marker) +{ + return gl::PushGroupMarkerEXT(length, marker); +} + +void GL_APIENTRY glPopGroupMarkerEXT() +{ + return gl::PopGroupMarkerEXT(); +} + +void GL_APIENTRY glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) +{ + return gl::EGLImageTargetTexture2DOES(target, image); +} + +void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) +{ + return gl::EGLImageTargetRenderbufferStorageOES(target, image); +} + +void GL_APIENTRY glBindVertexArrayOES(GLuint array) +{ + return gl::BindVertexArrayOES(array); +} + +void GL_APIENTRY glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays) +{ + return gl::DeleteVertexArraysOES(n, arrays); +} + +void GL_APIENTRY glGenVertexArraysOES(GLsizei n, GLuint *arrays) +{ + return gl::GenVertexArraysOES(n, arrays); +} + +GLboolean GL_APIENTRY glIsVertexArrayOES(GLuint array) +{ + return gl::IsVertexArrayOES(array); +} + +void GL_APIENTRY glDebugMessageControlKHR(GLenum source, + GLenum type, + GLenum severity, + GLsizei count, + const GLuint *ids, + GLboolean enabled) +{ + return gl::DebugMessageControlKHR(source, type, severity, count, ids, enabled); +} + +void GL_APIENTRY glDebugMessageInsertKHR(GLenum source, + GLenum type, + GLuint id, + GLenum severity, + GLsizei length, + const GLchar *buf) +{ + return gl::DebugMessageInsertKHR(source, type, id, severity, length, buf); +} + +void GL_APIENTRY glDebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void *userParam) +{ + return gl::DebugMessageCallbackKHR(callback, userParam); +} + +GLuint GL_APIENTRY glGetDebugMessageLogKHR(GLuint count, + GLsizei bufSize, + GLenum *sources, + GLenum *types, + GLuint *ids, + GLenum *severities, + GLsizei *lengths, + GLchar *messageLog) +{ + return gl::GetDebugMessageLogKHR(count, bufSize, sources, types, ids, severities, lengths, + messageLog); +} + +void GL_APIENTRY glPushDebugGroupKHR(GLenum source, + GLuint id, + GLsizei length, + const GLchar *message) +{ + return gl::PushDebugGroupKHR(source, id, length, message); +} + +void GL_APIENTRY glPopDebugGroupKHR(void) +{ + return gl::PopDebugGroupKHR(); +} + +void GL_APIENTRY glObjectLabelKHR(GLenum identifier, + GLuint name, + GLsizei length, + const GLchar *label) +{ + return gl::ObjectLabelKHR(identifier, name, length, label); +} + +void GL_APIENTRY +glGetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label) +{ + return gl::GetObjectLabelKHR(identifier, name, bufSize, length, label); +} + +void GL_APIENTRY glObjectPtrLabelKHR(const void *ptr, GLsizei length, const GLchar *label) +{ + return gl::ObjectPtrLabelKHR(ptr, length, label); +} + +void GL_APIENTRY glGetObjectPtrLabelKHR(const void *ptr, + GLsizei bufSize, + GLsizei *length, + GLchar *label) +{ + return gl::GetObjectPtrLabelKHR(ptr, bufSize, length, label); +} + +void GL_APIENTRY glGetPointervKHR(GLenum pname, void **params) +{ + return gl::GetPointervKHR(pname, params); +} + +void GL_APIENTRY glBindUniformLocationCHROMIUM(GLuint program, GLint location, const GLchar *name) +{ + return gl::BindUniformLocationCHROMIUM(program, location, name); +} + +void GL_APIENTRY glCoverageModulationCHROMIUM(GLenum components) +{ + return gl::CoverageModulationCHROMIUM(components); +} + +// CHROMIUM_path_rendendering +void GL_APIENTRY glMatrixLoadfCHROMIUM(GLenum matrixMode, const GLfloat *matrix) +{ + gl::MatrixLoadfCHROMIUM(matrixMode, matrix); +} + +void GL_APIENTRY glMatrixLoadIdentityCHROMIUM(GLenum matrixMode) +{ + gl::MatrixLoadIdentityCHROMIUM(matrixMode); +} + +GLuint GL_APIENTRY glGenPathsCHROMIUM(GLsizei range) +{ + return gl::GenPathsCHROMIUM(range); +} + +void GL_APIENTRY glDeletePathsCHROMIUM(GLuint first, GLsizei range) +{ + gl::DeletePathsCHROMIUM(first, range); +} + +GLboolean GL_APIENTRY glIsPathCHROMIUM(GLuint path) +{ + return gl::IsPathCHROMIUM(path); +} + +void GL_APIENTRY glPathCommandsCHROMIUM(GLuint path, + GLsizei numCommands, + const GLubyte *commands, + GLsizei numCoords, + GLenum coordType, + const void *coords) +{ + gl::PathCommandsCHROMIUM(path, numCommands, commands, numCoords, coordType, coords); +} + +void GL_APIENTRY glPathParameterfCHROMIUM(GLuint path, GLenum pname, GLfloat value) +{ + gl::PathParameterfCHROMIUM(path, pname, value); +} + +void GL_APIENTRY glPathParameteriCHROMIUM(GLuint path, GLenum pname, GLint value) +{ + gl::PathParameteriCHROMIUM(path, pname, value); +} + +void GL_APIENTRY glGetPathParameterfvCHROMIUM(GLuint path, GLenum pname, GLfloat *value) +{ + gl::GetPathParameterfCHROMIUM(path, pname, value); +} + +void GL_APIENTRY glGetPathParameterivCHROMIUM(GLuint path, GLenum pname, GLint *value) +{ + gl::GetPathParameteriCHROMIUM(path, pname, value); +} + +void GL_APIENTRY glPathStencilFuncCHROMIUM(GLenum func, GLint ref, GLuint mask) +{ + gl::PathStencilFuncCHROMIUM(func, ref, mask); +} + +void GL_APIENTRY glStencilFillPathCHROMIUM(GLuint path, GLenum fillMode, GLuint mask) +{ + gl::StencilFillPathCHROMIUM(path, fillMode, mask); +} + +void GL_APIENTRY glStencilStrokePathCHROMIUM(GLuint path, GLint reference, GLuint mask) +{ + gl::StencilStrokePathCHROMIUM(path, reference, mask); +} + +void GL_APIENTRY glCoverFillPathCHROMIUM(GLuint path, GLenum coverMode) +{ + gl::CoverFillPathCHROMIUM(path, coverMode); +} + +void GL_APIENTRY glCoverStrokePathCHROMIUM(GLuint path, GLenum coverMode) +{ + gl::CoverStrokePathCHROMIUM(path, coverMode); +} + +void GL_APIENTRY glStencilThenCoverFillPathCHROMIUM(GLuint path, + GLenum fillMode, + GLuint mask, + GLenum coverMode) +{ + gl::StencilThenCoverFillPathCHROMIUM(path, fillMode, mask, coverMode); +} + +void GL_APIENTRY glStencilThenCoverStrokePathCHROMIUM(GLuint path, + GLint reference, + GLuint mask, + GLenum coverMode) +{ + gl::StencilThenCoverStrokePathCHROMIUM(path, reference, mask, coverMode); +} + +void GL_APIENTRY glCoverFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + gl::CoverFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, coverMode, + transformType, transformValues); +} + +void GL_APIENTRY glCoverStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + gl::CoverStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, coverMode, + transformType, transformValues); +} + +void GL_APIENTRY glStencilFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum fillMode, + GLuint mask, + GLenum transformType, + const GLfloat *transformValues) +{ + gl::StencilFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, fillMode, mask, + transformType, transformValues); +} + +void GL_APIENTRY glStencilStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLint reference, + GLuint mask, + GLenum transformType, + const GLfloat *transformValues) +{ + gl::StencilStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, reference, mask, + transformType, transformValues); +} + +void GL_APIENTRY glStencilThenCoverFillPathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLenum fillMode, + GLuint mask, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + gl::StencilThenCoverFillPathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, fillMode, + mask, coverMode, transformType, transformValues); +} + +void GL_APIENTRY glStencilThenCoverStrokePathInstancedCHROMIUM(GLsizei numPaths, + GLenum pathNameType, + const void *paths, + GLuint pathBase, + GLint reference, + GLuint mask, + GLenum coverMode, + GLenum transformType, + const GLfloat *transformValues) +{ + gl::StencilThenCoverStrokePathInstancedCHROMIUM(numPaths, pathNameType, paths, pathBase, + reference, mask, coverMode, transformType, + transformValues); +} + +void GL_APIENTRY glBindFragmentInputLocationCHROMIUM(GLuint program, + GLint location, + const GLchar *name) +{ + gl::BindFragmentInputLocationCHROMIUM(program, location, name); +} + +void GL_APIENTRY glProgramPathFragmentInputGenCHROMIUM(GLuint program, + GLint location, + GLenum genMode, + GLint components, + const GLfloat *coeffs) +{ + gl::ProgramPathFragmentInputGenCHROMIUM(program, location, genMode, components, coeffs); +} + +// GLES 3.1 +void GL_APIENTRY glDispatchCompute(GLuint numGroupsX, GLuint numGroupsY, GLuint numGroupsZ) +{ + gl::DispatchCompute(numGroupsX, numGroupsY, numGroupsZ); +} + +void GL_APIENTRY glDispatchComputeIndirect(GLintptr indirect) +{ + gl::DispatchComputeIndirect(indirect); +} + +void GL_APIENTRY glDrawArraysIndirect(GLenum mode, const void *indirect) +{ + gl::DrawArraysIndirect(mode, indirect); +} + +void GL_APIENTRY glDrawElementsIndirect(GLenum mode, GLenum type, const void *indirect) +{ + gl::DrawElementsIndirect(mode, type, indirect); +} + +void GL_APIENTRY glFramebufferParameteri(GLenum target, GLenum pname, GLint param) +{ + gl::FramebufferParameteri(target, pname, param); +} + +void GL_APIENTRY glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint *params) +{ + gl::GetFramebufferParameteriv(target, pname, params); +} + +void GL_APIENTRY glGetProgramInterfaceiv(GLuint program, + GLenum programInterface, + GLenum pname, + GLint *params) +{ + gl::GetProgramInterfaceiv(program, programInterface, pname, params); +} + +GLuint GL_APIENTRY glGetProgramResourceIndex(GLuint program, + GLenum programInterface, + const GLchar *name) +{ + return gl::GetProgramResourceIndex(program, programInterface, name); +} + +void GL_APIENTRY glGetProgramResourceName(GLuint program, + GLenum programInterface, + GLuint index, + GLsizei bufSize, + GLsizei *length, + GLchar *name) +{ + gl::GetProgramResourceName(program, programInterface, index, bufSize, length, name); +} + +void GL_APIENTRY glGetProgramResourceiv(GLuint program, + GLenum programInterface, + GLuint index, + GLsizei propCount, + const GLenum *props, + GLsizei bufSize, + GLsizei *length, + GLint *params) +{ + gl::GetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, + params); +} + +GLint GL_APIENTRY glGetProgramResourceLocation(GLuint program, + GLenum programInterface, + const GLchar *name) +{ + return gl::GetProgramResourceLocation(program, programInterface, name); +} + +void GL_APIENTRY glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) +{ + gl::UseProgramStages(pipeline, stages, program); +} + +void GL_APIENTRY glActiveShaderProgram(GLuint pipeline, GLuint program) +{ + gl::ActiveShaderProgram(pipeline, program); +} + +GLuint GL_APIENTRY glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const *strings) +{ + return gl::CreateShaderProgramv(type, count, strings); +} + +void GL_APIENTRY glBindProgramPipeline(GLuint pipeline) +{ + gl::BindProgramPipeline(pipeline); +} + +void GL_APIENTRY glDeleteProgramPipelines(GLsizei n, const GLuint *pipelines) +{ + gl::DeleteProgramPipelines(n, pipelines); +} + +void GL_APIENTRY glGenProgramPipelines(GLsizei n, GLuint *pipelines) +{ + gl::GenProgramPipelines(n, pipelines); +} + +GLboolean GL_APIENTRY glIsProgramPipeline(GLuint pipeline) +{ + return gl::IsProgramPipeline(pipeline); +} + +void GL_APIENTRY glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint *params) +{ + gl::GetProgramPipelineiv(pipeline, pname, params); +} + +void GL_APIENTRY glProgramUniform1i(GLuint program, GLint location, GLint v0) +{ + gl::ProgramUniform1i(program, location, v0); +} + +void GL_APIENTRY glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) +{ + gl::ProgramUniform2i(program, location, v0, v1); +} + +void GL_APIENTRY glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) +{ + gl::ProgramUniform3i(program, location, v0, v1, v2); +} + +void GL_APIENTRY +glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) +{ + gl::ProgramUniform4i(program, location, v0, v1, v2, v3); +} + +void GL_APIENTRY glProgramUniform1ui(GLuint program, GLint location, GLuint v0) +{ + gl::ProgramUniform1ui(program, location, v0); +} + +void GL_APIENTRY glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) +{ + gl::ProgramUniform2ui(program, location, v0, v1); +} + +void GL_APIENTRY +glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) +{ + gl::ProgramUniform3ui(program, location, v0, v1, v2); +} + +void GL_APIENTRY +glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) +{ + gl::ProgramUniform4ui(program, location, v0, v1, v2, v3); +} + +void GL_APIENTRY glProgramUniform1f(GLuint program, GLint location, GLfloat v0) +{ + gl::ProgramUniform1f(program, location, v0); +} + +void GL_APIENTRY glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) +{ + gl::ProgramUniform2f(program, location, v0, v1); +} + +void GL_APIENTRY +glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) +{ + gl::ProgramUniform3f(program, location, v0, v1, v2); +} + +void GL_APIENTRY +glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) +{ + gl::ProgramUniform4f(program, location, v0, v1, v2, v3); +} + +void GL_APIENTRY glProgramUniform1iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + gl::ProgramUniform1iv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform2iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + gl::ProgramUniform2iv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform3iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + gl::ProgramUniform3iv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform4iv(GLuint program, + GLint location, + GLsizei count, + const GLint *value) +{ + gl::ProgramUniform4iv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform1uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + gl::ProgramUniform1uiv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform2uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + gl::ProgramUniform2uiv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform3uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + gl::ProgramUniform3uiv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform4uiv(GLuint program, + GLint location, + GLsizei count, + const GLuint *value) +{ + gl::ProgramUniform4uiv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform1fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + gl::ProgramUniform1fv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform2fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + gl::ProgramUniform2fv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform3fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + gl::ProgramUniform3fv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniform4fv(GLuint program, + GLint location, + GLsizei count, + const GLfloat *value) +{ + gl::ProgramUniform4fv(program, location, count, value); +} + +void GL_APIENTRY glProgramUniformMatrix2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix2fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix3fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix4fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix2x3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix2x3fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix3x2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix3x2fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix2x4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix2x4fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix4x2fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix4x2fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix3x4fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix3x4fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glProgramUniformMatrix4x3fv(GLuint program, + GLint location, + GLsizei count, + GLboolean transpose, + const GLfloat *value) +{ + gl::ProgramUniformMatrix4x3fv(program, location, count, transpose, value); +} + +void GL_APIENTRY glValidateProgramPipeline(GLuint pipeline) +{ + gl::ValidateProgramPipeline(pipeline); +} + +void GL_APIENTRY glGetProgramPipelineInfoLog(GLuint pipeline, + GLsizei bufSize, + GLsizei *length, + GLchar *infoLog) +{ + gl::GetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog); +} + +void GL_APIENTRY glBindImageTexture(GLuint unit, + GLuint texture, + GLint level, + GLboolean layered, + GLint layer, + GLenum access, + GLenum format) +{ + gl::BindImageTexture(unit, texture, level, layered, layer, access, format); +} + +void GL_APIENTRY glGetBooleani_v(GLenum target, GLuint index, GLboolean *data) +{ + gl::GetBooleani_v(target, index, data); +} + +void GL_APIENTRY glMemoryBarrier(GLbitfield barriers) +{ + gl::MemoryBarrier(barriers); +} + +void GL_APIENTRY glMemoryBarrierByRegion(GLbitfield barriers) +{ + gl::MemoryBarrierByRegion(barriers); +} + +void GL_APIENTRY glTexStorage2DMultisample(GLenum target, + GLsizei samples, + GLenum internalformat, + GLsizei width, + GLsizei height, + GLboolean fixedsamplelocations) +{ + gl::TexStorage2DMultisample(target, samples, internalformat, width, height, + fixedsamplelocations); +} + +void GL_APIENTRY glGetMultisamplefv(GLenum pname, GLuint index, GLfloat *val) +{ + gl::GetMultisamplefv(pname, index, val); +} + +void GL_APIENTRY glSampleMaski(GLuint maskNumber, GLbitfield mask) +{ + gl::SampleMaski(maskNumber, mask); +} + +void GL_APIENTRY glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint *params) +{ + gl::GetTexLevelParameteriv(target, level, pname, params); +} + +void GL_APIENTRY glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat *params) +{ + gl::GetTexLevelParameterfv(target, level, pname, params); +} + +void GL_APIENTRY glBindVertexBuffer(GLuint bindingindex, + GLuint buffer, + GLintptr offset, + GLsizei stride) +{ + gl::BindVertexBuffer(bindingindex, buffer, offset, stride); +} + +void GL_APIENTRY glVertexAttribFormat(GLuint attribindex, + GLint size, + GLenum type, + GLboolean normalized, + GLuint relativeoffset) +{ + gl::VertexAttribFormat(attribindex, size, type, normalized, relativeoffset); +} + +void GL_APIENTRY glVertexAttribIFormat(GLuint attribindex, + GLint size, + GLenum type, + GLuint relativeoffset) +{ + gl::VertexAttribIFormat(attribindex, size, type, relativeoffset); +} + +void GL_APIENTRY glVertexAttribBinding(GLuint attribindex, GLuint bindingindex) +{ + gl::VertexAttribBinding(attribindex, bindingindex); +} + +void GL_APIENTRY glVertexBindingDivisor(GLuint bindingindex, GLuint divisor) +{ + gl::VertexBindingDivisor(bindingindex, divisor); +} +} // extern "C" diff --git a/gfx/angle/src/libGLESv2/libGLESv2.def b/gfx/angle/src/libGLESv2/libGLESv2.def new file mode 100755 index 000000000..3bf0345c1 --- /dev/null +++ b/gfx/angle/src/libGLESv2/libGLESv2.def @@ -0,0 +1,414 @@ +LIBRARY libGLESv2 +EXPORTS + glActiveTexture @1 + glAttachShader @2 + glBindAttribLocation @3 + glBindBuffer @4 + glBindFramebuffer @5 + glBindRenderbuffer @6 + glBindTexture @7 + glBlendColor @8 + glBlendEquation @9 + glBlendEquationSeparate @10 + glBlendFunc @11 + glBlendFuncSeparate @12 + glBufferData @13 + glBufferSubData @14 + glCheckFramebufferStatus @15 + glClear @16 + glClearColor @17 + glClearDepthf @18 + glClearStencil @19 + glColorMask @20 + glCompileShader @21 + glCompressedTexImage2D @22 + glCompressedTexSubImage2D @23 + glCopyTexImage2D @24 + glCopyTexSubImage2D @25 + glCreateProgram @26 + glCreateShader @27 + glCullFace @28 + glDeleteBuffers @29 + glDeleteFramebuffers @30 + glDeleteProgram @32 + glDeleteRenderbuffers @33 + glDeleteShader @34 + glDeleteTextures @31 + glDepthFunc @36 + glDepthMask @37 + glDepthRangef @38 + glDetachShader @35 + glDisable @39 + glDisableVertexAttribArray @40 + glDrawArrays @41 + glDrawElements @42 + glEnable @43 + glEnableVertexAttribArray @44 + glFinish @45 + glFlush @46 + glFramebufferRenderbuffer @47 + glFramebufferTexture2D @48 + glFrontFace @49 + glGenBuffers @50 + glGenFramebuffers @52 + glGenRenderbuffers @53 + glGenTextures @54 + glGenerateMipmap @51 + glGetActiveAttrib @55 + glGetActiveUniform @56 + glGetAttachedShaders @57 + glGetAttribLocation @58 + glGetBooleanv @59 + glGetBufferParameteriv @60 + glGetError @61 + glGetFloatv @62 + glGetFramebufferAttachmentParameteriv @63 + glGetIntegerv @64 + glGetProgramInfoLog @66 + glGetProgramiv @65 + glGetRenderbufferParameteriv @67 + glGetShaderInfoLog @69 + glGetShaderPrecisionFormat @70 + glGetShaderSource @71 + glGetShaderiv @68 + glGetString @72 + glGetTexParameterfv @73 + glGetTexParameteriv @74 + glGetUniformLocation @77 + glGetUniformfv @75 + glGetUniformiv @76 + glGetVertexAttribPointerv @80 + glGetVertexAttribfv @78 + glGetVertexAttribiv @79 + glHint @81 + glIsBuffer @82 + glIsEnabled @83 + glIsFramebuffer @84 + glIsProgram @85 + glIsRenderbuffer @86 + glIsShader @87 + glIsTexture @88 + glLineWidth @89 + glLinkProgram @90 + glPixelStorei @91 + glPolygonOffset @92 + glReadPixels @93 + glReleaseShaderCompiler @94 + glRenderbufferStorage @95 + glSampleCoverage @96 + glScissor @97 + glShaderBinary @98 + glShaderSource @99 + glStencilFunc @100 + glStencilFuncSeparate @101 + glStencilMask @102 + glStencilMaskSeparate @103 + glStencilOp @104 + glStencilOpSeparate @105 + glTexImage2D @106 + glTexParameterf @107 + glTexParameterfv @108 + glTexParameteri @109 + glTexParameteriv @110 + glTexSubImage2D @111 + glUniform1f @112 + glUniform1fv @113 + glUniform1i @114 + glUniform1iv @115 + glUniform2f @116 + glUniform2fv @117 + glUniform2i @118 + glUniform2iv @119 + glUniform3f @120 + glUniform3fv @121 + glUniform3i @122 + glUniform3iv @123 + glUniform4f @124 + glUniform4fv @125 + glUniform4i @126 + glUniform4iv @127 + glUniformMatrix2fv @128 + glUniformMatrix3fv @129 + glUniformMatrix4fv @130 + glUseProgram @131 + glValidateProgram @132 + glVertexAttrib1f @133 + glVertexAttrib1fv @134 + glVertexAttrib2f @135 + glVertexAttrib2fv @136 + glVertexAttrib3f @137 + glVertexAttrib3fv @138 + glVertexAttrib4f @139 + glVertexAttrib4fv @140 + glVertexAttribPointer @141 + glViewport @142 + + ; Extensions + glBlitFramebufferANGLE @149 + glRenderbufferStorageMultisampleANGLE @150 + glDeleteFencesNV @151 + glFinishFenceNV @152 + glGenFencesNV @153 + glGetFenceivNV @154 + glIsFenceNV @155 + glSetFenceNV @156 + glTestFenceNV @157 + glGetTranslatedShaderSourceANGLE @159 + glTexStorage2DEXT @160 + glGetGraphicsResetStatusEXT @161 + glReadnPixelsEXT @162 + glGetnUniformfvEXT @163 + glGetnUniformivEXT @164 + glGenQueriesEXT @165 + glDeleteQueriesEXT @166 + glIsQueryEXT @167 + glBeginQueryEXT @168 + glEndQueryEXT @169 + glGetQueryivEXT @170 + glGetQueryObjectuivEXT @171 + glVertexAttribDivisorANGLE @172 + glDrawArraysInstancedANGLE @173 + glDrawElementsInstancedANGLE @174 + glProgramBinaryOES @175 + glGetProgramBinaryOES @176 + glDrawBuffersEXT @179 + glMapBufferOES @285 + glUnmapBufferOES @286 + glGetBufferPointervOES @287 + glMapBufferRangeEXT @288 + glFlushMappedBufferRangeEXT @289 + glDiscardFramebufferEXT @293 + glInsertEventMarkerEXT @294 + glPushGroupMarkerEXT @295 + glPopGroupMarkerEXT @296 + glEGLImageTargetTexture2DOES @297 + glEGLImageTargetRenderbufferStorageOES @298 + glBindVertexArrayOES @299 + glDeleteVertexArraysOES @300 + glGenVertexArraysOES @301 + glIsVertexArrayOES @302 + glDebugMessageControlKHR @303 + glDebugMessageInsertKHR @304 + glDebugMessageCallbackKHR @305 + glGetDebugMessageLogKHR @306 + glPushDebugGroupKHR @307 + glPopDebugGroupKHR @308 + glObjectLabelKHR @309 + glGetObjectLabelKHR @310 + glObjectPtrLabelKHR @311 + glGetObjectPtrLabelKHR @312 + glGetPointervKHR @313 + glQueryCounterEXT @314 + glGetQueryObjectivEXT @315 + glGetQueryObjecti64vEXT @316 + glGetQueryObjectui64vEXT @317 + glBindUniformLocationCHROMIUM @318 + glCoverageModulationCHROMIUM @319 + + glMatrixLoadfCHROMIUM @320 + glMatrixLoadIdentityCHROMIUM @321 + glGenPathsCHROMIUM @322 + glDeletePathsCHROMIUM @323 + glIsPathCHROMIUM @324 + glPathCommandsCHROMIUM @325 + glPathParameterfCHROMIUM @326 + glPathParameteriCHROMIUM @327 + glGetPathParameterfvCHROMIUM @328 + glGetPathParameterivCHROMIUM @329 + glPathStencilFuncCHROMIUM @330 + glStencilFillPathCHROMIUM @331 + glStencilStrokePathCHROMIUM @332 + glCoverFillPathCHROMIUM @333 + glCoverStrokePathCHROMIUM @334 + glStencilThenCoverFillPathCHROMIUM @335 + glStencilThenCoverStrokePathCHROMIUM @336 + glCoverFillPathInstancedCHROMIUM @337 + glCoverStrokePathInstancedCHROMIUM @338 + glStencilStrokePathInstancedCHROMIUM @339 + glStencilFillPathInstancedCHROMIUM @340 + glStencilThenCoverFillPathInstancedCHROMIUM @341 + glStencilThenCoverStrokePathInstancedCHROMIUM @342 + glBindFragmentInputLocationCHROMIUM @343 + glProgramPathFragmentInputGenCHROMIUM @344 + + ; GLES 3.0 Functions + glReadBuffer @180 + glDrawRangeElements @181 + glTexImage3D @182 + glTexSubImage3D @183 + glCopyTexSubImage3D @184 + glCompressedTexImage3D @185 + glCompressedTexSubImage3D @186 + glGenQueries @187 + glDeleteQueries @188 + glIsQuery @189 + glBeginQuery @190 + glEndQuery @191 + glGetQueryiv @192 + glGetQueryObjectuiv @193 + glUnmapBuffer @194 + glGetBufferPointerv @195 + glDrawBuffers @196 + glUniformMatrix2x3fv @197 + glUniformMatrix3x2fv @198 + glUniformMatrix2x4fv @199 + glUniformMatrix4x2fv @200 + glUniformMatrix3x4fv @201 + glUniformMatrix4x3fv @202 + glBlitFramebuffer @203 + glRenderbufferStorageMultisample @204 + glFramebufferTextureLayer @205 + glMapBufferRange @206 + glFlushMappedBufferRange @207 + glBindVertexArray @208 + glDeleteVertexArrays @209 + glGenVertexArrays @210 + glIsVertexArray @211 + glGetIntegeri_v @212 + glBeginTransformFeedback @213 + glEndTransformFeedback @214 + glBindBufferRange @215 + glBindBufferBase @216 + glTransformFeedbackVaryings @217 + glGetTransformFeedbackVarying @218 + glVertexAttribIPointer @219 + glGetVertexAttribIiv @220 + glGetVertexAttribIuiv @221 + glVertexAttribI4i @222 + glVertexAttribI4ui @223 + glVertexAttribI4iv @224 + glVertexAttribI4uiv @225 + glGetUniformuiv @226 + glGetFragDataLocation @227 + glUniform1ui @228 + glUniform2ui @229 + glUniform3ui @230 + glUniform4ui @231 + glUniform1uiv @232 + glUniform2uiv @233 + glUniform3uiv @234 + glUniform4uiv @235 + glClearBufferiv @236 + glClearBufferuiv @237 + glClearBufferfv @238 + glClearBufferfi @239 + glGetStringi @240 + glCopyBufferSubData @241 + glGetUniformIndices @242 + glGetActiveUniformsiv @243 + glGetUniformBlockIndex @244 + glGetActiveUniformBlockiv @245 + glGetActiveUniformBlockName @246 + glUniformBlockBinding @247 + glDrawArraysInstanced @248 + glDrawElementsInstanced @249 + glFenceSync @250 + glIsSync @251 + glDeleteSync @252 + glClientWaitSync @253 + glWaitSync @254 + glGetInteger64v @255 + glGetSynciv @256 + glGetInteger64i_v @257 + glGetBufferParameteri64v @258 + glGenSamplers @259 + glDeleteSamplers @260 + glIsSampler @261 + glBindSampler @262 + glSamplerParameteri @263 + glSamplerParameteriv @264 + glSamplerParameterf @265 + glSamplerParameterfv @266 + glGetSamplerParameteriv @267 + glGetSamplerParameterfv @268 + glVertexAttribDivisor @269 + glBindTransformFeedback @270 + glDeleteTransformFeedbacks @271 + glGenTransformFeedbacks @272 + glIsTransformFeedback @273 + glPauseTransformFeedback @274 + glResumeTransformFeedback @275 + glGetProgramBinary @276 + glProgramBinary @277 + glProgramParameteri @278 + glInvalidateFramebuffer @279 + glInvalidateSubFramebuffer @280 + glTexStorage2D @281 + glTexStorage3D @282 + glGetInternalformativ @283 + + ; GLES 3.1 Functions + glDispatchCompute @345 + glDispatchComputeIndirect @346 + glDrawArraysIndirect @347 + glDrawElementsIndirect @348 + glFramebufferParameteri @349 + glGetFramebufferParameteriv @350 + glGetProgramInterfaceiv @351 + glGetProgramResourceIndex @352 + glGetProgramResourceName @353 + glGetProgramResourceiv @354 + glGetProgramResourceLocation @355 + glUseProgramStages @356 + glActiveShaderProgram @357 + glCreateShaderProgramv @358 + glBindProgramPipeline @359 + glDeleteProgramPipelines @360 + glGenProgramPipelines @361 + glIsProgramPipeline @362 + glGetProgramPipelineiv @363 + glProgramUniform1i @364 + glProgramUniform2i @365 + glProgramUniform3i @366 + glProgramUniform4i @367 + glProgramUniform1ui @368 + glProgramUniform2ui @369 + glProgramUniform3ui @370 + glProgramUniform4ui @371 + glProgramUniform1f @372 + glProgramUniform2f @373 + glProgramUniform3f @374 + glProgramUniform4f @375 + glProgramUniform1iv @376 + glProgramUniform2iv @377 + glProgramUniform3iv @378 + glProgramUniform4iv @379 + glProgramUniform1uiv @380 + glProgramUniform2uiv @381 + glProgramUniform3uiv @382 + glProgramUniform4uiv @383 + glProgramUniform1fv @384 + glProgramUniform2fv @385 + glProgramUniform3fv @386 + glProgramUniform4fv @387 + glProgramUniformMatrix2fv @388 + glProgramUniformMatrix3fv @389 + glProgramUniformMatrix4fv @390 + glProgramUniformMatrix2x3fv @391 + glProgramUniformMatrix3x2fv @392 + glProgramUniformMatrix2x4fv @393 + glProgramUniformMatrix4x2fv @394 + glProgramUniformMatrix3x4fv @395 + glProgramUniformMatrix4x3fv @396 + glValidateProgramPipeline @397 + glGetProgramPipelineInfoLog @398 + glBindImageTexture @399 + glGetBooleani_v @400 + glMemoryBarrier @401 + glMemoryBarrierByRegion @402 + glTexStorage2DMultisample @403 + glGetMultisamplefv @404 + glSampleMaski @405 + glGetTexLevelParameteriv @406 + glGetTexLevelParameterfv @407 + glBindVertexBuffer @408 + glVertexAttribFormat @409 + glVertexAttribIFormat @410 + glVertexAttribBinding @411 + glVertexBindingDivisor @412 + + ; ANGLE Platform Implementation + ANGLEPlatformCurrent @290 + ANGLEPlatformInitialize @291 + ANGLEPlatformShutdown @292 + diff --git a/gfx/angle/src/libGLESv2/libGLESv2.rc b/gfx/angle/src/libGLESv2/libGLESv2.rc new file mode 100755 index 000000000..dfae63eaa --- /dev/null +++ b/gfx/angle/src/libGLESv2/libGLESv2.rc @@ -0,0 +1,103 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include <windows.h>
+#include "../common/version.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "#include ""../common/version.h""\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,ANGLE_REVISION,0
+ PRODUCTVERSION ANGLE_MAJOR_VERSION,ANGLE_MINOR_VERSION,ANGLE_REVISION,0
+ FILEFLAGSMASK 0x17L
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "ANGLE libGLESv2 Dynamic Link Library"
+ VALUE "FileVersion", ANGLE_VERSION_STRING
+ VALUE "InternalName", "libGLESv2"
+ VALUE "LegalCopyright", "Copyright (C) 2015 Google Inc."
+ VALUE "OriginalFilename", "libGLESv2.dll"
+ VALUE "PrivateBuild", ANGLE_VERSION_STRING
+ VALUE "ProductName", "ANGLE libGLESv2 Dynamic Link Library"
+ VALUE "ProductVersion", ANGLE_VERSION_STRING
+ VALUE "Comments", "Build Date: " ANGLE_COMMIT_DATE
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
diff --git a/gfx/angle/src/libGLESv2/moz.build b/gfx/angle/src/libGLESv2/moz.build new file mode 100755 index 000000000..1d40b3b67 --- /dev/null +++ b/gfx/angle/src/libGLESv2/moz.build @@ -0,0 +1,88 @@ + +# +# WARNING WARNING WARNING +# +# This file is generated by generate_mozbuild.py (from +# https://github.com/mozilla/angle). Do not modify it without also modifying +# generate_mozbuild.py. +# +# WARNING WARNING WARNING +# +UNIFIED_SOURCES += [ + 'entry_points_egl.cpp', + 'entry_points_egl_ext.cpp', + 'entry_points_gles_2_0.cpp', + 'entry_points_gles_2_0_ext.cpp', + 'entry_points_gles_3_0.cpp', + 'entry_points_gles_3_1.cpp', + 'global_state.cpp', + 'libGLESv2.cpp', +] + + +if CONFIG['GNU_CXX']: + CXXFLAGS += [ + '-Wno-attributes', + '-Wno-shadow', + '-Wno-sign-compare', + '-Wno-unknown-pragmas', + '-Wno-unreachable-code', + ] + if CONFIG['CLANG_CXX']: + CXXFLAGS += [ + '-Wno-inconsistent-missing-override', + '-Wno-unused-private-field', + ] + else: + CXXFLAGS += [ + '-Wno-shadow-compatible-local', + '-Wno-shadow-local', + ] + +if CONFIG['MOZ_DIRECTX_SDK_PATH'] and not CONFIG['MOZ_HAS_WINSDK_WITH_D3D']: + LOCAL_INCLUDES += ['%' + '%s/include/' % CONFIG['MOZ_DIRECTX_SDK_PATH']] + +DEFINES['_CRT_SECURE_NO_DEPRECATE'] = True +DEFINES['_HAS_EXCEPTIONS'] = 0 + +if not CONFIG['MOZ_DEBUG']: + DEFINES['_SECURE_SCL'] = 0 + +DEFINES['ANGLE_ENABLE_D3D9'] = True +DEFINES['ANGLE_SKIP_DXGI_1_2_CHECK'] = True +if CONFIG['MOZ_HAS_WINSDK_WITH_D3D']: + DEFINES['ANGLE_ENABLE_D3D11'] = True + +DEFINES['ANGLE_COMPILE_OPTIMIZATION_LEVEL'] = 'D3DCOMPILE_OPTIMIZATION_LEVEL1' +DEFINES['ANGLE_NO_EXCEPTIONS'] = True + +# We need these defined to nothing so that we don't get bogus dllimport declspecs +DEFINES['GL_APICALL'] = "" +DEFINES['GL_GLEXT_PROTOTYPES'] = "" +DEFINES['EGLAPI'] = "" + + + +LOCAL_INCLUDES += [ '../../include', '../../src', '../../src/common/third_party/numerics', '../../src/third_party/khronos' ] + +DEFINES['LIBANGLE_IMPLEMENTATION'] = "1" +DEFINES['ANGLE_ENABLE_HLSL'] = "1" +DEFINES['ANGLE_ENABLE_GLSL'] = "1" +DEFINES['ANGLE_ENABLE_ESSL'] = "1" +DEFINES['ANGLE_ENABLE_KEYEDMUTEX'] = "1" + +if CONFIG['MOZ_HAS_WINSDK_WITH_D3D']: + OS_LIBS += [ 'd3d9', 'dxguid' ] +else: + EXTRA_DSO_LDOPTS += [ + '\'%s/lib/%s/d3d9.lib\'' % (CONFIG['MOZ_DIRECTX_SDK_PATH'], CONFIG['MOZ_D3D_CPU_SUFFIX']), + '\'%s/lib/%s/dxguid.lib\'' % (CONFIG['MOZ_DIRECTX_SDK_PATH'], CONFIG['MOZ_D3D_CPU_SUFFIX']), + ] + +GeckoSharedLibrary('libGLESv2', linkage=None) + +RCFILE = SRCDIR + '/libGLESv2.rc' +DEFFILE = SRCDIR + '/libGLESv2.def' + +USE_LIBS += ['libANGLE'] + diff --git a/gfx/angle/src/libGLESv2/resource.h b/gfx/angle/src/libGLESv2/resource.h new file mode 100755 index 000000000..39adaad0d --- /dev/null +++ b/gfx/angle/src/libGLESv2/resource.h @@ -0,0 +1,14 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by libGLESv2.rc + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 101 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1001 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif |