Capture/Replay: add frontend feature to force capture limits

Some of the limits set when FrameCapture is enabled are reflected in
the serialized context. In order for capture/replay tests to pass
these limits may also be needed to be enforced when replaying. Add a
fronten feature enable_capture_limits for this and use it in the
capture replay test script.

Patch authored by gert.wollny@collabora.com.

Bug: angleproject:5750
Change-Id: I3d333d22fe65c12dd5aa5f263d19a2c1568541c2
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2790301
Reviewed-by: Jamie Madill <jmadill@chromium.org>
Commit-Queue: Jamie Madill <jmadill@chromium.org>
This commit is contained in:
Jamie Madill 2021-03-13 22:48:13 +01:00 коммит произвёл Commit Bot
Родитель e0b9d4f7e1
Коммит 9a025fd448
3 изменённых файлов: 18 добавлений и 7 удалений

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

@ -65,6 +65,11 @@ struct FrontendFeatures : angle::FeatureSetBase
angle::Feature allowCompressedFormats = {"allow_compressed_formats",
angle::FeatureCategory::FrontendWorkarounds,
"Allow compressed formats", &members};
angle::Feature captureLimits = {"enable_capture_limits",
angle::FeatureCategory::FrontendFeatures,
"Set the context limits like frame capturing was enabled",
&members, "http://anglebug.com/5750"};
};
inline FrontendFeatures::FrontendFeatures() = default;

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

@ -19,6 +19,7 @@
#include "common/angle_version.h"
#include "common/matrix_utils.h"
#include "common/platform.h"
#include "common/system_utils.h"
#include "common/utilities.h"
#include "libANGLE/Buffer.h"
#include "libANGLE/Compiler.h"
@ -50,6 +51,7 @@ namespace gl
{
namespace
{
egl::ShareGroup *AllocateOrGetShareGroup(egl::Display *display, const gl::Context *shareContext)
{
if (shareContext)
@ -3732,14 +3734,19 @@ void Context::initCaps()
// If we're capturing application calls for replay, don't expose any binary formats to prevent
// traces from trying to use cached results
if (getFrameCapture()->enabled())
if (getFrameCapture()->enabled() || getFrontendFeatures().captureLimits.enabled)
{
INFO() << "Limiting binary format support count to zero while FrameCapture enabled";
INFO() << "Limit some features because "
<< (getFrameCapture()->enabled() ? "FrameCapture is enabled"
: "FrameCapture limits were forced")
<< std::endl;
INFO() << "Limiting binary format support count to zero";
mDisplay->overrideFrontendFeatures({"disable_program_binary"}, true);
// Set to the most common limit per gpuinfo.org. Required for several platforms we test.
constexpr GLint maxImageUnits = 8;
INFO() << "Limiting image unit count to " << maxImageUnits << " while FrameCapture enabled";
INFO() << "Limiting image unit count to " << maxImageUnits;
ANGLE_LIMIT_CAP(mState.mCaps.maxImageUnits, maxImageUnits);
// Set a large uniform buffer offset alignment that works on multiple platforms.
@ -3747,8 +3754,7 @@ void Context::initCaps()
// Values seen during development: ARM (16), Intel (32), Qualcomm (128), Nvidia (256)
constexpr GLint uniformBufferOffsetAlignment = 256;
ASSERT(uniformBufferOffsetAlignment % mState.mCaps.uniformBufferOffsetAlignment == 0);
INFO() << "Setting uniform buffer offset alignment to " << uniformBufferOffsetAlignment
<< " while FrameCapture enabled";
INFO() << "Setting uniform buffer offset alignment to " << uniformBufferOffsetAlignment;
mState.mCaps.uniformBufferOffsetAlignment = uniformBufferOffsetAlignment;
INFO() << "Disabling GL_EXT_map_buffer_range and GL_OES_mapbuffer during capture, which "
@ -3766,8 +3772,7 @@ void Context::initCaps()
// Nvidia's Vulkan driver only supports 4 draw buffers
constexpr GLint maxDrawBuffers = 4;
INFO() << "Limiting draw buffer count to " << maxDrawBuffers
<< " while FrameCapture enabled";
INFO() << "Limiting draw buffer count to " << maxDrawBuffers;
ANGLE_LIMIT_CAP(mState.mCaps.maxDrawBuffers, maxDrawBuffers);
}

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

@ -649,6 +649,7 @@ class TestBatch():
def RunReplay(self, replay_exe_path, child_processes_manager, tests):
env = os.environ.copy()
env['ANGLE_CAPTURE_ENABLED'] = '0'
env['ANGLE_FEATURE_OVERRIDES_ENABLED'] = 'enable_capture_limits'
returncode, output = child_processes_manager.RunSubprocess([replay_exe_path],
env,
timeout=SUBPROCESS_TIMEOUT)