mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-13 15:16:16 +00:00
Add Log.h to replace all uses of iostream
On Android iostream doesn't appear in logcat, the system log that's often used for printf debugging. Introduce Chromium/ANGLE like logging that looks like the following: InfoLog() << stuff << stuff; This makes sure the message is put in logcat on Android and removes static initializers from <iostream> BUG=dawn:286 Change-Id: Ie0d018f49bcac1a7b740739a6e59d45ae6728638 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/14102 Commit-Queue: Corentin Wallez <cwallez@chromium.org> Reviewed-by: David Turner <digit@google.com> Reviewed-by: Austin Eng <enga@chromium.org>
This commit is contained in:
committed by
Commit Bot service account
parent
1d6250d016
commit
95586ff184
@@ -15,6 +15,7 @@
|
||||
#include "SampleUtils.h"
|
||||
|
||||
#include "common/Assert.h"
|
||||
#include "common/Log.h"
|
||||
#include "common/Platform.h"
|
||||
#include "utils/BackendBinding.h"
|
||||
#include "utils/TerribleCommandBuffer.h"
|
||||
@@ -28,31 +29,31 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
void PrintDeviceError(WGPUErrorType errorType, const char* message, void*) {
|
||||
const char* errorTypeName = "";
|
||||
switch (errorType) {
|
||||
case WGPUErrorType_Validation:
|
||||
std::cout << "Validation ";
|
||||
errorTypeName = "Validation";
|
||||
break;
|
||||
case WGPUErrorType_OutOfMemory:
|
||||
std::cout << "Out of memory ";
|
||||
errorTypeName = "Out of memory";
|
||||
break;
|
||||
case WGPUErrorType_Unknown:
|
||||
std::cout << "Unknown ";
|
||||
errorTypeName = "Unknown";
|
||||
break;
|
||||
case WGPUErrorType_DeviceLost:
|
||||
std::cout << "Device lost ";
|
||||
errorTypeName = "Device lost";
|
||||
break;
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return;
|
||||
}
|
||||
std::cout << "error: " << message << std::endl;
|
||||
ErrorLog() << errorTypeName << " error: " << message;
|
||||
}
|
||||
|
||||
void PrintGLFWError(int code, const char* message) {
|
||||
std::cout << "GLFW error: " << code << " - " << message << std::endl;
|
||||
ErrorLog() << "GLFW error: " << code << " - " << message;
|
||||
}
|
||||
|
||||
enum class CmdBufType {
|
||||
|
||||
Reference in New Issue
Block a user