Add EGL_ANGLE_workaround_control extension.

This extension is used to query strings from an array based on index,
which will be used to query all the information about workarounds in
ANGLE.

Bug: angleproject:1621

Change-Id: I27157f278f7f17c92c8b4fd7753e2a5ecd0528f6
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1627723
Commit-Queue: Jonah Ryan-Davis <jonahr@google.com>
Reviewed-by: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jonah Ryan-Davis 2019-05-23 13:52:52 -04:00 коммит произвёл Commit Bot
Родитель 06055b5e8d
Коммит f52f2637ae
43 изменённых файлов: 458 добавлений и 24 удалений

Просмотреть файл

@ -0,0 +1,117 @@
Name
ANGLE_workaround_control
Name Strings
EGL_ANGLE_workaround_control
Contributors
Jonah Ryan-Davis (jonahr 'at' google.com)
Contact
Jonah Ryan-Davis (jonahr 'at' google.com)
Status
Draft
Version
Version 1, May 23, 2019
Number
EGL Extension #XXX
Extension Type
EGL device extension
Dependencies
This extension is written against the wording of the EGL 1.4
Specification.
Overview
This extension defines a method to query a string describing
properties of the EGL client or of an EGL display connection
which are looked up via the property name and index.
IP Status
No known claims.
New Types
None.
New Procedures and Functions
const char *eglQueryStringiANGLE(
EGLDisplay dpy,
EGLint name,
EGLint index);
New Tokens
Accepted as a queried <name> in eglQueryStringiANGLE:
EGL_WORKAROUND_NAME_ANGLE 0x3460
EGL_WORKAROUND_CATEGORY_ANGLE 0x3461
EGL_WORKAROUND_DESCRIPTION_ANGLE 0x3462
EGL_WORKAROUND_BUG_ANGLE 0x3463
EGL_WORKAROUND_ENABLED_ANGLE 0x3464
Additions to the EGL 1.5 Specification
Add the following to the end of section 3.3 "EGL Queries":
const char *eglQueryStringiANGLE(EGLDisplay dpy,
EGLint name, EGLint index);
eGLQueryStringiANGLE returns a pointer to a static, zero-
terminated string describing some aspect of the EGL
implementation running on the specified display, from an array of
strings. name may be one of EGL_WORKAROUND_NAME_ANGLE,
EGL_WORKAROUND_CATEGORY_ANGLE, EGL_WORKAROUND_DESCRIPTION_ANGLE,
EGL_WORKAROUND_BUG_ANGLE, or EGL_WORKAROUND_ENABLED_ANGLE. Index
must be a valid index to access into the array of strings.
The EGL_WORKAROUND_NAME_ANGLE array contains strings that
describe the name of each workaround available in the display.
The EGL_WORKAROUND_CATEGORY_ANGLE array contains strings
with corresponding indices to the array of names. Each string
describes the category of the workaround at the specified index.
The EGL_WORKAROUND_DESCRIPTION_ANGLE array contains strings
with corresponding indices to the array of names. Each string
describes the workaround at the specified index.
The EGL_WORKAROUND_BUG_ANGLE array contains strings
with corresponding indices to the array of names. Each string
describes the bug related to the workaround at the specified
index.
The EGL_WORKAROUND_ENABLED_ANGLE array contains strings
with corresponding indices to the array of names. Each string has
the value "true" if the workaround is currently enabled, or
"false" if the workaround is currently disabled.
Errors
On failure, NULL is returned.
An EGL_BAD_DISPLAY error is generated if dpy is not a valid
display.
An EGL_BAD_PARAMETER error is generated if name is not one of the
values described above.
An EGL_BAD_PARAMETER error is generated if index is not within
the valid range of indices for the array.
Issues
None
Revision History
Version 1, May 23, 2019 (Jonah Ryan-Davis)
- Initial Draft

Просмотреть файл

@ -209,6 +209,19 @@ EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncValuesCHROMIUM(EGLDisplay dpy,
#define EGL_HIGH_POWER_ANGLE 0x0002
#endif /* EGL_ANGLE_power_preference */
#ifndef EGL_ANGLE_workaround_control
#define EGL_ANGLE_workaround_control 1
#define EGL_WORKAROUND_NAME_ANGLE 0x3460
#define EGL_WORKAROUND_CATEGORY_ANGLE 0x3461
#define EGL_WORKAROUND_DESCRIPTION_ANGLE 0x3462
#define EGL_WORKAROUND_BUG_ANGLE 0x3463
#define EGL_WORKAROUND_ENABLED_ANGLE 0x3464
typedef const char *(EGLAPIENTRYP PFNEGLQUERYSTRINGIANGLEPROC) (EGLDisplay dpy, EGLint name, EGLint index);
#ifdef EGL_EGLEXT_PROTOTYPES
EGLAPI const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index);
#endif
#endif /* EGL_ANGLE_workaround_control */
// clang-format on
#endif // INCLUDE_EGL_EGLEXT_ANGLE_

Просмотреть файл

@ -138,11 +138,11 @@ struct FeatureSetBase
}
}
void getFeatures(FeatureList &features) const
void populateFeatureList(FeatureList *features) const
{
for (FeatureMap::const_iterator it = members.begin(); it != members.end(); it++)
{
features.push_back(it->second);
features->push_back(it->second);
}
}
};

Просмотреть файл

@ -69,6 +69,12 @@
<param><ptype>EGLint</ptype> <name>limit</name></param>
<param><ptype>EGLint</ptype> <name>mode</name></param>
</command>
<command>
<proto><ptype>const char *</ptype> <name>eglQueryStringiANGLE</name></proto>
<param><ptype>EGLDisplay</ptype> <name>dpy</name></param>
<param><ptype>EGLint</ptype> <name>name</name></param>
<param><ptype>EGLint</ptype> <name>index</name></param>
</command>
</commands>
<!-- SECTION: ANGLE extension interface definitions -->
<extensions>
@ -97,5 +103,10 @@
<command name="eglProgramCacheResizeANGLE"/>
</require>
</extension>
<extension name="EGL_ANGLE_workaround_control" supported="egl">
<require>
<command name="eglQueryStringiANGLE"/>
</require>
</extension>
</extensions>
</registry>

Просмотреть файл

@ -85,6 +85,7 @@ supported_egl_extensions = [
"EGL_ANGLE_stream_producer_d3d_texture",
"EGL_ANGLE_surface_d3d_texture_2d_share_handle",
"EGL_ANGLE_window_fixed_size",
"EGL_ANGLE_workaround_control",
"EGL_CHROMIUM_get_sync_values",
"EGL_EXT_create_context_robustness",
"EGL_EXT_device_query",

Просмотреть файл

@ -90,7 +90,7 @@
"GL/EGL entry points:scripts/egl.xml":
"842e24514c4cfe09fba703c17a0fd292",
"GL/EGL entry points:scripts/egl_angle_ext.xml":
"745534010f31fbe8e1a1fcddce15ed2d",
"cc91aa6b14979dc7b3a0b7fee024e59e",
"GL/EGL entry points:scripts/entry_point_packed_gl_enums.json":
"28238b0f52826c3794eaa1aa940238bf",
"GL/EGL entry points:scripts/generate_entry_points.py":
@ -100,7 +100,7 @@
"GL/EGL entry points:scripts/gl_angle_ext.xml":
"11e1eb2cbe51ae6e7b8705d3506846d5",
"GL/EGL entry points:scripts/registry_xml.py":
"169e89c63aad5bde60012b64cccced27",
"79d48343cb33f2f534720f84dcba1b4f",
"GL/EGL entry points:src/libANGLE/Context_gles_1_0_autogen.h":
"fad4ec629b41e9d97ff57a132ad946cb",
"GL/EGL entry points:src/libANGLE/validationES1_autogen.h":
@ -138,25 +138,25 @@
"GL/EGL entry points:src/libGLESv2/libGLESv2_autogen.cpp":
"c99457bcd86a5b94c61185c1bcddfdcb",
"GL/EGL entry points:src/libGLESv2/libGLESv2_autogen.def":
"f92d6246265e21a5ed7d949d9de1e26e",
"7bf137682e60dc977445d4ef989b3dcf",
"GL/EGL/WGL loader:scripts/egl.xml":
"842e24514c4cfe09fba703c17a0fd292",
"GL/EGL/WGL loader:scripts/egl_angle_ext.xml":
"745534010f31fbe8e1a1fcddce15ed2d",
"cc91aa6b14979dc7b3a0b7fee024e59e",
"GL/EGL/WGL loader:scripts/generate_loader.py":
"b8c0dc876c8122bdc2447de982bcfad6",
"GL/EGL/WGL loader:scripts/registry_xml.py":
"169e89c63aad5bde60012b64cccced27",
"79d48343cb33f2f534720f84dcba1b4f",
"GL/EGL/WGL loader:scripts/wgl.xml":
"aa96419c582af2f6673430e2847693f4",
"GL/EGL/WGL loader:src/libEGL/egl_loader_autogen.cpp":
"d270ee9f0b0bcbb58f3a8967758d9b38",
"07e4ac072bd111f32d0798131e5e2926",
"GL/EGL/WGL loader:src/libEGL/egl_loader_autogen.h":
"77d0a6b43528115ea2ce3a987b25fa91",
"5faf638e5f4b23e268193e2cf4a03aae",
"GL/EGL/WGL loader:util/egl_loader_autogen.cpp":
"d397c5b251c10f44857c9098eab5f9a2",
"310b388513c03d205c33e84454851ed7",
"GL/EGL/WGL loader:util/egl_loader_autogen.h":
"897a66bc15e1791e356d7324f2ff94af",
"093393b593b7e1af814c1e9da3e7b053",
"GL/EGL/WGL loader:util/gles_loader_autogen.cpp":
"34056ce8d9c18d3cdcd23e16b94508c4",
"GL/EGL/WGL loader:util/gles_loader_autogen.h":
@ -408,9 +408,9 @@
"proc table:src/libGLESv2/gen_proc_table.py":
"3be3e8ed7fad58e8cc6fcf348da7b17d",
"proc table:src/libGLESv2/proc_table_autogen.cpp":
"1e89c264adbe7120edb636013383598b",
"fd3852952eecf7a81758edeb3b5465c3",
"proc table:src/libGLESv2/proc_table_data.json":
"90457a473e43279e4f9c93ff6279e1b4",
"e04e3c3c46ba7ed4994ce64aedbff390",
"uniform type:src/common/gen_uniform_type_table.py":
"9dd389f2b5793ba635169d61cef2dde9",
"uniform type:src/common/uniform_type_info_autogen.cpp":

Просмотреть файл

@ -1409,7 +1409,8 @@ DisplayExtensions::DisplayExtensions()
imageNativeBuffer(false),
getFrameTimestamps(false),
recordable(false),
powerPreference(false)
powerPreference(false),
workaroundControlANGLE(false)
{}
std::vector<std::string> DisplayExtensions::getStrings() const
@ -1464,6 +1465,7 @@ std::vector<std::string> DisplayExtensions::getStrings() const
InsertExtensionString("EGL_ANDROID_get_frame_timestamps", getFrameTimestamps, &extensionStrings);
InsertExtensionString("EGL_ANDROID_recordable", recordable, &extensionStrings);
InsertExtensionString("EGL_ANGLE_power_preference", powerPreference, &extensionStrings);
InsertExtensionString("EGL_ANGLE_workaround_control", workaroundControlANGLE, &extensionStrings);
// TODO(jmadill): Enable this when complete.
//InsertExtensionString("KHR_create_context_no_error", createContextNoError, &extensionStrings);
// clang-format on

Просмотреть файл

@ -883,6 +883,9 @@ struct DisplayExtensions
// EGL_ANGLE_power_preference
bool powerPreference;
// EGL_ANGLE_workaround_control
bool workaroundControlANGLE;
};
struct DeviceExtensions

Просмотреть файл

@ -543,6 +543,9 @@ Error Display::initialize()
config.second.renderableType |= EGL_OPENGL_ES_BIT;
}
mFeatures.clear();
mImplementation->populateFeatureList(&mFeatures);
initDisplayExtensions();
initVendorString();
@ -1244,6 +1247,9 @@ void Display::initDisplayExtensions()
// that ANativeWindow is not recordable.
mDisplayExtensions.recordable = true;
// EGL_ANGLE_workaround_control is implemented on all backends.
mDisplayExtensions.workaroundControlANGLE = true;
mDisplayExtensionString = GenerateExtensionsString(mDisplayExtensions);
}
@ -1437,4 +1443,38 @@ EGLint Display::programCacheResize(EGLint limit, EGLenum mode)
}
}
const char *Display::queryStringi(const EGLint name, const EGLint index)
{
const char *result = nullptr;
switch (name)
{
case EGL_WORKAROUND_NAME_ANGLE:
result = mFeatures[index]->name;
break;
case EGL_WORKAROUND_CATEGORY_ANGLE:
result = angle::FeatureCategoryToString(mFeatures[index]->category);
break;
case EGL_WORKAROUND_DESCRIPTION_ANGLE:
result = mFeatures[index]->description;
break;
case EGL_WORKAROUND_BUG_ANGLE:
result = mFeatures[index]->bug;
break;
case EGL_WORKAROUND_ENABLED_ANGLE:
if (mFeatures[index]->enabled)
{
result = "true";
}
else
{
result = "false";
}
break;
default:
UNREACHABLE();
return nullptr;
}
return result;
}
} // namespace egl

Просмотреть файл

@ -23,6 +23,7 @@
#include "libANGLE/LoggingAnnotator.h"
#include "libANGLE/MemoryProgramCache.h"
#include "libANGLE/Version.h"
#include "platform/Feature.h"
namespace gl
{
@ -190,6 +191,10 @@ class Display final : public LabeledObject, angle::NonCopyable
typedef std::set<gl::Context *> ContextSet;
const ContextSet &getContextSet() { return mContextSet; }
const angle::FeatureList &getFeatures() const { return mFeatures; }
const char *queryStringi(const EGLint name, const EGLint index);
private:
Display(EGLenum platform, EGLNativeDisplayType displayId, Device *eglDevice);
@ -237,6 +242,8 @@ class Display final : public LabeledObject, angle::NonCopyable
BlobCache mBlobCache;
gl::MemoryProgramCache mMemoryProgramCache;
size_t mGlobalTextureShareGroupUsers;
angle::FeatureList mFeatures;
};
} // namespace egl

Просмотреть файл

