Remove base/logging from a lot more files in native

This commit is contained in:
Henrik Rydgård 2020-08-15 15:51:41 +02:00
parent bf72f746ea
commit 5eb13378c6
21 changed files with 125 additions and 116 deletions

View File

@ -601,7 +601,7 @@ bool GameManager::InstallZippedISO(struct zip *z, int isoFileIndex, std::string
std::string outputISOFilename = g_Config.currentDirectory + "/" + fn.substr(nameOffset);
size_t bytesCopied = 0;
if (ExtractFile(z, isoFileIndex, outputISOFilename, &bytesCopied, allBytes)) {
ILOG("Successfully extracted ISO file to '%s'", outputISOFilename.c_str());
INFO_LOG(IO, "Successfully extracted ISO file to '%s'", outputISOFilename.c_str());
}
zip_close(z);
if (deleteAfter) {

View File

@ -18,10 +18,11 @@
#define MSG_NOSIGNAL 0x00
#endif
#include "base/logging.h"
#include "base/timeutil.h"
#include "file/fd_util.h"
#include "Common/Log.h"
Buffer::Buffer() { }
Buffer::~Buffer() { }
@ -63,7 +64,7 @@ void Buffer::AppendValue(int value) {
void Buffer::Take(size_t length, std::string *dest) {
if (length > data_.size()) {
ELOG("Truncating length in Buffer::Take()");
ERROR_LOG(IO, "Truncating length in Buffer::Take()");
length = data_.size();
}
dest->resize(length);
@ -90,7 +91,7 @@ int Buffer::TakeLineCRLF(std::string *dest) {
void Buffer::Skip(size_t length) {
if (length > data_.size()) {
ELOG("Truncating length in Buffer::Skip()");
ERROR_LOG(IO, "Truncating length in Buffer::Skip()");
length = data_.size();
}
data_.erase(data_.begin(), data_.begin() + length);
@ -122,10 +123,10 @@ void Buffer::Printf(const char *fmt, ...) {
ssize_t retval = vsnprintf(buffer, sizeof(buffer), fmt, vl);
if (retval >= (ssize_t)sizeof(buffer)) {
// Output was truncated. TODO: Do something.
ELOG("Buffer::Printf truncated output");
ERROR_LOG(IO, "Buffer::Printf truncated output");
}
if (retval < 0) {
ELOG("Buffer::Printf failed");
ERROR_LOG(IO, "Buffer::Printf failed");
}
va_end(vl);
char *ptr = Append(retval);
@ -164,14 +165,14 @@ bool Buffer::FlushSocket(uintptr_t sock, double timeout, bool *cancelled) {
if (!ready && leftTimeout >= 0.0) {
leftTimeout -= CANCEL_INTERVAL;
if (leftTimeout < 0) {
ELOG("FlushSocket timed out");
ERROR_LOG(IO, "FlushSocket timed out");
return false;
}
}
}
int sent = send(sock, &data_[pos], (int)(end - pos), MSG_NOSIGNAL);
if (sent < 0) {
ELOG("FlushSocket failed");
ERROR_LOG(IO, "FlushSocket failed");
return false;
}
pos += sent;
@ -200,7 +201,7 @@ bool Buffer::ReadAll(int fd, int hintSize) {
if (retval == 0) {
break;
} else if (retval < 0) {
ELOG("Error reading from buffer: %i", retval);
ERROR_LOG(IO, "Error reading from buffer: %i", retval);
return false;
}
char *p = Append((size_t)retval);
@ -232,7 +233,7 @@ bool Buffer::ReadAllWithProgress(int fd, int knownSize, float *progress, bool *c
if (retval == 0) {
return true;
} else if (retval < 0) {
ELOG("Error reading from buffer: %i", retval);
ERROR_LOG(IO, "Error reading from buffer: %i", retval);
return false;
}
char *p = Append((size_t)retval);

View File

@ -1,11 +1,11 @@
#ifndef _IO_BUFFER_H
#define _IO_BUFFER_H
#pragma once
#include <string>
#include <vector>
#include "base/basictypes.h"
#include "base/logging.h"
#include "Common/Common.h"
// Acts as a queue. Intended to be as fast as possible for most uses.
// Does not do synchronization, must use external mutexes.
@ -84,5 +84,3 @@ class Buffer {
DISALLOW_COPY_AND_ASSIGN(Buffer);
};
#endif // _IO_BUFFER_H

View File

@ -37,7 +37,7 @@ void OutputDebugStringUTF8(const char *p) {
#else
void OutputDebugStringUTF8(const char *p) {
ILOG("%s", p);
INFO_LOG(SYSTEM, "%s", p);
}
#endif

View File

@ -1,7 +1,6 @@
#include <cstdio>
#include "base/basictypes.h"
#include "base/logging.h"
#include "base/timeutil.h"
#ifdef _WIN32
@ -15,6 +14,8 @@
#include <switch.h>
#endif // HAVE_LIBNX
#include "Common/Log.h"
static double curtime = 0;
static float curtime_f = 0;
@ -107,7 +108,7 @@ bool LoggingDeadline::End() {
if (time_now_d() > endTime_) {
double late = (time_now_d() - endTime_);
double totalTime = late + totalTime_;
ELOG("===== %0.2fms DEADLINE PASSED FOR %s at %0.2fms - %0.2fms late =====", totalTime_ * 1000.0, name_, 1000.0 * totalTime, 1000.0 * late);
ERROR_LOG(SYSTEM, "===== %0.2fms DEADLINE PASSED FOR %s at %0.2fms - %0.2fms late =====", totalTime_ * 1000.0, name_, 1000.0 * totalTime, 1000.0 * late);
return false;
}
return true;

View File

@ -57,7 +57,7 @@ bool LoadRemoteFileList(const std::string &url, bool *cancel, std::vector<FileIn
// Try to extract from an automatic webserver directory listing...
GetQuotedStrings(listing, items);
} else {
ELOG("Unsupported Content-Type: %s", contentType.c_str());
ERROR_LOG(IO, "Unsupported Content-Type: %s", contentType.c_str());
return false;
}

View File

@ -2,11 +2,9 @@
// TODO:
// Zoom gesture a la http://www.zdnet.com/blog/burnette/how-to-use-multi-touch-in-android-2-part-6-implementing-the-pinch-zoom-gesture/1847
#include "base/logging.h"
#include "base/timeutil.h"
#include "input/gesture_detector.h"
const float estimatedInertiaDamping = 0.75f;
GestureDetector::GestureDetector() {

View File

@ -15,7 +15,7 @@ JsonReader::JsonReader(const std::string &filename) {
if (buffer_) {
parse();
} else {
ELOG("Failed to read json %s", filename.c_str());
ERROR_LOG(IO, "Failed to read json file '%s'", filename.c_str());
}
}
}
@ -33,7 +33,7 @@ int JsonGet::numChildren() const {
const JsonNode *JsonGet::get(const char *child_name) const {
if (!child_name) {
FLOG("JSON: Cannot get from null child name");
ERROR_LOG(IO, "JSON: Cannot get from null child name");
return nullptr;
}
if (value_.getTag() != JSON_OBJECT) {
@ -58,7 +58,7 @@ const char *JsonGet::getStringOrDie(const char *child_name) const {
const JsonNode *val = get(child_name, JSON_STRING);
if (val)
return val->value.toString();
FLOG("String '%s' missing from node", child_name);
ERROR_LOG(IO, "String '%s' missing from node", child_name);
return nullptr;
}

View File

@ -2,9 +2,10 @@
#include <vector>
#include "base/basictypes.h"
#include "base/logging.h"
#include "ext/gason/gason.h"
#include "Common/Log.h"
namespace json {
struct JsonGet {
@ -72,7 +73,7 @@ private:
char *error_pos;
int status = jsonParse(buffer_, &error_pos, &root_, alloc_);
if (status != JSON_OK) {
ELOG("Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos);
ERROR_LOG(IO, "Error at (%i): %s\n%s\n\n", (int)(error_pos - buffer_), jsonStrError(status), error_pos);
return false;
}
ok_ = true;

View File

@ -18,7 +18,6 @@
#include <stdio.h>
#include <stdlib.h>
#include "base/logging.h"
#include "base/buffer.h"
#include "base/stringutil.h"
#include "data/compression.h"
@ -27,6 +26,8 @@
#include "net/url.h"
#include "thread/threadutil.h"
#include "Common/Log.h"
namespace net {
Connection::Connection()
@ -48,11 +49,11 @@ inline unsigned short myhtons(unsigned short x) {
bool Connection::Resolve(const char *host, int port, DNSType type) {
if ((intptr_t)sock_ != -1) {
ELOG("Resolve: Already have a socket");
ERROR_LOG(IO, "Resolve: Already have a socket");
return false;
}
if (!host || port < 1 || port > 65535) {
ELOG("Resolve: Invalid host or port (%d)", port);
ERROR_LOG(IO, "Resolve: Invalid host or port (%d)", port);
return false;
}
@ -64,7 +65,7 @@ bool Connection::Resolve(const char *host, int port, DNSType type) {
std::string err;
if (!net::DNSResolve(host, port_str, &resolved_, err, type)) {
ELOG("Failed to resolve host %s: %s", host, err.c_str());
ERROR_LOG(IO, "Failed to resolve host %s: %s", host, err.c_str());
// So that future calls fail.
port_ = 0;
return false;
@ -75,7 +76,7 @@ bool Connection::Resolve(const char *host, int port, DNSType type) {
bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
if (port_ <= 0) {
ELOG("Bad port");
ERROR_LOG(IO, "Bad port");
return false;
}
sock_ = -1;
@ -91,7 +92,7 @@ bool Connection::Connect(int maxTries, double timeout, bool *cancelConnect) {
int sock = socket(possible->ai_family, SOCK_STREAM, IPPROTO_TCP);
if ((intptr_t)sock == -1) {
ELOG("Bad socket");
ERROR_LOG(IO, "Bad socket");
continue;
}
fd_util::SetNonBlocking(sock, true);
@ -326,14 +327,14 @@ int Client::ReadResponseHeaders(Buffer *readbuf, std::vector<std::string> &respo
if (!ready && leftTimeout >= 0.0) {
leftTimeout -= CANCEL_INTERVAL;
if (leftTimeout < 0) {
ELOG("HTTP headers timed out");
ERROR_LOG(IO, "HTTP headers timed out");
return -1;
}
}
};
// Let's hope all the headers are available in a single packet...
if (readbuf->Read(sock(), 4096) < 0) {
ELOG("Failed to read HTTP headers :(");
ERROR_LOG(IO, "Failed to read HTTP headers :(");
return -1;
}
@ -429,7 +430,7 @@ int Client::ReadResponseEntity(Buffer *readbuf, const std::vector<std::string> &
output->TakeAll(&compressed);
bool result = decompress_string(compressed, &decompressed);
if (!result) {
ELOG("Error decompressing using zlib");
ERROR_LOG(IO, "Error decompressing using zlib");
if (progress)
*progress = 0.0f;
return -1;
@ -448,9 +449,7 @@ Download::Download(const std::string &url, const std::string &outfile)
}
Download::~Download() {
if (!joined_) {
FLOG("Download destructed without join");
}
_assert_msg_(joined_, "Download destructed without join");
}
void Download::Start() {
@ -459,7 +458,7 @@ void Download::Start() {
void Download::Join() {
if (joined_) {
ELOG("Already joined thread!");
ERROR_LOG(IO, "Already joined thread!");
}
thread_.join();
joined_ = true;
@ -479,7 +478,7 @@ int Download::PerformGET(const std::string &url) {
http::Client client;
if (!client.Resolve(fileUrl.Host().c_str(), fileUrl.Port())) {
ELOG("Failed resolving %s", url.c_str());
ERROR_LOG(IO, "Failed resolving %s", url.c_str());
return -1;
}
@ -488,7 +487,7 @@ int Download::PerformGET(const std::string &url) {
}
if (!client.Connect(2, 20.0, &cancelled_)) {
ELOG("Failed connecting to server or cancelled.");
ERROR_LOG(IO, "Failed connecting to server or cancelled.");
return -1;
}
@ -525,7 +524,7 @@ void Download::Do() {
if (resultCode == 301 || resultCode == 302 || resultCode == 303 || resultCode == 307 || resultCode == 308) {
std::string redirectURL = RedirectLocation(downloadURL);
if (redirectURL.empty()) {
ELOG("Could not find Location header for redirect");
ERROR_LOG(IO, "Could not find Location header for redirect");
resultCode_ = resultCode;
} else if (redirectURL == downloadURL || redirectURL == url_) {
// Simple loop detected, bail out.
@ -534,18 +533,18 @@ void Download::Do() {
// Perform the next GET.
if (resultCode_ == 0)
ILOG("Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str());
INFO_LOG(IO, "Download of %s redirected to %s", downloadURL.c_str(), redirectURL.c_str());
downloadURL = redirectURL;
continue;
}
if (resultCode == 200) {
ILOG("Completed downloading %s to %s", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str());
INFO_LOG(IO, "Completed downloading %s to %s", url_.c_str(), outfile_.empty() ? "memory" : outfile_.c_str());
if (!outfile_.empty() && !buffer_.FlushToFile(outfile_.c_str())) {
ELOG("Failed writing download to %s", outfile_.c_str());
ERROR_LOG(IO, "Failed writing download to %s", outfile_.c_str());
}
} else {
ELOG("Error downloading %s to %s: %i", url_.c_str(), outfile_.c_str(), resultCode);
ERROR_LOG(IO, "Error downloading %s to %s: %i", url_.c_str(), outfile_.c_str(), resultCode);
}
resultCode_ = resultCode;
}

View File

@ -4,11 +4,12 @@
#include <stdio.h>
#include <stdlib.h>
#include "base/logging.h"
#include "base/stringutil.h"
#include "file/fd_util.h"
#include "net/sinks.h"
#include "Common/Log.h"
namespace http {
RequestHeader::RequestHeader()
@ -32,7 +33,7 @@ bool RequestHeader::GetParamValue(const char *param_name, std::string *value) co
for (size_t i = 0; i < v.size(); i++) {
std::vector<std::string> parts;
SplitString(v[i], '=', parts);
ILOG("Param: %s Value: %s", parts[0].c_str(), parts[1].c_str());
INFO_LOG(IO, "Param: %s Value: %s", parts[0].c_str(), parts[1].c_str());
if (parts[0] == param_name) {
*value = parts[1];
return true;
@ -120,13 +121,13 @@ int RequestHeader::ParseHttpHeader(const char *buffer) {
if (!strncasecmp(key, "User-Agent", key_len)) {
user_agent = new char[value_len + 1];
memcpy(user_agent, buffer, value_len + 1);
ILOG("user-agent: %s", user_agent);
INFO_LOG(IO, "user-agent: %s", user_agent);
} else if (!strncasecmp(key, "Referer", key_len)) {
referer = new char[value_len + 1];
memcpy(referer, buffer, value_len + 1);
} else if (!strncasecmp(key, "Content-Length", key_len)) {
content_length = atoi(buffer);
ILOG("Content-Length: %i", (int)content_length);
INFO_LOG(IO, "Content-Length: %i", (int)content_length);
} else {
std::string key_str(key, key_len);
std::transform(key_str.begin(), key_str.end(), key_str.begin(), tolower);
@ -149,12 +150,12 @@ void RequestHeader::ParseHeaders(net::InputSink *sink) {
line_count++;
if (type == SIMPLE) {
// Done!
ILOG("Simple: Done parsing http request.");
INFO_LOG(IO, "Simple: Done parsing http request.");
break;
}
}
ILOG("finished parsing request.");
INFO_LOG(IO, "finished parsing request.");
ok = line_count > 1;
}

View File

@ -34,13 +34,14 @@
#include <stdio.h>
#include <stdlib.h>
#include "base/logging.h"
#include "base/buffer.h"
#include "file/fd_util.h"
#include "net/http_server.h"
#include "net/sinks.h"
#include "thread/executor.h"
#include "Common/Log.h"
namespace http {
// Note: charset here helps prevent XSS.
@ -53,7 +54,7 @@ Request::Request(int fd)
header_.ParseHeaders(in_);
if (header_.ok) {
ILOG("The request carried with it %i bytes", (int)header_.content_length);
INFO_LOG(IO, "The request carried with it %i bytes", (int)header_.content_length);
} else {
Close();
}
@ -62,10 +63,10 @@ Request::Request(int fd)
Request::~Request() {
Close();
CHECK(in_->Empty());
_assert_(in_->Empty());
delete in_;
if (!out_->Empty()) {
ELOG("Output not empty - connection abort?");
ERROR_LOG(IO, "Output not empty - connection abort?");
}
delete out_;
}
@ -108,12 +109,12 @@ void Request::WriteHttpResponseHeader(const char *ver, int status, int64_t size,
}
void Request::WritePartial() const {
CHECK(fd_);
_assert_(fd_);
out_->Flush();
}
void Request::Write() {
CHECK(fd_);
_assert_(fd_);
WritePartial();
Close();
}
@ -171,7 +172,7 @@ bool Server::Listen4(int port) {
if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
closesocket(listener_);
ELOG("Failed to bind to port %i. Bailing.", port);
ERROR_LOG(IO, "Failed to bind to port %d. Bailing.", port);
return false;
}
@ -188,7 +189,7 @@ bool Server::Listen4(int port) {
port = ntohs(server_addr.sin_port);
}
ILOG("HTTP server started on port %i", port);
INFO_LOG(IO, "HTTP server started on port %d", port);
port_ = port;
return true;
@ -216,7 +217,7 @@ bool Server::Listen6(int port, bool ipv6_only) {
if (bind(listener_, (struct sockaddr *)&server_addr, sizeof(server_addr)) < 0) {
closesocket(listener_);
ELOG("Failed to bind to port %i. Bailing.", port);
ERROR_LOG(IO, "Failed to bind to port %d. Bailing.", port);
return false;
}
@ -233,7 +234,7 @@ bool Server::Listen6(int port, bool ipv6_only) {
port = ntohs(server_addr.sin6_port);
}
ILOG("HTTP server started on port %i", port);
INFO_LOG(IO, "HTTP server started on port %d", port);
port_ = port;
return true;
@ -268,7 +269,7 @@ bool Server::RunSlice(double timeout) {
return true;
}
else {
ELOG("socket accept failed: %i", conn_fd);
ERROR_LOG(IO, "socket accept failed: %i", conn_fd);
return false;
}
}
@ -293,7 +294,7 @@ void Server::Stop() {
void Server::HandleConnection(int conn_fd) {
Request request(conn_fd);
if (!request.IsOK()) {
WLOG("Bad request, ignoring.");
WARN_LOG(IO, "Bad request, ignoring.");
return;
}
HandleRequest(request);
@ -321,7 +322,7 @@ void Server::HandleRequestDefault(const Request &request) {
}
void Server::Handle404(const Request &request) {
ILOG("No handler for '%s', falling back to 404.", request.resource());
INFO_LOG(IO, "No handler for '%s', falling back to 404.", request.resource());
const char *payload = "<html><body>404 not found</body></html>\r\n";
request.WriteHttpResponseHeader("1.0", 404, (int)strlen(payload));
request.Out()->Push(payload);

View File

@ -1,6 +1,5 @@
#include "ppsspp_config.h"
#include "net/resolve.h"
#include "base/logging.h"
#include "base/timeutil.h"
#include <stdio.h>
#include <stdlib.h>
@ -25,6 +24,7 @@
#include <unistd.h>
#endif
#include "base/timeutil.h"
namespace net {
@ -45,6 +45,7 @@ void Shutdown()
}
bool DNSResolve(const std::string &host, const std::string &service, addrinfo **res, std::string &error, DNSType type) {
#if PPSSPP_PLATFORM(SWITCH)
// Force IPv4 lookups.
if (type == DNSType::IPV6) {
@ -102,7 +103,7 @@ void DNSResolveFree(addrinfo *res)
freeaddrinfo(res);
}
bool GetIPList(std::vector<std::string>& IP4s) {
bool GetIPList(std::vector<std::string> &IP4s) {
char ipstr[INET6_ADDRSTRLEN]; // We use IPv6 length since it's longer than IPv4
#if defined(getifaddrs) // On Android: Requires __ANDROID_API__ >= 24
struct ifaddrs* ifAddrStruct = NULL;

View File

@ -1,4 +1,6 @@
#ifdef _WIN32
#include "ppsspp_config.h"
#if PPSSPP_PLATFORM(WINDOWS)
#ifndef NOMINMAX
#define NOMINMAX
@ -21,10 +23,11 @@
#include <algorithm>
#include <cstdarg>
#include "base/logging.h"
#include "net/sinks.h"
#include "file/fd_util.h"
#include "Common/Log.h"
#ifndef MSG_NOSIGNAL
// Default value to 0x00 (do nothing) in systems where it's not supported
#define MSG_NOSIGNAL 0
@ -182,7 +185,7 @@ bool InputSink::Block() {
void InputSink::AccountFill(int bytes) {
if (bytes < 0) {
ELOG("Error reading from socket");
ERROR_LOG(IO, "Error reading from socket");
return;
}
@ -303,10 +306,10 @@ bool OutputSink::Printf(const char *fmt, ...) {
// Okay, did we actually write?
if (result >= (int)avail) {
// This means the result string was too big for the buffer.
ELOG("Not enough space to format output.");
ERROR_LOG(IO, "Not enough space to format output.");
return false;
} else if (result < 0) {
ELOG("vsnprintf failed.");
ERROR_LOG(IO, "vsnprintf failed.");
return false;
}
@ -373,7 +376,7 @@ void OutputSink::AccountPush(size_t bytes) {
void OutputSink::AccountDrain(int bytes) {
if (bytes < 0) {
ELOG("Error writing to socket");
ERROR_LOG(IO, "Error writing to socket");
return;
}

View File

@ -1,7 +1,8 @@
#include "base/logging.h"
#include "base/stringutil.h"
#include "net/url.h"
#include "Common/Log.h"
const char *UrlEncoder::unreservedChars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.~";
const char *UrlEncoder::hexChars = "0123456789ABCDEF";
@ -10,7 +11,7 @@ int MultipartFormDataEncoder::seq = 0;
void Url::Split() {
size_t colonSlashSlash = url_.find("://");
if (colonSlashSlash == std::string::npos) {
ELOG("Invalid URL: %s", url_.c_str());
ERROR_LOG(IO, "Invalid URL: %s", url_.c_str());
return;
}

View File

@ -8,12 +8,13 @@
#include <string.h>
#include "base/logging.h"
#include "base/timeutil.h"
#include "gfx_es2/draw_buffer.h"
#include "ppsspp_config.h"
#include "profiler/profiler.h"
#include "Common/Log.h"
#define MAX_CATEGORIES 64 // Can be any number, represents max profiled names.
#define MAX_DEPTH 16 // Can be any number, represents max nesting depth of profiled names.
#if PPSSPP_PLATFORM(IOS) && defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < __IPHONE_9_0
@ -147,7 +148,7 @@ int internal_profiler_enter(const char *category_name, int *out_thread_id) {
}
internal_profiler_resume(thread_id, category, now);
} else {
DLOG("profiler: recursive enter (%i - %s)", category, category_name);
DEBUG_LOG(SYSTEM, "profiler: recursive enter (%i - %s)", category, category_name);
}
depth++;
@ -164,7 +165,7 @@ void internal_profiler_leave(int thread_id, int category) {
int &depth = profiler.depth[thread_id];
if (category < 0 || category >= MAX_CATEGORIES) {
ELOG("Bad category index %d", category);
ERROR_LOG(SYSTEM, "Bad category index %d", category);
depth--;
return;
}
@ -172,9 +173,7 @@ void internal_profiler_leave(int thread_id, int category) {
double now = real_time_now();
depth--;
if (depth < 0) {
FLOG("Profiler enter/leave mismatch!");
}
_assert_msg_(depth >= 0, "Profiler enter/leave mismatch!");
int parent = profiler.parentCategory[thread_id][depth];
// When there's recursion, we don't suspend or resume.

View File

@ -1,5 +1,4 @@
#include "thin3d/DataFormatGL.h"
#include "base/logging.h"
#include "Common/Log.h"
namespace Draw {

View File

@ -1,10 +1,7 @@
#include <algorithm>
#include "Common/MemoryUtil.h"
#include "Core/Reporting.h"
#include "GLQueueRunner.h"
#include "GLRenderManager.h"
#include "DataFormatGL.h"
#include "base/logging.h"
#include "base/logging.h" // For OutputDebugStringUTF8
#include "base/stringutil.h"
#include "gfx/gl_common.h"
#include "gfx/gl_debug_log.h"
@ -13,6 +10,14 @@
#include "math/dataconv.h"
#include "math/math_util.h"
#include "Common/Log.h"
#include "Common/MemoryUtil.h"
#include "Core/Reporting.h"
#include "GLQueueRunner.h"
#include "GLRenderManager.h"
#include "DataFormatGL.h"
#define TEXCACHE_NAME_CACHE_SIZE 16
#ifdef IOS
@ -223,7 +228,7 @@ void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps, bool ski
if (!anyFailed)
Reporting::ReportMessage("Error in shader program link: info: %s\nfs: %s\n%s\nvs: %s\n%s", infoLog.c_str(), fsDesc.c_str(), fsCode, vsDesc.c_str(), vsCode);
ELOG("Could not link program:\n %s", infoLog.c_str());
ERROR_LOG(G3D, "Could not link program:\n %s", infoLog.c_str());
ERROR_LOG(G3D, "VS desc:\n%s", vsDesc.c_str());
ERROR_LOG(G3D, "FS desc:\n%s", fsDesc.c_str());
ERROR_LOG(G3D, "VS:\n%s\n", vsCode);
@ -277,8 +282,8 @@ void GLQueueRunner::RunInitSteps(const std::vector<GLRInitStep> &steps, bool ski
if (!success) {
std::string infoLog = GetInfoLog(shader, glGetShaderiv, glGetShaderInfoLog);
#ifdef __ANDROID__
ELOG("Error in shader compilation! %s\n", infoLog.c_str());
ELOG("Shader source:\n%s\n", (const char *)code);
ERROR_LOG(G3D, "Error in shader compilation! %s\n", infoLog.c_str());
ERROR_LOG(G3D, "Shader source:\n%s\n", (const char *)code);
#endif
ERROR_LOG(G3D, "Error in shader compilation for: %s", step.create_shader.shader->desc.c_str());
ERROR_LOG(G3D, "Info log: %s", infoLog.c_str());
@ -547,10 +552,10 @@ retry_depth:
// ILOG("Framebuffer verified complete.");
break;
case GL_FRAMEBUFFER_UNSUPPORTED:
ELOG("GL_FRAMEBUFFER_UNSUPPORTED");
ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED");
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT:
ELOG("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT");
break;
default:
FLOG("Other framebuffer error: %i", status);
@ -1566,10 +1571,10 @@ void GLQueueRunner::fbo_ext_create(const GLRInitStep &step) {
// ILOG("Framebuffer verified complete.");
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
ELOG("GL_FRAMEBUFFER_UNSUPPORTED");
ERROR_LOG(G3D, "GL_FRAMEBUFFER_UNSUPPORTED");
break;
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
ELOG("GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT ");
ERROR_LOG(G3D, "GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT ");
break;
default:
FLOG("Other framebuffer error: %i", status);

View File

@ -4,11 +4,12 @@
#include "gfx_es2/gpu_features.h"
#include "thin3d/thin3d.h"
#include "thread/threadutil.h"
#include "base/logging.h"
#include "Common/Log.h"
#include "Common/MemoryUtil.h"
#if 0 // def _DEBUG
#define VLOG ILOG
#define VLOG(...) INFO_LOG(G3D, __VA_ARGS__)
#else
#define VLOG(...)
#endif

View File

@ -4,14 +4,13 @@
#include <sstream>
#include "Common/Log.h"
#include "base/logging.h"
#include "Common/Vulkan/VulkanContext.h"
#include "thin3d/VulkanRenderManager.h"
#include "thread/threadutil.h"
#if 0 // def _DEBUG
#define VLOG ILOG
#define VLOG(...) INFO_LOG(G3D, __VA_ARGS__)
#else
#define VLOG(...)
#endif
@ -162,7 +161,7 @@ void VulkanRenderManager::CreateBackbuffers() {
VkImage *swapchainImages = new VkImage[swapchainImageCount_];
res = vkGetSwapchainImagesKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), &swapchainImageCount_, swapchainImages);
if (res != VK_SUCCESS) {
ELOG("vkGetSwapchainImagesKHR failed");
ERROR_LOG(G3D, "vkGetSwapchainImagesKHR failed");
delete[] swapchainImages;
return;
}
@ -210,7 +209,7 @@ void VulkanRenderManager::CreateBackbuffers() {
}
if (newInflightFrames_ != -1) {
ILOG("Updating inflight frames to %d", newInflightFrames_);
INFO_LOG(G3D, "Updating inflight frames to %d", newInflightFrames_);
vulkan_->UpdateInflightFrames(newInflightFrames_);
newInflightFrames_ = -1;
}
@ -222,7 +221,7 @@ void VulkanRenderManager::CreateBackbuffers() {
run_ = true;
// Won't necessarily be 0.
threadInitFrame_ = vulkan_->GetCurFrame();
ILOG("Starting Vulkan submission thread (threadInitFrame_ = %d)", vulkan_->GetCurFrame());
INFO_LOG(G3D, "Starting Vulkan submission thread (threadInitFrame_ = %d)", vulkan_->GetCurFrame());
thread_ = std::thread(&VulkanRenderManager::ThreadFunc, this);
}
}
@ -245,7 +244,7 @@ void VulkanRenderManager::StopThread() {
frameData.profile.timestampDescriptions.clear();
}
thread_.join();
ILOG("Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame());
INFO_LOG(G3D, "Vulkan submission thread joined. Frame=%d", vulkan_->GetCurFrame());
// Eat whatever has been queued up for this frame if anything.
Wipe();
@ -275,7 +274,7 @@ void VulkanRenderManager::StopThread() {
}
}
} else {
ILOG("Vulkan submission thread was already stopped.");
INFO_LOG(G3D, "Vulkan submission thread was already stopped.");
}
}
@ -300,7 +299,7 @@ void VulkanRenderManager::DestroyBackbuffers() {
}
VulkanRenderManager::~VulkanRenderManager() {
ILOG("VulkanRenderManager destructor");
INFO_LOG(G3D, "VulkanRenderManager destructor");
StopThread();
vulkan_->WaitUntilQueueIdle();
@ -352,7 +351,7 @@ void VulkanRenderManager::ThreadFunc() {
}
VLOG("PULL: Running frame %d", threadFrame);
if (firstFrame) {
ILOG("Running first frame (%d)", threadFrame);
INFO_LOG(G3D, "Running first frame (%d)", threadFrame);
firstFrame = false;
}
Run(threadFrame);
@ -428,7 +427,7 @@ void VulkanRenderManager::BeginFrame(bool enableProfiling) {
// Must be after the fence - this performs deletes.
VLOG("PUSH: BeginFrame %d", curFrame);
if (!run_) {
WLOG("BeginFrame while !run_!");
WARN_LOG(G3D, "BeginFrame while !run_!");
}
vulkan_->BeginFrame();
@ -614,7 +613,7 @@ bool VulkanRenderManager::CopyFramebufferToMemorySync(VKRFramebuffer *src, VkIma
} else {
// Backbuffer.
if (!(vulkan_->GetSurfaceCapabilities().supportedUsageFlags & VK_IMAGE_USAGE_TRANSFER_SRC_BIT)) {
ELOG("Copying from backbuffer not supported, can't take screenshots");
ERROR_LOG(G3D, "Copying from backbuffer not supported, can't take screenshots");
return false;
}
switch (vulkan_->GetSwapchainFormat()) {
@ -622,7 +621,7 @@ bool VulkanRenderManager::CopyFramebufferToMemorySync(VKRFramebuffer *src, VkIma
case VK_FORMAT_R8G8B8A8_UNORM: srcFormat = Draw::DataFormat::R8G8B8A8_UNORM; break;
// NOTE: If you add supported formats here, make sure to also support them in VulkanQueueRunner::CopyReadbackBuffer.
default:
ELOG("Unsupported backbuffer format for screenshots");
ERROR_LOG(G3D, "Unsupported backbuffer format for screenshots");
return false;
}
}
@ -1074,9 +1073,9 @@ void VulkanRenderManager::BeginSubmitFrame(int frame) {
VkResult res = vkAcquireNextImageKHR(vulkan_->GetDevice(), vulkan_->GetSwapchain(), UINT64_MAX, acquireSemaphore_, (VkFence)VK_NULL_HANDLE, &frameData.curSwapchainImage);
if (res == VK_SUBOPTIMAL_KHR) {
// Hopefully the resize will happen shortly. Ignore - one frame might look bad or something.
WLOG("VK_SUBOPTIMAL_KHR returned - ignoring");
WARN_LOG(G3D, "VK_SUBOPTIMAL_KHR returned - ignoring");
} else if (res == VK_ERROR_OUT_OF_DATE_KHR) {
WLOG("VK_ERROR_OUT_OF_DATE_KHR returned - processing the frame, but not presenting");
WARN_LOG(G3D, "VK_ERROR_OUT_OF_DATE_KHR returned - processing the frame, but not presenting");
frameData.skipSwap = true;
} else {
_assert_msg_(res == VK_SUCCESS, "vkAcquireNextImageKHR failed! result=%s", VulkanResultToString(res));

View File

@ -6,9 +6,10 @@
#include <stdlib.h>
#include <stdexcept>
#include "base/logging.h"
#include "thin3d/d3dx9_loader.h"
#include "Common/Log.h"
// TODO: See if we can use the bundled D3Dcompiler_47.dll to compiler for DX9 as well.
typedef BOOL(__stdcall *TFunc_D3DXCheckVersion)(UINT D3DSDKVersion, UINT D3DXSDKVersion);
@ -114,7 +115,7 @@ HMODULE loadDllLastVersion(unsigned int* version, bool debugVersion) {
}
void handleNotFoundAddr(const char* sFuncName) {
ELOG("Failed to find D3DX function %s", sFuncName);
ERROR_LOG(G3D, "Failed to find D3DX function %s", sFuncName);
failedFunctions++;
}
@ -126,7 +127,7 @@ int LoadD3DX9Dynamic(bool debugVersion) {
hm_d3dx = loadDllLastVersion(&d3dx_version, debugVersion);
if (!hm_d3dx) {
ELOG("Failed to find D3DX dll.");
ERROR_LOG(G3D, "Failed to find D3DX dll.");
return 0;
}
const int NERROR = -1;
@ -137,7 +138,7 @@ int LoadD3DX9Dynamic(bool debugVersion) {
__HANDLE_DLL_ENTRY(D3DXCompileShader);
if (failedFunctions > 0) {
ELOG("Failed to load %i D3DX functions. This will not go well.", failedFunctions);
ERROR_LOG(G3D, "Failed to load %i D3DX functions. This will not go well.", failedFunctions);
}
return failedFunctions > 0 ? 0 : d3dx_version;