mirror of
https://github.com/godotengine/godot-angle-static.git
synced 2026-01-03 14:09:33 +03:00
Perf Tests: Trigger test failure on API errors.
A prior refactor had broken the method we used to cause test steps to fail on API errors. This CL restores the path. We detected this when analyzing a particular GLES trace that contained invalid GLES calls. Bug: angleproject:5788 Change-Id: I26940e49cf73ce6050ea6ee274d5c5748835a167 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2782008 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: Cody Northrop <cnorthrop@google.com> Reviewed-by: Tim Van Patten <timvp@google.com>
This commit is contained in:
@@ -219,7 +219,7 @@ int SampleApplication::run()
|
||||
#if defined(ANGLE_ENABLE_ASSERTS)
|
||||
if (IsGLExtensionEnabled("GL_KHR_debug"))
|
||||
{
|
||||
EnableDebugCallback(this);
|
||||
EnableDebugCallback(nullptr, nullptr);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
@@ -195,6 +195,25 @@ void DumpTraceEventsToJSONFile(const std::vector<TraceEvent> &traceEvents,
|
||||
printf("Error writing trace file to %s\n", outputFileName);
|
||||
}
|
||||
}
|
||||
|
||||
ANGLE_MAYBE_UNUSED void KHRONOS_APIENTRY PerfTestDebugCallback(GLenum source,
|
||||
GLenum type,
|
||||
GLuint id,
|
||||
GLenum severity,
|
||||
GLsizei length,
|
||||
const GLchar *message,
|
||||
const void *userParam)
|
||||
{
|
||||
// Early exit on non-errors.
|
||||
if (type != GL_DEBUG_TYPE_ERROR || !userParam)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ANGLERenderTest *renderTest =
|
||||
const_cast<ANGLERenderTest *>(reinterpret_cast<const ANGLERenderTest *>(userParam));
|
||||
renderTest->onErrorMessage(message);
|
||||
}
|
||||
} // anonymous namespace
|
||||
|
||||
TraceEvent::TraceEvent(char phaseIn,
|
||||
@@ -708,7 +727,7 @@ void ANGLERenderTest::SetUp()
|
||||
#if defined(ANGLE_ENABLE_ASSERTS)
|
||||
if (IsGLExtensionEnabled("GL_KHR_debug"))
|
||||
{
|
||||
EnableDebugCallback(this);
|
||||
EnableDebugCallback(&PerfTestDebugCallback, this);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -955,7 +974,7 @@ std::vector<TraceEvent> &ANGLERenderTest::getTraceEventBuffer()
|
||||
void ANGLERenderTest::onErrorMessage(const char *errorMessage)
|
||||
{
|
||||
abortTest();
|
||||
FAIL() << "Failing test because of unexpected internal ANGLE error:\n" << errorMessage << "\n";
|
||||
FAIL() << "Failing test because of unexpected error:\n" << errorMessage << "\n";
|
||||
}
|
||||
|
||||
uint32_t ANGLERenderTest::getCurrentThreadSerial()
|
||||
|
||||
@@ -114,6 +114,8 @@ GLuint CompileProgramInternal(const char *vsSource,
|
||||
return CheckLinkStatusAndReturnProgram(program, true);
|
||||
}
|
||||
|
||||
const void *gCallbackChainUserParam;
|
||||
|
||||
void KHRONOS_APIENTRY DebugMessageCallback(GLenum source,
|
||||
GLenum type,
|
||||
GLuint id,
|
||||
@@ -126,6 +128,12 @@ void KHRONOS_APIENTRY DebugMessageCallback(GLenum source,
|
||||
std::string typeText = gl::GetDebugMessageTypeString(type);
|
||||
std::string severityText = gl::GetDebugMessageSeverityString(severity);
|
||||
std::cerr << sourceText << ", " << typeText << ", " << severityText << ": " << message << "\n";
|
||||
|
||||
GLDEBUGPROC callbackChain = reinterpret_cast<GLDEBUGPROC>(const_cast<void *>(userParam));
|
||||
if (callbackChain)
|
||||
{
|
||||
callbackChain(source, type, id, severity, length, message, gCallbackChainUserParam);
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -342,8 +350,10 @@ bool LinkAttachedProgram(GLuint program)
|
||||
return (CheckLinkStatusAndReturnProgram(program, true) != 0);
|
||||
}
|
||||
|
||||
void EnableDebugCallback(const void *userParam)
|
||||
void EnableDebugCallback(GLDEBUGPROC callbackChain, const void *userParam)
|
||||
{
|
||||
gCallbackChainUserParam = userParam;
|
||||
|
||||
glEnable(GL_DEBUG_OUTPUT);
|
||||
glEnable(GL_DEBUG_OUTPUT_SYNCHRONOUS);
|
||||
// Enable medium and high priority messages.
|
||||
@@ -359,7 +369,7 @@ void EnableDebugCallback(const void *userParam)
|
||||
// Disable performance messages to reduce spam.
|
||||
glDebugMessageControlKHR(GL_DONT_CARE, GL_DEBUG_TYPE_PERFORMANCE, GL_DONT_CARE, 0, nullptr,
|
||||
GL_FALSE);
|
||||
glDebugMessageCallbackKHR(DebugMessageCallback, userParam);
|
||||
glDebugMessageCallbackKHR(DebugMessageCallback, reinterpret_cast<const void *>(callbackChain));
|
||||
}
|
||||
|
||||
namespace angle
|
||||
|
||||
@@ -49,7 +49,7 @@ ANGLE_UTIL_EXPORT GLuint LoadBinaryProgramOES(const std::vector<uint8_t> &binary
|
||||
ANGLE_UTIL_EXPORT GLuint LoadBinaryProgramES3(const std::vector<uint8_t> &binary,
|
||||
GLenum binaryFormat);
|
||||
|
||||
ANGLE_UTIL_EXPORT void EnableDebugCallback(const void *userParam);
|
||||
ANGLE_UTIL_EXPORT void EnableDebugCallback(GLDEBUGPROC callbackChain, const void *userParam);
|
||||
|
||||
namespace angle
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user