Commit 0d3683c4 by Geoff Lang

Update ANGLE_platform_angle to allow requesting of Renderer versions.

Added enums to allow users to request major and minor versions of the underlying API and if a WARP device is used. BUG=angle:490 Change-Id: I0bfb2ac8d327da28a47cc8e6346300e47ab9538c Reviewed-on: https://chromium-review.googlesource.com/225081Reviewed-by: 's avatarShannon Woods <shannonwoods@chromium.org> Tested-by: 's avatarGeoff Lang <geofflang@chromium.org>
parent 6b0cf996
...@@ -47,8 +47,8 @@ Dependencies ...@@ -47,8 +47,8 @@ Dependencies
Overview Overview
This extension defines how to create EGL resources from resources using This extension defines how to create EGL resources from native resources
the functions defined by EGL_EXT_platform_base. using the functions defined by EGL_EXT_platform_base.
New Types New Types
...@@ -68,10 +68,12 @@ New Tokens ...@@ -68,10 +68,12 @@ New Tokens
eglGetPlatformDisplayEXT: eglGetPlatformDisplayEXT:
EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202
EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3203
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3204
Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute: Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3203 EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3205
Additions to the EGL Specification Additions to the EGL Specification
...@@ -88,45 +90,27 @@ New Behavior ...@@ -88,45 +90,27 @@ New Behavior
The <native_display> parameter is of type EGLNativeDisplayType. If The <native_display> parameter is of type EGLNativeDisplayType. If
<native_display> is EGL_DEFAULT_DISPLAY a default display is returned. <native_display> is EGL_DEFAULT_DISPLAY a default display is returned.
Multiple calls with the same <native_display> will return the same Multiple calls with the same <native_display> will return the same
EGLDisplay handle. The value of EGL_PLATFORM_ANGLE_TYPE_ANGLE, if any, EGLDisplay handle. If <platform> is set to EGL_PLATFORM_ANGLE_ANGLE and
is ignored if there was previously a EGLDisplay successfully created for a the returned display is in an uninitialized state, its attributes are
given value of EGLNativeDisplayType. overwritten by those provided in the <attrib_list>, if any.
If no <attrib_list> is specified, the value of If no <attrib_list> is specified, the value of
EGL_PLATFORM_ANGLE_TYPE_ANGLE is implicitly set to EGL_PLATFORM_ANGLE_TYPE_ANGLE is implicitly set to
EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE. Otherwise, the value of EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE.
EGL_PLATFORM_ANGLE_TYPE_ANGLE should be:
- EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE for an implementation dependent If no <attrib_list> is specified, the values of
display, equivalent to using a <native_display> of EGL_DEFAULT_DISPLAY, EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
- EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE for a D3D9 display which translates EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE are implicitly set to
to OpenGL ES, EGL_DONT_CARE.
- EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE for a D3D11 display which
translates to OpenGL ES, If EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE is set to EGL_DONT_CARE and
- EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE a D3D11 WARP display which EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE is not set to EGL_DONT_CARE,
translates to OpenGL ES, an EGL_BAD_ATTRIBUTE error is generated and EGL_NO_DISPLAY is returned.
- EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE for an OpenGL display which
translates to OpenGL ES,
- EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE for a native OpenGL ES display
If no display matching the requested <native_display> or of the type If no display matching the requested <native_display> or of the type
requested by the value of EGL_PLATFORM_ANGLE_TYPE_ANGLE is available, requested by the value of EGL_PLATFORM_ANGLE_TYPE_ANGLE is available,
EGL_NO_DISPLAY is returned. No error condition is raised in this case. EGL_NO_DISPLAY is returned. No error condition is raised in this case.
Dependencies on ANGLE_platform_angle_d3d
The EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE,
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE and
EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE <native_display> parameters to
eglGetPlatformDisplayEXT are only valid if ANGLE_platform_angle_d3d is
supported.
Dependencies on ANGLE_platform_angle_opengl
The EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE and
EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE <native_display> parameters to
eglGetPlatformDisplayEXT are only valid if ANGLE_platform_angle_opengl is
supported.
Issues Issues
None None
...@@ -134,8 +118,10 @@ Issues ...@@ -134,8 +118,10 @@ Issues
Revision History Revision History
Version 1, 2014-02-04 (Scott Graham) Version 1, 2014-02-04 (Scott Graham)
- Initial draft - Initial draft
Version 2, 2014-06-05 (Geoff Lang) Version 2, 2014-06-05 (Geoff Lang)
- Rename extension from ANGLE_platform_angle_d3d to - Rename extension from ANGLE_platform_angle_d3d to ANGLE_platform_angle.
ANGLE_platform_angle. - Add sub-extensions for specific platforms.
- Add sub-extensions for specific platforms. Version 3, 2014-10-20 (Geoff Lang)
- Add attributes to request specific feature level and context versions.
- Moved descriptions of platforms to child extension specs.
...@@ -51,14 +51,46 @@ New Tokens ...@@ -51,14 +51,46 @@ New Tokens
Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute: Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3204 EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3206
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3205 EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207
EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE 0x3206
Accepted as an attribute name in the <attrib_list> argument of
eglGetPlatformDisplayEXT:
EGL_PLATFORM_ANGLE_USE_WARP_ANGLE 0x3208
Additions to the EGL Specification Additions to the EGL Specification
None. None.
New Behavior
To request a display that is backed by Direct3D resources, the value of
EGL_PLATFORM_ANGLE_TYPE_ANGLE should be:
- EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE for a D3D9 display,
- EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE for a D3D11 display.
To request a specific maximum feature level to be used by the D3D11
display, EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE can be used. Only feature
levels that are capable of supporting all available client APIs will be
used unless explicitly requested.
EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE have no effect when requesting
a D3D9 display.
If no <attrib_list> is specified to eglGetPlatformDisplayEXT, the value of
EGL_PLATFORM_ANGLE_USE_WARP_ANGLE is implicitly set to
EGL_FALSE. Otherwise, the value of EGL_PLATFORM_ANGLE_USE_WARP_ANGLE should
be:
- EGL_TRUE to request a WARP device.
- EGL_FALSE to request a hardware accelerated device.
If EGL_PLATFORM_ANGLE_USE_WARP_ANGLE is set to EGL_TRUE and
EGL_PLATFORM_ANGLE_TYPE_ANGLE is not set to
EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE then an EGL_BAD_ATTRIBUTE error is
generated and EGL_NO_DISPLAY is returned.
Issues Issues
None None
...@@ -66,4 +98,8 @@ Issues ...@@ -66,4 +98,8 @@ Issues
Revision History Revision History
Version 1, 2014-06-05 (Geoff Lang) Version 1, 2014-06-05 (Geoff Lang)
- Initial draft - Initial draft
Version 2, 2014-10-27 (Geoff Lang)
- Separate WARP devices into a new attribute instead of a platform type.
- Moved descriptions of platforms and major/minor versions from
EGL_ANGLE_platform_angle spec to EGL_ANGLE_platform_angle_d3d.
...@@ -51,13 +51,24 @@ New Tokens ...@@ -51,13 +51,24 @@ New Tokens
Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute: Accepted as values for the EGL_PLATFORM_ANGLE_TYPE_ANGLE attribute:
EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x3207 EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x3209
EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x3208 EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320A
Additions to the EGL Specification Additions to the EGL Specification
None. None.
New Behavior
To request a display that translates to OpenGL or OpenGL ES, the value of
EGL_PLATFORM_ANGLE_TYPE_ANGLE should be:
- EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE for an OpenGL display,
- EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE for a native OpenGL ES display.
To request a specific maximum context version to use for the underlying
API, EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE and
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE can be used.
Issues Issues
None None
...@@ -65,4 +76,7 @@ Issues ...@@ -65,4 +76,7 @@ Issues
Revision History Revision History
Version 1, 2014-06-05 (Geoff Lang) Version 1, 2014-06-05 (Geoff Lang)
- Initial draft - Initial draft
\ No newline at end of file Version 2, 2014-10-27 (Geoff Lang)
- Moved descriptions of platforms and major/minor versions from
EGL_ANGLE_platform_angle spec to EGL_ANGLE_platform_angle_opengl.
...@@ -442,20 +442,22 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu ...@@ -442,20 +442,22 @@ EGLAPI EGLBoolean EGLAPIENTRY eglQuerySurfacePointerANGLE (EGLDisplay dpy, EGLSu
#define EGL_ANGLE_platform_angle 1 #define EGL_ANGLE_platform_angle 1
#define EGL_PLATFORM_ANGLE_ANGLE 0x3201 #define EGL_PLATFORM_ANGLE_ANGLE 0x3201
#define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202 #define EGL_PLATFORM_ANGLE_TYPE_ANGLE 0x3202
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3203 #define EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE 0x3203
#define EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE 0x3204
#define EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE 0x3205
#endif /* EGL_ANGLE_platform_angle */ #endif /* EGL_ANGLE_platform_angle */
#ifndef EGL_ANGLE_platform_angle_d3d #ifndef EGL_ANGLE_platform_angle_d3d
#define EGL_ANGLE_platform_angle_d3d 1 #define EGL_ANGLE_platform_angle_d3d 1
#define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3204 #define EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE 0x3206
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3205 #define EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE 0x3207
#define EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE 0x3206 #define EGL_PLATFORM_ANGLE_USE_WARP_ANGLE 0x3208
#endif /* EGL_ANGLE_platform_angle_d3d */ #endif /* EGL_ANGLE_platform_angle_d3d */
#ifndef EGL_ANGLE_platform_angle_opengl #ifndef EGL_ANGLE_platform_angle_opengl
#define EGL_ANGLE_platform_angle_opengl 1 #define EGL_ANGLE_platform_angle_opengl 1
#define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x3207 #define EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE 0x3209
#define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x3208 #define EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE 0x320A
#endif /* EGL_ANGLE_platform_angle_opengl */ #endif /* EGL_ANGLE_platform_angle_opengl */
#ifndef EGL_ARM_pixmap_multisample_discard #ifndef EGL_ARM_pixmap_multisample_discard
......
...@@ -255,6 +255,7 @@ ...@@ -255,6 +255,7 @@
<ClInclude Include="..\..\src\common\tls.h"/> <ClInclude Include="..\..\src\common\tls.h"/>
<ClInclude Include="..\..\src\common\utilities.h"/> <ClInclude Include="..\..\src\common\utilities.h"/>
<ClInclude Include="..\..\src\common\version.h"/> <ClInclude Include="..\..\src\common\version.h"/>
<ClInclude Include="..\..\src\libEGL\AttributeMap.h"/>
<ClInclude Include="..\..\src\libEGL\Config.h"/> <ClInclude Include="..\..\src\libEGL\Config.h"/>
<ClInclude Include="..\..\src\libEGL\Display.h"/> <ClInclude Include="..\..\src\libEGL\Display.h"/>
<ClInclude Include="..\..\src\libEGL\Surface.h"/> <ClInclude Include="..\..\src\libEGL\Surface.h"/>
...@@ -269,6 +270,7 @@ ...@@ -269,6 +270,7 @@
<ClCompile Include="..\..\src\common\mathutil.cpp"/> <ClCompile Include="..\..\src\common\mathutil.cpp"/>
<ClCompile Include="..\..\src\common\tls.cpp"/> <ClCompile Include="..\..\src\common\tls.cpp"/>
<ClCompile Include="..\..\src\common\utilities.cpp"/> <ClCompile Include="..\..\src\common\utilities.cpp"/>
<ClCompile Include="..\..\src\libEGL\AttributeMap.cpp"/>
<ClCompile Include="..\..\src\libEGL\Config.cpp"/> <ClCompile Include="..\..\src\libEGL\Config.cpp"/>
<ClCompile Include="..\..\src\libEGL\Display.cpp"/> <ClCompile Include="..\..\src\libEGL\Display.cpp"/>
<ClCompile Include="..\..\src\libEGL\Surface.cpp"/> <ClCompile Include="..\..\src\libEGL\Surface.cpp"/>
......
...@@ -253,6 +253,18 @@ ...@@ -253,6 +253,18 @@
<Filter Include="src"> <Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier> <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="src\libEGL">
<UniqueIdentifier>{D633941D-C923-DFCE-3A9B-DCF851CC7DBA}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\libEGL">
<UniqueIdentifier>{D633941D-C923-DFCE-3A9B-DCF851CC7DBA}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\common"> <Filter Include="src\common">
<UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier> <UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
</Filter> </Filter>
...@@ -354,6 +366,12 @@ ...@@ -354,6 +366,12 @@
<ClInclude Include="..\..\src\common\version.h"> <ClInclude Include="..\..\src\common\version.h">
<Filter>src\common</Filter> <Filter>src\common</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\src\libEGL\AttributeMap.cpp">
<Filter>src\libEGL</Filter>
</ClCompile>
<ClInclude Include="..\..\src\libEGL\AttributeMap.h">
<Filter>src\libEGL</Filter>
</ClInclude>
<ClCompile Include="..\..\src\libEGL\Config.cpp"> <ClCompile Include="..\..\src\libEGL\Config.cpp">
<Filter>src\libEGL</Filter> <Filter>src\libEGL</Filter>
</ClCompile> </ClCompile>
......
...@@ -370,6 +370,7 @@ ...@@ -370,6 +370,7 @@
<ClInclude Include="..\..\..\..\src\common\tls.h"/> <ClInclude Include="..\..\..\..\src\common\tls.h"/>
<ClInclude Include="..\..\..\..\src\common\utilities.h"/> <ClInclude Include="..\..\..\..\src\common\utilities.h"/>
<ClInclude Include="..\..\..\..\src\common\version.h"/> <ClInclude Include="..\..\..\..\src\common\version.h"/>
<ClInclude Include="..\..\..\..\src\libEGL\AttributeMap.h"/>
<ClInclude Include="..\..\..\..\src\libEGL\Config.h"/> <ClInclude Include="..\..\..\..\src\libEGL\Config.h"/>
<ClInclude Include="..\..\..\..\src\libEGL\Display.h"/> <ClInclude Include="..\..\..\..\src\libEGL\Display.h"/>
<ClInclude Include="..\..\..\..\src\libEGL\Surface.h"/> <ClInclude Include="..\..\..\..\src\libEGL\Surface.h"/>
...@@ -386,6 +387,7 @@ ...@@ -386,6 +387,7 @@
<ClCompile Include="..\..\..\..\src\common\mathutil.cpp"/> <ClCompile Include="..\..\..\..\src\common\mathutil.cpp"/>
<ClCompile Include="..\..\..\..\src\common\tls.cpp"/> <ClCompile Include="..\..\..\..\src\common\tls.cpp"/>
<ClCompile Include="..\..\..\..\src\common\utilities.cpp"/> <ClCompile Include="..\..\..\..\src\common\utilities.cpp"/>
<ClCompile Include="..\..\..\..\src\libEGL\AttributeMap.cpp"/>
<ClCompile Include="..\..\..\..\src\libEGL\Config.cpp"/> <ClCompile Include="..\..\..\..\src\libEGL\Config.cpp"/>
<ClCompile Include="..\..\..\..\src\libEGL\Display.cpp"/> <ClCompile Include="..\..\..\..\src\libEGL\Display.cpp"/>
<ClCompile Include="..\..\..\..\src\libEGL\Surface.cpp"/> <ClCompile Include="..\..\..\..\src\libEGL\Surface.cpp"/>
......
...@@ -253,6 +253,18 @@ ...@@ -253,6 +253,18 @@
<Filter Include="src"> <Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier> <UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter> </Filter>
<Filter Include="src\libEGL">
<UniqueIdentifier>{D633941D-C923-DFCE-3A9B-DCF851CC7DBA}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\libEGL">
<UniqueIdentifier>{D633941D-C923-DFCE-3A9B-DCF851CC7DBA}</UniqueIdentifier>
</Filter>
<Filter Include="src">
<UniqueIdentifier>{8CDEE807-BC53-E450-C8B8-4DEBB66742D4}</UniqueIdentifier>
</Filter>
<Filter Include="src\common"> <Filter Include="src\common">
<UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier> <UniqueIdentifier>{2F5FD094-EF52-77F7-7AA8-4327A01BF747}</UniqueIdentifier>
</Filter> </Filter>
...@@ -381,6 +393,12 @@ ...@@ -381,6 +393,12 @@
<ClInclude Include="..\..\..\..\src\common\version.h"> <ClInclude Include="..\..\..\..\src\common\version.h">
<Filter>src\common</Filter> <Filter>src\common</Filter>
</ClInclude> </ClInclude>
<ClCompile Include="..\..\..\..\src\libEGL\AttributeMap.cpp">
<Filter>src\libEGL</Filter>
</ClCompile>
<ClInclude Include="..\..\..\..\src\libEGL\AttributeMap.h">
<Filter>src\libEGL</Filter>
</ClInclude>
<ClCompile Include="..\..\..\..\src\libEGL\Config.cpp"> <ClCompile Include="..\..\..\..\src\libEGL\Config.cpp">
<Filter>src\libEGL</Filter> <Filter>src\libEGL</Filter>
</ClCompile> </ClCompile>
......
...@@ -12,7 +12,7 @@ SampleApplication::SampleApplication(const std::string& name, size_t width, size ...@@ -12,7 +12,7 @@ SampleApplication::SampleApplication(const std::string& name, size_t width, size
: mName(name), : mName(name),
mRunning(false) mRunning(false)
{ {
mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, requestedRenderer)); mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, EGLPlatformParameters(requestedRenderer)));
mTimer.reset(CreateTimer()); mTimer.reset(CreateTimer());
mOSWindow.reset(CreateOSWindow()); mOSWindow.reset(CreateOSWindow());
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
'common/utilities.cpp', 'common/utilities.cpp',
'common/utilities.h', 'common/utilities.h',
'common/version.h', 'common/version.h',
'libEGL/AttributeMap.cpp',
'libEGL/AttributeMap.h',
'libEGL/Config.cpp', 'libEGL/Config.cpp',
'libEGL/Config.h', 'libEGL/Config.h',
'libEGL/Display.cpp', 'libEGL/Display.cpp',
......
//
// 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.
//
#include "libEGL/AttributeMap.h"
namespace egl
{
AttributeMap::AttributeMap()
{
}
AttributeMap::AttributeMap(const EGLint *attributes)
{
for (const EGLint *curAttrib = attributes; curAttrib[0] != EGL_NONE; curAttrib++)
{
insert(curAttrib[0], curAttrib[1]);
}
}
void AttributeMap::insert(EGLint key, EGLint value)
{
mAttributes[key] = value;
}
bool AttributeMap::contains(EGLint key) const
{
return (mAttributes.find(key) != mAttributes.end());
}
EGLint AttributeMap::get(EGLint key, EGLint defaultValue) const
{
std::map<EGLint, EGLint>::const_iterator iter = mAttributes.find(key);
return (mAttributes.find(key) != mAttributes.end()) ? iter->second : defaultValue;
}
}
//
// 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.
//
#ifndef LIBEGL_ATTRIBUTEMAP_H_
#define LIBEGL_ATTRIBUTEMAP_H_
#include <EGL/egl.h>
#include <map>
namespace egl
{
class AttributeMap
{
public:
AttributeMap();
explicit AttributeMap(const EGLint *attributes);
virtual void insert(EGLint key, EGLint value);
virtual bool contains(EGLint key) const;
virtual EGLint get(EGLint key, EGLint defaultValue) const;
private:
std::map<EGLint, EGLint> mAttributes;
};
}
#endif // LIBEGL_ATTRIBUTEMAP_H_
...@@ -35,26 +35,34 @@ static DisplayMap *GetDisplayMap() ...@@ -35,26 +35,34 @@ static DisplayMap *GetDisplayMap()
return &displays; return &displays;
} }
egl::Display *Display::getDisplay(EGLNativeDisplayType displayId, EGLint displayType) egl::Display *Display::getDisplay(EGLNativeDisplayType displayId, const AttributeMap &attribMap)
{ {
Display *display = NULL;
DisplayMap *displays = GetDisplayMap(); DisplayMap *displays = GetDisplayMap();
DisplayMap::const_iterator iter = displays->find(displayId); DisplayMap::const_iterator iter = displays->find(displayId);
if (iter != displays->end()) if (iter != displays->end())
{ {
return iter->second; display = iter->second;
}
else
{
display = new egl::Display(displayId);
displays->insert(std::make_pair(displayId, display));
} }
// FIXME: Check if displayId is a valid display device context
egl::Display *display = new egl::Display(displayId, displayType); // Apply new attributes if the display is not initialized yet.
displays->insert(std::make_pair(displayId, display)); if (!display->isInitialized())
{
display->setAttributes(attribMap);
}
return display; return display;
} }
Display::Display(EGLNativeDisplayType displayId, EGLint displayType) Display::Display(EGLNativeDisplayType displayId)
: mDisplayId(displayId), : mDisplayId(displayId),
mRequestedDisplayType(displayType), mAttributeMap(),
mRenderer(NULL) mRenderer(NULL)
{ {
} }
...@@ -71,6 +79,11 @@ Display::~Display() ...@@ -71,6 +79,11 @@ Display::~Display()
} }
} }
void Display::setAttributes(const AttributeMap &attribMap)
{
mAttributeMap = attribMap;
}
Error Display::initialize() Error Display::initialize()
{ {
if (isInitialized()) if (isInitialized())
...@@ -78,7 +91,7 @@ Error Display::initialize() ...@@ -78,7 +91,7 @@ Error Display::initialize()
return Error(EGL_SUCCESS); return Error(EGL_SUCCESS);
} }
mRenderer = glCreateRenderer(this, mDisplayId, mRequestedDisplayType); mRenderer = glCreateRenderer(this, mDisplayId, mAttributeMap);
if (!mRenderer) if (!mRenderer)
{ {
...@@ -139,6 +152,8 @@ void Display::terminate() ...@@ -139,6 +152,8 @@ void Display::terminate()
glDestroyRenderer(mRenderer); glDestroyRenderer(mRenderer);
mRenderer = NULL; mRenderer = NULL;
mConfigSet.mSet.clear();
} }
bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig) bool Display::getConfigs(EGLConfig *configs, const EGLint *attribList, EGLint configSize, EGLint *numConfig)
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "libEGL/Error.h" #include "libEGL/Error.h"
#include "libEGL/Config.h" #include "libEGL/Config.h"
#include "libEGL/AttributeMap.h"
namespace gl namespace gl
{ {
...@@ -34,7 +35,7 @@ class Display ...@@ -34,7 +35,7 @@ class Display
Error initialize(); Error initialize();
void terminate(); void terminate();
static egl::Display *getDisplay(EGLNativeDisplayType displayId, EGLint displayType); static egl::Display *getDisplay(EGLNativeDisplayType displayId, const AttributeMap &attribMap);
static const char *getExtensionString(egl::Display *display); static const char *getExtensionString(egl::Display *display);
...@@ -70,12 +71,14 @@ class Display ...@@ -70,12 +71,14 @@ class Display
private: private:
DISALLOW_COPY_AND_ASSIGN(Display); DISALLOW_COPY_AND_ASSIGN(Display);
Display(EGLNativeDisplayType displayId, EGLint displayType); Display(EGLNativeDisplayType displayId);
void setAttributes(const AttributeMap &attribMap);
Error restoreLostDevice(); Error restoreLostDevice();
EGLNativeDisplayType mDisplayId; EGLNativeDisplayType mDisplayId;
EGLint mRequestedDisplayType; AttributeMap mAttributeMap;
typedef std::set<Surface*> SurfaceSet; typedef std::set<Surface*> SurfaceSet;
SurfaceSet mSurfaceSet; SurfaceSet mSurfaceSet;
......
...@@ -101,7 +101,7 @@ EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id) ...@@ -101,7 +101,7 @@ EGLDisplay __stdcall eglGetDisplay(EGLNativeDisplayType display_id)
{ {
EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id); EVENT("(EGLNativeDisplayType display_id = 0x%0.8p)", display_id);
return egl::Display::getDisplay(display_id, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE); return egl::Display::getDisplay(display_id, egl::AttributeMap());
} }
EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list) EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_display, const EGLint *attrib_list)
...@@ -130,7 +130,11 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis ...@@ -130,7 +130,11 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis
} }
#endif #endif
EGLint requestedDisplayType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE; EGLint platformType = EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE;
bool majorVersionSpecified = false;
bool minorVersionSpecified = false;
bool requestedWARP = false;
if (attrib_list) if (attrib_list)
{ {
for (const EGLint *curAttrib = attrib_list; curAttrib[0] != EGL_NONE; curAttrib += 2) for (const EGLint *curAttrib = attrib_list; curAttrib[0] != EGL_NONE; curAttrib += 2)
...@@ -138,7 +142,69 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis ...@@ -138,7 +142,69 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis
switch (curAttrib[0]) switch (curAttrib[0])
{ {
case EGL_PLATFORM_ANGLE_TYPE_ANGLE: case EGL_PLATFORM_ANGLE_TYPE_ANGLE:
requestedDisplayType = curAttrib[1]; 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 (!egl::Display::supportsPlatformD3D())
{
recordError(egl::Error(EGL_SUCCESS));
return EGL_NO_DISPLAY;
}
break;
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
if (!egl::Display::supportsPlatformOpenGL())
{
recordError(egl::Error(EGL_SUCCESS));
return EGL_NO_DISPLAY;
}
break;
default:
recordError(egl::Error(EGL_SUCCESS));
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_USE_WARP_ANGLE:
if (!egl::Display::supportsPlatformD3D())
{
recordError(egl::Error(EGL_SUCCESS));
return EGL_NO_DISPLAY;
}
switch (curAttrib[1])
{
case EGL_FALSE:
case EGL_TRUE:
break;
default:
recordError(egl::Error(EGL_SUCCESS));
return EGL_NO_DISPLAY;
}
requestedWARP = (curAttrib[1] == EGL_TRUE);
break; break;
default: default:
...@@ -147,36 +213,20 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis ...@@ -147,36 +213,20 @@ EGLDisplay __stdcall eglGetPlatformDisplayEXT(EGLenum platform, void *native_dis
} }
} }
switch (requestedDisplayType) if (!majorVersionSpecified && minorVersionSpecified)
{ {
case EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE: recordError(egl::Error(EGL_BAD_ATTRIBUTE));
break; return EGL_NO_DISPLAY;
}
case EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE:
if (!egl::Display::supportsPlatformD3D())
{
recordError(egl::Error(EGL_SUCCESS));
return EGL_NO_DISPLAY;
}
break;
case EGL_PLATFORM_ANGLE_TYPE_OPENGL_ANGLE:
case EGL_PLATFORM_ANGLE_TYPE_OPENGLES_ANGLE:
if (!egl::Display::supportsPlatformOpenGL())
{
recordError(egl::Error(EGL_SUCCESS));
return EGL_NO_DISPLAY;
}
break;
default: if (platformType != EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE && requestedWARP)
recordError(egl::Error(EGL_SUCCESS)); {
recordError(egl::Error(EGL_BAD_ATTRIBUTE));
return EGL_NO_DISPLAY; return EGL_NO_DISPLAY;
} }
return egl::Display::getDisplay(displayId, requestedDisplayType); recordError(egl::Error(EGL_SUCCESS));
return egl::Display::getDisplay(displayId, egl::AttributeMap(attrib_list));
} }
EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) EGLBoolean __stdcall eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
......
...@@ -18,6 +18,7 @@ namespace egl ...@@ -18,6 +18,7 @@ namespace egl
{ {
class Display; class Display;
class Surface; class Surface;
class AttributeMap;
} }
namespace gl namespace gl
...@@ -60,7 +61,7 @@ gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext, ...@@ -60,7 +61,7 @@ gl::Context *glCreateContext(int clientVersion, const gl::Context *shareContext,
void glDestroyContext(gl::Context *context); void glDestroyContext(gl::Context *context);
void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface); void glMakeCurrent(gl::Context *context, egl::Display *display, egl::Surface *surface);
gl::Context *glGetCurrentContext(); gl::Context *glGetCurrentContext();
rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDisplay, EGLint requestedDisplayType); rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDisplay, const egl::AttributeMap &attribMap);
void glDestroyRenderer(rx::Renderer *renderer); void glDestroyRenderer(rx::Renderer *renderer);
__eglMustCastToProperFunctionPointerType EGLAPIENTRY glGetProcAddress(const char *procname); __eglMustCastToProperFunctionPointerType EGLAPIENTRY glGetProcAddress(const char *procname);
......
...@@ -13,6 +13,8 @@ ...@@ -13,6 +13,8 @@
#include "third_party/trace_event/trace_event.h" #include "third_party/trace_event/trace_event.h"
#include "libGLESv2/Shader.h" #include "libGLESv2/Shader.h"
#include "libEGL/AttributeMap.h"
#if defined (ANGLE_ENABLE_D3D9) #if defined (ANGLE_ENABLE_D3D9)
#include "libGLESv2/renderer/d3d/d3d9/Renderer9.h" #include "libGLESv2/renderer/d3d/d3d9/Renderer9.h"
#endif // ANGLE_ENABLE_D3D9 #endif // ANGLE_ENABLE_D3D9
...@@ -91,12 +93,12 @@ const Workarounds &Renderer::getWorkarounds() const ...@@ -91,12 +93,12 @@ const Workarounds &Renderer::getWorkarounds() const
return mWorkarounds; return mWorkarounds;
} }
typedef Renderer *(*CreateRendererFunction)(egl::Display*, EGLNativeDisplayType, EGLint); typedef Renderer *(*CreateRendererFunction)(egl::Display*, EGLNativeDisplayType, const egl::AttributeMap &);
template <typename RendererType> template <typename RendererType>
Renderer *CreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDisplay, EGLint requestedDisplayType) Renderer *CreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDisplay, const egl::AttributeMap &attributes)
{ {
return new RendererType(display, nativeDisplay, requestedDisplayType); return new RendererType(display, nativeDisplay, attributes);
} }
} }
...@@ -104,15 +106,16 @@ Renderer *CreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDispl ...@@ -104,15 +106,16 @@ Renderer *CreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDispl
extern "C" extern "C"
{ {
rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDisplay, EGLint requestedDisplayType) rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType nativeDisplay, const egl::AttributeMap &attribMap)
{ {
std::vector<rx::CreateRendererFunction> rendererCreationFunctions; std::vector<rx::CreateRendererFunction> rendererCreationFunctions;
EGLint requestedDisplayType = attribMap.get(EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE);
# if defined(ANGLE_ENABLE_D3D11) # if defined(ANGLE_ENABLE_D3D11)
if (nativeDisplay == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE || if (nativeDisplay == EGL_D3D11_ELSE_D3D9_DISPLAY_ANGLE ||
nativeDisplay == EGL_D3D11_ONLY_DISPLAY_ANGLE || nativeDisplay == EGL_D3D11_ONLY_DISPLAY_ANGLE ||
requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE || requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
requestedDisplayType == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
{ {
rendererCreationFunctions.push_back(rx::CreateRenderer<rx::Renderer11>); rendererCreationFunctions.push_back(rx::CreateRenderer<rx::Renderer11>);
} }
...@@ -151,7 +154,7 @@ rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType nativ ...@@ -151,7 +154,7 @@ rx::Renderer *glCreateRenderer(egl::Display *display, EGLNativeDisplayType nativ
for (size_t i = 0; i < rendererCreationFunctions.size(); i++) for (size_t i = 0; i < rendererCreationFunctions.size(); i++)
{ {
rx::Renderer *renderer = rendererCreationFunctions[i](display, nativeDisplay, requestedDisplayType); rx::Renderer *renderer = rendererCreationFunctions[i](display, nativeDisplay, attribMap);
if (renderer->initialize() == EGL_SUCCESS) if (renderer->initialize() == EGL_SUCCESS)
{ {
return renderer; return renderer;
......
...@@ -93,10 +93,9 @@ ID3D11Resource *GetSRVResource(ID3D11ShaderResourceView *srv) ...@@ -93,10 +93,9 @@ ID3D11Resource *GetSRVResource(ID3D11ShaderResourceView *srv)
} }
Renderer11::Renderer11(egl::Display *display, EGLNativeDisplayType hDc, EGLint requestedDisplay) Renderer11::Renderer11(egl::Display *display, EGLNativeDisplayType hDc, const egl::AttributeMap &attributes)
: Renderer(display), : Renderer(display),
mDc(hDc), mDc(hDc)
mRequestedDisplay(requestedDisplay)
{ {
mVertexDataManager = NULL; mVertexDataManager = NULL;
mIndexDataManager = NULL; mIndexDataManager = NULL;
...@@ -128,6 +127,32 @@ Renderer11::Renderer11(egl::Display *display, EGLNativeDisplayType hDc, EGLint r ...@@ -128,6 +127,32 @@ Renderer11::Renderer11(egl::Display *display, EGLNativeDisplayType hDc, EGLint r
mAppliedGeometryShader = NULL; mAppliedGeometryShader = NULL;
mCurPointGeometryShader = NULL; mCurPointGeometryShader = NULL;
mAppliedPixelShader = NULL; mAppliedPixelShader = NULL;
EGLint requestedMajorVersion = attributes.get(EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, EGL_DONT_CARE);
EGLint requestedMinorVersion = attributes.get(EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, EGL_DONT_CARE);
if (requestedMajorVersion == EGL_DONT_CARE || requestedMajorVersion >= 11)
{
if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 0)
{
mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_11_0);
}
}
if (requestedMajorVersion == EGL_DONT_CARE || requestedMajorVersion >= 10)
{
if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 1)
{
mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_10_1);
}
if (requestedMinorVersion == EGL_DONT_CARE || requestedMinorVersion >= 0)
{
mAvailableFeatureLevels.push_back(D3D_FEATURE_LEVEL_10_0);
}
}
mDriverType = (attributes.get(EGL_PLATFORM_ANGLE_USE_WARP_ANGLE, EGL_FALSE) == EGL_TRUE) ? D3D_DRIVER_TYPE_WARP
: D3D_DRIVER_TYPE_HARDWARE;
} }
Renderer11::~Renderer11() Renderer11::~Renderer11()
...@@ -173,28 +198,14 @@ EGLint Renderer11::initialize() ...@@ -173,28 +198,14 @@ EGLint Renderer11::initialize()
} }
#endif #endif
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
};
D3D_DRIVER_TYPE driverType = D3D_DRIVER_TYPE_HARDWARE;
if (mRequestedDisplay == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE)
{
driverType = D3D_DRIVER_TYPE_WARP;
}
HRESULT result = S_OK; HRESULT result = S_OK;
#ifdef _DEBUG #ifdef _DEBUG
result = D3D11CreateDevice(NULL, result = D3D11CreateDevice(NULL,
driverType, mDriverType,
NULL, NULL,
D3D11_CREATE_DEVICE_DEBUG, D3D11_CREATE_DEVICE_DEBUG,
featureLevels, mAvailableFeatureLevels.data(),
ArraySize(featureLevels), mAvailableFeatureLevels.size(),
D3D11_SDK_VERSION, D3D11_SDK_VERSION,
&mDevice, &mDevice,
&mFeatureLevel, &mFeatureLevel,
...@@ -209,11 +220,11 @@ EGLint Renderer11::initialize() ...@@ -209,11 +220,11 @@ EGLint Renderer11::initialize()
#endif #endif
{ {
result = D3D11CreateDevice(NULL, result = D3D11CreateDevice(NULL,
driverType, mDriverType,
NULL, NULL,
0, 0,
featureLevels, mAvailableFeatureLevels.data(),
ArraySize(featureLevels), mAvailableFeatureLevels.size(),
D3D11_SDK_VERSION, D3D11_SDK_VERSION,
&mDevice, &mDevice,
&mFeatureLevel, &mFeatureLevel,
...@@ -1776,27 +1787,20 @@ bool Renderer11::testDeviceResettable() ...@@ -1776,27 +1787,20 @@ bool Renderer11::testDeviceResettable()
return false; return false;
} }
D3D_FEATURE_LEVEL featureLevels[] =
{
D3D_FEATURE_LEVEL_11_0,
D3D_FEATURE_LEVEL_10_1,
D3D_FEATURE_LEVEL_10_0,
};
ID3D11Device* dummyDevice; ID3D11Device* dummyDevice;
D3D_FEATURE_LEVEL dummyFeatureLevel; D3D_FEATURE_LEVEL dummyFeatureLevel;
ID3D11DeviceContext* dummyContext; ID3D11DeviceContext* dummyContext;
HRESULT result = D3D11CreateDevice(NULL, HRESULT result = D3D11CreateDevice(NULL,
D3D_DRIVER_TYPE_HARDWARE, mDriverType,
NULL, NULL,
#if defined(_DEBUG) #if defined(_DEBUG)
D3D11_CREATE_DEVICE_DEBUG, D3D11_CREATE_DEVICE_DEBUG,
#else #else
0, 0,
#endif #endif
featureLevels, mAvailableFeatureLevels.data(),
ArraySize(featureLevels), mAvailableFeatureLevels.size(),
D3D11_SDK_VERSION, D3D11_SDK_VERSION,
&dummyDevice, &dummyDevice,
&dummyFeatureLevel, &dummyFeatureLevel,
......
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
#include "libGLESv2/renderer/d3d/d3d11/InputLayoutCache.h" #include "libGLESv2/renderer/d3d/d3d11/InputLayoutCache.h"
#include "libGLESv2/renderer/RenderTarget.h" #include "libGLESv2/renderer/RenderTarget.h"
#include "libEGL/AttributeMap.h"
namespace gl namespace gl
{ {
class FramebufferAttachment; class FramebufferAttachment;
...@@ -45,7 +47,7 @@ enum ...@@ -45,7 +47,7 @@ enum
class Renderer11 : public Renderer class Renderer11 : public Renderer
{ {
public: public:
Renderer11(egl::Display *display, EGLNativeDisplayType hDc, EGLint requestedDisplay); Renderer11(egl::Display *display, EGLNativeDisplayType hDc, const egl::AttributeMap &attributes);
virtual ~Renderer11(); virtual ~Renderer11();
static Renderer11 *makeRenderer11(Renderer *renderer); static Renderer11 *makeRenderer11(Renderer *renderer);
...@@ -226,7 +228,8 @@ class Renderer11 : public Renderer ...@@ -226,7 +228,8 @@ class Renderer11 : public Renderer
HMODULE mD3d11Module; HMODULE mD3d11Module;
HMODULE mDxgiModule; HMODULE mDxgiModule;
HDC mDc; HDC mDc;
EGLint mRequestedDisplay; std::vector<D3D_FEATURE_LEVEL> mAvailableFeatureLevels;
D3D_DRIVER_TYPE mDriverType;
HLSLCompiler mCompiler; HLSLCompiler mCompiler;
......
...@@ -92,7 +92,7 @@ enum ...@@ -92,7 +92,7 @@ enum
MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4 MAX_TEXTURE_IMAGE_UNITS_VTF_SM3 = 4
}; };
Renderer9::Renderer9(egl::Display *display, EGLNativeDisplayType hDc, EGLint requestedDisplay) Renderer9::Renderer9(egl::Display *display, EGLNativeDisplayType hDc, const egl::AttributeMap &attributes)
: Renderer(display), : Renderer(display),
mDc(hDc) mDc(hDc)
{ {
......
...@@ -22,6 +22,11 @@ namespace gl ...@@ -22,6 +22,11 @@ namespace gl
class FramebufferAttachment; class FramebufferAttachment;
} }
namespace egl
{
class AttributeMap;
}
namespace rx namespace rx
{ {
class VertexDataManager; class VertexDataManager;
...@@ -34,7 +39,7 @@ class Blit9; ...@@ -34,7 +39,7 @@ class Blit9;
class Renderer9 : public Renderer class Renderer9 : public Renderer
{ {
public: public:
Renderer9(egl::Display *display, EGLNativeDisplayType hDc, EGLint requestedDisplay); Renderer9(egl::Display *display, EGLNativeDisplayType hDc, const egl::AttributeMap &attributes);
virtual ~Renderer9(); virtual ~Renderer9();
static Renderer9 *makeRenderer9(Renderer *renderer); static Renderer9 *makeRenderer9(Renderer *renderer);
......
...@@ -2,21 +2,21 @@ ...@@ -2,21 +2,21 @@
#include "EGLWindow.h" #include "EGLWindow.h"
#include "OSWindow.h" #include "OSWindow.h"
ANGLETest::ANGLETest(EGLint glesMajorVersion, EGLint requestedRenderer) ANGLETest::ANGLETest(EGLint glesMajorVersion, const EGLPlatformParameters &platform)
: mEGLWindow(NULL), : mEGLWindow(NULL)
mOSWindow(NULL)
{ {
mEGLWindow = new EGLWindow(1280, 720, glesMajorVersion, requestedRenderer); mEGLWindow = new EGLWindow(1280, 720, glesMajorVersion, platform);
} }
void ANGLETest::SetUp() ANGLETest::~ANGLETest()
{ {
if (!initTestWindow()) delete mEGLWindow;
{ mEGLWindow = NULL;
FAIL() << "Failed to create ANGLE test window."; }
}
if (!resizeWindow(mEGLWindow->getWidth(), mEGLWindow->getHeight())) void ANGLETest::SetUp()
{
if (!ResizeWindow(mEGLWindow->getWidth(), mEGLWindow->getHeight()))
{ {
FAIL() << "Failed to resize ANGLE test window."; FAIL() << "Failed to resize ANGLE test window.";
} }
...@@ -46,11 +46,6 @@ void ANGLETest::TearDown() ...@@ -46,11 +46,6 @@ void ANGLETest::TearDown()
exit(0); exit(0);
} }
} }
if (!destroyTestWindow())
{
FAIL() << "ANGLE test window destruction failed.";
}
} }
void ANGLETest::swapBuffers() void ANGLETest::swapBuffers()
...@@ -196,7 +191,7 @@ bool ANGLETest::destroyEGLContext() ...@@ -196,7 +191,7 @@ bool ANGLETest::destroyEGLContext()
return true; return true;
} }
bool ANGLETest::initTestWindow() bool ANGLETest::InitTestWindow()
{ {
mOSWindow = CreateOSWindow(); mOSWindow = CreateOSWindow();
if (!mOSWindow->initialize("ANGLE_TEST", 128, 128)) if (!mOSWindow->initialize("ANGLE_TEST", 128, 128))
...@@ -204,12 +199,12 @@ bool ANGLETest::initTestWindow() ...@@ -204,12 +199,12 @@ bool ANGLETest::initTestWindow()
return false; return false;
} }
mOSWindow->setVisible(false); mOSWindow->setVisible(true);
return true; return true;
} }
bool ANGLETest::destroyTestWindow() bool ANGLETest::DestroyTestWindow()
{ {
if (mOSWindow) if (mOSWindow)
{ {
...@@ -221,12 +216,27 @@ bool ANGLETest::destroyTestWindow() ...@@ -221,12 +216,27 @@ bool ANGLETest::destroyTestWindow()
return true; return true;
} }
bool ANGLETest::resizeWindow(int width, int height) bool ANGLETest::ResizeWindow(int width, int height)
{ {
return mOSWindow->resize(width, height); return mOSWindow->resize(width, height);
} }
void ANGLETest::setWindowVisible(bool isVisible) void ANGLETest::SetWindowVisible(bool isVisible)
{ {
mOSWindow->setVisible(isVisible); mOSWindow->setVisible(isVisible);
} }
OSWindow *ANGLETest::mOSWindow = NULL;
void ANGLETestEnvironment::SetUp()
{
if (!ANGLETest::InitTestWindow())
{
FAIL() << "Failed to create ANGLE test window.";
}
}
void ANGLETestEnvironment::TearDown()
{
ANGLETest::DestroyTestWindow();
}
...@@ -53,11 +53,14 @@ class OSWindow; ...@@ -53,11 +53,14 @@ class OSWindow;
class ANGLETest : public testing::Test class ANGLETest : public testing::Test
{ {
protected: protected:
ANGLETest(EGLint requestedRenderer, EGLint glesMajorVersion); ANGLETest(EGLint glesMajorVersion, const EGLPlatformParameters &platform);
~ANGLETest();
public: public:
bool resizeWindow(int width, int height); static bool InitTestWindow();
void setWindowVisible(bool isVisible); static bool DestroyTestWindow();
static bool ResizeWindow(int width, int height);
static void SetWindowVisible(bool isVisible);
protected: protected:
virtual void SetUp(); virtual void SetUp();
...@@ -85,13 +88,19 @@ class ANGLETest : public testing::Test ...@@ -85,13 +88,19 @@ class ANGLETest : public testing::Test
bool isMultisampleEnabled() const; bool isMultisampleEnabled() const;
private: private:
bool initTestWindow();
bool destroyTestWindow();
bool createEGLContext(); bool createEGLContext();
bool destroyEGLContext(); bool destroyEGLContext();
EGLWindow *mEGLWindow; EGLWindow *mEGLWindow;
OSWindow *mOSWindow;
static OSWindow *mOSWindow;
};
class ANGLETestEnvironment : public testing::Environment
{
public:
virtual void SetUp();
virtual void TearDown();
}; };
#endif // ANGLE_TESTS_ANGLE_TEST_H_ #endif // ANGLE_TESTS_ANGLE_TEST_H_
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D9>, TFT<Gles::Two, Rend::D3D11>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(BlendMinMaxTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(BlendMinMaxTest, TestFixtureTypes);
template<typename T> template<typename T>
class BlendMinMaxTest : public ANGLETest class BlendMinMaxTest : public ANGLETest
{ {
protected: protected:
BlendMinMaxTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) BlendMinMaxTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(BlitFramebufferANGLETest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(BlitFramebufferANGLETest, TestFixtureTypes);
template<typename T> template<typename T>
class BlitFramebufferANGLETest : public ANGLETest class BlitFramebufferANGLETest : public ANGLETest
{ {
protected: protected:
BlitFramebufferANGLETest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) BlitFramebufferANGLETest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(256); setWindowWidth(256);
setWindowHeight(256); setWindowHeight(256);
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
#include <cstdint> #include <cstdint>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(BufferDataTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(BufferDataTest, TestFixtureTypes);
template<typename T> template<typename T>
class BufferDataTest : public ANGLETest class BufferDataTest : public ANGLETest
{ {
protected: protected:
BufferDataTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) BufferDataTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(16); setWindowWidth(16);
setWindowHeight(16); setWindowHeight(16);
...@@ -203,14 +202,13 @@ TYPED_TEST(BufferDataTest, HugeSetDataShouldNotCrash) ...@@ -203,14 +202,13 @@ TYPED_TEST(BufferDataTest, HugeSetDataShouldNotCrash)
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypesIndexedBufferCopyTest; ANGLE_TYPED_TEST_CASE(IndexedBufferCopyTest, ES3_D3D11);
TYPED_TEST_CASE(IndexedBufferCopyTest, TestFixtureTypesIndexedBufferCopyTest);
template<typename T> template<typename T>
class IndexedBufferCopyTest : public ANGLETest class IndexedBufferCopyTest : public ANGLETest
{ {
protected: protected:
IndexedBufferCopyTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) IndexedBufferCopyTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(16); setWindowWidth(16);
setWindowHeight(16); setWindowHeight(16);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>, TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(ClearTest, ES2_D3D9, ES2_D3D11, ES3_D3D11);
TYPED_TEST_CASE(ClearTest, TestFixtureTypes); ANGLE_TYPED_TEST_CASE(ClearTestES3, ES3_D3D11);
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypesES3;
TYPED_TEST_CASE(ClearTestES3, TestFixtureTypesES3);
template<typename T> template<typename T>
class ClearTestBase : public ANGLETest class ClearTestBase : public ANGLETest
{ {
protected: protected:
ClearTestBase() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) ClearTestBase() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
...@@ -2,14 +2,13 @@ ...@@ -2,14 +2,13 @@
#include "media/pixel.inl" #include "media/pixel.inl"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(CompressedTextureTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(CompressedTextureTest, TestFixtureTypes);
template<typename T> template<typename T>
class CompressedTextureTest : public ANGLETest class CompressedTextureTest : public ANGLETest
{ {
protected: protected:
CompressedTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) CompressedTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(512); setWindowWidth(512);
setWindowHeight(512); setWindowHeight(512);
...@@ -167,14 +166,12 @@ TYPED_TEST(CompressedTextureTest, CompressedTexStorage) ...@@ -167,14 +166,12 @@ TYPED_TEST(CompressedTextureTest, CompressedTexStorage)
} }
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypesES3; ANGLE_TYPED_TEST_CASE(CompressedTextureTestES3, ES3_D3D11);
TYPED_TEST_CASE(CompressedTextureTestES3, TestFixtureTypesES3);
template<typename T> template<typename T>
class CompressedTextureTestES3 : public CompressedTextureTest<T> { }; class CompressedTextureTestES3 : public CompressedTextureTest<T> { };
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Three, Rend::D3D11>> TestFixtureTypesD3D11; ANGLE_TYPED_TEST_CASE(CompressedTextureTestD3D11, ES2_D3D11, ES3_D3D11);
TYPED_TEST_CASE(CompressedTextureTestD3D11, TestFixtureTypesD3D11);
template<typename T> template<typename T>
class CompressedTextureTestD3D11 : public CompressedTextureTest<T> { }; class CompressedTextureTestD3D11 : public CompressedTextureTest<T> { };
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(DepthStencilFormatsTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(DepthStencilFormatsTest, TestFixtureTypes); ANGLE_TYPED_TEST_CASE(DepthStencilFormatsTestES3, ES3_D3D11);
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypesES3;
TYPED_TEST_CASE(DepthStencilFormatsTestES3, TestFixtureTypesES3);
template<typename T> template<typename T>
class DepthStencilFormatsTestBase : public ANGLETest class DepthStencilFormatsTestBase : public ANGLETest
{ {
protected: protected:
DepthStencilFormatsTestBase() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) DepthStencilFormatsTestBase() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>, TFT<Gles::Two, Rend::D3D11> > TestFixtureTypes; ANGLE_TYPED_TEST_CASE(DrawBuffersTest, ES2_D3D11, ES3_D3D11);
TYPED_TEST_CASE(DrawBuffersTest, TestFixtureTypes);
template<typename T> template<typename T>
class DrawBuffersTest : public ANGLETest class DrawBuffersTest : public ANGLETest
{ {
protected: protected:
DrawBuffersTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) DrawBuffersTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
...@@ -24,7 +23,7 @@ class DrawBuffersTest : public ANGLETest ...@@ -24,7 +23,7 @@ class DrawBuffersTest : public ANGLETest
ANGLETest::SetUp(); ANGLETest::SetUp();
// This test seems to fail on an nVidia machine when the window is hidden // This test seems to fail on an nVidia machine when the window is hidden
setWindowVisible(true); SetWindowVisible(true);
glGenFramebuffers(1, &mFBO); glGenFramebuffers(1, &mFBO);
glBindFramebuffer(GL_FRAMEBUFFER, mFBO); glBindFramebuffer(GL_FRAMEBUFFER, mFBO);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(FramebufferFormatsTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(FramebufferFormatsTest, TestFixtureTypes);
template<typename T> template<typename T>
class FramebufferFormatsTest : public ANGLETest class FramebufferFormatsTest : public ANGLETest
{ {
protected: protected:
FramebufferFormatsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) FramebufferFormatsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(GLSLTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(GLSLTest, TestFixtureTypes);
template<typename T> template<typename T>
class GLSLTest : public ANGLETest class GLSLTest : public ANGLETest
{ {
protected: protected:
GLSLTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) GLSLTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
#include <vector> #include <vector>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(IncompleteTextureTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(IncompleteTextureTest, TestFixtureTypes);
template<typename T> template<typename T>
class IncompleteTextureTest : public ANGLETest class IncompleteTextureTest : public ANGLETest
{ {
protected: protected:
IncompleteTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) IncompleteTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
#include <array> #include <array>
template <typename IndexType, GLenum IndexTypeName> template <typename T, typename IndexType, GLenum IndexTypeName>
class IndexedPointsTest : public ANGLETest class IndexedPointsTest : public ANGLETest
{ {
protected: protected:
IndexedPointsTest() : ANGLETest(2, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE) IndexedPointsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
...@@ -123,7 +123,7 @@ protected: ...@@ -123,7 +123,7 @@ protected:
static const GLuint mPointCount = 4; static const GLuint mPointCount = 4;
}; };
typedef IndexedPointsTest<GLubyte, GL_UNSIGNED_BYTE> IndexedPointsTestUByte; typedef IndexedPointsTest<ES2_D3D11, GLubyte, GL_UNSIGNED_BYTE> IndexedPointsTestUByte;
TEST_F(IndexedPointsTestUByte, UnsignedByteOffset0) TEST_F(IndexedPointsTestUByte, UnsignedByteOffset0)
{ {
...@@ -145,7 +145,7 @@ TEST_F(IndexedPointsTestUByte, UnsignedByteOffset3) ...@@ -145,7 +145,7 @@ TEST_F(IndexedPointsTestUByte, UnsignedByteOffset3)
runTest(3); runTest(3);
} }
typedef IndexedPointsTest<GLushort, GL_UNSIGNED_SHORT> IndexedPointsTestUShort; typedef IndexedPointsTest<ES2_D3D11, GLushort, GL_UNSIGNED_SHORT> IndexedPointsTestUShort;
TEST_F(IndexedPointsTestUShort, UnsignedShortOffset0) TEST_F(IndexedPointsTestUShort, UnsignedShortOffset0)
{ {
...@@ -167,7 +167,7 @@ TEST_F(IndexedPointsTestUShort, UnsignedShortOffset3) ...@@ -167,7 +167,7 @@ TEST_F(IndexedPointsTestUShort, UnsignedShortOffset3)
runTest(3); runTest(3);
} }
typedef IndexedPointsTest<GLuint, GL_UNSIGNED_INT> IndexedPointsTestUInt; typedef IndexedPointsTest<ES2_D3D11, GLuint, GL_UNSIGNED_INT> IndexedPointsTestUInt;
TEST_F(IndexedPointsTestUInt, UnsignedIntOffset0) TEST_F(IndexedPointsTestUInt, UnsignedIntOffset0)
{ {
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(LineLoopTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(LineLoopTest, TestFixtureTypes);
template<typename T> template<typename T>
class LineLoopTest : public ANGLETest class LineLoopTest : public ANGLETest
{ {
protected: protected:
LineLoopTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) LineLoopTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(256); setWindowWidth(256);
setWindowHeight(256); setWindowHeight(256);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(MaxTextureSizeTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(MaxTextureSizeTest, TestFixtureTypes);
template<typename T> template<typename T>
class MaxTextureSizeTest : public ANGLETest class MaxTextureSizeTest : public ANGLETest
{ {
protected: protected:
MaxTextureSizeTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) MaxTextureSizeTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(512); setWindowWidth(512);
setWindowHeight(512); setWindowHeight(512);
......
...@@ -4,14 +4,13 @@ ...@@ -4,14 +4,13 @@
#include <Windows.h> #include <Windows.h>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(OcclusionQueriesTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(OcclusionQueriesTest, TestFixtureTypes);
template<typename T> template<typename T>
class OcclusionQueriesTest : public ANGLETest class OcclusionQueriesTest : public ANGLETest
{ {
protected: protected:
OcclusionQueriesTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) OcclusionQueriesTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(PBOExtensionTest, ES2_D3D11, ES3_D3D11);
TYPED_TEST_CASE(PBOExtensionTest, TestFixtureTypes);
template<typename T> template<typename T>
class PBOExtensionTest : public ANGLETest class PBOExtensionTest : public ANGLETest
{ {
protected: protected:
PBOExtensionTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) PBOExtensionTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(32); setWindowWidth(32);
setWindowHeight(32); setWindowHeight(32);
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
#include <stdint.h> #include <stdint.h>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(ProgramBinaryTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(ProgramBinaryTest, TestFixtureTypes);
template<typename T> template<typename T>
class ProgramBinaryTest : public ANGLETest class ProgramBinaryTest : public ANGLETest
{ {
protected: protected:
ProgramBinaryTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) ProgramBinaryTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(ReadPixelsTest, ES3_D3D11);
TYPED_TEST_CASE(ReadPixelsTest, TestFixtureTypes);
template<typename T> template<typename T>
class ReadPixelsTest : public ANGLETest class ReadPixelsTest : public ANGLETest
{ {
protected: protected:
ReadPixelsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) ReadPixelsTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(32); setWindowWidth(32);
setWindowHeight(32); setWindowHeight(32);
......
...@@ -5,16 +5,16 @@ ...@@ -5,16 +5,16 @@
// For example, they might be using the D3D11 renderer when the test is meant to be using the D3D9 renderer. // For example, they might be using the D3D11 renderer when the test is meant to be using the D3D9 renderer.
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>, TFT<Gles::Two, Rend::D3D11>, ANGLE_TYPED_TEST_CASE(RendererTest, ES2_D3D9, ES2_D3D11, ES2_D3D11_WARP, ES3_D3D11, ES3_D3D11_WARP,
TFT<Gles::Three, Rend::WARP>, TFT<Gles::Two, Rend::WARP>, ES2_D3D11_FL11_0, ES2_D3D11_FL11_0_WARP, ES3_D3D11_FL11_0, ES3_D3D11_FL11_0_WARP,
TFT<Gles::Two, Rend::D3D9> > TestFixtureTypes; ES2_D3D11_FL10_1, ES2_D3D11_FL10_1_WARP, ES3_D3D11_FL10_1, ES3_D3D11_FL10_1_WARP,
TYPED_TEST_CASE(RendererTest, TestFixtureTypes); ES2_D3D11_FL10_0, ES2_D3D11_FL10_0_WARP, ES3_D3D11_FL10_0, ES3_D3D11_FL10_0_WARP);
template<typename T> template<typename T>
class RendererTest : public ANGLETest class RendererTest : public ANGLETest
{ {
protected: protected:
RendererTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) RendererTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
...@@ -31,34 +31,79 @@ TYPED_TEST(RendererTest, RequestedRendererCreated) ...@@ -31,34 +31,79 @@ TYPED_TEST(RendererTest, RequestedRendererCreated)
std::string versionString = std::string(reinterpret_cast<const char*>(glGetString(GL_VERSION))); std::string versionString = std::string(reinterpret_cast<const char*>(glGetString(GL_VERSION)));
std::transform(versionString.begin(), versionString.end(), versionString.begin(), ::tolower); std::transform(versionString.begin(), versionString.end(), versionString.begin(), ::tolower);
EGLPlatformParameters platform = fixtureType.GetPlatform();
// Ensure that the renderer string contains D3D11, if we requested a D3D11 renderer. // Ensure that the renderer string contains D3D11, if we requested a D3D11 renderer.
if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE || fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE) if (platform.renderer == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{ {
ASSERT_NE(rendererString.find(std::string("direct3d11")), std::string::npos); ASSERT_NE(rendererString.find(std::string("direct3d11")), std::string::npos);
} }
// Ensure that the renderer string contains D3D9, if we requested a D3D9 renderer. // Ensure that the renderer string contains D3D9, if we requested a D3D9 renderer.
if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE) if (platform.renderer == EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE)
{ {
ASSERT_NE(rendererString.find(std::string("direct3d9")), std::string::npos); ASSERT_NE(rendererString.find(std::string("direct3d9")), std::string::npos);
} }
// Ensure that the renderer uses WARP, if we requested it. // Ensure that the renderer uses WARP, if we requested it.
if (fixtureType.GetRequestedRenderer() == EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE) if (platform.useWarp == EGL_TRUE)
{ {
auto basicRenderPos = rendererString.find(std::string("microsoft basic render")); auto basicRenderPos = rendererString.find(std::string("microsoft basic render"));
auto softwareAdapterPos = rendererString.find(std::string("software adapter")); auto softwareAdapterPos = rendererString.find(std::string("software adapter"));
ASSERT_TRUE(basicRenderPos != std::string::npos || softwareAdapterPos != std::string::npos); ASSERT_TRUE(basicRenderPos != std::string::npos || softwareAdapterPos != std::string::npos);
} }
// Ensure that the major and minor versions trigger expected behavior in D3D11
if (platform.renderer == EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE)
{
std::vector<std::string> acceptableShaderModels;
// When no specific major/minor version is requested, then ANGLE should return the highest possible feature level by default.
// The current hardware driver might not support Feature Level 11_0, but WARP always does.
// Therefore if WARP is specified but no major/minor version is specified, then we test to check that ANGLE returns FL11_0.
if (platform.majorVersion >= 11 || platform.majorVersion == EGL_DONT_CARE)
{
// Feature Level 10_0 corresponds to shader model 5_0
acceptableShaderModels.push_back("ps_5_0");
}
if (platform.majorVersion >= 10 || platform.majorVersion == EGL_DONT_CARE)
{
if (platform.minorVersion >= 1 || platform.minorVersion == EGL_DONT_CARE)
{
// Feature Level 10_1 corresponds to shader model 4_1
acceptableShaderModels.push_back("ps_4_1");
}
if (platform.minorVersion >= 0 || platform.minorVersion == EGL_DONT_CARE)
{
// Feature Level 10_0 corresponds to shader model 4_0
acceptableShaderModels.push_back("ps_4_0");
}
}
bool found = false;
for (size_t i = 0; i < acceptableShaderModels.size(); i++)
{
if (rendererString.find(acceptableShaderModels[i]) != std::string::npos)
{
found = true;
}
}
ASSERT_TRUE(found);
}
EGLint glesMajorVersion = fixtureType.GetGlesMajorVersion();
// Ensure that the renderer string contains GL ES 3.0, if we requested a GL ES 3.0 // Ensure that the renderer string contains GL ES 3.0, if we requested a GL ES 3.0
if (fixtureType.GetGlesMajorVersion() == 3) if (glesMajorVersion == 3)
{ {
ASSERT_NE(versionString.find(std::string("es 3.0")), std::string::npos); ASSERT_NE(versionString.find(std::string("es 3.0")), std::string::npos);
} }
// Ensure that the version string contains GL ES 2.0, if we requested GL ES 2.0 // Ensure that the version string contains GL ES 2.0, if we requested GL ES 2.0
if (fixtureType.GetGlesMajorVersion() == 2) if (glesMajorVersion == 2)
{ {
ASSERT_NE(versionString.find(std::string("es 2.0")), std::string::npos); ASSERT_NE(versionString.find(std::string("es 2.0")), std::string::npos);
} }
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(SRGBTextureTest, ES2_D3D9, ES2_D3D11, ES3_D3D11);
TYPED_TEST_CASE(SRGBTextureTest, TestFixtureTypes);
template<typename T> template<typename T>
class SRGBTextureTest : public ANGLETest class SRGBTextureTest : public ANGLETest
{ {
protected: protected:
SRGBTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) SRGBTextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
#include <vector> #include <vector>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(SwizzleTest, ES3_D3D11);
TYPED_TEST_CASE(SwizzleTest, TestFixtureTypes);
template<typename T> template<typename T>
class SwizzleTest : public ANGLETest class SwizzleTest : public ANGLETest
{ {
protected: protected:
SwizzleTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) SwizzleTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(TextureTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(TextureTest, TestFixtureTypes);
template<typename T> template<typename T>
class TextureTest : public ANGLETest class TextureTest : public ANGLETest
{ {
protected: protected:
TextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) TextureTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Three, Rend::D3D11>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(TransformFeedbackTest, ES3_D3D11);
TYPED_TEST_CASE(TransformFeedbackTest, TestFixtureTypes);
template<typename T> template<typename T>
class TransformFeedbackTest : public ANGLETest class TransformFeedbackTest : public ANGLETest
{ {
protected: protected:
TransformFeedbackTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) TransformFeedbackTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(UniformTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(UniformTest, TestFixtureTypes);
template<typename T> template<typename T>
class UniformTest : public ANGLETest class UniformTest : public ANGLETest
{ {
protected: protected:
UniformTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) UniformTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
...@@ -3,14 +3,13 @@ ...@@ -3,14 +3,13 @@
#include <array> #include <array>
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(UnpackAlignmentTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(UnpackAlignmentTest, TestFixtureTypes);
template<typename T> template<typename T>
class UnpackAlignmentTest : public ANGLETest class UnpackAlignmentTest : public ANGLETest
{ {
protected: protected:
UnpackAlignmentTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) UnpackAlignmentTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
#include "ANGLETest.h" #include "ANGLETest.h"
// Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against. // Use this to select which configurations (e.g. which renderer, which GLES major version) these tests should be run against.
typedef ::testing::Types<TFT<Gles::Two, Rend::D3D11>, TFT<Gles::Two, Rend::D3D9>> TestFixtureTypes; ANGLE_TYPED_TEST_CASE(VertexAttributeTest, ES2_D3D9, ES2_D3D11);
TYPED_TEST_CASE(VertexAttributeTest, TestFixtureTypes);
template<typename T> template<typename T>
class VertexAttributeTest : public ANGLETest class VertexAttributeTest : public ANGLETest
{ {
protected: protected:
VertexAttributeTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetRequestedRenderer()) VertexAttributeTest() : ANGLETest(T::GetGlesMajorVersion(), T::GetPlatform())
{ {
setWindowWidth(128); setWindowWidth(128);
setWindowHeight(128); setWindowHeight(128);
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
int main(int argc, char** argv) int main(int argc, char** argv)
{ {
testing::InitGoogleTest(&argc, argv); testing::InitGoogleTest(&argc, argv);
testing::AddGlobalTestEnvironment(new ANGLETestEnvironment());
int rt = RUN_ALL_TESTS(); int rt = RUN_ALL_TESTS();
return rt; return rt;
} }
...@@ -31,7 +31,7 @@ SimpleBenchmark::SimpleBenchmark(const std::string &name, size_t width, size_t h ...@@ -31,7 +31,7 @@ SimpleBenchmark::SimpleBenchmark(const std::string &name, size_t width, size_t h
mSuffix(params.suffix()) mSuffix(params.suffix())
{ {
mOSWindow.reset(CreateOSWindow()); mOSWindow.reset(CreateOSWindow());
mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, params.requestedRenderer)); mEGLWindow.reset(new EGLWindow(width, height, glesMajorVersion, EGLPlatformParameters(params.requestedRenderer)));
mTimer.reset(CreateTimer()); mTimer.reset(CreateTimer());
} }
......
...@@ -16,13 +16,37 @@ ...@@ -16,13 +16,37 @@
#error unsupported OS. #error unsupported OS.
#endif #endif
EGLWindow::EGLWindow(size_t width, size_t height, EGLPlatformParameters::EGLPlatformParameters()
EGLint glesMajorVersion, EGLint requestedRenderer) : renderer(EGL_PLATFORM_ANGLE_TYPE_DEFAULT_ANGLE),
majorVersion(EGL_DONT_CARE),
minorVersion(EGL_DONT_CARE),
useWarp(EGL_FALSE)
{
}
EGLPlatformParameters::EGLPlatformParameters(EGLint renderer)
: renderer(renderer),
majorVersion(EGL_DONT_CARE),
minorVersion(EGL_DONT_CARE),
useWarp(EGL_FALSE)
{
}
EGLPlatformParameters::EGLPlatformParameters(EGLint renderer, EGLint majorVersion, EGLint minorVersion, EGLint useWarp)
: renderer(renderer),
majorVersion(majorVersion),
minorVersion(minorVersion),
useWarp(useWarp)
{
}
EGLWindow::EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform)
: mSurface(EGL_NO_SURFACE), : mSurface(EGL_NO_SURFACE),
mContext(EGL_NO_CONTEXT), mContext(EGL_NO_CONTEXT),
mDisplay(EGL_NO_DISPLAY), mDisplay(EGL_NO_DISPLAY),
mClientVersion(glesMajorVersion), mClientVersion(glesMajorVersion),
mRequestedRenderer(requestedRenderer), mPlatform(platform),
mWidth(width), mWidth(width),
mHeight(height), mHeight(height),
mRedBits(-1), mRedBits(-1),
...@@ -76,7 +100,10 @@ bool EGLWindow::initializeGL(OSWindow *osWindow) ...@@ -76,7 +100,10 @@ bool EGLWindow::initializeGL(OSWindow *osWindow)
const EGLint displayAttributes[] = const EGLint displayAttributes[] =
{ {
EGL_PLATFORM_ANGLE_TYPE_ANGLE, mRequestedRenderer, EGL_PLATFORM_ANGLE_TYPE_ANGLE, mPlatform.renderer,
EGL_PLATFORM_ANGLE_MAX_VERSION_MAJOR_ANGLE, mPlatform.majorVersion,
EGL_PLATFORM_ANGLE_MAX_VERSION_MINOR_ANGLE, mPlatform.minorVersion,
EGL_PLATFORM_ANGLE_USE_WARP_ANGLE, mPlatform.useWarp,
EGL_NONE, EGL_NONE,
}; };
......
...@@ -25,12 +25,22 @@ ...@@ -25,12 +25,22 @@
class OSWindow; class OSWindow;
struct EGLPlatformParameters
{
EGLint renderer;
EGLint majorVersion;
EGLint minorVersion;
EGLint useWarp;
EGLPlatformParameters();
explicit EGLPlatformParameters(EGLint renderer);
EGLPlatformParameters(EGLint renderer, EGLint majorVersion, EGLint minorVersion, EGLint useWarp);
};
class EGLWindow class EGLWindow
{ {
public: public:
EGLWindow(size_t width, size_t height, EGLWindow(size_t width, size_t height, EGLint glesMajorVersion, const EGLPlatformParameters &platform);
EGLint glesMajorVersion,
EGLint requestedRenderer);
~EGLWindow(); ~EGLWindow();
...@@ -49,7 +59,7 @@ class EGLWindow ...@@ -49,7 +59,7 @@ class EGLWindow
void swap(); void swap();
GLuint getClientVersion() const { return mClientVersion; } GLuint getClientVersion() const { return mClientVersion; }
EGLint getRequestedRenderer() const { return mRequestedRenderer; } const EGLPlatformParameters &getPlatform() const { return mPlatform; }
EGLConfig getConfig() const; EGLConfig getConfig() const;
EGLDisplay getDisplay() const; EGLDisplay getDisplay() const;
EGLSurface getSurface() const; EGLSurface getSurface() const;
...@@ -77,7 +87,7 @@ class EGLWindow ...@@ -77,7 +87,7 @@ class EGLWindow
EGLContext mContext; EGLContext mContext;
GLuint mClientVersion; GLuint mClientVersion;
EGLint mRequestedRenderer; EGLPlatformParameters mPlatform;
size_t mWidth; size_t mWidth;
size_t mHeight; size_t mHeight;
int mRedBits; int mRedBits;
......
...@@ -7,72 +7,76 @@ ...@@ -7,72 +7,76 @@
#ifndef UTIL_TEST_FIXTURE_TYPES_H #ifndef UTIL_TEST_FIXTURE_TYPES_H
#define UTIL_TEST_FIXTURE_TYPES_H #define UTIL_TEST_FIXTURE_TYPES_H
#include "EGLWindow.h"
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
namespace Gles template<EGLint platform, EGLint platformMajorVersion, EGLint platformMinorVersion, EGLint warp>
{ struct Platform
struct Two
{ {
static EGLint GetGlesMajorVersion() static EGLPlatformParameters GetPlatform()
{ {
return 2; return EGLPlatformParameters(platform, platformMajorVersion, platformMinorVersion, warp);
}; }
}; };
struct Three // Typedefs of common platform types
{ #define DEFINE_ANGLE_TEST_PLATFORM(name, platform, majorVersion, minorVersion, useWarp) \
static EGLint GetGlesMajorVersion() struct name : public Platform<platform, majorVersion, minorVersion, useWarp> { }
{
return 3;
};
};
} DEFINE_ANGLE_TEST_PLATFORM(D3D9, EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE, EGL_FALSE);
namespace Rend DEFINE_ANGLE_TEST_PLATFORM(D3D11, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE, EGL_FALSE);
{ DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_0, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 11, 0, EGL_FALSE);
DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_1, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 1, EGL_FALSE);
DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_0, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 0, EGL_FALSE);
struct D3D11 DEFINE_ANGLE_TEST_PLATFORM(D3D11_WARP, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_DONT_CARE, EGL_DONT_CARE, EGL_TRUE);
{ DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL11_0_WARP, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 11, 0, EGL_TRUE);
static EGLint GetRequestedRenderer() DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_1_WARP, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 1, EGL_TRUE);
{ DEFINE_ANGLE_TEST_PLATFORM(D3D11_FL10_0_WARP, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, 10, 0, EGL_TRUE);
return EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE;
};
};
struct D3D9 #undef DEFINE_ANGLE_TEST_PLATFORM
{
static EGLint GetRequestedRenderer()
{
return EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE;
};
};
struct WARP
{
static EGLint GetRequestedRenderer()
{
return EGL_PLATFORM_ANGLE_TYPE_D3D11_WARP_ANGLE;
};
};
}
// Test Fixture Type // Test Fixture Type
template<typename GlesVersionT, typename RendererT> template<GLint GLESMajorVersion, typename platformT>
struct TFT struct TestFixture
{ {
static EGLint GetGlesMajorVersion() static EGLint GetGlesMajorVersion()
{ {
return GlesVersionT::GetGlesMajorVersion(); return GLESMajorVersion;
} }
static EGLint GetRequestedRenderer() static EGLPlatformParameters GetPlatform()
{ {
return RendererT::GetRequestedRenderer(); return platformT::GetPlatform();
} }
}; };
#endif // UTIL_TEST_FIXTURE_TYPES_H // Typedefs of common fixture types
\ No newline at end of file typedef TestFixture<2, D3D9> ES2_D3D9;
typedef TestFixture<2, D3D11> ES2_D3D11;
typedef TestFixture<2, D3D11_FL11_0> ES2_D3D11_FL11_0;
typedef TestFixture<2, D3D11_FL10_1> ES2_D3D11_FL10_1;
typedef TestFixture<2, D3D11_FL10_0> ES2_D3D11_FL10_0;
typedef TestFixture<2, D3D11_WARP> ES2_D3D11_WARP;
typedef TestFixture<2, D3D11_FL11_0_WARP> ES2_D3D11_FL11_0_WARP;
typedef TestFixture<2, D3D11_FL10_1_WARP> ES2_D3D11_FL10_1_WARP;
typedef TestFixture<2, D3D11_FL10_0_WARP> ES2_D3D11_FL10_0_WARP;
typedef TestFixture<3, D3D11> ES3_D3D11;
typedef TestFixture<3, D3D11_FL11_0> ES3_D3D11_FL11_0;
typedef TestFixture<3, D3D11_FL10_1> ES3_D3D11_FL10_1;
typedef TestFixture<3, D3D11_FL10_0> ES3_D3D11_FL10_0;
typedef TestFixture<3, D3D11_WARP> ES3_D3D11_WARP;
typedef TestFixture<3, D3D11_FL11_0_WARP> ES3_D3D11_FL11_0_WARP;
typedef TestFixture<3, D3D11_FL10_1_WARP> ES3_D3D11_FL10_1_WARP;
typedef TestFixture<3, D3D11_FL10_0_WARP> ES3_D3D11_FL10_0_WARP;
#define ANGLE_TYPED_TEST_CASE(testName, ...) TYPED_TEST_CASE(testName, ::testing::Types<__VA_ARGS__>);
#endif // UTIL_TEST_FIXTURE_TYPES_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