Code cleanup: moving poly logging to xenia

This commit is contained in:
Ben Vanik
2015-05-02 01:59:50 -07:00
parent f7ca026db0
commit d76998915a
23 changed files with 156 additions and 198 deletions

View File

@@ -11,7 +11,6 @@
#include <algorithm>
#include "poly/logging.h"
#include "poly/math.h"
#include "xenia/gpu/gl4/gl4_gpu-private.h"
#include "xenia/gpu/gl4/gl4_graphics_system.h"
@@ -171,7 +170,7 @@ void CommandProcessor::CallInThread(std::function<void()> fn) {
void CommandProcessor::WorkerMain() {
context_->MakeCurrent();
if (!SetupGL()) {
PFATAL("Unable to setup command processor GL state");
XEFATAL("Unable to setup command processor GL state");
return;
}
@@ -229,19 +228,19 @@ bool CommandProcessor::SetupGL() {
// Circular buffer holding scratch vertex/index data.
if (!scratch_buffer_.Initialize()) {
PLOGE("Unable to initialize scratch buffer");
XELOGE("Unable to initialize scratch buffer");
return false;
}
// Command buffer.
if (!draw_batcher_.Initialize(&scratch_buffer_)) {
PLOGE("Unable to initialize command buffer");
XELOGE("Unable to initialize command buffer");
return false;
}
// Texture cache that keeps track of any textures/samplers used.
if (!texture_cache_.Initialize(memory_, &scratch_buffer_)) {
PLOGE("Unable to initialize texture cache");
XELOGE("Unable to initialize texture cache");
return false;
}
@@ -427,7 +426,7 @@ GLuint CommandProcessor::CreateGeometryProgram(const std::string& source) {
info_log.resize(log_length - 1);
glGetProgramInfoLog(program, log_length, &log_length,
const_cast<char*>(info_log.data()));
PLOGE("Unable to link program: %s", info_log.c_str());
XELOGE("Unable to link program: %s", info_log.c_str());
glDeleteProgram(program);
return 0;
}
@@ -928,7 +927,7 @@ bool CommandProcessor::ExecutePacketType3_XE_SWAP(RingbufferReader* reader,
uint32_t count) {
SCOPE_profile_cpu_f("gpu");
PLOGI("XE_SWAP");
XELOGI("XE_SWAP");
// Xenia-specific VdSwap hook.
// VdSwap will post this to tell us we need to swap the screen/fire an
@@ -1490,7 +1489,7 @@ bool CommandProcessor::IssueDraw() {
#define CHECK_ISSUE_UPDATE_STATUS(status, mismatch, error_message) \
{ \
if (status == UpdateStatus::kError) { \
PLOGE(error_message); \
XELOGE(error_message); \
draw_batcher_.DiscardDraw(); \
return false; \
} else if (status == UpdateStatus::kMismatch) { \
@@ -1810,7 +1809,7 @@ CommandProcessor::UpdateStatus CommandProcessor::UpdateState() {
#define CHECK_UPDATE_STATUS(status, mismatch, error_message) \
{ \
if (status == UpdateStatus::kError) { \
PLOGE(error_message); \
XELOGE(error_message); \
return status; \
} else if (status == UpdateStatus::kMismatch) { \
mismatch = true; \
@@ -2579,7 +2578,7 @@ bool CommandProcessor::IssueCopy() {
if (!source_framebuffer) {
// If we get here we are likely missing some state checks.
assert_always("No framebuffer for copy source? no-op copy?");
PLOGE("No framebuffer for copy source");
XELOGE("No framebuffer for copy source");
return false;
}

View File

@@ -67,7 +67,7 @@ X_STATUS GL4GraphicsSystem::Setup(cpu::Processor* processor,
// incoming ringbuffer packets.
command_processor_ = std::make_unique<CommandProcessor>(this);
if (!command_processor_->Initialize(std::move(processor_context))) {
PLOGE("Unable to initialize command processor");
XELOGE("Unable to initialize command processor");
return X_STATUS_UNSUCCESSFUL;
}
command_processor_->set_swap_handler(

View File

@@ -233,7 +233,7 @@ bool GL4Shader::PrepareVertexShader(
// Build static vertex array descriptor.
if (!PrepareVertexArrayObject()) {
PLOGE("Unable to prepare vertex shader array object");
XELOGE("Unable to prepare vertex shader array object");
return false;
}
std::string apply_transform =
@@ -280,7 +280,7 @@ bool GL4Shader::PrepareVertexShader(
std::string translated_source =
shader_translator_.TranslateVertexShader(this, program_cntl);
if (translated_source.empty()) {
PLOGE("Vertex shader failed translation");
XELOGE("Vertex shader failed translation");
return false;
}
source += translated_source;
@@ -333,7 +333,7 @@ bool GL4Shader::PreparePixelShader(
std::string translated_source =
shader_translator_.TranslatePixelShader(this, program_cntl);
if (translated_source.empty()) {
PLOGE("Pixel shader failed translation");
XELOGE("Pixel shader failed translation");
return false;
}
@@ -375,7 +375,7 @@ bool GL4Shader::CompileProgram(std::string source) {
: GL_FRAGMENT_SHADER,
1, &source_str);
if (!program_) {
PLOGE("Unable to create shader program");
XELOGE("Unable to create shader program");
return false;
}
@@ -390,7 +390,7 @@ bool GL4Shader::CompileProgram(std::string source) {
info_log.resize(log_length - 1);
glGetProgramInfoLog(program_, log_length, &log_length,
const_cast<char*>(info_log.data()));
PLOGE("Unable to link program: %s", info_log.c_str());
XELOGE("Unable to link program: %s", info_log.c_str());
error_log_ = std::move(info_log);
assert_always("Unable to link generated shader");
return false;
@@ -436,7 +436,7 @@ bool GL4Shader::CompileProgram(std::string source) {
fprintf(f, "\n*/\n");
fclose(f);
} else {
PLOGW("Got program binary but unable to find disassembly");
XELOGW("Got program binary but unable to find disassembly");
}
}
}

View File

@@ -13,7 +13,6 @@
#include "poly/assert.h"
#include "poly/cxx_compat.h"
#include "poly/logging.h"
#include "poly/math.h"
#include "xenia/gpu/gl4/gl4_gpu-private.h"
#include "xenia/logging.h"
@@ -63,17 +62,17 @@ bool GLContext::Initialize(HWND hwnd) {
pfd.iLayerType = PFD_MAIN_PLANE;
int pixel_format = ChoosePixelFormat(dc_, &pfd);
if (!pixel_format) {
PLOGE("Unable to choose pixel format");
XELOGE("Unable to choose pixel format");
return false;
}
if (!SetPixelFormat(dc_, pixel_format, &pfd)) {
PLOGE("Unable to set pixel format");
XELOGE("Unable to set pixel format");
return false;
}
HGLRC temp_context = wglCreateContext(dc_);
if (!temp_context) {
PLOGE("Unable to create temporary GL context");
XELOGE("Unable to create temporary GL context");
return false;
}
wglMakeCurrent(dc_, temp_context);
@@ -82,16 +81,16 @@ bool GLContext::Initialize(HWND hwnd) {
tls_wglew_context_ = &wglew_context_;
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK) {
PLOGE("Unable to initialize GLEW");
XELOGE("Unable to initialize GLEW");
return false;
}
if (wglewInit() != GLEW_OK) {
PLOGE("Unable to initialize WGLEW");
XELOGE("Unable to initialize WGLEW");
return false;
}
if (!WGLEW_ARB_create_context) {
PLOGE("WGL_ARG_create_context not supported by GL ICD");
XELOGE("WGL_ARG_create_context not supported by GL ICD");
return false;
}
@@ -108,12 +107,12 @@ bool GLContext::Initialize(HWND hwnd) {
wglMakeCurrent(nullptr, nullptr);
wglDeleteContext(temp_context);
if (!glrc_) {
PLOGE("Unable to create real GL context");
XELOGE("Unable to create real GL context");
return false;
}
if (!MakeCurrent()) {
PLOGE("Could not make real GL context current");
XELOGE("Could not make real GL context current");
return false;
}
@@ -124,7 +123,7 @@ bool GLContext::Initialize(HWND hwnd) {
SetupDebugging();
if (!blitter_.Initialize()) {
PLOGE("Unable to initialize blitter");
XELOGE("Unable to initialize blitter");
ClearCurrent();
return false;
}
@@ -154,33 +153,33 @@ std::unique_ptr<GLContext> GLContext::CreateShared() {
0};
new_glrc = wglCreateContextAttribsARB(dc_, glrc_, attrib_list);
if (!new_glrc) {
PLOGE("Could not create shared context");
XELOGE("Could not create shared context");
return nullptr;
}
}
auto new_context = std::make_unique<GLContext>(hwnd_, new_glrc);
if (!new_context->MakeCurrent()) {
PLOGE("Could not make new GL context current");
XELOGE("Could not make new GL context current");
return nullptr;
}
glewExperimental = GL_TRUE;
if (glewInit() != GLEW_OK) {
new_context->ClearCurrent();
PLOGE("Unable to initialize GLEW");
XELOGE("Unable to initialize GLEW");
return nullptr;
}
if (wglewInit() != GLEW_OK) {
new_context->ClearCurrent();
PLOGE("Unable to initialize WGLEW");
XELOGE("Unable to initialize WGLEW");
return nullptr;
}
SetupDebugging();
if (!new_context->blitter_.Initialize()) {
PLOGE("Unable to initialize blitter");
XELOGE("Unable to initialize blitter");
return nullptr;
}
@@ -325,7 +324,7 @@ bool GLContext::MakeCurrent() {
if (FLAGS_thread_safe_gl) {
global_gl_mutex_.unlock();
}
PLOGE("Unable to make GL context current");
XELOGE("Unable to make GL context current");
return false;
}
tls_glew_context_ = &glew_context_;

View File

@@ -215,7 +215,7 @@ TextureCache::TextureEntryView* TextureCache::Demand(
uint64_t texture_hash = texture_info.hash();
auto texture_entry = LookupOrInsertTexture(texture_info, texture_hash);
if (!texture_entry) {
PLOGE("Failed to setup texture");
XELOGE("Failed to setup texture");
return nullptr;
}
@@ -231,7 +231,7 @@ TextureCache::TextureEntryView* TextureCache::Demand(
// No existing view found - build it.
auto sampler_entry = LookupOrInsertSampler(sampler_info, sampler_hash);
if (!sampler_entry) {
PLOGE("Failed to setup texture sampler");
XELOGE("Failed to setup texture sampler");
return nullptr;
}
@@ -482,7 +482,7 @@ TextureCache::TextureEntry* TextureCache::LookupOrInsertTexture(
return false;
}
if (!uploaded) {
PLOGE("Failed to convert/upload texture");
XELOGE("Failed to convert/upload texture");
return nullptr;
}

View File

@@ -10,8 +10,8 @@
#include "xenia/gpu/gl4/wgl_control.h"
#include "poly/assert.h"
#include "poly/logging.h"
#include "xenia/gpu/gl4/gl4_gpu-private.h"
#include "xenia/logging.h"
#include "xenia/profiling.h"
namespace xe {
@@ -43,7 +43,7 @@ bool WGLControl::Create() {
wcex.lpszMenuName = nullptr;
wcex.lpszClassName = L"XeniaWglClass";
if (!RegisterClassEx(&wcex)) {
PLOGE("WGL RegisterClassEx failed");
XELOGE("WGL RegisterClassEx failed");
return false;
}
@@ -55,12 +55,12 @@ bool WGLControl::Create() {
CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT,
parent_hwnd(), nullptr, hInstance, this);
if (!hwnd_) {
PLOGE("WGL CreateWindow failed");
XELOGE("WGL CreateWindow failed");
return false;
}
if (!context_.Initialize(hwnd_)) {
PFATAL("Unable to initialize GL context");
XEFATAL("Unable to initialize GL context");
return false;
}