@ -16,6 +16,7 @@
#include "libANGLE/Stream.h"
#include "libANGLE/Version.h"
#include "libANGLE/renderer/EGLImplFactory.h"
#include "platform/Feature.h"
#include <set>
#include <vector>
@ -89,6 +90,8 @@ class DisplayImpl : public EGLImplFactory
void setBlobCache(egl::BlobCache *blobCache) { mBlobCache = blobCache; }
egl::BlobCache *getBlobCache() const { return mBlobCache; }
virtual void populateFeatureList(angle::FeatureList *features) = 0;
protected:
const egl::DisplayState &mState;

Просмотреть файл

@ -372,4 +372,10 @@ void DisplayD3D::handleResult(HRESULT hr,
mStoredErrorString = errorStream.str();
}
void DisplayD3D::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getWorkarounds().populateFeatureList(features);
}
} // namespace rx

Просмотреть файл

@ -83,6 +83,8 @@ class DisplayD3D : public DisplayImpl, public d3d::Context
const std::string &getStoredErrorString() const { return mStoredErrorString; }
void populateFeatureList(angle::FeatureList *features) override;
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
void generateCaps(egl::Caps *outCaps) const override;

Просмотреть файл

@ -3747,8 +3747,8 @@ angle::Result Renderer11::dispatchCompute(const gl::Context *context,
}
angle::Result Renderer11::dispatchComputeIndirect(const gl::Context *context, GLintptr indirect)
{
const auto &glState = context->getState();
const gl::Program *program = glState.getProgram();
const auto &glState = context->getState();
const gl::Program *program = glState.getProgram();
if (program->getActiveShaderStorageBlockCount() > 0 ||
program->getActiveAtomicCounterBufferCount() > 0)
{

Просмотреть файл

@ -74,6 +74,8 @@ class DisplayCGL : public DisplayGL
WorkerContext *createWorkerContext(std::string *infoLog);
void populateFeatureList(angle::FeatureList *features) override;
// Support for dual-GPU MacBook Pros. If the context was created
// preferring the high-power GPU, unreference that GPU during
// context destruction.

Просмотреть файл

@ -426,4 +426,9 @@ void DisplayCGL::unreferenceDiscreteGPU()
mDiscreteGPUPixelFormat = nullptr;
}
}
void DisplayCGL::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getWorkarounds().populateFeatureList(features);
}
}

Просмотреть файл

@ -690,4 +690,9 @@ WorkerContext *DisplayAndroid::createWorkerContext(std::string *infoLog,
return new WorkerContextAndroid(context, mEGL, mDummyPbuffer);
}
void DisplayAndroid::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getWorkarounds().populateFeatureList(features);
}
} // namespace rx

Просмотреть файл

@ -82,6 +82,8 @@ class DisplayAndroid : public DisplayEGL
EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) override;
void populateFeatureList(angle::FeatureList *features) override;
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;

Просмотреть файл

@ -1073,4 +1073,9 @@ WorkerContext *DisplayOzone::createWorkerContext(std::string *infoLog,
return new WorkerContextOzone(context, mEGL);
}
void DisplayOzone::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getWorkarounds().populateFeatureList(features);
}
} // namespace rx

Просмотреть файл

@ -160,6 +160,8 @@ class DisplayOzone final : public DisplayEGL
EGLContext sharedContext,
const native_egl::AttributeVector workerAttribs) override;
void populateFeatureList(angle::FeatureList *features) override;
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;

Просмотреть файл

@ -991,4 +991,9 @@ WorkerContext *DisplayGLX::createWorkerContext(std::string *infoLog)
return new WorkerContextGLX(context, &mGLX, workerPbuffer);
}
void DisplayGLX::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getWorkarounds().populateFeatureList(features);
}
} // namespace rx

Просмотреть файл

@ -100,6 +100,8 @@ class DisplayGLX : public DisplayGL
WorkerContext *createWorkerContext(std::string *infoLog);
void populateFeatureList(angle::FeatureList *features) override;
private:
egl::Error initializeContext(glx::FBConfig config,
const egl::AttributeMap &eglAttributes,

Просмотреть файл

@ -1058,4 +1058,9 @@ WorkerContext *DisplayWGL::createWorkerContext(std::string *infoLog,
return new WorkerContextWGL(mFunctionsWGL, workerPbuffer, workerDeviceContext, workerContext);
}
void DisplayWGL::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getWorkarounds().populateFeatureList(features);
}
} // namespace rx

Просмотреть файл

@ -85,6 +85,8 @@ class DisplayWGL : public DisplayGL
HGLRC sharedContext,
const std::vector<int> &workerContextAttribs);
void populateFeatureList(angle::FeatureList *features) override;
private:
egl::Error initializeImpl(egl::Display *display);
void destroy();

Просмотреть файл

@ -72,6 +72,8 @@ class DisplayNULL : public DisplayImpl
StreamProducerImpl *createStreamProducerD3DTexture(egl::Stream::ConsumerType consumerType,
const egl::AttributeMap &attribs) override;
void populateFeatureList(angle::FeatureList *features) override {}
private:
void generateExtensions(egl::DisplayExtensions *outExtensions) const override;
void generateCaps(egl::Caps *outCaps) const override;

Просмотреть файл

@ -169,9 +169,9 @@ gl::Version DisplayVk::getMaxSupportedESVersion() const
void DisplayVk::generateExtensions(egl::DisplayExtensions *outExtensions) const
{
outExtensions->createContextRobustness = true;
outExtensions->surfaceOrientation = true;
outExtensions->displayTextureShareGroup = true;
outExtensions->createContextRobustness = true;
outExtensions->surfaceOrientation = true;
outExtensions->displayTextureShareGroup = true;
outExtensions->robustResourceInitialization = true;
// The Vulkan implementation will always say that EGL_KHR_swap_buffers_with_damage is supported.
@ -233,4 +233,10 @@ egl::Error DisplayVk::getEGLError(EGLint errorCode)
{
return egl::Error(errorCode, 0, std::move(mStoredErrorString));
}
void DisplayVk::populateFeatureList(angle::FeatureList *features)
{
mRenderer->getFeatures().populateFeatureList(features);
}
} // namespace rx

Просмотреть файл

@ -92,6 +92,8 @@ class DisplayVk : public DisplayImpl, public vk::Context
// TODO(jmadill): Remove this once refactor is done. http://anglebug.com/3041
egl::Error getEGLError(EGLint errorCode);
void populateFeatureList(angle::FeatureList *features) override;
private:
virtual SurfaceImpl *createWindowSurfaceVk(const egl::SurfaceState &state,
EGLNativeWindowType window,

Просмотреть файл

@ -3728,4 +3728,38 @@ Error ValidateGetFrameTimestampsANDROID(const Display *display,
return NoError();
}
Error ValidateQueryStringiANGLE(const Display *display, EGLint name, EGLint index)
{
ANGLE_TRY(ValidateDisplay(display));
if (!display->getExtensions().workaroundControlANGLE)
{
return EglBadDisplay() << "EGL_ANGLE_workaround_control extension is not available.";
}
if (index < 0)
{
return EglBadParameter() << "index is negative.";
}
switch (name)
{
case EGL_WORKAROUND_NAME_ANGLE:
case EGL_WORKAROUND_CATEGORY_ANGLE:
case EGL_WORKAROUND_DESCRIPTION_ANGLE:
case EGL_WORKAROUND_BUG_ANGLE:
case EGL_WORKAROUND_ENABLED_ANGLE:
break;
default:
return EglBadParameter() << "name is not valid.";
}
if (static_cast<size_t>(index) >= display->getFeatures().size())
{
return EglBadParameter() << "index is too big.";
}
return NoError();
}
} // namespace egl

Просмотреть файл

@ -315,6 +315,8 @@ Error ValidateGetFrameTimestampsANDROID(const Display *display,
const EGLint *timestamps,
EGLnsecsANDROID *values);
Error ValidateQueryStringiANGLE(const Display *display, EGLint name, EGLint index);
} // namespace egl
#define ANGLE_EGL_TRY(THREAD, EXPR, FUNCNAME, LABELOBJECT) \

Просмотреть файл

@ -70,6 +70,7 @@ PFNEGLPROGRAMCACHERESIZEANGLEPROC EGL_ProgramCacheResizeANGLE;
PFNEGLQUERYSURFACEPOINTERANGLEPROC EGL_QuerySurfacePointerANGLE;
PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC EGL_CreateStreamProducerD3DTextureANGLE;
PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC EGL_StreamPostD3DTextureANGLE;
PFNEGLQUERYSTRINGIANGLEPROC EGL_QueryStringiANGLE;
PFNEGLGETSYNCVALUESCHROMIUMPROC EGL_GetSyncValuesCHROMIUM;
PFNEGLQUERYDEVICEATTRIBEXTPROC EGL_QueryDeviceAttribEXT;
PFNEGLQUERYDEVICESTRINGEXTPROC EGL_QueryDeviceStringEXT;
@ -194,6 +195,8 @@ void LoadEGL(LoadProc loadProc)
loadProc("EGL_CreateStreamProducerD3DTextureANGLE"));
EGL_StreamPostD3DTextureANGLE = reinterpret_cast<PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC>(
loadProc("EGL_StreamPostD3DTextureANGLE"));
EGL_QueryStringiANGLE =
reinterpret_cast<PFNEGLQUERYSTRINGIANGLEPROC>(loadProc("EGL_QueryStringiANGLE"));
EGL_GetSyncValuesCHROMIUM =
reinterpret_cast<PFNEGLGETSYNCVALUESCHROMIUMPROC>(loadProc("EGL_GetSyncValuesCHROMIUM"));
EGL_QueryDeviceAttribEXT =

Просмотреть файл

@ -74,6 +74,7 @@ extern PFNEGLPROGRAMCACHERESIZEANGLEPROC EGL_ProgramCacheResizeANGLE;
extern PFNEGLQUERYSURFACEPOINTERANGLEPROC EGL_QuerySurfacePointerANGLE;
extern PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC EGL_CreateStreamProducerD3DTextureANGLE;
extern PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC EGL_StreamPostD3DTextureANGLE;
extern PFNEGLQUERYSTRINGIANGLEPROC EGL_QueryStringiANGLE;
extern PFNEGLGETSYNCVALUESCHROMIUMPROC EGL_GetSyncValuesCHROMIUM;
extern PFNEGLQUERYDEVICEATTRIBEXTPROC EGL_QueryDeviceAttribEXT;
extern PFNEGLQUERYDEVICESTRINGEXTPROC EGL_QueryDeviceStringEXT;

Просмотреть файл

@ -678,4 +678,10 @@ EGLBoolean EGLAPIENTRY eglGetFrameTimestampsANDROID(EGLDisplay dpy,
EnsureEGLLoaded();
return EGL_GetFrameTimestampsANDROID(dpy, surface, frameId, numTimestamps, timestamps, values);
}
const char *EGLAPIENTRY eglQueryStringiANGLE(EGLDisplay dpy, EGLint name, EGLint index)
{
EnsureEGLLoaded();
return EGL_QueryStringiANGLE(dpy, name, index);
}
} // extern "C"

Просмотреть файл

@ -943,7 +943,7 @@ ANGLE_EXPORT EGLint EGLAPIENTRY EGL_ClientWaitSyncKHR(EGLDisplay dpy,
"eglClientWaitSync", GetDisplayIfValid(display), EGL_FALSE);
gl::Context *currentContext = thread->getContext();
EGLint syncStatus = EGL_FALSE;
EGLint syncStatus = EGL_FALSE;
ANGLE_EGL_TRY_RETURN(
thread, syncObject->clientWait(display, currentContext, flags, timeout, &syncStatus),
"eglClientWaitSync", GetDisplayIfValid(display), EGL_FALSE);
@ -1313,6 +1313,8 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingSupportedANDROID(EGLD
ANGLE_EGL_TRY_RETURN(
thread, ValidateGetCompositorTimingSupportedANDROID(display, eglSurface, nameInternal),
"eglQueryTimestampSupportedANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return eglSurface->getSupportedCompositorTimings().test(nameInternal);
}
@ -1340,6 +1342,7 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetCompositorTimingANDROID(EGLDisplay dp
"eglGetCompositorTimingANDROIDD", GetSurfaceIfValid(display, eglSurface),
EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
@ -1362,6 +1365,7 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetNextFrameIdANDROID(EGLDisplay dpy,
ANGLE_EGL_TRY_RETURN(thread, eglSurface->getNextFrameId(frameId), "eglGetNextFrameIdANDROID",
GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
@ -1383,6 +1387,8 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampSupportedANDROID(EGLDis
ANGLE_EGL_TRY_RETURN(
thread, ValidateGetFrameTimestampSupportedANDROID(display, eglSurface, timestampInternal),
"eglQueryTimestampSupportedANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return eglSurface->getSupportedTimestamps().test(timestampInternal);
}
@ -1413,7 +1419,26 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy
thread, eglSurface->getFrameTimestamps(frameId, numTimestamps, timestamps, values),
"eglGetFrameTimestampsANDROID", GetSurfaceIfValid(display, eglSurface), EGL_FALSE);
thread->setSuccess();
return EGL_TRUE;
}
ANGLE_EXPORT const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy,
EGLint name,
EGLint index)
{
ANGLE_SCOPED_GLOBAL_LOCK();
EVENT("(EGLDisplay dpy = 0x%016" PRIxPTR ", EGLint name = %d, EGLint index = %d)",
(uintptr_t)dpy, name, index);
egl::Display *display = static_cast<egl::Display *>(dpy);
Thread *thread = egl::GetCurrentThread();
ANGLE_EGL_TRY_RETURN(thread, ValidateQueryStringiANGLE(display, name, index),
"eglQueryStringiANGLE", GetDisplayIfValid(display), nullptr);
thread->setSuccess();
return display->queryStringi(name, index);
}
} // extern "C"

Просмотреть файл

@ -198,6 +198,10 @@ ANGLE_EXPORT EGLBoolean EGLAPIENTRY EGL_GetFrameTimestampsANDROID(EGLDisplay dpy
const EGLint *timestamps,
EGLnsecsANDROID *values);
ANGLE_EXPORT const char *EGLAPIENTRY EGL_QueryStringiANGLE(EGLDisplay dpy,
EGLint name,
EGLint index);
} // extern "C"
#endif // LIBGLESV2_ENTRYPOINTSEGLEXT_H_

Просмотреть файл

@ -1489,6 +1489,9 @@ EXPORTS
EGL_CreateStreamProducerD3DTextureANGLE
EGL_StreamPostD3DTextureANGLE
; EGL_ANGLE_workaround_control
EGL_QueryStringiANGLE
; EGL_CHROMIUM_get_sync_values
EGL_GetSyncValuesCHROMIUM

Просмотреть файл

@ -93,6 +93,7 @@ ProcEntry g_procTable[] = {
{"eglQueryStreamKHR", P(EGL_QueryStreamKHR)},
{"eglQueryStreamu64KHR", P(EGL_QueryStreamu64KHR)},
{"eglQueryString", P(EGL_QueryString)},
{"eglQueryStringiANGLE", P(EGL_QueryStringiANGLE)},
{"eglQuerySurface", P(EGL_QuerySurface)},
{"eglQuerySurfacePointerANGLE", P(EGL_QuerySurfacePointerANGLE)},
{"eglReleaseDeviceANGLE", P(EGL_ReleaseDeviceANGLE)},
@ -1418,5 +1419,5 @@ ProcEntry g_procTable[] = {
{"glWeightPointerOES", P(gl::WeightPointerOES)},
{"glWeightPointerOESContextANGLE", P(gl::WeightPointerOESContextANGLE)}};
size_t g_numProcs = 1332;
size_t g_numProcs = 1333;
} // namespace egl

Просмотреть файл

@ -1000,5 +1000,8 @@
"GL_CHROMIUM_lose_context": [
"glLoseContextCHROMIUM"
],
"EGL_ANGLE_workaround_control": [
"eglQueryStringiANGLE"
]
}

Просмотреть файл

@ -221,8 +221,7 @@ if (is_win || is_linux || is_mac || is_android) {
}
if (angle_enable_vulkan) {
sources += [ "gl_tests/VulkanFormatTablesTest.cpp" ]
sources += [ "gl_tests/VulkanUniformUpdatesTest.cpp" ]
sources += angle_white_box_tests_vulkan_sources
}
configs += [

Просмотреть файл

@ -3,6 +3,7 @@
# found in the LICENSE file.
angle_white_box_tests_sources = [
"egl_tests/EGLQueryStringIndexedTest.cpp",
"util_tests/PrintSystemInfoTest.cpp",
"test_utils/angle_test_configs.cpp",
"test_utils/angle_test_configs.h",
@ -20,3 +21,7 @@ angle_white_box_tests_win_sources = [
"gl_tests/D3DTextureTest.cpp",
"gl_tests/ErrorMessages.cpp",
]
angle_white_box_tests_vulkan_sources = [
"gl_tests/VulkanFormatTablesTest.cpp",
"gl_tests/VulkanUniformUpdatesTest.cpp",
]

Просмотреть файл

@ -20,7 +20,6 @@
#include <memory>
#include "libANGLE/renderer/d3d/d3d11/converged/CompositorNativeWindow11.h"
#include "test_utils/ANGLETest.h"
#include "util/OSWindow.h"
#include "util/com_utils.h"

Просмотреть файл

@ -0,0 +1,95 @@
//
// Copyright 2019 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.
//
// Tests the eglQueryStringiANGLE function exposed by the extension
// EGL_ANGLE_workaround_control.
#include <gtest/gtest.h>
#include "libANGLE/Display.h"
#include "test_utils/ANGLETest.h"
using namespace angle;
class EGLQueryStringIndexedTest : public ANGLETest
{
public:
void testSetUp() override
{
ASSERT_TRUE(IsEGLDisplayExtensionEnabled(getEGLWindow()->getDisplay(),
"EGL_ANGLE_workaround_control"));
}
void testTearDown() override {}
};
// Ensure eglQueryStringiANGLE generates EGL_BAD_DISPLAY if the display passed in is invalid.
TEST_P(EGLQueryStringIndexedTest, InvalidDisplay)
{
EXPECT_EQ(nullptr, eglQueryStringiANGLE(EGL_NO_DISPLAY, EGL_WORKAROUND_NAME_ANGLE, 0));
EXPECT_EGL_ERROR(EGL_BAD_DISPLAY);
}
// Ensure eglQueryStringiANGLE generates EGL_BAD_PARAMETER if the index is negative.
TEST_P(EGLQueryStringIndexedTest, NegativeIndex)
{
EXPECT_EQ(nullptr,
eglQueryStringiANGLE(getEGLWindow()->getDisplay(), EGL_WORKAROUND_NAME_ANGLE, -1));
EXPECT_EGL_ERROR(EGL_BAD_PARAMETER);
}
// Ensure eglQueryStringiANGLE generates EGL_BAD_PARAMETER if the index is out of bounds.
TEST_P(EGLQueryStringIndexedTest, IndexOutOfBounds)
{
EGLDisplay dpy = getEGLWindow()->getDisplay();
egl::Display *display = static_cast<egl::Display *>(dpy);
EXPECT_EQ(nullptr,
eglQueryStringiANGLE(dpy, EGL_WORKAROUND_NAME_ANGLE, display->getFeatures().size()));
EXPECT_EGL_ERROR(EGL_BAD_PARAMETER);
}
// Ensure eglQueryStringiANGLE generates EGL_BAD_PARAMETER if the name is not one of the valid
// options specified in the workaround.
TEST_P(EGLQueryStringIndexedTest, InvalidName)
{
EXPECT_EQ(nullptr, eglQueryStringiANGLE(getEGLWindow()->getDisplay(), 100, 0));
EXPECT_EGL_ERROR(EGL_BAD_PARAMETER);
}
// For each valid name and index in the workaround description arrays, query the values and ensure
// that no error is generated, and that the values match the correct values frim ANGLE's display's
// FeatureList.
TEST_P(EGLQueryStringIndexedTest, QueryAll)
{
EGLDisplay dpy = getEGLWindow()->getDisplay();
egl::Display *display = static_cast<egl::Display *>(dpy);
angle::FeatureList features = display->getFeatures();
for (size_t i = 0; i < features.size(); i++)
{
EXPECT_STREQ(features[i]->name, eglQueryStringiANGLE(dpy, EGL_WORKAROUND_NAME_ANGLE, i));
EXPECT_STREQ(FeatureCategoryToString(features[i]->category),
eglQueryStringiANGLE(dpy, EGL_WORKAROUND_CATEGORY_ANGLE, i));
EXPECT_STREQ(features[i]->description,
eglQueryStringiANGLE(dpy, EGL_WORKAROUND_DESCRIPTION_ANGLE, i));
EXPECT_STREQ(features[i]->bug, eglQueryStringiANGLE(dpy, EGL_WORKAROUND_BUG_ANGLE, i));
if (features[i]->enabled)
{
EXPECT_STREQ("true", eglQueryStringiANGLE(dpy, EGL_WORKAROUND_ENABLED_ANGLE, i));
}
else
{
EXPECT_STREQ("false", eglQueryStringiANGLE(dpy, EGL_WORKAROUND_ENABLED_ANGLE, i));
}
ASSERT_EGL_SUCCESS();
}
}
ANGLE_INSTANTIATE_TEST(EGLQueryStringIndexedTest,
ES2_D3D9(),
ES2_D3D11(),
ES2_OPENGL(),
ES2_VULKAN(),
ES3_D3D11(),
ES3_OPENGL());

Просмотреть файл

@ -72,6 +72,7 @@ ANGLE_UTIL_EXPORT PFNEGLQUERYSURFACEPOINTERANGLEPROC eglQuerySurfacePointerANGLE
ANGLE_UTIL_EXPORT PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC
eglCreateStreamProducerD3DTextureANGLE;
ANGLE_UTIL_EXPORT PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC eglStreamPostD3DTextureANGLE;
ANGLE_UTIL_EXPORT PFNEGLQUERYSTRINGIANGLEPROC eglQueryStringiANGLE;
ANGLE_UTIL_EXPORT PFNEGLGETSYNCVALUESCHROMIUMPROC eglGetSyncValuesCHROMIUM;
ANGLE_UTIL_EXPORT PFNEGLQUERYDEVICEATTRIBEXTPROC eglQueryDeviceAttribEXT;
ANGLE_UTIL_EXPORT PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT;
@ -198,6 +199,8 @@ void LoadEGL(LoadProc loadProc)
loadProc("eglCreateStreamProducerD3DTextureANGLE"));
eglStreamPostD3DTextureANGLE = reinterpret_cast<PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC>(
loadProc("eglStreamPostD3DTextureANGLE"));
eglQueryStringiANGLE =
reinterpret_cast<PFNEGLQUERYSTRINGIANGLEPROC>(loadProc("eglQueryStringiANGLE"));
eglGetSyncValuesCHROMIUM =
reinterpret_cast<PFNEGLGETSYNCVALUESCHROMIUMPROC>(loadProc("eglGetSyncValuesCHROMIUM"));
eglQueryDeviceAttribEXT =

Просмотреть файл

@ -79,6 +79,7 @@ ANGLE_UTIL_EXPORT extern PFNEGLQUERYSURFACEPOINTERANGLEPROC eglQuerySurfacePoint
ANGLE_UTIL_EXPORT extern PFNEGLCREATESTREAMPRODUCERD3DTEXTUREANGLEPROC
eglCreateStreamProducerD3DTextureANGLE;
ANGLE_UTIL_EXPORT extern PFNEGLSTREAMPOSTD3DTEXTUREANGLEPROC eglStreamPostD3DTextureANGLE;
ANGLE_UTIL_EXPORT extern PFNEGLQUERYSTRINGIANGLEPROC eglQueryStringiANGLE;
ANGLE_UTIL_EXPORT extern PFNEGLGETSYNCVALUESCHROMIUMPROC eglGetSyncValuesCHROMIUM;
ANGLE_UTIL_EXPORT extern PFNEGLQUERYDEVICEATTRIBEXTPROC eglQueryDeviceAttribEXT;
ANGLE_UTIL_EXPORT extern PFNEGLQUERYDEVICESTRINGEXTPROC eglQueryDeviceStringEXT;