Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 62475e9

Browse files
null77Commit Bot
authored andcommitted
Allow tests to pick ANGLE features.
This uses the EGL_ANGLE_feature_control extension through the test harness to control feature selection via a test config. This obviates the need for the hacky platform methods table override. Also adds a command graph feature that will be used to prototype the command graph linearization for Vulkan. Bug: angleproject:4029 Change-Id: Id37fadd5d2c317c9d9dd90dfab1fdc8e4ac3701f Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2007612 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Jonah Ryan-Davis <jonahr@google.com> Reviewed-by: Shahbaz Youssefi <syoussefi@chromium.org>
1 parent 0c10c95 commit 62475e9

File tree

6 files changed

+72
-2
lines changed

6 files changed

+72
-2
lines changed

include/platform/FeaturesVk.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,14 @@ struct FeaturesVk : FeatureSetBase
238238
"supports_swapchain_colorspace", FeatureCategory::VulkanFeatures,
239239
"VkDevice supports the VK_EXT_swapchain_colorspace extension", &members,
240240
"http://anglebug.com/2514"};
241+
242+
// Whether to use ANGLE's deferred command graph. http://anglebug.com/4029
243+
Feature commandGraph = {
244+
"command_graph",
245+
FeatureCategory::VulkanFeatures,
246+
"Use ANGLE's Vulkan deferred command graph.",
247+
&members,
248+
};
241249
};
242250

243251
inline FeaturesVk::FeaturesVk() = default;

src/libANGLE/renderer/vulkan/RendererVk.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,8 @@ void RendererVk::initFeatures(const ExtensionNameList &deviceExtensionNames)
14791479
IsPixel2(mPhysicalDeviceProperties.vendorID, mPhysicalDeviceProperties.deviceID) ||
14801480
IsPixel1XL(mPhysicalDeviceProperties.vendorID, mPhysicalDeviceProperties.deviceID));
14811481

1482+
ANGLE_FEATURE_CONDITION((&mFeatures), commandGraph, true);
1483+
14821484
angle::PlatformMethods *platform = ANGLEPlatformCurrent();
14831485
platform->overrideFeaturesVk(platform, &mFeatures);
14841486
}

src/tests/test_utils/angle_test_configs.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,15 @@ std::ostream &operator<<(std::ostream &stream, const PlatformParameters &pp)
187187
stream << "_NoVirtual";
188188
}
189189

190+
if (pp.eglParameters.commandGraphFeature == EGL_FALSE)
191+
{
192+
stream << "_NoCommandGraph";
193+
}
194+
else if (pp.eglParameters.commandGraphFeature == EGL_TRUE)
195+
{
196+
stream << "_CommandGraph";
197+
}
198+
190199
return stream;
191200
}
192201

src/tests/test_utils/angle_test_configs.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,13 @@ inline PlatformParameters WithNoFixture(const PlatformParameters &params)
206206
withNoFixture.noFixture = true;
207207
return withNoFixture;
208208
}
209+
210+
inline PlatformParameters WithNoCommandGraph(const PlatformParameters &params)
211+
{
212+
PlatformParameters withNoCommandGraph = params;
213+
withNoCommandGraph.eglParameters.commandGraphFeature = EGL_FALSE;
214+
return withNoCommandGraph;
215+
}
209216
} // namespace angle
210217

211218
#endif // ANGLE_TEST_CONFIGS_H_

util/EGLPlatformParameters.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ struct EGLPlatformParameters
5858
EGLint presentPath = EGL_DONT_CARE;
5959
EGLint debugLayersEnabled = EGL_DONT_CARE;
6060
EGLint contextVirtualization = EGL_DONT_CARE;
61+
EGLint commandGraphFeature = EGL_DONT_CARE;
6162
angle::PlatformMethods *platformMethods = nullptr;
6263
};
6364

util/EGLWindow.cpp

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
120120
angle::LoadEGL(getProcAddress);
121121
#endif // defined(ANGLE_USE_UTIL_LOADER)
122122

123+
const char *extensionString =
124+
static_cast<const char *>(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
125+
123126
std::vector<EGLAttrib> displayAttributes;
124127
displayAttributes.push_back(EGL_PLATFORM_ANGLE_TYPE_ANGLE);
125128
displayAttributes.push_back(params.renderer);
@@ -136,8 +139,6 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
136139

137140
if (params.presentPath != EGL_DONT_CARE)
138141
{
139-
const char *extensionString =
140-
static_cast<const char *>(eglQueryString(EGL_NO_DISPLAY, EGL_EXTENSIONS));
141142
if (strstr(extensionString, "EGL_ANGLE_experimental_present_path") == nullptr)
142143
{
143144
destroyGL();
@@ -169,6 +170,48 @@ bool EGLWindow::initializeDisplay(OSWindow *osWindow,
169170
displayAttributes.push_back(reinterpret_cast<EGLAttrib>(params.platformMethods));
170171
}
171172

173+
std::vector<const char *> disabledFeatureOverrides;
174+
std::vector<const char *> enabledFeatureOverrides;
175+
176+
if (params.commandGraphFeature == EGL_TRUE)
177+
{
178+
enabledFeatureOverrides.push_back("command_graph");
179+
}
180+
else if (params.commandGraphFeature == EGL_FALSE)
181+
{
182+
disabledFeatureOverrides.push_back("command_graph");
183+
}
184+
185+
if (!disabledFeatureOverrides.empty())
186+
{
187+
if (strstr(extensionString, "EGL_ANGLE_feature_control") == nullptr)
188+
{
189+
std::cout << "Missing EGL_ANGLE_feature_control.\n";
190+
destroyGL();
191+
return false;
192+
}
193+
194+
disabledFeatureOverrides.push_back(nullptr);
195+
196+
displayAttributes.push_back(EGL_FEATURE_OVERRIDES_DISABLED_ANGLE);
197+
displayAttributes.push_back(reinterpret_cast<EGLAttrib>(disabledFeatureOverrides.data()));
198+
}
199+
200+
if (!enabledFeatureOverrides.empty())
201+
{
202+
if (strstr(extensionString, "EGL_ANGLE_feature_control") == nullptr)
203+
{
204+
std::cout << "Missing EGL_ANGLE_feature_control.\n";
205+
destroyGL();
206+
return false;
207+
}
208+
209+
enabledFeatureOverrides.push_back(nullptr);
210+
211+
displayAttributes.push_back(EGL_FEATURE_OVERRIDES_ENABLED_ANGLE);
212+
displayAttributes.push_back(reinterpret_cast<EGLAttrib>(enabledFeatureOverrides.data()));
213+
}
214+
172215
displayAttributes.push_back(EGL_NONE);
173216

174217
mDisplay = eglGetPlatformDisplay(EGL_PLATFORM_ANGLE_ANGLE,

0 commit comments

Comments
 (0)