summaryrefslogtreecommitdiffstats
path: root/src/video_core
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core')
-rw-r--r--src/video_core/clipper.cpp2
-rw-r--r--src/video_core/command_processor.cpp6
-rw-r--r--src/video_core/debug_utils/debug_utils.cpp18
-rw-r--r--src/video_core/gpu_debugger.h2
-rw-r--r--src/video_core/primitive_assembly.cpp2
-rw-r--r--src/video_core/rasterizer.cpp12
-rw-r--r--src/video_core/renderer_opengl/gl_shader_util.cpp24
-rw-r--r--src/video_core/renderer_opengl/renderer_opengl.cpp12
-rw-r--r--src/video_core/vertex_shader.cpp6
-rw-r--r--src/video_core/video_core.cpp4
10 files changed, 50 insertions, 38 deletions
diff --git a/src/video_core/clipper.cpp b/src/video_core/clipper.cpp
index fbe4047ce..632fb959a 100644
--- a/src/video_core/clipper.cpp
+++ b/src/video_core/clipper.cpp
@@ -157,7 +157,7 @@ void ProcessTriangle(OutputVertex &v0, OutputVertex &v1, OutputVertex &v2) {
InitScreenCoordinates(vtx2);
- DEBUG_LOG(GPU,
+ LOG_TRACE(Render_Software,
"Triangle %lu/%lu (%lu buffer vertices) at position (%.3f, %.3f, %.3f, %.3f), "
"(%.3f, %.3f, %.3f, %.3f), (%.3f, %.3f, %.3f, %.3f) and "
"screen position (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f), (%.2f, %.2f, %.2f)",
diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp
index 431139cc2..b74cd3261 100644
--- a/src/video_core/command_processor.cpp
+++ b/src/video_core/command_processor.cpp
@@ -114,7 +114,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
(vertex_attribute_formats[i] == 2) ? *(s16*)srcdata :
*(float*)srcdata;
input.attr[i][comp] = float24::FromFloat32(srcval);
- DEBUG_LOG(GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08lx + 0x%04lx: %f",
+ LOG_TRACE(HW_GPU, "Loaded component %x of attribute %x for vertex %x (index %x) from 0x%08x + 0x%08lx + 0x%04lx: %f",
comp, i, vertex, index,
attribute_config.GetBaseAddress(),
vertex_attribute_sources[i] - base_address,
@@ -176,7 +176,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
auto& uniform = VertexShader::GetFloatUniform(uniform_setup.index);
if (uniform_setup.index > 95) {
- ERROR_LOG(GPU, "Invalid VS uniform index %d", (int)uniform_setup.index);
+ LOG_ERROR(HW_GPU, "Invalid VS uniform index %d", (int)uniform_setup.index);
break;
}
@@ -192,7 +192,7 @@ static inline void WritePicaReg(u32 id, u32 value, u32 mask) {
uniform.x = float24::FromRawFloat24(uniform_write_buffer[2] & 0xFFFFFF);
}
- DEBUG_LOG(GPU, "Set uniform %x to (%f %f %f %f)", (int)uniform_setup.index,
+ LOG_TRACE(HW_GPU, "Set uniform %x to (%f %f %f %f)", (int)uniform_setup.index,
uniform.x.ToFloat32(), uniform.y.ToFloat32(), uniform.z.ToFloat32(),
uniform.w.ToFloat32());
diff --git a/src/video_core/debug_utils/debug_utils.cpp b/src/video_core/debug_utils/debug_utils.cpp
index 71b03f31c..1a20f19ec 100644
--- a/src/video_core/debug_utils/debug_utils.cpp
+++ b/src/video_core/debug_utils/debug_utils.cpp
@@ -248,8 +248,8 @@ void DumpShader(const u32* binary_data, u32 binary_size, const u32* swizzle_data
it->component_mask = it->component_mask | component_mask;
}
} catch (const std::out_of_range& ) {
- _dbg_assert_msg_(GPU, 0, "Unknown output attribute mapping");
- ERROR_LOG(GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x",
+ _dbg_assert_msg_(HW_GPU, 0, "Unknown output attribute mapping");
+ LOG_ERROR(HW_GPU, "Unknown output attribute mapping: %03x, %03x, %03x, %03x",
(int)output_attributes[i].map_x.Value(),
(int)output_attributes[i].map_y.Value(),
(int)output_attributes[i].map_z.Value(),
@@ -309,7 +309,7 @@ static int is_pica_tracing = false;
void StartPicaTracing()
{
if (is_pica_tracing) {
- ERROR_LOG(GPU, "StartPicaTracing called even though tracing already running!");
+ LOG_WARNING(HW_GPU, "StartPicaTracing called even though tracing already running!");
return;
}
@@ -342,7 +342,7 @@ void OnPicaRegWrite(u32 id, u32 value)
std::unique_ptr<PicaTrace> FinishPicaTracing()
{
if (!is_pica_tracing) {
- ERROR_LOG(GPU, "FinishPicaTracing called even though tracing already running!");
+ LOG_WARNING(HW_GPU, "FinishPicaTracing called even though tracing isn't running!");
return {};
}
@@ -357,7 +357,7 @@ std::unique_ptr<PicaTrace> FinishPicaTracing()
}
const Math::Vec4<u8> LookupTexture(const u8* source, int x, int y, const TextureInfo& info) {
- _dbg_assert_(GPU, info.format == Pica::Regs::TextureFormat::RGB8);
+ _dbg_assert_(Debug_GPU, info.format == Pica::Regs::TextureFormat::RGB8);
// Cf. rasterizer code for an explanation of this algorithm.
int texel_index_within_tile = 0;
@@ -421,7 +421,7 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
// Initialize write structure
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, nullptr, nullptr, nullptr);
if (png_ptr == nullptr) {
- ERROR_LOG(GPU, "Could not allocate write struct\n");
+ LOG_ERROR(Debug_GPU, "Could not allocate write struct\n");
goto finalise;
}
@@ -429,13 +429,13 @@ void DumpTexture(const Pica::Regs::TextureConfig& texture_config, u8* data) {
// Initialize info structure
info_ptr = png_create_info_struct(png_ptr);
if (info_ptr == nullptr) {
- ERROR_LOG(GPU, "Could not allocate info struct\n");
+ LOG_ERROR(Debug_GPU, "Could not allocate info struct\n");
goto finalise;
}
// Setup Exception handling
if (setjmp(png_jmpbuf(png_ptr))) {
- ERROR_LOG(GPU, "Error during png creation\n");
+ LOG_ERROR(Debug_GPU, "Error during png creation\n");
goto finalise;
}
@@ -582,7 +582,7 @@ void DumpTevStageConfig(const std::array<Pica::Regs::TevStageConfig,6>& stages)
stage_info += "Stage " + std::to_string(index) + ": " + GetColorCombinerStr(tev_stage) + " " + GetAlphaCombinerStr(tev_stage) + "\n";
}
- DEBUG_LOG(GPU, "%s", stage_info.c_str());
+ LOG_TRACE(HW_GPU, "%s", stage_info.c_str());
}
} // namespace
diff --git a/src/video_core/gpu_debugger.h b/src/video_core/gpu_debugger.h
index 1242eb58f..16b1656bb 100644
--- a/src/video_core/gpu_debugger.h
+++ b/src/video_core/gpu_debugger.h
@@ -39,7 +39,7 @@ public:
virtual void GXCommandProcessed(int total_command_count)
{
const GSP_GPU::Command& cmd = observed->ReadGXCommandHistory(total_command_count-1);
- ERROR_LOG(GSP, "Received command: id=%x", (int)cmd.id.Value());
+ LOG_TRACE(Debug_GPU, "Received command: id=%x", (int)cmd.id.Value());
}
protected:
diff --git a/src/video_core/primitive_assembly.cpp b/src/video_core/primitive_assembly.cpp
index dabf2d1a3..102693ed9 100644
--- a/src/video_core/primitive_assembly.cpp
+++ b/src/video_core/primitive_assembly.cpp
@@ -43,7 +43,7 @@ void PrimitiveAssembler<VertexType>::SubmitVertex(VertexType& vtx, TriangleHandl
break;
default:
- ERROR_LOG(GPU, "Unknown triangle topology %x:", (int)topology);
+ LOG_ERROR(Render_Software, "Unknown triangle topology %x:", (int)topology);
break;
}
}
diff --git a/src/video_core/rasterizer.cpp b/src/video_core/rasterizer.cpp
index a35f0c0d8..b7e04a560 100644
--- a/src/video_core/rasterizer.cpp
+++ b/src/video_core/rasterizer.cpp
@@ -252,7 +252,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return combiner_output.rgb();
default:
- ERROR_LOG(GPU, "Unknown color combiner source %d\n", (int)source);
+ LOG_ERROR(HW_GPU, "Unknown color combiner source %d\n", (int)source);
return {};
}
};
@@ -272,7 +272,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return combiner_output.a();
default:
- ERROR_LOG(GPU, "Unknown alpha combiner source %d\n", (int)source);
+ LOG_ERROR(HW_GPU, "Unknown alpha combiner source %d\n", (int)source);
return 0;
}
};
@@ -283,7 +283,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
case ColorModifier::SourceColor:
return values;
default:
- ERROR_LOG(GPU, "Unknown color factor %d\n", (int)factor);
+ LOG_ERROR(HW_GPU, "Unknown color factor %d\n", (int)factor);
return {};
}
};
@@ -293,7 +293,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
case AlphaModifier::SourceAlpha:
return value;
default:
- ERROR_LOG(GPU, "Unknown color factor %d\n", (int)factor);
+ LOG_ERROR(HW_GPU, "Unknown color factor %d\n", (int)factor);
return 0;
}
};
@@ -307,7 +307,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return ((input[0] * input[1]) / 255).Cast<u8>();
default:
- ERROR_LOG(GPU, "Unknown color combiner operation %d\n", (int)op);
+ LOG_ERROR(HW_GPU, "Unknown color combiner operation %d\n", (int)op);
return {};
}
};
@@ -321,7 +321,7 @@ void ProcessTriangle(const VertexShader::OutputVertex& v0,
return input[0] * input[1] / 255;
default:
- ERROR_LOG(GPU, "Unknown alpha combiner operation %d\n", (int)op);
+ LOG_ERROR(HW_GPU, "Unknown alpha combiner operation %d\n", (int)op);
return 0;
}
};
diff --git a/src/video_core/renderer_opengl/gl_shader_util.cpp b/src/video_core/renderer_opengl/gl_shader_util.cpp
index fdac9ae1a..d0f82e6cd 100644
--- a/src/video_core/renderer_opengl/gl_shader_util.cpp
+++ b/src/video_core/renderer_opengl/gl_shader_util.cpp
@@ -20,7 +20,7 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
int info_log_length;
// Compile Vertex Shader
- DEBUG_LOG(GPU, "Compiling vertex shader.");
+ LOG_DEBUG(Render_OpenGL, "Compiling vertex shader...");
glShaderSource(vertex_shader_id, 1, &vertex_shader, nullptr);
glCompileShader(vertex_shader_id);
@@ -32,11 +32,15 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) {
std::vector<char> vertex_shader_error(info_log_length);
glGetShaderInfoLog(vertex_shader_id, info_log_length, nullptr, &vertex_shader_error[0]);
- DEBUG_LOG(GPU, "%s", &vertex_shader_error[0]);
+ if (result) {
+ LOG_DEBUG(Render_OpenGL, "%s", &vertex_shader_error[0]);
+ } else {
+ LOG_ERROR(Render_OpenGL, "Error compiling vertex shader:\n%s", &vertex_shader_error[0]);
+ }
}
// Compile Fragment Shader
- DEBUG_LOG(GPU, "Compiling fragment shader.");
+ LOG_DEBUG(Render_OpenGL, "Compiling fragment shader...");
glShaderSource(fragment_shader_id, 1, &fragment_shader, nullptr);
glCompileShader(fragment_shader_id);
@@ -48,11 +52,15 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) {
std::vector<char> fragment_shader_error(info_log_length);
glGetShaderInfoLog(fragment_shader_id, info_log_length, nullptr, &fragment_shader_error[0]);
- DEBUG_LOG(GPU, "%s", &fragment_shader_error[0]);
+ if (result) {
+ LOG_DEBUG(Render_OpenGL, "%s", &fragment_shader_error[0]);
+ } else {
+ LOG_ERROR(Render_OpenGL, "Error compiling fragment shader:\n%s", &fragment_shader_error[0]);
+ }
}
// Link the program
- DEBUG_LOG(GPU, "Linking program.");
+ LOG_DEBUG(Render_OpenGL, "Linking program...");
GLuint program_id = glCreateProgram();
glAttachShader(program_id, vertex_shader_id);
@@ -66,7 +74,11 @@ GLuint LoadShaders(const char* vertex_shader, const char* fragment_shader) {
if (info_log_length > 1) {
std::vector<char> program_error(info_log_length);
glGetProgramInfoLog(program_id, info_log_length, nullptr, &program_error[0]);
- DEBUG_LOG(GPU, "%s", &program_error[0]);
+ if (result) {
+ LOG_DEBUG(Render_OpenGL, "%s", &program_error[0]);
+ } else {
+ LOG_ERROR(Render_OpenGL, "Error linking shader:\n%s", &program_error[0]);
+ }
}
glDeleteShader(vertex_shader_id);
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp
index 06de6afbd..e2caeeb8f 100644
--- a/src/video_core/renderer_opengl/renderer_opengl.cpp
+++ b/src/video_core/renderer_opengl/renderer_opengl.cpp
@@ -90,7 +90,7 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig&
const VAddr framebuffer_vaddr = Memory::PhysicalToVirtualAddress(
framebuffer.active_fb == 1 ? framebuffer.address_left2 : framebuffer.address_left1);
- DEBUG_LOG(GPU, "0x%08x bytes from 0x%08x(%dx%d), fmt %x",
+ LOG_TRACE(Render_OpenGL, "0x%08x bytes from 0x%08x(%dx%d), fmt %x",
framebuffer.stride * framebuffer.height,
framebuffer_vaddr, (int)framebuffer.width,
(int)framebuffer.height, (int)framebuffer.format);
@@ -98,15 +98,15 @@ void RendererOpenGL::LoadFBToActiveGLTexture(const GPU::Regs::FramebufferConfig&
const u8* framebuffer_data = Memory::GetPointer(framebuffer_vaddr);
// TODO: Handle other pixel formats
- _dbg_assert_msg_(RENDER, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8,
+ _dbg_assert_msg_(Render_OpenGL, framebuffer.color_format == GPU::Regs::PixelFormat::RGB8,
"Unsupported 3DS pixel format.");
size_t pixel_stride = framebuffer.stride / 3;
// OpenGL only supports specifying a stride in units of pixels, not bytes, unfortunately
- _dbg_assert_(RENDER, pixel_stride * 3 == framebuffer.stride);
+ _dbg_assert_(Render_OpenGL, pixel_stride * 3 == framebuffer.stride);
// Ensure no bad interactions with GL_UNPACK_ALIGNMENT, which by default
// only allows rows to have a memory alignement of 4.
- _dbg_assert_(RENDER, pixel_stride % 4 == 0);
+ _dbg_assert_(Render_OpenGL, pixel_stride % 4 == 0);
glBindTexture(GL_TEXTURE_2D, texture.handle);
glPixelStorei(GL_UNPACK_ROW_LENGTH, (GLint)pixel_stride);
@@ -263,11 +263,11 @@ void RendererOpenGL::Init() {
int err = ogl_LoadFunctions();
if (ogl_LOAD_SUCCEEDED != err) {
- ERROR_LOG(RENDER, "Failed to initialize GL functions! Exiting...");
+ LOG_CRITICAL(Render_OpenGL, "Failed to initialize GL functions! Exiting...");
exit(-1);
}
- NOTICE_LOG(RENDER, "GL_VERSION: %s\n", glGetString(GL_VERSION));
+ LOG_INFO(Render_OpenGL, "GL_VERSION: %s", glGetString(GL_VERSION));
InitOpenGLObjects();
}
diff --git a/src/video_core/vertex_shader.cpp b/src/video_core/vertex_shader.cpp
index 0dff11a0f..477e78cfe 100644
--- a/src/video_core/vertex_shader.cpp
+++ b/src/video_core/vertex_shader.cpp
@@ -206,7 +206,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
case Instruction::OpCode::CALL:
increment_pc = false;
- _dbg_assert_(GPU, state.call_stack_pointer - state.call_stack < sizeof(state.call_stack));
+ _dbg_assert_(HW_GPU, state.call_stack_pointer - state.call_stack < sizeof(state.call_stack));
*++state.call_stack_pointer = state.program_counter - shader_memory;
// TODO: Does this offset refer to the beginning of shader memory?
@@ -218,7 +218,7 @@ static void ProcessShaderCode(VertexShaderState& state) {
break;
default:
- ERROR_LOG(GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x",
+ LOG_ERROR(HW_GPU, "Unhandled instruction: 0x%02x (%s): 0x%08x",
(int)instr.opcode.Value(), instr.GetOpCodeName().c_str(), instr.hex);
break;
}
@@ -285,7 +285,7 @@ OutputVertex RunShader(const InputVertex& input, int num_attributes)
state.debug.max_opdesc_id, registers.vs_main_offset,
registers.vs_output_attributes);
- DEBUG_LOG(GPU, "Output vertex: pos (%.2f, %.2f, %.2f, %.2f), col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f)",
+ LOG_TRACE(Render_Software, "Output vertex: pos (%.2f, %.2f, %.2f, %.2f), col(%.2f, %.2f, %.2f, %.2f), tc0(%.2f, %.2f)",
ret.pos.x.ToFloat32(), ret.pos.y.ToFloat32(), ret.pos.z.ToFloat32(), ret.pos.w.ToFloat32(),
ret.color.x.ToFloat32(), ret.color.y.ToFloat32(), ret.color.z.ToFloat32(), ret.color.w.ToFloat32(),
ret.tc0.u().ToFloat32(), ret.tc0.v().ToFloat32());
diff --git a/src/video_core/video_core.cpp b/src/video_core/video_core.cpp
index b581ff4da..6791e4007 100644
--- a/src/video_core/video_core.cpp
+++ b/src/video_core/video_core.cpp
@@ -30,13 +30,13 @@ void Init(EmuWindow* emu_window) {
g_current_frame = 0;
- NOTICE_LOG(VIDEO, "initialized OK");
+ LOG_DEBUG(Render, "initialized OK");
}
/// Shutdown the video core
void Shutdown() {
delete g_renderer;
- NOTICE_LOG(VIDEO, "shutdown OK");
+ LOG_DEBUG(Render, "shutdown OK");
}
} // namespace