Namespace Log.h/cpp in dawn::
The LogMessage::LogMessage constructor was redefining a symbol that exists in re2 inside of Chromium. So we namespace Log inside dawn:: to avoid the conflict. BUG=dawn:302 Change-Id: Ida349208e2c6fe9ac032e1bd8cd442dff0b3f6bc Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14320 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
parent
dd4584340d
commit
dc3317da6c
|
@ -49,11 +49,11 @@ void PrintDeviceError(WGPUErrorType errorType, const char* message, void*) {
|
|||
UNREACHABLE();
|
||||
return;
|
||||
}
|
||||
ErrorLog() << errorTypeName << " error: " << message;
|
||||
dawn::ErrorLog() << errorTypeName << " error: " << message;
|
||||
}
|
||||
|
||||
void PrintGLFWError(int code, const char* message) {
|
||||
ErrorLog() << "GLFW error: " << code << " - " << message;
|
||||
dawn::ErrorLog() << "GLFW error: " << code << " - " << message;
|
||||
}
|
||||
|
||||
enum class CmdBufType {
|
||||
|
|
|
@ -19,7 +19,7 @@ void HandleAssertionFailure(const char* file,
|
|||
const char* function,
|
||||
int line,
|
||||
const char* condition) {
|
||||
ErrorLog() << "Assertion failure at " << file << ":" << line << " (" << function
|
||||
dawn::ErrorLog() << "Assertion failure at " << file << ":" << line << " (" << function
|
||||
<< "): " << condition;
|
||||
DAWN_BREAKPOINT();
|
||||
}
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
# include <android/log.h>
|
||||
#endif
|
||||
|
||||
namespace dawn {
|
||||
|
||||
namespace {
|
||||
|
||||
const char* SeverityName(LogSeverity severity) {
|
||||
|
@ -110,3 +112,5 @@ LogMessage DebugLog(const char* file, const char* function, int line) {
|
|||
message << file << ":" << line << "(" << function << ")";
|
||||
return message;
|
||||
}
|
||||
|
||||
} // namespace dawn
|
||||
|
|
|
@ -45,8 +45,10 @@
|
|||
|
||||
#include <sstream>
|
||||
|
||||
// Log levels mostly used to signal intent where the log message is produced and used to route the
|
||||
// message to the correct output.
|
||||
namespace dawn {
|
||||
|
||||
// Log levels mostly used to signal intent where the log message is produced and used to route
|
||||
// the message to the correct output.
|
||||
enum class LogSeverity {
|
||||
Debug,
|
||||
Info,
|
||||
|
@ -83,8 +85,11 @@ LogMessage InfoLog();
|
|||
LogMessage WarningLog();
|
||||
LogMessage ErrorLog();
|
||||
|
||||
// DAWN_DEBUG is a helper macro that creates a DebugLog and outputs file/line/function information
|
||||
// DAWN_DEBUG is a helper macro that creates a DebugLog and outputs file/line/function
|
||||
// information
|
||||
LogMessage DebugLog(const char* file, const char* function, int line);
|
||||
#define DAWN_DEBUG() DebugLog(__FILE__, __func__, __LINE__)
|
||||
#define DAWN_DEBUG() ::dawn::DebugLog(__FILE__, __func__, __LINE__)
|
||||
|
||||
} // namespace dawn
|
||||
|
||||
#endif // COMMON_LOG_H_
|
||||
|
|
|
@ -167,7 +167,7 @@ namespace dawn_native {
|
|||
ErrorData* error = maybeError.AcquireError();
|
||||
|
||||
ASSERT(error != nullptr);
|
||||
InfoLog() << error->GetMessage();
|
||||
dawn::InfoLog() << error->GetMessage();
|
||||
delete error;
|
||||
|
||||
return true;
|
||||
|
|
|
@ -102,7 +102,7 @@ namespace dawn_native { namespace opengl {
|
|||
}
|
||||
|
||||
if (type == GL_DEBUG_TYPE_ERROR) {
|
||||
WarningLog() << "OpenGL error:"
|
||||
dawn::WarningLog() << "OpenGL error:"
|
||||
<< "\n Source: " << sourceText //
|
||||
<< "\n ID: " << id //
|
||||
<< "\n Severity: " << severityText //
|
||||
|
|
|
@ -64,7 +64,8 @@ namespace dawn_native { namespace opengl {
|
|||
if (infoLogLength > 1) {
|
||||
std::vector<char> buffer(infoLogLength);
|
||||
gl.GetShaderInfoLog(shader, infoLogLength, nullptr, &buffer[0]);
|
||||
ErrorLog() << source << "\nProgram compilation failed:\n" << buffer.data();
|
||||
dawn::ErrorLog() << source << "\nProgram compilation failed:\n"
|
||||
<< buffer.data();
|
||||
}
|
||||
}
|
||||
return shader;
|
||||
|
@ -95,7 +96,7 @@ namespace dawn_native { namespace opengl {
|
|||
if (infoLogLength > 1) {
|
||||
std::vector<char> buffer(infoLogLength);
|
||||
gl.GetProgramInfoLog(mProgram, infoLogLength, nullptr, &buffer[0]);
|
||||
ErrorLog() << "Program link failed:\n" << buffer.data();
|
||||
dawn::ErrorLog() << "Program link failed:\n" << buffer.data();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -253,7 +253,7 @@ namespace dawn_native { namespace vulkan {
|
|||
const char* /*pLayerPrefix*/,
|
||||
const char* pMessage,
|
||||
void* /*pUserdata*/) {
|
||||
WarningLog() << pMessage;
|
||||
dawn::WarningLog() << pMessage;
|
||||
ASSERT((flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) == 0);
|
||||
|
||||
return VK_FALSE;
|
||||
|
|
|
@ -159,7 +159,8 @@ DawnTestEnvironment::DawnTestEnvironment(int argc, char** argv) {
|
|||
}
|
||||
|
||||
if (strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
|
||||
InfoLog() << "\n\nUsage: " << argv[0]
|
||||
dawn::InfoLog()
|
||||
<< "\n\nUsage: " << argv[0]
|
||||
<< " [GTEST_FLAGS...] [-w] [-d] [-c] [--adapter-vendor-id=x]\n"
|
||||
" -w, --use-wire: Run the tests through the wire (defaults to no wire)\n"
|
||||
" -d, --enable-backend-validation: Enable backend validation (defaults"
|
||||
|
@ -187,7 +188,7 @@ void DawnTestEnvironment::SetUp() {
|
|||
mInstance.get()->DiscoverDefaultAdapters();
|
||||
DiscoverOpenGLAdapter();
|
||||
|
||||
InfoLog() << "Testing configuration\n"
|
||||
dawn::InfoLog() << "Testing configuration\n"
|
||||
"---------------------\n"
|
||||
"UseWire: "
|
||||
<< (mUseWire ? "true" : "false")
|
||||
|
@ -217,13 +218,14 @@ void DawnTestEnvironment::SetUp() {
|
|||
<< pci.deviceId;
|
||||
|
||||
// Preparing for outputting hex numbers
|
||||
InfoLog() << std::showbase << std::hex << std::setfill('0') << std::setw(4)
|
||||
dawn::InfoLog() << std::showbase << std::hex << std::setfill('0') << std::setw(4)
|
||||
|
||||
<< " - \"" << pci.name << "\"\n"
|
||||
<< " type: " << DeviceTypeName(adapter.GetDeviceType())
|
||||
<< ", backend: " << ParamName(adapter.GetBackendType()) << "\n"
|
||||
<< " vendorId: 0x" << vendorId.str() << ", deviceId: 0x" << deviceId.str()
|
||||
<< (mHasVendorIdFilter && mVendorIdFilter == pci.vendorId ? " [Selected]" : "")
|
||||
<< (mHasVendorIdFilter && mVendorIdFilter == pci.vendorId ? " [Selected]"
|
||||
: "")
|
||||
<< "\n";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -297,7 +297,7 @@ class DawnTestBase {
|
|||
// Skip a test when the given condition is satisfied.
|
||||
#define DAWN_SKIP_TEST_IF(condition) \
|
||||
if (condition) { \
|
||||
InfoLog() << "Test skipped: " #condition "."; \
|
||||
dawn::InfoLog() << "Test skipped: " #condition "."; \
|
||||
GTEST_SKIP(); \
|
||||
return; \
|
||||
}
|
||||
|
|
|
@ -113,7 +113,7 @@ DawnPerfTestEnvironment::DawnPerfTestEnvironment(int argc, char** argv)
|
|||
}
|
||||
|
||||
if (strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) {
|
||||
InfoLog()
|
||||
dawn::InfoLog()
|
||||
<< "Additional flags:"
|
||||
<< " [--calibration] [--override-steps=x] [--enable-tracing] [--trace-file=file]\n"
|
||||
<< " --calibration: Only run calibration. Calibration allows the perf test"
|
||||
|
|
|
@ -67,7 +67,7 @@ namespace utils {
|
|||
shaderc::Compiler compiler;
|
||||
auto result = compiler.CompileGlslToSpv(source, strlen(source), kind, "myshader?");
|
||||
if (result.GetCompilationStatus() != shaderc_compilation_status_success) {
|
||||
ErrorLog() << result.GetErrorMessage();
|
||||
dawn::ErrorLog() << result.GetErrorMessage();
|
||||
return {};
|
||||
}
|
||||
#ifdef DUMP_SPIRV_ASSEMBLY
|
||||
|
@ -106,7 +106,7 @@ namespace utils {
|
|||
shaderc::Compiler compiler;
|
||||
shaderc::SpvCompilationResult result = compiler.AssembleToSpv(source, strlen(source));
|
||||
if (result.GetCompilationStatus() != shaderc_compilation_status_success) {
|
||||
ErrorLog() << result.GetErrorMessage();
|
||||
dawn::ErrorLog() << result.GetErrorMessage();
|
||||
return {};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue