Commit e1a057e8 by Geoff Lang Committed by Commit Bot

Fully format some files.

Change-Id: Id6ea245849696d4c6d7eabc6860c0ac424dd8013 Reviewed-on: https://chromium-review.googlesource.com/1091309Reviewed-by: 's avatarGeoff Lang <geofflang@chromium.org> Commit-Queue: Geoff Lang <geofflang@chromium.org>
parent 74be296b
......@@ -715,13 +715,13 @@ void Extensions::setTextureExtensionSupport(const TextureCapsMap &textureCaps)
compressedEACR11SignedTexture = DetermineEACR11SignedTextureSupport(textureCaps);
compressedEACRG11UnsignedTexture = DetermineEACRG11UnsignedTextureSupport(textureCaps);
compressedEACRG11SignedTexture = DetermineEACRG11SignedTextureSupport(textureCaps);
sRGB = DetermineSRGBTextureSupport(textureCaps);
depthTextures = DetermineDepthTextureSupport(textureCaps);
depth32 = DetermineDepth32Support(textureCaps);
colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps);
colorBufferFloatRGBA = DetermineColorBufferFloatRGBASupport(textureCaps);
colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
textureNorm16 = DetermineTextureNorm16Support(textureCaps);
sRGB = DetermineSRGBTextureSupport(textureCaps);
depthTextures = DetermineDepthTextureSupport(textureCaps);
depth32 = DetermineDepth32Support(textureCaps);
colorBufferFloatRGB = DetermineColorBufferFloatRGBSupport(textureCaps);
colorBufferFloatRGBA = DetermineColorBufferFloatRGBASupport(textureCaps);
colorBufferFloat = DetermineColorBufferFloatSupport(textureCaps);
textureNorm16 = DetermineTextureNorm16Support(textureCaps);
}
const ExtensionInfoMap &GetExtensionInfoMap()
......@@ -1054,13 +1054,13 @@ Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensi
caps.fragmentLowpInt.setSimulatedInt(8);
// Table 6.20
caps.maxVertexAttributes = 8;
caps.maxVertexUniformVectors = 128;
caps.maxVaryingVectors = 8;
caps.maxCombinedTextureImageUnits = 8;
caps.maxVertexAttributes = 8;
caps.maxVertexUniformVectors = 128;
caps.maxVaryingVectors = 8;
caps.maxCombinedTextureImageUnits = 8;
caps.maxShaderTextureImageUnits[ShaderType::Fragment] = 8;
caps.maxFragmentUniformVectors = 16;
caps.maxRenderbufferSize = 1;
caps.maxFragmentUniformVectors = 16;
caps.maxRenderbufferSize = 1;
}
if (clientVersion >= Version(3, 0))
......@@ -1100,21 +1100,21 @@ Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensi
caps.maxServerWaitTimeout = 0;
// Table 6.31
caps.maxVertexAttributes = 16;
caps.maxVertexAttributes = 16;
caps.maxShaderUniformComponents[ShaderType::Vertex] = 1024;
caps.maxVertexUniformVectors = 256;
caps.maxVertexUniformVectors = 256;
caps.maxShaderUniformBlocks[ShaderType::Vertex] = 12;
caps.maxVertexOutputComponents = 64;
caps.maxVertexOutputComponents = 64;
caps.maxShaderTextureImageUnits[ShaderType::Vertex] = 16;
// Table 6.32
caps.maxShaderUniformComponents[ShaderType::Fragment] = 896;
caps.maxFragmentUniformVectors = 224;
caps.maxFragmentUniformVectors = 224;
caps.maxShaderUniformBlocks[ShaderType::Fragment] = 12;
caps.maxFragmentInputComponents = 60;
caps.maxFragmentInputComponents = 60;
caps.maxShaderTextureImageUnits[ShaderType::Fragment] = 16;
caps.minProgramTexelOffset = -8;
caps.maxProgramTexelOffset = 7;
caps.minProgramTexelOffset = -8;
caps.maxProgramTexelOffset = 7;
// Table 6.33
caps.maxUniformBufferBindings = 24;
......@@ -1154,33 +1154,33 @@ Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensi
caps.maxShaderAtomicCounterBuffers[ShaderType::Vertex] = 0;
caps.maxShaderAtomicCounters[ShaderType::Vertex] = 0;
caps.maxShaderImageUniforms[ShaderType::Vertex] = 0;
caps.maxShaderStorageBlocks[ShaderType::Vertex] = 0;
caps.maxShaderStorageBlocks[ShaderType::Vertex] = 0;
// Table 20.44
caps.maxShaderUniformComponents[ShaderType::Fragment] = 1024;
caps.maxFragmentUniformVectors = 256;
caps.maxFragmentUniformVectors = 256;
caps.maxShaderAtomicCounterBuffers[ShaderType::Fragment] = 0;
caps.maxShaderAtomicCounters[ShaderType::Fragment] = 0;
caps.maxShaderImageUniforms[ShaderType::Fragment] = 0;
caps.maxShaderStorageBlocks[ShaderType::Fragment] = 0;
caps.minProgramTextureGatherOffset = 0;
caps.maxProgramTextureGatherOffset = 0;
caps.maxShaderStorageBlocks[ShaderType::Fragment] = 0;
caps.minProgramTextureGatherOffset = 0;
caps.maxProgramTextureGatherOffset = 0;
// Table 20.45
caps.maxComputeWorkGroupCount = {{65535, 65535, 65535}};
caps.maxComputeWorkGroupSize = {{128, 128, 64}};
caps.maxComputeWorkGroupInvocations = 12;
caps.maxShaderUniformBlocks[ShaderType::Compute] = 12;
caps.maxShaderTextureImageUnits[ShaderType::Compute] = 16;
caps.maxComputeSharedMemorySize = 16384;
caps.maxComputeWorkGroupCount = {{65535, 65535, 65535}};
caps.maxComputeWorkGroupSize = {{128, 128, 64}};
caps.maxComputeWorkGroupInvocations = 12;
caps.maxShaderUniformBlocks[ShaderType::Compute] = 12;
caps.maxShaderTextureImageUnits[ShaderType::Compute] = 16;
caps.maxComputeSharedMemorySize = 16384;
caps.maxShaderUniformComponents[ShaderType::Compute] = 1024;
caps.maxShaderAtomicCounterBuffers[ShaderType::Compute] = 1;
caps.maxShaderAtomicCounters[ShaderType::Compute] = 8;
caps.maxShaderImageUniforms[ShaderType::Compute] = 4;
caps.maxShaderStorageBlocks[ShaderType::Compute] = 4;
caps.maxShaderStorageBlocks[ShaderType::Compute] = 4;
// Table 20.46
caps.maxUniformBufferBindings = 36;
caps.maxUniformBufferBindings = 36;
caps.maxCombinedTextureImageUnits = 48;
caps.maxCombinedShaderOutputResources = 4;
......@@ -1211,16 +1211,16 @@ Caps GenerateMinimumCaps(const Version &clientVersion, const Extensions &extensi
// Table 20.43gs (GL_EXT_geometry_shader)
caps.maxShaderUniformComponents[ShaderType::Geometry] = 1024;
caps.maxShaderUniformBlocks[ShaderType::Geometry] = 12;
caps.maxGeometryInputComponents = 64;
caps.maxGeometryOutputComponents = 64;
caps.maxGeometryOutputVertices = 256;
caps.maxGeometryTotalOutputComponents = 1024;
caps.maxShaderTextureImageUnits[ShaderType::Geometry] = 16;
caps.maxShaderUniformBlocks[ShaderType::Geometry] = 12;
caps.maxGeometryInputComponents = 64;
caps.maxGeometryOutputComponents = 64;
caps.maxGeometryOutputVertices = 256;
caps.maxGeometryTotalOutputComponents = 1024;
caps.maxShaderTextureImageUnits[ShaderType::Geometry] = 16;
caps.maxShaderAtomicCounterBuffers[ShaderType::Geometry] = 0;
caps.maxShaderAtomicCounters[ShaderType::Geometry] = 0;
caps.maxShaderStorageBlocks[ShaderType::Geometry] = 0;
caps.maxGeometryShaderInvocations = 32;
caps.maxShaderStorageBlocks[ShaderType::Geometry] = 0;
caps.maxGeometryShaderInvocations = 32;
// Table 20.46 (GL_EXT_geometry_shader)
caps.maxShaderImageUniforms[ShaderType::Geometry] = 0;
......
......@@ -312,14 +312,14 @@ void Debug::pushDefaultGroup()
c0.source = GL_DONT_CARE;
c0.type = GL_DONT_CARE;
c0.severity = GL_DONT_CARE;
c0.enabled = true;
c0.enabled = true;
g.controls.push_back(std::move(c0));
Control c1;
c1.source = GL_DONT_CARE;
c1.type = GL_DONT_CARE;
c1.severity = GL_DEBUG_SEVERITY_LOW;
c1.enabled = false;
c1.enabled = false;
g.controls.push_back(std::move(c1));
mGroups.push_back(std::move(g));
......
......@@ -24,7 +24,7 @@ class LabeledObject
public:
virtual ~LabeledObject() {}
virtual void setLabel(const std::string &label) = 0;
virtual const std::string &getLabel() const = 0;
virtual const std::string &getLabel() const = 0;
};
class Debug : angle::NonCopyable
......
......@@ -11,8 +11,8 @@
#include <iterator>
#include <platform/Platform.h>
#include <EGL/eglext.h>
#include <platform/Platform.h>
#include "common/debug.h"
#include "common/platform.h"
......@@ -31,7 +31,8 @@ static std::string GenerateExtensionsString(const T &extensions)
std::vector<std::string> extensionsVector = extensions.getStrings();
std::ostringstream stream;
std::copy(extensionsVector.begin(), extensionsVector.end(), std::ostream_iterator<std::string>(stream, " "));
std::copy(extensionsVector.begin(), extensionsVector.end(),
std::ostream_iterator<std::string>(stream, " "));
return stream.str();
}
......@@ -92,8 +93,8 @@ Device::~Device()
Error Device::getDevice(EGLAttrib *value)
{
void *nativeDevice = nullptr;
egl::Error error = getImplementation()->getDevice(&nativeDevice);
*value = reinterpret_cast<EGLAttrib>(nativeDevice);
egl::Error error = getImplementation()->getDevice(&nativeDevice);
*value = reinterpret_cast<EGLAttrib>(nativeDevice);
return error;
}
......@@ -117,5 +118,4 @@ const std::string &Device::getExtensionString() const
{
return mDeviceExtensionString;
}
}
......@@ -11,8 +11,8 @@
#define LIBANGLE_DEVICE_H_
#include "common/angleutils.h"
#include "libANGLE/Error.h"
#include "libANGLE/Display.h"
#include "libANGLE/Error.h"
#include <memory>
......@@ -50,7 +50,6 @@ class Device final : angle::NonCopyable
DeviceExtensions mDeviceExtensions;
std::string mDeviceExtensionString;
};
}
#endif // LIBANGLE_DEVICE_H_
#endif // LIBANGLE_DEVICE_H_
......@@ -16,8 +16,8 @@
#include <sstream>
#include <vector>
#include <platform/Platform.h>
#include <EGL/eglext.h>
#include <platform/Platform.h>
#include "common/debug.h"
#include "common/mathutil.h"
......@@ -36,23 +36,23 @@
#include "third_party/trace_event/trace_event.h"
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
# include "libANGLE/renderer/d3d/DisplayD3D.h"
#include "libANGLE/renderer/d3d/DisplayD3D.h"
#endif
#if defined(ANGLE_ENABLE_OPENGL)
# if defined(ANGLE_PLATFORM_WINDOWS)
# include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
# elif defined(ANGLE_USE_X11)
# include "libANGLE/renderer/gl/glx/DisplayGLX.h"
# elif defined(ANGLE_PLATFORM_APPLE)
# include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
# elif defined(ANGLE_USE_OZONE)
# include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
# elif defined(ANGLE_PLATFORM_ANDROID)
# include "libANGLE/renderer/gl/egl/android/DisplayAndroid.h"
# else
# error Unsupported OpenGL platform.
# endif
#if defined(ANGLE_PLATFORM_WINDOWS)
#include "libANGLE/renderer/gl/wgl/DisplayWGL.h"
#elif defined(ANGLE_USE_X11)
#include "libANGLE/renderer/gl/glx/DisplayGLX.h"
#elif defined(ANGLE_PLATFORM_APPLE)
#include "libANGLE/renderer/gl/cgl/DisplayCGL.h"
#elif defined(ANGLE_USE_OZONE)
#include "libANGLE/renderer/gl/egl/ozone/DisplayOzone.h"
#elif defined(ANGLE_PLATFORM_ANDROID)
#include "libANGLE/renderer/gl/egl/android/DisplayAndroid.h"
#else
#error Unsupported OpenGL platform.
#endif
#endif
#if defined(ANGLE_ENABLE_NULL)
......@@ -77,7 +77,7 @@ namespace egl
namespace
{
typedef std::map<EGLNativeWindowType, Surface*> WindowSurfaceMap;
typedef std::map<EGLNativeWindowType, Surface *> WindowSurfaceMap;
// Get a map of all EGL window surfaces to validate that no window has more than one EGL surface
// associated with it.
static WindowSurfaceMap *GetWindowSurfaces()
......@@ -592,7 +592,7 @@ Error Display::terminate()
return NoError();
}
std::vector<const Config*> Display::getConfigs(const egl::AttributeMap &attribs) const
std::vector<const Config *> Display::getConfigs(const egl::AttributeMap &attribs) const
{
return mConfigSet.filter(attribs);
}
......@@ -825,7 +825,8 @@ Error Display::restoreLostDevice()
{
if ((*ctx)->isResetNotificationEnabled())
{
// If reset notifications have been requested, application must delete all contexts first
// If reset notifications have been requested, application must delete all contexts
// first
return EglContextLost();
}
}
......@@ -841,7 +842,8 @@ Error Display::destroySurface(Surface *surface)
ASSERT(windowSurfaces);
bool surfaceRemoved = false;
for (WindowSurfaceMap::iterator iter = windowSurfaces->begin(); iter != windowSurfaces->end(); iter++)
for (WindowSurfaceMap::iterator iter = windowSurfaces->begin();
iter != windowSurfaces->end(); iter++)
{
if (iter->second == surface)
{
......@@ -919,7 +921,8 @@ void Display::notifyDeviceLost()
return;
}
for (ContextSet::iterator context = mContextSet.begin(); context != mContextSet.end(); context++)
for (ContextSet::iterator context = mContextSet.begin(); context != mContextSet.end();
context++)
{
(*context)->markContextLost();
}
......@@ -985,8 +988,8 @@ static ClientExtensions GenerateClientExtensions()
ClientExtensions extensions;
extensions.clientExtensions = true;
extensions.platformBase = true;
extensions.platformANGLE = true;
extensions.platformBase = true;
extensions.platformANGLE = true;
#if defined(ANGLE_ENABLE_D3D9) || defined(ANGLE_ENABLE_D3D11)
extensions.platformANGLED3D = true;
......@@ -1002,8 +1005,8 @@ static ClientExtensions GenerateClientExtensions()
#endif
#if defined(ANGLE_ENABLE_D3D11)
extensions.deviceCreation = true;
extensions.deviceCreationD3D11 = true;
extensions.deviceCreation = true;
extensions.deviceCreationD3D11 = true;
extensions.experimentalPresentPath = true;
#endif
......@@ -1027,7 +1030,8 @@ static std::string GenerateExtensionsString(const T &extensions)
std::vector<std::string> extensionsVector = extensions.getStrings();
std::ostringstream stream;
std::copy(extensionsVector.begin(), extensionsVector.end(), std::ostream_iterator<std::string>(stream, " "));
std::copy(extensionsVector.begin(), extensionsVector.end(),
std::ostream_iterator<std::string>(stream, " "));
return stream.str();
}
......@@ -1051,9 +1055,9 @@ void Display::initDisplayExtensions()
mDisplayExtensions = mImplementation->getExtensions();
// Some extensions are always available because they are implemented in the EGL layer.
mDisplayExtensions.createContext = true;
mDisplayExtensions.createContextNoError = true;
mDisplayExtensions.createContextWebGLCompatibility = true;
mDisplayExtensions.createContext = true;
mDisplayExtensions.createContextNoError = true;
mDisplayExtensions.createContextWebGLCompatibility = true;
mDisplayExtensions.createContextBindGeneratesResource = true;
mDisplayExtensions.createContextClientArrays = true;
mDisplayExtensions.pixelFormatFloat = true;
......@@ -1115,8 +1119,7 @@ bool Display::isValidNativeDisplay(EGLNativeDisplayType display)
}
#if defined(ANGLE_PLATFORM_WINDOWS) && !defined(ANGLE_ENABLE_WINDOWS_STORE)
if (display == EGL_SOFTWARE_DISPLAY_ANGLE ||
display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
if (display == EGL_SOFTWARE_DISPLAY_ANGLE || display == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
display == EGL_D3D11_ONLY_DISPLAY_ANGLE)
{
return true;
......
......@@ -181,7 +181,7 @@ class Display final : angle::NonCopyable
ConfigSet mConfigSet;
typedef std::set<gl::Context*> ContextSet;
typedef std::set<gl::Context *> ContextSet;
ContextSet mContextSet;
typedef std::set<Image *> ImageSet;
......@@ -215,4 +215,4 @@ class Display final : angle::NonCopyable
} // namespace egl
#endif // LIBANGLE_DISPLAY_H_
#endif // LIBANGLE_DISPLAY_H_
......@@ -10,10 +10,10 @@
#include "common/debug.h"
#include "common/utilities.h"
#include "libANGLE/Renderbuffer.h"
#include "libANGLE/Texture.h"
#include "libANGLE/angletypes.h"
#include "libANGLE/formatutils.h"
#include "libANGLE/Texture.h"
#include "libANGLE/Renderbuffer.h"
#include "libANGLE/renderer/EGLImplFactory.h"
#include "libANGLE/renderer/ImageImpl.h"
......@@ -30,8 +30,8 @@ gl::ImageIndex GetImageIndex(EGLenum eglTarget, const egl::AttributeMap &attribs
}
gl::TextureTarget target = egl_gl::EGLImageTargetToTextureTarget(eglTarget);
GLint mip = static_cast<GLint>(attribs.get(EGL_GL_TEXTURE_LEVEL_KHR, 0));
GLint layer = static_cast<GLint>(attribs.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0));
GLint mip = static_cast<GLint>(attribs.get(EGL_GL_TEXTURE_LEVEL_KHR, 0));
GLint layer = static_cast<GLint>(attribs.get(EGL_GL_TEXTURE_ZOFFSET_KHR, 0));
if (target == gl::TextureTarget::_3D)
{
......
......@@ -9,8 +9,8 @@
#include "libANGLE/Stream.h"
#include <platform/Platform.h>
#include <EGL/eglext.h>
#include <platform/Platform.h>
#include "common/debug.h"
#include "common/mathutil.h"
......@@ -118,7 +118,7 @@ Error Stream::createConsumerGLTextureExternal(const AttributeMap &attributes, gl
ASSERT(context != nullptr);
const auto &glState = context->getGLState();
EGLenum bufferType = attributes.getAsInt(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
EGLenum bufferType = attributes.getAsInt(EGL_COLOR_BUFFER_TYPE, EGL_RGB_BUFFER);
if (bufferType == EGL_RGB_BUFFER)
{
mPlanes[0].texture = glState.getTargetTexture(gl::TextureType::External);
......
......@@ -65,7 +65,8 @@ Surface::Surface(EGLint surfaceType,
mDSFormat(config->depthStencilFormat),
mInitState(gl::InitState::Initialized)
{
mPostSubBufferRequested = (attributes.get(EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_FALSE) == EGL_TRUE);
mPostSubBufferRequested =
(attributes.get(EGL_POST_SUB_BUFFER_SUPPORTED_NV, EGL_FALSE) == EGL_TRUE);
mFlexibleSurfaceCompatibilityRequested =
(attributes.get(EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE, EGL_FALSE) == EGL_TRUE);
......
......@@ -586,8 +586,10 @@ Error ValidateStream(const Display *display, const Stream *stream)
return NoError();
}
Error ValidateCreateContext(Display *display, Config *configuration, gl::Context *shareContext,
const AttributeMap& attributes)
Error ValidateCreateContext(Display *display,
Config *configuration,
gl::Context *shareContext,
const AttributeMap &attributes)
{
ANGLE_TRY(ValidateConfig(display, configuration));
......@@ -595,180 +597,184 @@ Error ValidateCreateContext(Display *display, Config *configuration, gl::Context
EGLAttrib clientMajorVersion = 1;
EGLAttrib clientMinorVersion = 0;
EGLAttrib contextFlags = 0;
bool resetNotification = false;
for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
bool resetNotification = false;
for (AttributeMap::const_iterator attributeIter = attributes.begin();
attributeIter != attributes.end(); attributeIter++)
{
EGLAttrib attribute = attributeIter->first;
EGLAttrib value = attributeIter->second;
switch (attribute)
{
case EGL_CONTEXT_CLIENT_VERSION:
clientMajorVersion = value;
break;
case EGL_CONTEXT_MINOR_VERSION:
clientMinorVersion = value;
break;
case EGL_CONTEXT_CLIENT_VERSION:
clientMajorVersion = value;
break;
case EGL_CONTEXT_FLAGS_KHR:
contextFlags = value;
break;
case EGL_CONTEXT_MINOR_VERSION:
clientMinorVersion = value;
break;
case EGL_CONTEXT_OPENGL_DEBUG:
break;
case EGL_CONTEXT_FLAGS_KHR:
contextFlags = value;
break;
case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
// Only valid for OpenGL (non-ES) contexts
return EglBadAttribute();
case EGL_CONTEXT_OPENGL_DEBUG:
break;
case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
if (!display->getExtensions().createContextRobustness)
{
return EglBadAttribute();
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
case EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR:
// Only valid for OpenGL (non-ES) contexts
return EglBadAttribute();
}
break;
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
return EglBadAttribute() << "EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR is not"
<< " valid for GLES with EGL 1.4 and KHR_create_context. Use"
<< " EXT_create_context_robustness.";
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
if (!display->getExtensions().createContextRobustness)
{
return EglBadAttribute();
}
if (value == EGL_LOSE_CONTEXT_ON_RESET_EXT)
{
resetNotification = true;
}
else if (value != EGL_NO_RESET_NOTIFICATION_EXT)
{
return EglBadAttribute();
}
break;
case EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT:
if (!display->getExtensions().createContextRobustness)
{
return EglBadAttribute();
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute();
}
break;
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR:
return EglBadAttribute()
<< "EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR is not"
<< " valid for GLES with EGL 1.4 and KHR_create_context. Use"
<< " EXT_create_context_robustness.";
case EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT:
if (!display->getExtensions().createContextRobustness)
{
return EglBadAttribute();
}
if (value == EGL_LOSE_CONTEXT_ON_RESET_EXT)
{
resetNotification = true;
}
else if (value != EGL_NO_RESET_NOTIFICATION_EXT)
{
return EglBadAttribute();
}
break;
case EGL_CONTEXT_OPENGL_NO_ERROR_KHR:
if (!display->getExtensions().createContextNoError)
{
return EglBadAttribute() << "Invalid Context attribute.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "Attribute must be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE:
if (!display->getExtensions().createContextWebGLCompatibility)
{
return EglBadAttribute() << "Attribute "
"EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE requires "
"EGL_ANGLE_create_context_webgl_compatibility.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE must be "
"EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM:
if (!display->getExtensions().createContextBindGeneratesResource)
{
return EglBadAttribute()
<< "Attribute EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM requires "
"EGL_CHROMIUM_create_context_bind_generates_resource.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM "
"must be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE:
if (!display->getExtensions().displayTextureShareGroup)
{
return EglBadAttribute() << "Attribute "
"EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE requires "
"EGL_ANGLE_display_texture_share_group.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE must be "
"EGL_TRUE or EGL_FALSE.";
}
if (shareContext &&
(shareContext->usingDisplayTextureShareGroup() != (value == EGL_TRUE)))
{
return EglBadAttribute() << "All contexts within a share group must be "
"created with the same value of "
"EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE.";
}
break;
case EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE:
if (!display->getExtensions().createContextClientArrays)
{
return EglBadAttribute()
<< "Attribute EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE requires "
"EGL_ANGLE_create_context_client_arrays.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE must "
"be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE:
if (!display->getExtensions().programCacheControl)
{
return EglBadAttribute()
<< "Attribute EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE "
"requires EGL_ANGLE_program_cache_control.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute()
<< "EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE must "
"be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_CONTEXT_OPENGL_NO_ERROR_KHR:
if (!display->getExtensions().createContextNoError)
{
return EglBadAttribute() << "Invalid Context attribute.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "Attribute must be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE:
if (!display->getExtensions().createContextWebGLCompatibility)
{
return EglBadAttribute() << "Attribute "
"EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE requires "
"EGL_ANGLE_create_context_webgl_compatibility.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute()
<< "EGL_CONTEXT_WEBGL_COMPATIBILITY_ANGLE must be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM:
if (!display->getExtensions().createContextBindGeneratesResource)
{
return EglBadAttribute()
<< "Attribute EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM requires "
"EGL_CHROMIUM_create_context_bind_generates_resource.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_CONTEXT_BIND_GENERATES_RESOURCE_CHROMIUM "
"must be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE:
if (!display->getExtensions().displayTextureShareGroup)
{
return EglBadAttribute() << "Attribute "
"EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE requires "
"EGL_ANGLE_display_texture_share_group.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute()
<< "EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE must be EGL_TRUE or EGL_FALSE.";
}
if (shareContext &&
(shareContext->usingDisplayTextureShareGroup() != (value == EGL_TRUE)))
{
return EglBadAttribute() << "All contexts within a share group must be "
"created with the same value of "
"EGL_DISPLAY_TEXTURE_SHARE_GROUP_ANGLE.";
}
break;
case EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE:
if (!display->getExtensions().createContextClientArrays)
{
return EglBadAttribute()
<< "Attribute EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE requires "
"EGL_ANGLE_create_context_client_arrays.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_CONTEXT_CLIENT_ARRAYS_ENABLED_ANGLE must "
"be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE:
if (!display->getExtensions().programCacheControl)
{
return EglBadAttribute()
<< "Attribute EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE "
"requires EGL_ANGLE_program_cache_control.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_CONTEXT_PROGRAM_BINARY_CACHE_ENABLED_ANGLE must "
"be EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
if (!display->getExtensions().robustResourceInitialization)
{
return EglBadAttribute() << "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
"requires EGL_ANGLE_robust_resource_initialization.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_EXTENSIONS_ENABLED_ANGLE:
if (!display->getExtensions().createContextExtensionsEnabled)
{
return EglBadAttribute()
<< "Attribute EGL_EXTENSIONS_ENABLED_ANGLE "
"requires EGL_ANGLE_create_context_extensions_enabled.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_EXTENSIONS_ENABLED_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
default:
return EglBadAttribute() << "Unknown attribute.";
case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
if (!display->getExtensions().robustResourceInitialization)
{
return EglBadAttribute()
<< "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
"requires EGL_ANGLE_robust_resource_initialization.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
case EGL_EXTENSIONS_ENABLED_ANGLE:
if (!display->getExtensions().createContextExtensionsEnabled)
{
return EglBadAttribute()
<< "Attribute EGL_EXTENSIONS_ENABLED_ANGLE "
"requires EGL_ANGLE_create_context_extensions_enabled.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_EXTENSIONS_ENABLED_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
default:
return EglBadAttribute() << "Unknown attribute.";
}
}
......@@ -809,8 +815,8 @@ Error ValidateCreateContext(Display *display, Config *configuration, gl::Context
}
// Note: EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR does not apply to ES
const EGLint validContextFlags = (EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR |
EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR);
const EGLint validContextFlags =
(EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR | EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR);
if ((contextFlags & ~validContextFlags) != 0)
{
return EglBadAttribute();
......@@ -839,8 +845,10 @@ Error ValidateCreateContext(Display *display, Config *configuration, gl::Context
return NoError();
}
Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWindowType window,
const AttributeMap& attributes)
Error ValidateCreateWindowSurface(Display *display,
Config *config,
EGLNativeWindowType window,
const AttributeMap &attributes)
{
ANGLE_TRY(ValidateConfig(display, config));
......@@ -851,93 +859,95 @@ Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWin
const DisplayExtensions &displayExtensions = display->getExtensions();
for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
for (AttributeMap::const_iterator attributeIter = attributes.begin();
attributeIter != attributes.end(); attributeIter++)
{
EGLAttrib attribute = attributeIter->first;
EGLAttrib value = attributeIter->second;
switch (attribute)
{
case EGL_RENDER_BUFFER:
switch (value)
{
case EGL_BACK_BUFFER:
case EGL_RENDER_BUFFER:
switch (value)
{
case EGL_BACK_BUFFER:
break;
case EGL_SINGLE_BUFFER:
return EglBadMatch(); // Rendering directly to front buffer not supported
default:
return EglBadAttribute();
}
break;
case EGL_SINGLE_BUFFER:
return EglBadMatch(); // Rendering directly to front buffer not supported
default:
return EglBadAttribute();
}
break;
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
if (!displayExtensions.postSubBuffer)
{
return EglBadAttribute();
}
break;
case EGL_POST_SUB_BUFFER_SUPPORTED_NV:
if (!displayExtensions.postSubBuffer)
{
return EglBadAttribute();
}
break;
case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
if (!displayExtensions.flexibleSurfaceCompatibility)
{
return EglBadAttribute();
}
break;
case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
if (!displayExtensions.flexibleSurfaceCompatibility)
{
return EglBadAttribute();
}
break;
case EGL_WIDTH:
case EGL_HEIGHT:
if (!displayExtensions.windowFixedSize)
{
return EglBadAttribute();
}
if (value < 0)
{
return EglBadParameter();
}
break;
case EGL_WIDTH:
case EGL_HEIGHT:
if (!displayExtensions.windowFixedSize)
{
return EglBadAttribute();
}
if (value < 0)
{
return EglBadParameter();
}
break;
case EGL_FIXED_SIZE_ANGLE:
if (!displayExtensions.windowFixedSize)
{
return EglBadAttribute();
}
break;
case EGL_FIXED_SIZE_ANGLE:
if (!displayExtensions.windowFixedSize)
{
return EglBadAttribute();
}
break;
case EGL_SURFACE_ORIENTATION_ANGLE:
if (!displayExtensions.surfaceOrientation)
{
return EglBadAttribute() << "EGL_ANGLE_surface_orientation is not enabled.";
}
break;
case EGL_SURFACE_ORIENTATION_ANGLE:
if (!displayExtensions.surfaceOrientation)
{
return EglBadAttribute() << "EGL_ANGLE_surface_orientation is not enabled.";
}
break;
case EGL_VG_COLORSPACE:
return EglBadMatch();
case EGL_VG_ALPHA_FORMAT:
return EglBadMatch();
case EGL_DIRECT_COMPOSITION_ANGLE:
if (!displayExtensions.directComposition)
{
return EglBadAttribute();
}
break;
case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
if (!display->getExtensions().robustResourceInitialization)
{
return EglBadAttribute() << "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
"requires EGL_ANGLE_robust_resource_initialization.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
default:
return EglBadAttribute();
case EGL_VG_COLORSPACE:
return EglBadMatch();
case EGL_VG_ALPHA_FORMAT:
return EglBadMatch();
case EGL_DIRECT_COMPOSITION_ANGLE:
if (!displayExtensions.directComposition)
{
return EglBadAttribute();
}
break;
case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
if (!display->getExtensions().robustResourceInitialization)
{
return EglBadAttribute()
<< "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
"requires EGL_ANGLE_robust_resource_initialization.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
default:
return EglBadAttribute();
}
}
......@@ -949,86 +959,88 @@ Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWin
return NoError();
}
Error ValidateCreatePbufferSurface(Display *display, Config *config, const AttributeMap& attributes)
Error ValidateCreatePbufferSurface(Display *display, Config *config, const AttributeMap &attributes)
{
ANGLE_TRY(ValidateConfig(display, config));
const DisplayExtensions &displayExtensions = display->getExtensions();
for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
for (AttributeMap::const_iterator attributeIter = attributes.begin();
attributeIter != attributes.end(); attributeIter++)
{
EGLAttrib attribute = attributeIter->first;
EGLAttrib value = attributeIter->second;
switch (attribute)
{
case EGL_WIDTH:
case EGL_HEIGHT:
if (value < 0)
{
return EglBadParameter();
}
break;
case EGL_WIDTH:
case EGL_HEIGHT:
if (value < 0)
{
return EglBadParameter();
}
break;
case EGL_LARGEST_PBUFFER:
break;
case EGL_LARGEST_PBUFFER:
break;
case EGL_TEXTURE_FORMAT:
switch (value)
{
case EGL_NO_TEXTURE:
case EGL_TEXTURE_RGB:
case EGL_TEXTURE_RGBA:
case EGL_TEXTURE_FORMAT:
switch (value)
{
case EGL_NO_TEXTURE:
case EGL_TEXTURE_RGB:
case EGL_TEXTURE_RGBA:
break;
default:
return EglBadAttribute();
}
break;
default:
return EglBadAttribute();
}
break;
case EGL_TEXTURE_TARGET:
switch (value)
{
case EGL_NO_TEXTURE:
case EGL_TEXTURE_2D:
case EGL_TEXTURE_TARGET:
switch (value)
{
case EGL_NO_TEXTURE:
case EGL_TEXTURE_2D:
break;
default:
return EglBadAttribute();
}
break;
default:
return EglBadAttribute();
}
break;
case EGL_MIPMAP_TEXTURE:
break;
case EGL_MIPMAP_TEXTURE:
break;
case EGL_VG_COLORSPACE:
break;
case EGL_VG_COLORSPACE:
break;
case EGL_VG_ALPHA_FORMAT:
break;
case EGL_VG_ALPHA_FORMAT:
break;
case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
if (!displayExtensions.flexibleSurfaceCompatibility)
{
return EglBadAttribute()
<< "EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE cannot be used "
"without EGL_ANGLE_flexible_surface_compatibility support.";
}
break;
case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
if (!display->getExtensions().robustResourceInitialization)
{
return EglBadAttribute() << "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
"requires EGL_ANGLE_robust_resource_initialization.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
default:
return EglBadAttribute();
case EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE:
if (!displayExtensions.flexibleSurfaceCompatibility)
{
return EglBadAttribute()
<< "EGL_FLEXIBLE_SURFACE_COMPATIBILITY_SUPPORTED_ANGLE cannot be used "
"without EGL_ANGLE_flexible_surface_compatibility support.";
}
break;
case EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE:
if (!display->getExtensions().robustResourceInitialization)
{
return EglBadAttribute()
<< "Attribute EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE "
"requires EGL_ANGLE_robust_resource_initialization.";
}
if (value != EGL_TRUE && value != EGL_FALSE)
{
return EglBadAttribute() << "EGL_ROBUST_RESOURCE_INITIALIZATION_ANGLE must be "
"either EGL_TRUE or EGL_FALSE.";
}
break;
default:
return EglBadAttribute();
}
}
......@@ -1048,7 +1060,7 @@ Error ValidateCreatePbufferSurface(Display *display, Config *config, const Attri
return EglBadMatch();
}
if ((textureFormat == EGL_TEXTURE_RGB && config->bindToTextureRGB != EGL_TRUE) ||
if ((textureFormat == EGL_TEXTURE_RGB && config->bindToTextureRGB != EGL_TRUE) ||
(textureFormat == EGL_TEXTURE_RGBA && config->bindToTextureRGBA != EGL_TRUE))
{
return EglBadAttribute();
......@@ -1056,7 +1068,8 @@ Error ValidateCreatePbufferSurface(Display *display, Config *config, const Attri
EGLint width = static_cast<EGLint>(attributes.get(EGL_WIDTH, 0));
EGLint height = static_cast<EGLint>(attributes.get(EGL_HEIGHT, 0));
if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height)))
if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT &&
(!gl::isPow2(width) || !gl::isPow2(height)))
{
return EglBadMatch();
}
......@@ -1064,8 +1077,11 @@ Error ValidateCreatePbufferSurface(Display *display, Config *config, const Attri
return NoError();
}
Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, EGLClientBuffer buffer,
Config *config, const AttributeMap& attributes)
Error ValidateCreatePbufferFromClientBuffer(Display *display,
EGLenum buftype,
EGLClientBuffer buffer,
Config *config,
const AttributeMap &attributes)
{
ANGLE_TRY(ValidateConfig(display, config));
......@@ -1073,45 +1089,46 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
switch (buftype)
{
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!displayExtensions.d3dShareHandleClientBuffer)
{
return EglBadParameter();
}
if (buffer == nullptr)
{
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!displayExtensions.d3dShareHandleClientBuffer)
{
return EglBadParameter();
}
if (buffer == nullptr)
{
return EglBadParameter();
}
break;
case EGL_D3D_TEXTURE_ANGLE:
if (!displayExtensions.d3dTextureClientBuffer)
{
return EglBadParameter();
}
if (buffer == nullptr)
{
return EglBadParameter();
}
break;
case EGL_IOSURFACE_ANGLE:
if (!displayExtensions.iosurfaceClientBuffer)
{
return EglBadParameter() << "<buftype> EGL_IOSURFACE_ANGLE requires the "
"EGL_ANGLE_iosurface_client_buffer extension.";
}
if (buffer == nullptr)
{
return EglBadParameter() << "<buffer> must be non null";
}
break;
default:
return EglBadParameter();
}
break;
}
case EGL_D3D_TEXTURE_ANGLE:
if (!displayExtensions.d3dTextureClientBuffer)
{
return EglBadParameter();
}
if (buffer == nullptr)
{
return EglBadParameter();
}
break;
case EGL_IOSURFACE_ANGLE:
if (!displayExtensions.iosurfaceClientBuffer)
{
return EglBadParameter() << "<buftype> EGL_IOSURFACE_ANGLE requires the "
"EGL_ANGLE_iosurface_client_buffer extension.";
}
if (buffer == nullptr)
{
return EglBadParameter() << "<buffer> must be non null";
}
break;
default:
return EglBadParameter();
}
for (AttributeMap::const_iterator attributeIter = attributes.begin(); attributeIter != attributes.end(); attributeIter++)
for (AttributeMap::const_iterator attributeIter = attributes.begin();
attributeIter != attributes.end(); attributeIter++)
{
EGLAttrib attribute = attributeIter->first;
EGLAttrib value = attributeIter->second;
......@@ -1121,8 +1138,7 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
case EGL_WIDTH:
case EGL_HEIGHT:
if (buftype != EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE &&
buftype != EGL_D3D_TEXTURE_ANGLE &&
buftype != EGL_IOSURFACE_ANGLE)
buftype != EGL_D3D_TEXTURE_ANGLE && buftype != EGL_IOSURFACE_ANGLE)
{
return EglBadParameter()
<< "Width and Height are not supported for thie <buftype>";
......@@ -1252,7 +1268,8 @@ Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, E
}
const Caps &caps = display->getCaps();
if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT && (!gl::isPow2(width) || !gl::isPow2(height)))
if (textureFormat != EGL_NO_TEXTURE && !caps.textureNPOT &&
(!gl::isPow2(width) || !gl::isPow2(height)))
{
return EglBadMatch();
}
......@@ -1554,7 +1571,7 @@ Error ValidateCreateImageKHR(const Display *display,
return EglBadAccess() << "texture has a surface bound to it.";
}
EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL_KHR, 0);
EGLAttrib level = attributes.get(EGL_GL_TEXTURE_LEVEL_KHR, 0);
gl::TextureTarget cubeMapFace = egl_gl::EGLCubeMapTargetToCubeMapTarget(target);
if (texture->getWidth(cubeMapFace, static_cast<size_t>(level)) == 0 ||
texture->getHeight(cubeMapFace, static_cast<size_t>(level)) == 0)
......
......@@ -39,15 +39,24 @@ Error ValidateContext(const Display *display, const gl::Context *context);
Error ValidateImage(const Display *display, const Image *image);
// Entry point validation
Error ValidateCreateContext(Display *display, Config *configuration, gl::Context *shareContext,
const AttributeMap& attributes);
Error ValidateCreateWindowSurface(Display *display, Config *config, EGLNativeWindowType window,
const AttributeMap& attributes);
Error ValidateCreatePbufferSurface(Display *display, Config *config, const AttributeMap& attributes);
Error ValidateCreatePbufferFromClientBuffer(Display *display, EGLenum buftype, EGLClientBuffer buffer,
Config *config, const AttributeMap& attributes);
Error ValidateCreateContext(Display *display,
Config *configuration,
gl::Context *shareContext,
const AttributeMap &attributes);
Error ValidateCreateWindowSurface(Display *display,
Config *config,
EGLNativeWindowType window,
const AttributeMap &attributes);
Error ValidateCreatePbufferSurface(Display *display,
Config *config,
const AttributeMap &attributes);
Error ValidateCreatePbufferFromClientBuffer(Display *display,
EGLenum buftype,
EGLClientBuffer buffer,
Config *config,
const AttributeMap &attributes);
Error ValidateMakeCurrent(Display *display, Surface *draw, Surface *read, gl::Context *context);
......@@ -191,4 +200,4 @@ Error ValidateQueryContext(const Display *display,
} \
}
#endif // LIBANGLE_VALIDATIONEGL_H_
#endif // LIBANGLE_VALIDATIONEGL_H_
......@@ -9,35 +9,51 @@
#include "libGLESv2/entry_points_egl.h"
#include "libGLESv2/entry_points_egl_ext.h"
extern "C"
{
extern "C" {
EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config)
EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay dpy,
const EGLint *attrib_list,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
return egl::ChooseConfig(dpy, attrib_list, configs, config_size, num_config);
}
EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target)
EGLBoolean EGLAPIENTRY eglCopyBuffers(EGLDisplay dpy,
EGLSurface surface,
EGLNativePixmapType target)
{
return egl::CopyBuffers(dpy, surface, target);
}
EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list)
EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay dpy,
EGLConfig config,
EGLContext share_context,
const EGLint *attrib_list)
{
return egl::CreateContext(dpy, config, share_context, attrib_list);
}
EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list)
EGLSurface EGLAPIENTRY eglCreatePbufferSurface(EGLDisplay dpy,
EGLConfig config,
const EGLint *attrib_list)
{
return egl::CreatePbufferSurface(dpy, config, attrib_list);
}
EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list)
EGLSurface EGLAPIENTRY eglCreatePixmapSurface(EGLDisplay dpy,
EGLConfig config,
EGLNativePixmapType pixmap,
const EGLint *attrib_list)
{
return egl::CreatePixmapSurface(dpy, config, pixmap, attrib_list);
}
EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list)
EGLSurface EGLAPIENTRY eglCreateWindowSurface(EGLDisplay dpy,
EGLConfig config,
EGLNativeWindowType win,
const EGLint *attrib_list)
{
return egl::CreateWindowSurface(dpy, config, win, attrib_list);
}
......@@ -52,12 +68,18 @@ EGLBoolean EGLAPIENTRY eglDestroySurface(EGLDisplay dpy, EGLSurface surface)
return egl::DestroySurface(dpy, surface);
}
EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value)
EGLBoolean EGLAPIENTRY eglGetConfigAttrib(EGLDisplay dpy,
EGLConfig config,
EGLint attribute,
EGLint *value)
{
return egl::GetConfigAttrib(dpy, config, attribute, value);
}
EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config)
EGLBoolean EGLAPIENTRY eglGetConfigs(EGLDisplay dpy,
EGLConfig *configs,
EGLint config_size,
EGLint *num_config)
{
return egl::GetConfigs(dpy, configs, config_size, num_config);
}
......@@ -87,22 +109,31 @@ EGLBoolean EGLAPIENTRY eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *mino
return egl::Initialize(dpy, major, minor);
}
EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx)
EGLBoolean EGLAPIENTRY eglMakeCurrent(EGLDisplay dpy,
EGLSurface draw,
EGLSurface read,
EGLContext ctx)
{
return egl::MakeCurrent(dpy, draw, read, ctx);
}
EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value)
EGLBoolean EGLAPIENTRY eglQueryContext(EGLDisplay dpy,
EGLContext ctx,
EGLint attribute,
EGLint *value)
{
return egl::QueryContext(dpy, ctx, attribute, value);
}
const char* EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
const char *EGLAPIENTRY eglQueryString(EGLDisplay dpy, EGLint name)
{
return egl::QueryString(dpy, name);
}
EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value)
EGLBoolean EGLAPIENTRY eglQuerySurface(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
EGLint *value)
{
return egl::QuerySurface(dpy, surface, attribute, value);
}
......@@ -137,7 +168,10 @@ EGLBoolean EGLAPIENTRY eglReleaseTexImage(EGLDisplay dpy, EGLSurface surface, EG
return egl::ReleaseTexImage(dpy, surface, buffer);
}
EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value)
EGLBoolean EGLAPIENTRY eglSurfaceAttrib(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
EGLint value)
{
return egl::SurfaceAttrib(dpy, surface, attribute, value);
}
......@@ -157,7 +191,11 @@ EGLenum EGLAPIENTRY eglQueryAPI(void)
return egl::QueryAPI();
}
EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list)
EGLSurface EGLAPIENTRY eglCreatePbufferFromClientBuffer(EGLDisplay dpy,
EGLenum buftype,
EGLClientBuffer buffer,
EGLConfig config,
const EGLint *attrib_list)
{
return egl::CreatePbufferFromClientBuffer(dpy, buftype, buffer, config, attrib_list);
}
......@@ -192,12 +230,19 @@ EGLint EGLAPIENTRY eglClientWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags,
return egl::ClientWaitSync(dpy, sync, flags, timeout);
}
EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy, EGLSync sync, EGLint attribute, EGLAttrib *value)
EGLBoolean EGLAPIENTRY eglGetSyncAttrib(EGLDisplay dpy,
EGLSync sync,
EGLint attribute,
EGLAttrib *value)
{
return egl::GetSyncAttrib(dpy, sync, attribute, value);
}
EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy, EGLContext ctx, EGLenum target, EGLClientBuffer buffer, const EGLAttrib *attrib_list)
EGLImage EGLAPIENTRY eglCreateImage(EGLDisplay dpy,
EGLContext ctx,
EGLenum target,
EGLClientBuffer buffer,
const EGLAttrib *attrib_list)
{
return egl::CreateImage(dpy, ctx, target, buffer, attrib_list);
}
......@@ -207,17 +252,25 @@ EGLBoolean EGLAPIENTRY eglDestroyImage(EGLDisplay dpy, EGLImage image)
return egl::DestroyImage(dpy, image);
}
EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform, void *native_display, const EGLAttrib *attrib_list)
EGLDisplay EGLAPIENTRY eglGetPlatformDisplay(EGLenum platform,
void *native_display,
const EGLAttrib *attrib_list)
{
return egl::GetPlatformDisplay(platform, native_display, attrib_list);
}
EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy, EGLConfig config, void *native_window, const EGLAttrib *attrib_list)
EGLSurface EGLAPIENTRY eglCreatePlatformWindowSurface(EGLDisplay dpy,
EGLConfig config,
void *native_window,
const EGLAttrib *attrib_list)
{
return egl::CreatePlatformWindowSurface(dpy, config, native_window, attrib_list);
}
EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy, EGLConfig config, void *native_pixmap, const EGLAttrib *attrib_list)
EGLSurface EGLAPIENTRY eglCreatePlatformPixmapSurface(EGLDisplay dpy,
EGLConfig config,
void *native_pixmap,
const EGLAttrib *attrib_list)
{
return egl::CreatePlatformPixmapSurface(dpy, config, native_pixmap, attrib_list);
}
......@@ -227,17 +280,27 @@ EGLBoolean EGLAPIENTRY eglWaitSync(EGLDisplay dpy, EGLSync sync, EGLint flags)
return egl::WaitSync(dpy, sync, flags);
}
EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE(EGLDisplay dpy,
EGLSurface surface,
EGLint attribute,
void **value)
{
return egl::QuerySurfacePointerANGLE(dpy, surface, attribute, value);
}
EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height)
EGLBoolean EGLAPIENTRY eglPostSubBufferNV(EGLDisplay dpy,
EGLSurface surface,
EGLint x,
EGLint y,
EGLint width,
EGLint height)
{
return egl::PostSubBufferNV(dpy, surface, x, y, width, height);
}
EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
EGLDisplay EGLAPIENTRY eglGetPlatformDisplayEXT(EGLenum platform,
void *native_display,
const EGLint *attrib_list)
{
return egl::GetPlatformDisplayEXT(platform, native_display, attrib_list);
}
......@@ -263,12 +326,14 @@ EGLBoolean EGLAPIENTRY eglQueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute
return egl::QueryDisplayAttribEXT(dpy, attribute, value);
}
EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribute, EGLAttrib *value)
EGLBoolean EGLAPIENTRY eglQueryDeviceAttribEXT(EGLDeviceEXT device,
EGLint attribute,
EGLAttrib *value)
{
return egl::QueryDeviceAttribEXT(device, attribute, value);
}
const char * EGLAPIENTRY eglQueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
const char *EGLAPIENTRY eglQueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
{
return egl::QueryDeviceStringEXT(device, name);
}
......
......@@ -16,26 +16,59 @@ 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 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 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 __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 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 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);
......@@ -43,14 +76,23 @@ 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 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 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);
......@@ -58,17 +100,36 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY WaitClient(void);
ANGLE_EXPORT EGLContext EGLAPIENTRY GetCurrentContext(void);
// EGL 1.5
ANGLE_EXPORT EGLSync EGLAPIENTRY CreateSync(EGLDisplay dpy, EGLenum type, const EGLAttrib *attrib_list);
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 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 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_
#endif // LIBGLESV2_ENTRYPOINTSEGL_H_
......@@ -10,10 +10,10 @@
#include "libGLESv2/global_state.h"
#include "libANGLE/Context.h"
#include "libANGLE/Display.h"
#include "libANGLE/Device.h"
#include "libANGLE/Surface.h"
#include "libANGLE/Display.h"
#include "libANGLE/Stream.h"
#include "libANGLE/Surface.h"
#include "libANGLE/Thread.h"
#include "libANGLE/validationEGL.h"
......@@ -23,14 +23,19 @@ namespace egl
{
// EGL_ANGLE_query_surface_pointer
EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value)
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);
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);
Display *display = static_cast<Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
......@@ -54,23 +59,23 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
// validate the attribute parameter
switch (attribute)
{
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
{
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
break;
case EGL_DXGI_KEYED_MUTEX_ANGLE:
if (!display->getExtensions().keyedMutex)
{
case EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE:
if (!display->getExtensions().surfaceD3DTexture2DShareHandle)
{
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
break;
case EGL_DXGI_KEYED_MUTEX_ANGLE:
if (!display->getExtensions().keyedMutex)
{
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
break;
default:
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
break;
default:
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
error = eglSurface->querySurfacePointerANGLE(attribute, value);
......@@ -78,11 +83,14 @@ EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surfa
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)
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);
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)
......@@ -91,8 +99,8 @@ EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLin
return EGL_FALSE;
}
Display *display = static_cast<Display*>(dpy);
Surface *eglSurface = static_cast<Surface*>(surface);
Display *display = static_cast<Display *>(dpy);
Surface *eglSurface = static_cast<Surface *>(surface);
Error error = ValidateSurface(display, eglSurface);
if (error.isError())
......@@ -133,10 +141,14 @@ EGLBoolean EGLAPIENTRY PostSubBufferNV(EGLDisplay dpy, EGLSurface surface, EGLin
}
// EGL_EXT_platform_base
EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
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);
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();
Error err = ValidateGetPlatformDisplayEXT(platform, native_display, attrib_list);
......@@ -219,7 +231,7 @@ EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribut
device, attribute, value);
Thread *thread = GetCurrentThread();
Device *dev = static_cast<Device*>(device);
Device *dev = static_cast<Device *>(device);
if (dev == EGL_NO_DEVICE_EXT || !Device::IsValidDevice(dev))
{
thread->setError(EglBadAccess());
......@@ -242,18 +254,18 @@ EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribut
// validate the attribute parameter
switch (attribute)
{
case EGL_D3D11_DEVICE_ANGLE:
case EGL_D3D9_DEVICE_ANGLE:
if (!dev->getExtensions().deviceD3D || dev->getType() != attribute)
{
case EGL_D3D11_DEVICE_ANGLE:
case EGL_D3D9_DEVICE_ANGLE:
if (!dev->getExtensions().deviceD3D || dev->getType() != attribute)
{
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
error = dev->getDevice(value);
break;
default:
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
error = dev->getDevice(value);
break;
default:
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
thread->setError(error);
......@@ -261,13 +273,12 @@ EGLBoolean EGLAPIENTRY QueryDeviceAttribEXT(EGLDeviceEXT device, EGLint attribut
}
// EGL_EXT_device_query
const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
const char *EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
{
EVENT("(EGLDeviceEXT device = 0x%0.8p, EGLint name = %d)",
device, name);
EVENT("(EGLDeviceEXT device = 0x%0.8p, EGLint name = %d)", device, name);
Thread *thread = GetCurrentThread();
Device *dev = static_cast<Device*>(device);
Device *dev = static_cast<Device *>(device);
if (dev == EGL_NO_DEVICE_EXT || !Device::IsValidDevice(dev))
{
thread->setError(EglBadDevice());
......@@ -277,12 +288,12 @@ const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
const char *result;
switch (name)
{
case EGL_EXTENSIONS:
result = dev->getExtensionString().c_str();
break;
default:
thread->setError(EglBadDevice());
return nullptr;
case EGL_EXTENSIONS:
result = dev->getExtensionString().c_str();
break;
default:
thread->setError(EglBadDevice());
return nullptr;
}
thread->setError(NoError());
......@@ -292,11 +303,11 @@ const char * EGLAPIENTRY QueryDeviceStringEXT(EGLDeviceEXT device, EGLint name)
// 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);
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);
Display *display = static_cast<Display *>(dpy);
Error error = ValidateDisplay(display);
if (error.isError())
......@@ -314,13 +325,13 @@ EGLBoolean EGLAPIENTRY QueryDisplayAttribEXT(EGLDisplay dpy, EGLint attribute, E
// validate the attribute parameter
switch (attribute)
{
case EGL_DEVICE_EXT:
*value = reinterpret_cast<EGLAttrib>(display->getDevice());
break;
case EGL_DEVICE_EXT:
*value = reinterpret_cast<EGLAttrib>(display->getDevice());
break;
default:
thread->setError(EglBadAttribute());
return EGL_FALSE;
default:
thread->setError(EglBadAttribute());
return EGL_FALSE;
}
thread->setError(error);
......@@ -339,8 +350,8 @@ ANGLE_EXPORT EGLImageKHR EGLAPIENTRY CreateImageKHR(EGLDisplay dpy,
dpy, ctx, target, buffer, attrib_list);
Thread *thread = GetCurrentThread();
Display *display = static_cast<Display *>(dpy);
gl::Context *context = static_cast<gl::Context *>(ctx);
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);
......@@ -435,7 +446,7 @@ EGLStreamKHR EGLAPIENTRY CreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_li
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);
Display *display = static_cast<Display *>(dpy);
AttributeMap attributes = AttributeMap::CreateFromIntArray(attrib_list);
Error error = ValidateCreateStreamKHR(display, attributes);
......
......@@ -17,13 +17,23 @@ namespace egl
{
// EGL_ANGLE_query_surface_pointer
ANGLE_EXPORT EGLBoolean EGLAPIENTRY QuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value);
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);
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);
ANGLE_EXPORT EGLDisplay EGLAPIENTRY GetPlatformDisplayEXT(EGLenum platform,
void *native_display,
const EGLint *attrib_list);
ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformWindowSurfaceEXT(EGLDisplay dpy,
EGLConfig config,
void *native_window,
......@@ -34,9 +44,13 @@ ANGLE_EXPORT EGLSurface EGLAPIENTRY CreatePlatformPixmapSurfaceEXT(EGLDisplay dp
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);
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,
......@@ -123,4 +137,4 @@ ANGLE_EXPORT EGLint EGLAPIENTRY ProgramCacheResizeANGLE(EGLDisplay dpy, EGLint l
} // namespace egl
#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_
#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_
......@@ -26,4 +26,4 @@ Thread *GetCurrentThread();
} // namespace egl
#endif // LIBGLESV2_GLOBALSTATE_H_
#endif // LIBGLESV2_GLOBALSTATE_H_
......@@ -45,8 +45,10 @@
#define ASSERT_EGL_ERROR(err) ASSERT_EQ((err), eglGetError())
#define ASSERT_EGL_SUCCESS() ASSERT_EGL_ERROR(EGL_SUCCESS)
#define ASSERT_GLENUM_EQ(expected, actual) ASSERT_EQ(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
#define EXPECT_GLENUM_EQ(expected, actual) EXPECT_EQ(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
#define ASSERT_GLENUM_EQ(expected, actual) \
ASSERT_EQ(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
#define EXPECT_GLENUM_EQ(expected, actual) \
EXPECT_EQ(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
#define ASSERT_GLENUM_NE(expected, actual) \
ASSERT_NE(static_cast<GLenum>(expected), static_cast<GLenum>(actual))
#define EXPECT_GLENUM_NE(expected, actual) \
......@@ -167,25 +169,24 @@ GLColor32F ReadColor32F(GLint x, GLint y);
#define EXPECT_PIXEL_COLOR32F_EQ(x, y, angleColor) EXPECT_EQ(angleColor, angle::ReadColor32F(x, y))
#define EXPECT_PIXEL_RECT_EQ(x, y, width, height, color) \
\
{ \
\
{ \
std::vector<GLColor> actualColors(width *height); \
glReadPixels((x), (y), (width), (height), GL_RGBA, GL_UNSIGNED_BYTE, actualColors.data()); \
std::vector<GLColor> expectedColors(width *height, color); \
EXPECT_EQ(expectedColors, actualColors); \
\
}
}
#define EXPECT_PIXEL_NEAR(x, y, r, g, b, a, abs_error) \
{ \
GLubyte pixel[4]; \
glReadPixels((x), (y), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); \
EXPECT_GL_NO_ERROR(); \
EXPECT_NEAR((r), pixel[0], abs_error); \
EXPECT_NEAR((g), pixel[1], abs_error); \
EXPECT_NEAR((b), pixel[2], abs_error); \
EXPECT_NEAR((a), pixel[3], abs_error); \
}
#define EXPECT_PIXEL_NEAR(x, y, r, g, b, a, abs_error) \
{ \
GLubyte pixel[4]; \
glReadPixels((x), (y), 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); \
EXPECT_GL_NO_ERROR(); \
EXPECT_NEAR((r), pixel[0], abs_error); \
EXPECT_NEAR((g), pixel[1], abs_error); \
EXPECT_NEAR((b), pixel[2], abs_error); \
EXPECT_NEAR((a), pixel[3], abs_error); \
}
#define EXPECT_PIXEL32F_NEAR(x, y, r, g, b, a, abs_error) \
\
......@@ -207,14 +208,13 @@ GLColor32F ReadColor32F(GLint x, GLint y);
EXPECT_PIXEL32F_NEAR(x, y, angleColor.R, angleColor.G, angleColor.B, angleColor.A, abs_error)
#define EXPECT_COLOR_NEAR(expected, actual, abs_error) \
\
{ \
\
{ \
EXPECT_NEAR(expected.R, actual.R, abs_error); \
EXPECT_NEAR(expected.G, actual.G, abs_error); \
EXPECT_NEAR(expected.B, actual.B, abs_error); \
EXPECT_NEAR(expected.A, actual.A, abs_error); \
\
}
}
#define EXPECT_PIXEL32F_NEAR(x, y, r, g, b, a, abs_error) \
\
{ \
......@@ -236,7 +236,7 @@ class ANGLETestBase;
struct TestPlatformContext final : private angle::NonCopyable
{
bool ignoreMessages = false;
bool ignoreMessages = false;
ANGLETestBase *currentTest = nullptr;
};
......@@ -452,13 +452,13 @@ bool IsRelease();
// Note: git cl format messes up this formatting.
#define ANGLE_SKIP_TEST_IF(COND) \
\
if(COND) \
\
{ \
\
if (COND) \
\
{ \
std::cout << "Test skipped: " #COND "." << std::endl; \
return; \
\
} ANGLE_EMPTY_STATEMENT
} \
ANGLE_EMPTY_STATEMENT
#endif // ANGLE_TESTS_ANGLE_TEST_H_
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment